?? settings.cs
字號:
?namespace ElementIT.PowUpload
{
using System;
using System.Runtime.InteropServices;
public class Settings
{
private static long _HTTPRuntime_MaxRequestLength = -1;
public static SettingsCollection CommonSettings = new SettingsCollection(true);
public static SingleRequestSettings SingleSettings = new SingleRequestSettings();
static Settings()
{
InitCommonSettings();
}
internal Settings()
{
}
internal static object GetValue(string id, string name)
{
if (((id != null) && (SingleRequestSettings._personalSettings[id] != null)) && ((SettingsCollection) SingleRequestSettings._personalSettings[id]).HasKey(name))
{
return ((SettingsCollection) SingleRequestSettings._personalSettings[id])[name];
}
return CommonSettings[name];
}
internal static void InitCommonSettings()
{
try
{
_HTTPRuntime_MaxRequestLength = long.Parse(Common.GetWebConfigValue("system.web/httpRuntime", "maxRequestLength", false, "nothing").ToString());
if (Environment.Version.Major >= 2)
{
_HTTPRuntime_MaxRequestLength *= 0x400;
}
}
catch
{
_HTTPRuntime_MaxRequestLength = long.Parse("4194304");
}
CommonSettings["processPages"] = Common.GetConfigValue("settings", "processPages", false, "*.aspx").ToString();
CommonSettings["ignorePages"] = Common.GetConfigValue("settings", "ignorePages", false, "").ToString();
CommonSettings["writeDebugLogs"] = Common.StrToBln(Common.GetConfigValue("settings", "writeDebugLogs", false, "false").ToString());
object obj3 = Common.GetConfigValue("settings", "bandwidthLimit", false, "-1");
try
{
CommonSettings["bandwidthLimit"] = int.Parse(obj3.ToString());
}
catch
{
CommonSettings["bandwidthLimit"] = int.Parse("-1");
}
CommonSettings["uploadIDQueryField"] = Common.GetConfigValue("settings", "uploadIDQueryField", false, "UploadID").ToString();
CommonSettings["throwErrorsImmediately"] = Common.StrToBln(Common.GetConfigValue("settings", "throwErrorsImmediately", false, "true").ToString());
CommonSettings["logExceptions"] = Common.StrToBln(Common.GetConfigValue("settings", "logExceptions", false, "false").ToString());
object obj4 = Common.GetConfigValue("settings", "minRequestLengthProcess", false, "-1");
try
{
CommonSettings["minRequestLengthProcess"] = long.Parse(obj4.ToString());
}
catch
{
CommonSettings["minRequestLengthProcess"] = long.Parse("-1");
}
CommonSettings["ignoreHttpRuntimeMaxRequestLength"] = Common.StrToBln(Common.GetConfigValue("settings", "ignoreHttpRuntimeMaxRequestLength", false, "true").ToString());
CommonSettings["passForm"] = Common.StrToBln(Common.GetConfigValue("settings", "passForm", false, "true").ToString());
object obj5 = Common.GetConfigValue("settings", "maxRequestLength", false, "-1");
try
{
CommonSettings["maxRequestLength"] = long.Parse(obj5.ToString());
}
catch
{
CommonSettings["maxRequestLength"] = long.Parse("-1");
}
object obj6 = Common.GetConfigValue("settings", "maxRequestLengthToCloseConnection", false, "-1");
try
{
CommonSettings["maxRequestLengthToCloseConnection"] = long.Parse(obj6.ToString());
}
catch
{
CommonSettings["maxRequestLengthToCloseConnection"] = long.Parse("-1");
}
CommonSettings["tempPath"] = Common.GetConfigValue("settings", "tempPath", false, @"C:\Temp\").ToString();
object obj7 = Common.GetConfigValue("settings", "bufferSize", false, "16384");
try
{
CommonSettings["bufferSize"] = int.Parse(obj7.ToString());
}
catch
{
CommonSettings["bufferSize"] = int.Parse("16384");
}
}
public static long HTTPRuntime_MaxRequestLength
{
get
{
return _HTTPRuntime_MaxRequestLength;
}
}
[StructLayout(LayoutKind.Sequential, Size=1)]
public struct SettingsParams
{
public const string UploadIDQueryField = "uploadIDQueryField";
public const string ProcessPages = "processPages";
public const string MaxRequestLength = "maxRequestLength";
public const string IgnorePages = "ignorePages";
public const string ThrowErrorsImmediately = "throwErrorsImmediately";
public const string LogExceptions = "logExceptions";
public const string MinRequestLengthProcess = "minRequestLengthProcess";
public const string TempPath = "tempPath";
public const string IgnoreHttpRuntimeMaxRequestLength = "ignoreHttpRuntimeMaxRequestLength";
public const string UploadHandleObject = "uploadHandleObject";
public const string MaxRequestLengthToCloseConnection = "maxRequestLengthToCloseConnection";
public const string BandwidthLimit = "bandwidthLimit";
public const string PassForm = "passForm";
internal const string WriteDebugLogs = "writeDebugLogs";
internal const string BufferSize = "bufferSize";
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -