John ed2fcf39e1 changes for comparing PROMS generated PDFs with PROMS generated PDFs
Added checkbox to compare PROMS generated PDFs with PROMS generated PDFs
Logic to support the comparing of PROMS generated PDFs with PROMS generated PDFs
2012-06-20 16:06:55 +00:00

171 lines
4.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Configuration;
using System.Reflection;
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 bool _ComparePROMStoPROMSPDF = false; // default to compare 16-bit generated PDFs
public static bool ComparePROMStoPROMSPDF
{
get
{
if (!WasLoaded) LoadOperatingMode();
return _ComparePROMStoPROMSPDF;
}
set { _ComparePROMStoPROMSPDF = 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";
_ComparePROMStoPROMSPDF = _DebugMode;
}
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; }
}
private static string _ReleaseMode = null;
public static string ReleaseMode
{
get
{
if (_ReleaseMode == null)
{
string relType = "RELEASE"; // default to normal Release Mode setting
// Get the type of release:
// "Demo", "Westinghouse", "Release"
object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false);
if (attributes.Length > 0)
relType = ((AssemblyConfigurationAttribute)attributes[0]).Configuration.ToUpper();
_ReleaseMode = relType;
}
return _ReleaseMode;
}
}
private static string _EULAfile = null;
public static string EULAfile
{
get {
if (_EULAfile == null)
{
switch (ReleaseMode)
{
case "DEMO": // Demo CD/DVD release
_EULAfile = "DemoEULA.txt";
break;
case "WESTINGHOUSE":
_EULAfile = "WestinghouseEULA.txt";
break;
default:
_EULAfile = "EULA.txt";
break;
}
}
return _EULAfile;
}
}
}
}