예제 #1
0
파일: Main.cs 프로젝트: umby24/ZBase
        private static void Setup()
        {
            var myLogger = new Logger();

            myLogger.Setup();

            Logger.Log(LogType.Debug, "Loading configuration...");
            Configuration.Load(); // -- Load server settings.
            Logger.Log(LogType.Debug, "Done");

            var wd = new Watchdog();

            TaskScheduler.RegisterTask("Watchdog", wd);
            TaskScheduler.RegisterTask("Heartbeat", new Heartbeat());
            TaskScheduler.RegisterTask("Blocks", new BlockManager());
            TaskScheduler.RegisterTask("PluginManager", new PluginManager());
            CommandHandler.RegisterInternalCommands();
            TaskScheduler.RegisterTask("Commands", new CommandHandler());

            TaskScheduler.RunSetupTasks();
            _server = new Server();

            LoadMaps();

            FillManager.LoadFills();
        }
예제 #2
0
파일: Logger.cs 프로젝트: umby24/ZBase
        public override void Setup()
        {
            if (_setup)
            {
                if (!Directory.Exists(Configuration.Settings.General.LogDirectory))
                {
                    Directory.CreateDirectory(Configuration.Settings.General.LogDirectory);
                }

                _minimumLevel = (LogType)Enum.Parse(typeof(LogType), Configuration.Settings.General.LogLevel, true);
                _fileOutput   = true;
                DateTime nowTime = DateTime.UtcNow;
                _filename = "log." + nowTime.Year + nowTime.Month + nowTime.Day + nowTime.Hour + nowTime.Minute + ".txt";
                _filename = Path.Combine(Configuration.Settings.General.LogDirectory, _filename);
                File.AppendAllText(_filename, "# Log Start at " + nowTime.ToLongDateString() + " - " + nowTime.ToLongTimeString() + Environment.NewLine);

                PruneLogs();
                TaskScheduler.RegisterTask("Logger", this);
                return;
            }

            LastRun  = new DateTime();
            Interval = new TimeSpan(0, 0, 2);
            _setup   = true;
        }
예제 #3
0
        public Configuration()
        {
            Network = new NetworkSettings();
            General = new GeneralSettings();
            Formats = new TextSettings();
            Cpe     = new CpeSettings();
            Ranks   = Rank.GetDefaultRanks();

            Interval = TimeSpan.FromSeconds(1);
            TaskScheduler.UnregisterTask("Settings Reload");
            TaskScheduler.RegisterTask("Settings Reload", this);
        }