📄 carriersetting.cs
字号:
namespace Imps.Client.Core
{
using System;
using System.Text;
using System.Xml;
public class CarrierSetting : PropertyDictionary
{
private static Imps.Client.Core.CarrierSetting _instance;
private static object _lock = new object();
private Imps.Client.Core.SystemSetting _systemSetting;
internal CarrierSetting(Imps.Client.Core.SystemSetting systemSetting)
{
this._systemSetting = systemSetting;
_instance = this;
}
public void LoadXml(XmlNode xmlNode)
{
if (xmlNode.Attributes.Count > 0)
{
int objValue = 0;
int.TryParse(xmlNode.Attributes["version"].Value, ref objValue);
this._systemSetting.SetPropertyValue<int>("version", objValue);
}
foreach (XmlNode node in xmlNode.ChildNodes)
{
string name;
if (((name = node.Name) != null) && (((name == "MatchSubscribeNeeded") || (name == "SupportOtherCarrier")) || ((name == "SupportFederation") || (name == "MatchServiceEnabled"))))
{
bool flag = false;
bool.TryParse(node.InnerText, ref flag);
this._systemSetting.SetPropertyValue<bool>(node.Name, flag);
continue;
}
this._systemSetting.SetPropertyValue<string>(node.Name, node.InnerXml);
}
}
public override string ToString()
{
StringBuilder builder = new StringBuilder();
builder.Append(string.Format("<CarrierSetting version=\"{0}\" >", this.Version));
builder.Append(string.Format("<{0}>{1}</{0}>", "MatchServiceEnabled", this.MatchServiceEnabled));
builder.Append(string.Format("<CarrierShortName>{0}</CarrierShortName>", this.CarrierShortName));
builder.Append(string.Format("<CarrierFullName>{0}</CarrierFullName>", this.CarrierFullName));
builder.Append(string.Format("<CarrierEnglishName>{0}</CarrierEnglishName>", this.CarrierEnglishName));
builder.Append(string.Format("<ImpsServiceLocalName>{0}</ImpsServiceLocalName>", this.ImpsServiceLocalName));
builder.Append(string.Format("<ImpsServiceEnglishName>{0}</ImpsServiceEnglishName>", this.ImpsServiceEnglishName));
builder.Append(string.Format("<MatchSubscribeNeeded>{0}</MatchSubscribeNeeded>", this.MatchSubscribeNeeded));
builder.Append(string.Format("<SupportOtherOperator>{0}</SupportOtherOperator>", this.SupportOtherCarrier));
builder.Append(string.Format("<SupportFederation>{0}</SupportFederation>", this.SupportFederation));
builder.Append(string.Format("<SupportedLanguages>{0}</SupportedLanguages>", this.SupportedLanguages.ToString()));
builder.Append("</CarrierSetting>");
return builder.ToString();
}
public string AdWord
{
get
{
return this._systemSetting.GetPropertyValue<string>("AdWord", "意见反馈");
}
}
[ConfigCategory(ConfigCategory.System)]
public string CarrierEnglishName
{
get
{
return this._systemSetting.GetPropertyValue<string>("CarrierEnglishName");
}
}
[ConfigCategory(ConfigCategory.System)]
public string CarrierFullName
{
get
{
return this._systemSetting.GetPropertyValue<string>("CarrierFullName");
}
}
[ConfigCategory(ConfigCategory.System)]
public string CarrierShortName
{
get
{
return this._systemSetting.GetPropertyValue<string>("CarrierShortName");
}
}
[ConfigCategory(ConfigCategory.System)]
public string ImpsServiceEnglishName
{
get
{
return this._systemSetting.GetPropertyValue<string>("ImpsServiceEnglishName");
}
}
[ConfigCategory(ConfigCategory.System)]
public string ImpsServiceLocalName
{
get
{
return this._systemSetting.GetPropertyValue<string>("ImpsServiceLocalName");
}
}
public static Imps.Client.Core.CarrierSetting Instance
{
get
{
return _instance;
}
}
[ConfigCategory(ConfigCategory.System)]
public bool MatchServiceEnabled
{
get
{
return this._systemSetting.GetPropertyValue<bool>("MatchServiceEnabled", true);
}
}
[ConfigCategory(ConfigCategory.System)]
public bool MatchSubscribeNeeded
{
get
{
return this._systemSetting.GetPropertyValue<bool>("MatchSubscribeNeeded");
}
}
[ConfigCategory(ConfigCategory.System)]
private string[] SupportedLanguages
{
get
{
return this._systemSetting.GetPropertyValue<string>("SupportedLanguages").Split(new char[] { ',' });
}
}
[ConfigCategory(ConfigCategory.System)]
public bool SupportFederation
{
get
{
return this._systemSetting.GetPropertyValue<bool>("SupportFederation");
}
}
public bool SupportOtherCarrier
{
get
{
return this._systemSetting.GetPropertyValue<bool>("SupportOtherCarrier");
}
}
[ConfigCategory(ConfigCategory.System)]
public int Version
{
get
{
return this._systemSetting.GetPropertyValue<int>("version");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -