using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperSocket.Common;
namespace SuperSocket.SocketBase.Config
{
///
/// Poco configuration source
///
[Serializable]
public class ConfigurationSource : RootConfig, IConfigurationSource
{
///
/// Initializes a new instance of the class.
///
public ConfigurationSource()
{
}
///
/// Initializes a new instance of the class.
///
/// The source.
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();
}
}
///
/// Gets the servers definitions.
///
public IEnumerable Servers { get; set; }
///
/// Gets/sets the server types definition.
///
public IEnumerable ServerTypes { get; set; }
///
/// Gets/sets the connection filters definition.
///
public IEnumerable ConnectionFilters { get; set; }
///
/// Gets/sets the log factories definition.
///
public IEnumerable LogFactories { get; set; }
///
/// Gets/sets the Receive filter factories definition.
///
public IEnumerable ReceiveFilterFactories { get; set; }
///
/// Gets/sets the command loaders definition.
///
public IEnumerable CommandLoaders { get; set; }
}
}