88 lines
2.4 KiB
C#
88 lines
2.4 KiB
C#
using System;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Web.Configuration;
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
public static bool UseScriptsBundling
|
|
{
|
|
get
|
|
{
|
|
bool applyBundling;
|
|
if (WebConfigurationManager.AppSettings.AllKeys.Contains("UseScriptsBundling") &&
|
|
bool.TryParse(WebConfigurationManager.AppSettings["UseScriptsBundling"], out applyBundling))
|
|
{
|
|
return applyBundling;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
} |