2012-05-08 12:55:52 +00:00

119 lines
3.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Configuration;
namespace Volian.Base.Library
{
public static class VlnSettings
{
// This is used to toggle the colored text during the Data Conversion
// and will set the font and background in PROMS 2010 for Demo/Release mode (white background black text)
// or for Debug mode (shaded background, and color text on PDF output
// For PROMS 2010, this is set via the App.config setting:
// <appSettings>
// <add key ="OperatingMode" value ="Debug"|"Demo"|"Production"/>
// For DataLoader, this is set via the Debug checkbox on the form.
private static bool WasLoaded = false;
private static bool _DebugPagination = false;
public static bool DebugPagination
{
get { return VlnSettings._DebugPagination; }
set { VlnSettings._DebugPagination = value; }
}
private static bool _DebugText = false;
public static bool DebugText
{
get { return VlnSettings._DebugText; }
set { VlnSettings._DebugText = value; }
}
private static bool _DebugMode = false;
public static bool DebugMode
{
get
{
if (!WasLoaded) LoadOperatingMode();
return _DebugMode;
}
set { _DebugMode = value; }
}
private static bool _DemoMode = false;
public static bool DemoMode
{
get
{
if (!WasLoaded) LoadOperatingMode();
return _DemoMode;
}
set { _DemoMode = value; }
}
private static bool _ProductionMode = true; // default to OperatingMode to production
public static bool ProductionMode
{
get
{
if (!WasLoaded) LoadOperatingMode();
return _ProductionMode;
}
set { _ProductionMode = value; }
}
private static bool _OriginalPageBreak = false; // default to not using 16bit pagebreaks
public static bool OriginalPageBreak
{
get
{
if (!WasLoaded) LoadOperatingMode();
return _OriginalPageBreak;
}
set { _OriginalPageBreak = value; }
}
private static void LoadOperatingMode()
{
string opMode = ConfigurationManager.AppSettings["OperatingMode"];
if (opMode != null && opMode != "")
{
_DebugMode = opMode.ToUpper() == "DEBUG";
_DemoMode = opMode.ToUpper() == "DEMO";
_ProductionMode = opMode.ToUpper() == "PRODUCTION";
}
string pageBreak = ConfigurationManager.AppSettings["OriginalPageBreak"];
if (pageBreak != null && pageBreak != "")
{
_OriginalPageBreak = pageBreak.ToUpper() == "TRUE";
}
WasLoaded = true;
}
private static string _TemporaryFolder = null;
public static string TemporaryFolder
{
get
{
if (_TemporaryFolder == null)
{
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VE-PROMS
//Vista - C:\Users\{user}\AppData\Local\Temp\VE-PROMS
_TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
_TemporaryFolder += @"\VEPROMS";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
}
return _TemporaryFolder;
}
}
private static string _UserID=Environment.UserName.ToUpper();
public static string UserID
{
get { return VlnSettings._UserID; }
set { VlnSettings._UserID = value; }
}
private static bool _StepTypeToolTip = false;
public static bool StepTypeToolType
{
get { return VlnSettings._StepTypeToolTip; }
set { VlnSettings._StepTypeToolTip = value; }
}
}
}