Exemple #1
0
        /// <summary>
        /// Creates a new instance of <see cref="SnapServer"/>
        /// </summary>
        public SnapServer(IToServerSettings settings)
            : this()
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            ServerSettings settings2 = settings.ToServerSettings();

            if (settings2 is null)
            {
                throw new ArgumentNullException(nameof(settings), "The ToServerSettings method returned null");
            }

            settings2.Validate();

            foreach (ServerDatabaseSettings db in settings2.Databases)
            {
                AddDatabase(db);
            }

            foreach (SnapSocketListenerSettings list in settings2.Listeners)
            {
                AddSocketListener(list);
            }
        }
Exemple #2
0
        /// <summary>
        /// Creates a new instance of <see cref="SnapServer"/>
        /// </summary>
        public SnapServer(IToServerSettings settings)
            : this()
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            var settings2 = settings.ToServerSettings();

            if (settings2 == null)
            {
                throw new ArgumentNullException("settings", "The ToServerSettings method returned null");
            }
            settings2.Validate();

            foreach (var db in settings2.Databases)
            {
                AddDatabase(db);
            }
            foreach (var list in settings2.Listeners)
            {
                AddSocketListener(list);
            }
        }
        /// <summary>
        /// Creates a new instance of <see cref="SnapServer"/>
        /// </summary>
        public SnapServer(IToServerSettings settings)
            : this()
        {
            if (settings == null)
                throw new ArgumentNullException("settings");
            var settings2 = settings.ToServerSettings();
            if (settings2 == null)
                throw new ArgumentNullException("settings", "The ToServerSettings method returned null");
            settings2.Validate();

            foreach (var db in settings2.Databases)
            {
                AddDatabase(db);
            }
            foreach (var list in settings2.Listeners)
            {
                AddSocketListener(list);
            }
        }