예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RootConfig"/> class.
        /// </summary>
        /// <param name="rootConfig">The root config.</param>
        public RootConfig(IRootConfig rootConfig)
#if NETSTANDARD2_0
            : this()
#endif
        {
            rootConfig.CopyPropertiesTo(this);
            this.OptionElements = rootConfig.OptionElements;
        }
예제 #2
0
        protected override IWorkItem CreateAppServer <T>(IRootConfig rootConfig, IServerConfig serverConfig)
        {
            var appServer = new AppDomainAppServer(typeof(T));

            var config = new ConfigurationSource();

            rootConfig.CopyPropertiesTo(config);

            appServer.Setup(new AppDomainBootstrap(config), serverConfig, new ProviderFactoryInfo[]
            {
                new ProviderFactoryInfo(ProviderKey.SocketServerFactory, ProviderKey.SocketServerFactory.Name, typeof(SocketServerFactory)),
                new ProviderFactoryInfo(ProviderKey.LogFactory, ProviderKey.LogFactory.Name, typeof(ConsoleLogFactory))
            });

            return(appServer);
        }
예제 #3
0
        /// <summary>
        /// Initializes the specified servers.
        /// </summary>
        /// <param name="rootConfig">The root config.</param>
        /// <param name="servers">The passed in AppServers, which have been setup.</param>
        /// <returns></returns>
        public static bool Initialize(IRootConfig rootConfig, IEnumerable <IAppServer> servers)
        {
            if (rootConfig == null)
            {
                throw new ArgumentNullException("rootConfig");
            }

            var config = new ConfigMockup();

            rootConfig.CopyPropertiesTo(config);

            m_ServerList = new List <IAppServer>(servers.Count());
            m_ServerList.AddRange(servers);
            m_Initialized = true;

            m_Config = config;

            return(true);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RootConfig"/> class.
 /// </summary>
 /// <param name="rootConfig">The root config.</param>
 public RootConfig(IRootConfig rootConfig)
 {
     rootConfig.CopyPropertiesTo(this);
     this.OptionElements = rootConfig.OptionElements;
 }
        /// <summary>
        /// Initializes the specified servers.
        /// </summary>
        /// <param name="rootConfig">The root config.</param>
        /// <param name="servers">The passed in AppServers, which have been setup.</param>
        /// <returns></returns>
        public static bool Initialize(IRootConfig rootConfig, IEnumerable<IAppServer> servers)
        {
            if (rootConfig == null)
                throw new ArgumentNullException("rootConfig");

            var config = new ConfigMockup();
            rootConfig.CopyPropertiesTo(config);

            m_ServerList = new List<IAppServer>(servers.Count());
            m_ServerList.AddRange(servers);
            m_Initialized = true;

            m_Config = config;

            return true;
        }