123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Linq;
- using System.Text;
- using SuperSocket.Common;
- using SuperSocket.SocketBase;
- using SuperSocket.SocketBase.Config;
- using System.Collections.Specialized;
- namespace SuperSocket.SocketEngine.Configuration
- {
-
-
-
- public partial class SocketServiceConfig : ConfigurationSection, IConfigurationSource
- {
-
-
-
- [ConfigurationProperty("servers")]
- public ServerCollection Servers
- {
- get
- {
- return this["servers"] as ServerCollection;
- }
- }
-
-
-
- [ConfigurationProperty("serverTypes")]
- public TypeProviderCollection ServerTypes
- {
- get
- {
- return this["serverTypes"] as TypeProviderCollection;
- }
- }
-
-
-
- [ConfigurationProperty("connectionFilters", IsRequired = false)]
- public TypeProviderCollection ConnectionFilters
- {
- get
- {
- return this["connectionFilters"] as TypeProviderCollection;
- }
- }
-
-
-
- [ConfigurationProperty("logFactories", IsRequired = false)]
- public TypeProviderCollection LogFactories
- {
- get
- {
- return this["logFactories"] as TypeProviderCollection;
- }
- }
-
-
-
- [ConfigurationProperty("receiveFilterFactories", IsRequired = false)]
- public TypeProviderCollection ReceiveFilterFactories
- {
- get
- {
- return this["receiveFilterFactories"] as TypeProviderCollection;
- }
- }
-
-
-
- [ConfigurationProperty("commandLoaders", IsRequired = false)]
- public TypeProviderCollection CommandLoaders
- {
- get
- {
- return this["commandLoaders"] as TypeProviderCollection;
- }
- }
-
-
-
- [ConfigurationProperty("maxWorkingThreads", IsRequired = false, DefaultValue = -1)]
- public int MaxWorkingThreads
- {
- get
- {
- return (int)this["maxWorkingThreads"];
- }
- }
-
-
-
- [ConfigurationProperty("minWorkingThreads", IsRequired = false, DefaultValue = -1)]
- public int MinWorkingThreads
- {
- get
- {
- return (int)this["minWorkingThreads"];
- }
- }
-
-
-
- [ConfigurationProperty("maxCompletionPortThreads", IsRequired = false, DefaultValue = -1)]
- public int MaxCompletionPortThreads
- {
- get
- {
- return (int)this["maxCompletionPortThreads"];
- }
- }
-
-
-
- [ConfigurationProperty("minCompletionPortThreads", IsRequired = false, DefaultValue = -1)]
- public int MinCompletionPortThreads
- {
- get
- {
- return (int)this["minCompletionPortThreads"];
- }
- }
-
-
-
- [ConfigurationProperty("performanceDataCollectInterval", IsRequired = false, DefaultValue = 60)]
- public int PerformanceDataCollectInterval
- {
- get
- {
- return (int)this["performanceDataCollectInterval"];
- }
- }
-
-
-
-
-
-
- [ConfigurationProperty("disablePerformanceDataCollector", IsRequired = false, DefaultValue = false)]
- public bool DisablePerformanceDataCollector
- {
- get
- {
- return (bool)this["disablePerformanceDataCollector"];
- }
- }
-
-
-
- [ConfigurationProperty("isolation", IsRequired = false, DefaultValue = IsolationMode.None)]
- public IsolationMode Isolation
- {
- get { return (IsolationMode)this["isolation"]; }
- }
-
-
-
- [ConfigurationProperty("logFactory", IsRequired = false, DefaultValue = "")]
- public string LogFactory
- {
- get
- {
- return (string)this["logFactory"];
- }
- }
-
-
-
- public NameValueCollection OptionElements { get; private set; }
-
-
-
-
-
-
-
-
-
-
- protected override bool OnDeserializeUnrecognizedElement(string elementName, System.Xml.XmlReader reader)
- {
-
- if (!"services".Equals(elementName, StringComparison.OrdinalIgnoreCase))
- {
- if (OptionElements == null)
- OptionElements = new NameValueCollection();
- OptionElements.Add(elementName, reader.ReadOuterXml());
- return true;
- }
- var serverTypes = new TypeProviderCollection();
- reader.Read();
- serverTypes.Deserialize(reader);
- this["serverTypes"] = serverTypes;
- return true;
- }
-
-
-
-
-
-
-
-
- protected override bool OnDeserializeUnrecognizedAttribute(string name, string value)
- {
- const string xmlns = "xmlns";
- const string xmlnsPrefix = "xmlns:";
- const string xsiPrefix = "xsi:";
-
- if (name.Equals(xmlns) || name.StartsWith(xmlnsPrefix) || name.StartsWith(xsiPrefix))
- return true;
- return false;
- }
-
-
-
-
-
-
- public TConfig GetChildConfig<TConfig>(string childConfigName)
- where TConfig : ConfigurationElement, new()
- {
- return this.OptionElements.GetChildConfig<TConfig>(childConfigName);
- }
- IEnumerable<IServerConfig> IConfigurationSource.Servers
- {
- get
- {
- return this.Servers;
- }
- }
- IEnumerable<ITypeProvider> IConfigurationSource.ServerTypes
- {
- get
- {
- return this.ServerTypes;
- }
- }
- IEnumerable<ITypeProvider> IConfigurationSource.ConnectionFilters
- {
- get
- {
- return this.ConnectionFilters;
- }
- }
- IEnumerable<ITypeProvider> IConfigurationSource.LogFactories
- {
- get
- {
- return this.LogFactories;
- }
- }
- IEnumerable<ITypeProvider> IConfigurationSource.ReceiveFilterFactories
- {
- get
- {
- return this.ReceiveFilterFactories;
- }
- }
- IEnumerable<ITypeProvider> IConfigurationSource.CommandLoaders
- {
- get
- {
- return this.CommandLoaders;
- }
- }
- }
- }
|