Example #1
0
File: Main.cs Project: 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();
        }
Example #2
0
        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;
        }
Example #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);
        }