예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 protected ServerBase()
 {
     Logger          = new Logger();
     _knownClients   = new ConcurrentDictionary <Guid, ExtendedClientInfo>();
     _packageManager = new PackageManager(PackagesFolder);
     _handlerManager = new HandlerManager(Logger, _packageManager);
     // Make sure the packages folder exists
     Directory.CreateDirectory(PackagesFolder);
 }
예제 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        protected ServerBase(TSet settings, params EventHandler <LogEventArgs>[] defaultLogHandlers)
        {
            Settings = settings;
            // Initialize the logger
            Logger = new Logger();
            foreach (var logEvent in defaultLogHandlers)
            {
                Logger.LogEvent += logEvent;
            }
            // Initialize others
            _packageManager = new PackageManager(Settings.PackagesFolder);
            _handlerManager = new HandlerManager(Logger, _packageManager);
            _clientManager  = new ClientManager();
            // Make sure the packages folder exists
            Directory.CreateDirectory(Settings.PackagesFolder);

            // Autostart if wanted
            if (Settings.AutoStart)
            {
                Start();
            }
        }