72 lines
2.0 KiB
C#
72 lines
2.0 KiB
C#
using System;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
|
|
namespace EnVisage
|
|
{
|
|
public class AppSettingsManager
|
|
{
|
|
public static string HiQPdfSerialNumber
|
|
{
|
|
get
|
|
{
|
|
if (ConfigurationManager.AppSettings.AllKeys.Contains("HiQPdfSerialNumber"))
|
|
return ConfigurationManager.AppSettings["HiQPdfSerialNumber"];
|
|
|
|
return string.Empty;
|
|
}
|
|
}
|
|
|
|
public static int HiQPdfBrowserWidth
|
|
{
|
|
get
|
|
{
|
|
int width;
|
|
if (ConfigurationManager.AppSettings.AllKeys.Contains("HiQPdfBrowserWidth") &&
|
|
int.TryParse(ConfigurationManager.AppSettings["HiQPdfBrowserWidth"], out width) && width > 0)
|
|
{
|
|
return width;
|
|
}
|
|
|
|
return 1920;
|
|
}
|
|
}
|
|
|
|
public static string DefaultPassword
|
|
{
|
|
get
|
|
{
|
|
if (ConfigurationManager.AppSettings.AllKeys.Contains("DefaultPassword"))
|
|
return ConfigurationManager.AppSettings["DefaultPassword"];
|
|
|
|
throw new InvalidOperationException("Default Password doesn't exist");
|
|
}
|
|
}
|
|
|
|
public static string MongoDBConnectionString
|
|
{
|
|
get
|
|
{
|
|
if (ConfigurationManager.AppSettings.AllKeys.Contains("MongoDBConnectionString"))
|
|
return ConfigurationManager.AppSettings["MongoDBConnectionString"];
|
|
|
|
return string.Empty;
|
|
}
|
|
}
|
|
|
|
public static bool MongoDBIsTestMode
|
|
{
|
|
get
|
|
{
|
|
bool isTestMode;
|
|
if (ConfigurationManager.AppSettings.AllKeys.Contains("MongoDBIsTestMode") &&
|
|
bool.TryParse(ConfigurationManager.AppSettings["MongoDBIsTestMode"], out isTestMode))
|
|
{
|
|
return isTestMode;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |