123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479 |
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Configuration;
- using System.IO;
- using System.Security.Authentication;
- using System.Text;
- using System.Xml;
- using System.Linq;
- using SuperSocket.Common;
- using SuperSocket.SocketBase;
- using SuperSocket.SocketBase.Config;
- namespace SuperSocket.SocketEngine.Configuration
- {
-
-
-
- public partial class Server : ConfigurationElementBase, IServerConfig
- {
-
-
-
-
-
-
- [ConfigurationProperty("serverTypeName", IsRequired = false)]
- public string ServerTypeName
- {
- get { return this["serverTypeName"] as string; }
- }
-
-
-
-
-
-
- [ConfigurationProperty("serverType", IsRequired = false)]
- public string ServerType
- {
- get { return this["serverType"] as string; }
- }
-
-
-
- [ConfigurationProperty("receiveFilterFactory", IsRequired = false)]
- public string ReceiveFilterFactory
- {
- get { return this["receiveFilterFactory"] as string; }
- }
-
-
-
- [ConfigurationProperty("ip", IsRequired = false)]
- public string Ip
- {
- get { return this["ip"] as string; }
- }
-
-
-
- [ConfigurationProperty("port", IsRequired = false)]
- public int Port
- {
- get { return (int)this["port"]; }
- }
-
-
-
- [ConfigurationProperty("mode", IsRequired = false, DefaultValue = "Tcp")]
- public SocketMode Mode
- {
- get { return (SocketMode)this["mode"]; }
- }
-
-
-
-
-
-
- [ConfigurationProperty("disabled", DefaultValue = "false")]
- public bool Disabled
- {
- get { return (bool)this["disabled"]; }
- }
-
-
-
- [ConfigurationProperty("sendTimeOut", IsRequired = false, DefaultValue = ServerConfig.DefaultSendTimeout)]
- public int SendTimeOut
- {
- get { return (int)this["sendTimeOut"]; }
- }
-
-
-
- [ConfigurationProperty("maxConnectionNumber", IsRequired = false, DefaultValue = ServerConfig.DefaultMaxConnectionNumber)]
- public int MaxConnectionNumber
- {
- get { return (int)this["maxConnectionNumber"]; }
- }
-
-
-
-
-
-
- [ConfigurationProperty("receiveBufferSize", IsRequired = false, DefaultValue = ServerConfig.DefaultReceiveBufferSize)]
- public int ReceiveBufferSize
- {
- get { return (int)this["receiveBufferSize"]; }
- }
-
-
-
-
-
-
- [ConfigurationProperty("sendBufferSize", IsRequired = false, DefaultValue = ServerConfig.DefaultSendBufferSize)]
- public int SendBufferSize
- {
- get { return (int)this["sendBufferSize"]; }
- }
-
-
-
-
-
-
- [ConfigurationProperty("syncSend", IsRequired = false, DefaultValue = false)]
- public bool SyncSend
- {
- get { return (bool)this["syncSend"]; }
- }
-
-
-
-
- [ConfigurationProperty("logCommand", IsRequired = false, DefaultValue = false)]
- public bool LogCommand
- {
- get { return (bool)this["logCommand"]; }
- }
-
-
-
-
-
-
- [ConfigurationProperty("logBasicSessionActivity", IsRequired = false, DefaultValue = true)]
- public bool LogBasicSessionActivity
- {
- get { return (bool)this["logBasicSessionActivity"]; }
- }
-
-
-
-
-
-
- [ConfigurationProperty("logAllSocketException", IsRequired = false, DefaultValue = false)]
- public bool LogAllSocketException
- {
- get { return (bool)this["logAllSocketException"]; }
- }
-
-
-
-
- [ConfigurationProperty("clearIdleSession", IsRequired = false, DefaultValue = false)]
- public bool ClearIdleSession
- {
- get { return (bool)this["clearIdleSession"]; }
- }
-
-
-
-
- [ConfigurationProperty("clearIdleSessionInterval", IsRequired = false, DefaultValue = ServerConfig.DefaultClearIdleSessionInterval)]
- public int ClearIdleSessionInterval
- {
- get { return (int)this["clearIdleSessionInterval"]; }
- }
-
-
-
-
- [ConfigurationProperty("idleSessionTimeOut", IsRequired = false, DefaultValue = ServerConfig.DefaultIdleSessionTimeOut)]
- public int IdleSessionTimeOut
- {
- get { return (int)this["idleSessionTimeOut"]; }
- }
-
-
-
-
- [ConfigurationProperty("certificate", IsRequired = false)]
- public CertificateConfig CertificateConfig
- {
- get
- {
- return (CertificateConfig)this["certificate"];
- }
- }
-
-
-
-
-
-
- public ICertificateConfig Certificate
- {
- get { return CertificateConfig; }
- }
-
-
-
- [ConfigurationProperty("security", IsRequired = false, DefaultValue = "None")]
- public string Security
- {
- get
- {
- return (string)this["security"];
- }
- }
-
-
-
-
-
-
- [ConfigurationProperty("maxRequestLength", IsRequired = false, DefaultValue = ServerConfig.DefaultMaxRequestLength)]
- public int MaxRequestLength
- {
- get
- {
- return (int)this["maxRequestLength"];
- }
- }
-
-
-
- [ConfigurationProperty("disableSessionSnapshot", IsRequired = false, DefaultValue = false)]
- public bool DisableSessionSnapshot
- {
- get
- {
- return (bool)this["disableSessionSnapshot"];
- }
- }
-
-
-
- [ConfigurationProperty("sessionSnapshotInterval", IsRequired = false, DefaultValue = ServerConfig.DefaultSessionSnapshotInterval)]
- public int SessionSnapshotInterval
- {
- get
- {
- return (int)this["sessionSnapshotInterval"];
- }
- }
-
-
-
-
-
-
- [ConfigurationProperty("connectionFilter", IsRequired = false)]
- public string ConnectionFilter
- {
- get
- {
- return (string)this["connectionFilter"];
- }
- }
-
-
-
- [ConfigurationProperty("commandLoader", IsRequired = false)]
- public string CommandLoader
- {
- get
- {
- return (string)this["commandLoader"];
- }
- }
-
-
-
- [ConfigurationProperty("keepAliveTime", IsRequired = false, DefaultValue = ServerConfig.DefaultKeepAliveTime)]
- public int KeepAliveTime
- {
- get
- {
- return (int)this["keepAliveTime"];
- }
- }
-
-
-
- [ConfigurationProperty("keepAliveInterval", IsRequired = false, DefaultValue = ServerConfig.DefaultKeepAliveInterval)]
- public int KeepAliveInterval
- {
- get
- {
- return (int)this["keepAliveInterval"];
- }
- }
-
-
-
- [ConfigurationProperty("listenBacklog", IsRequired = false, DefaultValue = ServerConfig.DefaultListenBacklog)]
- public int ListenBacklog
- {
- get
- {
- return (int)this["listenBacklog"];
- }
- }
-
-
-
- [ConfigurationProperty("startupOrder", IsRequired = false, DefaultValue = 0)]
- public int StartupOrder
- {
- get
- {
- return (int)this["startupOrder"];
- }
- }
-
-
-
-
-
-
- [ConfigurationProperty("sendingQueueSize", IsRequired = false, DefaultValue = ServerConfig.DefaultSendingQueueSize)]
- public int SendingQueueSize
- {
- get
- {
- return (int)this["sendingQueueSize"];
- }
- }
-
-
-
- [ConfigurationProperty("logFactory", IsRequired = false, DefaultValue = "")]
- public string LogFactory
- {
- get
- {
- return (string)this["logFactory"];
- }
- }
-
-
-
-
-
-
- [ConfigurationProperty("textEncoding", IsRequired = false, DefaultValue = "")]
- public string TextEncoding
- {
- get
- {
- return (string)this["textEncoding"];
- }
- }
-
-
-
- [ConfigurationProperty("listeners", IsRequired = false)]
- public ListenerConfigCollection Listeners
- {
- get
- {
- return this["listeners"] as ListenerConfigCollection;
- }
- }
-
-
-
- IEnumerable<IListenerConfig> IServerConfig.Listeners
- {
- get
- {
- return this.Listeners;
- }
- }
-
-
-
-
-
-
- [ConfigurationProperty("commandAssemblies", IsRequired = false)]
- public CommandAssemblyCollection CommandAssemblies
- {
- get
- {
- return this["commandAssemblies"] as CommandAssemblyCollection;
- }
- }
- IEnumerable<ICommandAssemblyConfig> IServerConfig.CommandAssemblies
- {
- get { return this.CommandAssemblies; }
- }
-
-
-
-
-
-
- public TConfig GetChildConfig<TConfig>(string childConfigName)
- where TConfig : ConfigurationElement, new()
- {
- return this.OptionElements.GetChildConfig<TConfig>(childConfigName);
- }
-
-
-
-
-
-
-
-
-
- protected override bool OnDeserializeUnrecognizedAttribute(string name, string value)
- {
-
- if (!"serviceName".Equals(name, StringComparison.OrdinalIgnoreCase))
- return base.OnDeserializeUnrecognizedAttribute(name, value);
- this["serverTypeName"] = value;
- return true;
- }
- }
- }
|