1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using SuperSocket.Common;
- namespace SuperSocket.SocketBase.Config
- {
- /// <summary>
- /// Poco configuration source
- /// </summary>
- [Serializable]
- public class ConfigurationSource : RootConfig, IConfigurationSource
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ConfigurationSource"/> class.
- /// </summary>
- public ConfigurationSource()
- {
- }
- /// <summary>
- /// Initializes a new instance of the <see cref="ConfigurationSource"/> class.
- /// </summary>
- /// <param name="source">The source.</param>
- public ConfigurationSource(IConfigurationSource source)
- : base(source)
- {
- if (source.Servers != null && source.Servers.Any())
- {
- this.Servers = source.Servers.Select(s => new ServerConfig(s)).ToArray();
- }
- if (source.ServerTypes != null && source.ServerTypes.Any())
- {
- this.ServerTypes = source.ServerTypes.Select(s => s.CopyPropertiesTo(new TypeProviderConfig())).ToArray();
- }
- if (source.ConnectionFilters != null && source.ConnectionFilters.Any())
- {
- this.ConnectionFilters = source.ConnectionFilters.Select(s => s.CopyPropertiesTo(new TypeProviderConfig())).ToArray();
- }
- if (source.LogFactories != null && source.LogFactories.Any())
- {
- this.LogFactories = source.LogFactories.Select(s => s.CopyPropertiesTo(new TypeProviderConfig())).ToArray();
- }
- if (source.ReceiveFilterFactories != null && source.ReceiveFilterFactories.Any())
- {
- this.ReceiveFilterFactories = source.ReceiveFilterFactories.Select(s => s.CopyPropertiesTo(new TypeProviderConfig())).ToArray();
- }
- if (source.CommandLoaders != null && source.CommandLoaders.Any())
- {
- this.CommandLoaders = source.CommandLoaders.Select(s => s.CopyPropertiesTo(new TypeProviderConfig())).ToArray();
- }
- }
- /// <summary>
- /// Gets the servers definitions.
- /// </summary>
- public IEnumerable<IServerConfig> Servers { get; set; }
- /// <summary>
- /// Gets/sets the server types definition.
- /// </summary>
- public IEnumerable<ITypeProvider> ServerTypes { get; set; }
- /// <summary>
- /// Gets/sets the connection filters definition.
- /// </summary>
- public IEnumerable<ITypeProvider> ConnectionFilters { get; set; }
- /// <summary>
- /// Gets/sets the log factories definition.
- /// </summary>
- public IEnumerable<ITypeProvider> LogFactories { get; set; }
- /// <summary>
- /// Gets/sets the Receive filter factories definition.
- /// </summary>
- public IEnumerable<ITypeProvider> ReceiveFilterFactories { get; set; }
- /// <summary>
- /// Gets/sets the command loaders definition.
- /// </summary>
- public IEnumerable<ITypeProvider> CommandLoaders { get; set; }
- }
- }
|