本文整理汇总了C#中System.Text.Encoding.GetEncoding方法的典型用法代码示例。如果您正苦于以下问题:C# Encoding.GetEncoding方法的具体用法?C# Encoding.GetEncoding怎么用?C# Encoding.GetEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.Encoding
的用法示例。
在下文中一共展示了Encoding.GetEncoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TmphAppSetting
static TmphAppSetting()
{
#if MONO
settings = new NameValueCollection();
ConfigPath = LogPath = Laurent.Lee.CLB.pub.ApplicationPath;
ConfigIncludeName = defaultConfigIncludeName;
MaxLogSize = 1 << 20;
MaxLogCacheCount = 1 << 10;
JsonDepth = 64;
JavascriptMinTime = new DateTime(1970, 1, 1, 8, 0, 0);
Encoding = Encoding.UTF8;
TinyThreadStackSize = 128 << 10;
ThreadStackSize = 1 << 20;
PoolSize = 4;
StreamBufferSize = 4 << 10;
#else
try
{
Settings = ConfigurationManager.AppSettings;
ConfigFile = Settings["configFile"];
if (ConfigFile == null)
{
ConfigFile = (ConfigPath = CLB.TmphPub.ApplicationPath) + DefaultConfigFile;
}
else if (ConfigFile.IndexOf(':') == -1)
{
ConfigFile = (ConfigPath = CLB.TmphPub.ApplicationPath) + ConfigFile;
}
else ConfigPath = new FileInfo(ConfigFile).Directory.fullName().ToLower();
ConfigIncludeName = Settings["configIncludeName"];
if (ConfigIncludeName == null) ConfigIncludeName = DefaultConfigIncludeName;
LogPath = Settings["logPath"];
if (LogPath == null || !TmphDirectory.Create(LogPath = LogPath.pathSuffix().ToLower()))
LogPath = CLB.TmphPub.ApplicationPath;
var maxLogSize = Settings["maxLogSize"];
if (!int.TryParse(maxLogSize, out MaxLogSize)) MaxLogSize = 1 << 20;
var maxLogCacheCount = Settings["maxLogCacheCount"];
if (!int.TryParse(maxLogCacheCount, out MaxLogCacheCount)) MaxLogCacheCount = 1 << 10;
var jsonParseDepth = Settings["jsonDepth"];
if (!int.TryParse(jsonParseDepth, out JsonDepth)) JsonDepth = 64;
var javascriptMinTimeString = Settings["javascriptMinTime"];
if (!DateTime.TryParse(javascriptMinTimeString, out JavascriptMinTime))
{
JavascriptMinTime = new DateTime(1970, 1, 1, 8, 0, 0);
}
if (Settings["isLogConsole"] != null) IsLogConsole = true;
if (Settings["isErrorLog"] != null) IsErrorLog = true;
var encoding = Settings["encoding"];
if (encoding != null)
{
try
{
Encoding = Encoding.GetEncoding(encoding);
}
catch (Exception error)
{
Console.WriteLine(error.ToString());
Encoding = Encoding.UTF8;
}
}
if (Encoding == null) Encoding = Encoding.UTF8;
var tinyThreadStackSize = Settings["tinyThreadStackSize"];
if (!int.TryParse(tinyThreadStackSize, out TinyThreadStackSize)) TinyThreadStackSize = 128 << 10;
var threadStackSize = Settings["threadStackSize"];
if (!int.TryParse(threadStackSize, out ThreadStackSize)) ThreadStackSize = 1 << 20;
var poolSize = Settings["poolSize"];
if (!int.TryParse(poolSize, out PoolSize)) PoolSize = 4;
if (Settings["isPoolDebug"] != null) IsPoolDebug = true;
var streamBufferSize = Settings["streamBufferSize"];
if (!int.TryParse(streamBufferSize, out StreamBufferSize)) StreamBufferSize = 4 << 10;
if (Settings["isCheckMemory"] != null) IsCheckMemory = true;
}
catch (Exception error)
{
Settings = new NameValueCollection();
ConfigPath = LogPath = CLB.TmphPub.ApplicationPath;
ConfigIncludeName = DefaultConfigIncludeName;
MaxLogSize = 1 << 20;
MaxLogCacheCount = 1 << 10;
JsonDepth = 64;
JavascriptMinTime = new DateTime(1970, 1, 1, 8, 0, 0);
Encoding = Encoding.UTF8;
TinyThreadStackSize = 128 << 10;
ThreadStackSize = 1 << 20;
PoolSize = 4;
//.........这里部分代码省略.........