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: // // // For DataLoader, this is set via the Debug checkbox on the form. private static bool WasLoaded = false; 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 void LoadOperatingMode() { string opMode = ConfigurationManager.AppSettings["OperatingMode"]; if (opMode != null && opMode != "") { _DebugMode = opMode.ToUpper() == "DEBUG"; _DemoMode = opMode.ToUpper() == "DEMO"; _ProductionMode = opMode.ToUpper() == "PRODUCTION"; } 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 += @"\VE-PROMS"; if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder); } return _TemporaryFolder; } } // used for Debug mode (at least for now) // this is where the PDF 16-bit VE-PROMS output is placed and merged (via layers) into the PROMS 2010 PDF Output private static string _OldPDFFolder = @"C:\Temp\16bit"; public static string OldPDFFolder { get { return VlnSettings._OldPDFFolder; } set { VlnSettings._OldPDFFolder = value; } } private static string _UserID=Environment.UserName.ToUpper(); public static string UserID { get { return VlnSettings._UserID; } set { VlnSettings._UserID = value; } } } }