Пример #1
0
        protected override void OnTick()
        {
            if (m_Restarting || !Enabled)
            {
                return;
            }

            if (DateTime.Now < m_RestartTime)
            {
                return;
            }

            if (WarningDelay > TimeSpan.Zero)
            {
                Warning_Callback();
                Timer.DelayCall(WarningDelay, WarningDelay, new TimerCallback(Warning_Callback));
            }

            Warning_Callback(); // warn immediately
            AutoSave.Save();    // perform the final save

            m_Restarting = true;

            Timer.DelayCall(RestartDelay, new TimerCallback(Restart_Callback));
        }
Пример #2
0
        public static void DoRestart(object state)
        {
            object[] states = (object[])state;
            bool     normal = (bool)states[0];

            lock (World.Items.Values)
            {
                lock (World.Mobiles.Values)
                {
                    AutoSave.Save();
                }
            }

            if (normal)
            {
                if (File.Exists("Launcher.exe"))
                {
                    m_Mobile.SendMessage("Launcher found, restarting...");
                    Process.Start("Launcher.exe", Arguments());
                    Core.Process.Kill();
                }
            }

            Process.Start(Core.ExePath, Arguments());
            Core.Process.Kill();
        }
Пример #3
0
        protected override void OnTick()
        {
            if (Restarting || !Enabled)
            {
                return;
            }

            if (WarningDelay > TimeSpan.Zero && !DoneWarning && RestartTime - WarningDelay < DateTime.Now)
            {
                World.Broadcast(0x22, true, "The server will be going down in about {0} minute{1}.", WarningDelay.TotalMinutes.ToString(), WarningDelay.TotalMinutes == 1 ? "" : "s");

                DoneWarning = true;
                return;
            }

            if (DateTime.Now < RestartTime)
            {
                return;
            }

            AutoSave.Save();
            Restarting = true;

            TimedShutdown(true);
        }
Пример #4
0
        protected override void OnTick()
        {
            if (m_Restarting || !Enabled)
            {
                return;
            }

//			if ( DateTime.Now < m_RestartTime )
//				return;

            if (m_WarningCount < WarningIntervals.Length && DateTime.Now >= (m_RestartTime - TimeSpan.FromSeconds(WarningIntervals[m_WarningCount])))
            {
                Warning_Callback();
            }
            else if (DateTime.Now >= m_RestartTime)
            {
                AutoSave.SavesEnabled = false;

                if (!AutoSave.BackingUp)
                {
                    AutoSave.ThreadedBackup();
                }

                FinalRestart();
            }
        }
Пример #5
0
            protected override void OnTick()
            {
                // Si pas d'IP enregistrée on arrête le timer
                if (m_Adress == null)
                {
                    Stop();
                    return;
                }

                // Si on ne trouve pas l'ip, on ne reboot pas et on continue le timer.
                IPAddress ip = ServerList.FindPublicAddress();

                if (ip == null)
                {
                    Console.WriteLine("Adresse IP introuvable, vérifiez votre connexion à internet.");
                    return;
                }

                // Si adresse IP changée et personne en ligne, on reboot
                if (m_Adress != ip.ToString() && Network.NetState.Instances.Count == 0)
                {
                    World.Broadcast(0x35, false, "Changement d'adresse IP détecté, redémarrage en cours...");
                    Logging.RestartLog("Redémarrage du serveur car changement d'adresse IP détecté");
                    AutoSave.Save();
                    Core.Kill(true);
                }
            }
Пример #6
0
            protected override void OnTick()
            {
                if (Maintenance.Scheduled == false)
                {
                    return;
                }

                string text;

                if (Maintenance.Countdown > 1)
                {
                    text = String.Format("Server restarting in {0} minutes for maintenance...", Maintenance.Countdown);
                }
                else if (Maintenance.Countdown == 1)
                {
                    text = String.Format("Server restarting in {0} minute for maintenance...", Maintenance.Countdown);
                }
                else
                {
                    text = String.Format("Server restarting now...");
                }

                World.Broadcast(0x22, true, text);
                Console.WriteLine(text);

                if (Maintenance.Countdown == 0)
                {
                    AutoSave.Save();
                    Core.Kill(Maintenance.Shutdown == false);
                }

                Maintenance.Countdown--;
            }
Пример #7
0
		static AutoSave()
		{
			Instance = new AutoSave();

			SavesEnabled = true;

			BackupSource = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Saves/");
			BackupTarget = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Backups/Automatic/");
		}
Пример #8
0
        static AutoSave()
        {
            Instance = new AutoSave();

            SavesEnabled = true;

            BackupSource = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Saves/");
            BackupTarget = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Backups/Automatic/");
        }
Пример #9
0
 public static void InvokeShutdown_OnCommand(CommandEventArgs e)
 {
     try
     {
         World.Broadcast(0x22, true, "The world is shutting down.");
         AutoSave.Save();
         Core.Process.Kill();
     }
     catch
     { e.Mobile.SendMessage("Shutdown Failed"); }
 }
Пример #10
0
        private static void Backup()
        {
            Console.Write("Crash: Backing up...");

            try
            {
                string timeStamp = GetTimeStamp();

                string root       = GetRoot();
                string rootBackup = Combine(root, String.Format("Backups/Crashed/{0}/", timeStamp));
                string rootOrigin = Combine(root, String.Format("Saves/"));
                string rootInfo   = Combine(root, String.Format("Info/"));

                // Create new directories
                CreateDirectory(rootBackup);
                CreateDirectory(rootBackup, "Accounts/");
                CreateDirectory(rootBackup, "Items/");
                CreateDirectory(rootBackup, "Mobiles/");
                CreateDirectory(rootBackup, "Guilds/");
                CreateDirectory(rootBackup, "Regions/");
                CreateDirectory(rootBackup, "Info/");

                // Copy files
                CopyFile(rootOrigin, rootBackup, "Accounts/Accounts.xml");

                CopyFile(rootOrigin, rootBackup, "Items/Items.bin");
                CopyFile(rootOrigin, rootBackup, "Items/Items.idx");
                CopyFile(rootOrigin, rootBackup, "Items/Items.tdb");

                CopyFile(rootOrigin, rootBackup, "Mobiles/Mobiles.bin");
                CopyFile(rootOrigin, rootBackup, "Mobiles/Mobiles.idx");
                CopyFile(rootOrigin, rootBackup, "Mobiles/Mobiles.tdb");

                CopyFile(rootOrigin, rootBackup, "Guilds/Guilds.bin");
                CopyFile(rootOrigin, rootBackup, "Guilds/Guilds.idx");

                CopyFile(rootOrigin, rootBackup, "Regions/Regions.bin");
                CopyFile(rootOrigin, rootBackup, "Regions/Regions.idx");

                AutoSave.InfoBackup(rootBackup);
                AutoSave.ArticleBackup(rootBackup);

                Console.WriteLine("done");
            }
            catch
            {
                Console.WriteLine("failed");
            }
        }
Пример #11
0
        public void FinalRestart()
        {
            AutoSave.Save();             //ONE LAST SAVE! :P

            m_Restarting = true;

            DelayCall(RestartDelay, Restart_Callback);

            if (RestartDelay > TimeSpan.Zero)
            {
                World.Broadcast(38, 0, true, "---- SERVER WARS ----");
                World.Broadcast(38, 0, true, String.Format("RESTARTING IN {0}", FormatTimeSpan(RestartDelay)));
                PrepareServerWar();
            }
        }
Пример #12
0
            protected override void OnTick()
            {
                if (Maintenance.Scheduled == false)
                {
                    return;
                }

                string text;

                if (Maintenance.Countdown > 5)
                {                       // just tell staff
                    text = string.Format("[Staff] Server restart in {0} minutes", Maintenance.Countdown);
                    Server.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 0x482, text);
                }
                else
                {                       // tell everyone
                    if (Maintenance.Countdown > 1)
                    {
                        text = String.Format("Server restarting in {0} minutes for maintenance...", Maintenance.Countdown);
                    }
                    else if (Maintenance.Countdown == 1)
                    {
                        text = String.Format("Server restarting in {0} minute for maintenance...", Maintenance.Countdown);
                    }
                    else
                    {
                        text = String.Format("Server restarting now...");
                    }

                    World.Broadcast(0x22, true, text);
                }
                Console.WriteLine(text);


                if (Maintenance.Countdown == 0)
                {
                    AutoSave.Save();
                    Core.Kill(Maintenance.Shutdown == false);
                }

                Maintenance.Countdown--;
            }
Пример #13
0
        public static void Shutdown_OnCommand(CommandEventArgs e)
        {
            if (Restarting)
            {
                e.Mobile.SendMessage("The server is already shutting down.");
            }
            else
            {
                e.Mobile.SendMessage("You have initiated server shutdown.");

                StopTimer();

                Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                {
                    AutoSave.Save();
                    Restarting = true;

                    TimedShutdown(false);
                });
            }
        }
Пример #14
0
        protected override void OnTick()
        {
            if (m_Restarting || !m_enabled)
            {
                return;
            }

            if (Cron.GameTimeNow < m_RestartTime)
            {
                return;
            }

            // warn the user 5 minutes before the server goes down
            if (ShutdownWarningInterval > TimeSpan.Zero)
            {
                TimeSpan dx = (m_RestartTime + RestartDelay) - Cron.GameTimeNow;
                dx = TimeSpan.FromMinutes(dx.TotalMinutes - 5);
                Timer.DelayCall(dx, ShutdownWarningInterval, new TimerCallback(ShutdownWarning_Callback));
            }

            // if we're doing server wars, lets tell the players
            if (RestartDelay != TimeSpan.Zero && RestartDelay != TimeSpan.FromMinutes(ServerWarsDefault))
            {
                Timer.DelayCall(TimeSpan.FromMinutes(0), WarsWarningInterval, new TimerCallback(WarWarning_Callback));
            }

            // if World.SaveOption.NoSaves is on, don't call AutoSave.Save() as it will still move the directories around
            if (World.SaveType == World.SaveOption.NoSaves)
            {
                Console.WriteLine("Note: AutoSave.Save() skipped because: World.SaveOption.NoSaves");
            }
            else
            {
                AutoSave.Save();                        // last save before "Server Wars"
            }
            AutoSave.SavesEnabled = false;              // disable saves now
            m_Restarting          = true;               // okay, all set

            Timer.DelayCall(RestartDelay, new TimerCallback(Restart_Callback));
        }
Пример #15
0
        public void FinalRestart()
        {
            if (WorldBackup.BackingUp)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(FinalRestart));
            }
            else
            {
                AutoSave.Save();                 //ONE LAST SAVE! :P

                m_Restarting = true;

                Timer.DelayCall(RestartDelay, new TimerCallback(Restart_Callback));

                if (RestartDelay > TimeSpan.Zero)
                {
                    World.Broadcast(38, 0, true, "---- SERVER WARS ----");
                    World.Broadcast(38, 0, true, String.Format("RESTARTING IN {0}", FormatTimeSpan(RestartDelay)));
                    PrepareServerWar();
                }
            }
        }
Пример #16
0
        protected override void OnTick()
        {
            if (m_CrashServer || !Enabled)
            {
                return;
            }

            if (DateTime.Now < m_CrashTime)
            {
                return;
            }

            if (WarningDelay > TimeSpan.Zero)
            {
                Warning_Callback();
                Timer.DelayCall(WarningDelay, WarningDelay, new TimerCallback(Warning_Callback));
            }

            AutoSave.Save();
            m_CrashServer = true;

            Timer.DelayCall(CrashDelay, new TimerCallback(ForceServerCrash_Callback));
        }
Пример #17
0
        protected override void OnTick()
        {
            if (m_Restarting || !Enabled)
            {
                return;
            }

            if (DateTime.Now < m_RestartTime)
            {
                return;
            }

            if (WarningDelay > TimeSpan.Zero)
            {
                Warning_Callback();
                DelayCall(WarningDelay, WarningDelay, Warning_Callback);
            }

            AutoSave.Save();

            m_Restarting = true;

            DelayCall(RestartDelay, Restart_Callback);
        }
Пример #18
0
        public static void Restart_OnCommand(CommandEventArgs e)
        {
            if (Restarting)
            {
                e.Mobile.SendMessage("The server is already restarting.");
            }
            else
            {
                e.Mobile.SendMessage("You have initiated server restart.");

                StopTimer();

                bool recompile = e.Arguments.Length > 0 && e.Arguments[0].ToLower() == "true";

                if (recompile)
                {
                    if (!File.Exists(RecompilePath))
                    {
                        e.Mobile.SendMessage("Unable to Re-Compile due to missing file: {0}", RecompilePath);
                        recompile = false;
                    }
                    else
                    {
                        e.Mobile.SendMessage("Recompiling after restart!");
                    }
                }

                DelayCall(TimeSpan.FromSeconds(1), () =>
                {
                    AutoSave.Save();

                    Restarting = true;
                    TimedShutdown(true, recompile);
                });
            }
        }
Пример #19
0
        private static void DoRestart()
        {
            if (!_Schedule.Enabled)
            {
                _Expire = 0;

                _Timer.Stop();
                _Timer = null;

                World.Broadcast(0x22, true, "The server restart has been cancelled!");

                return;
            }

            var delay = TimeSpan.FromMilliseconds(_Expire - VitaNexCore.Ticks);

            if (delay > TimeSpan.Zero)
            {
                World.Broadcast(0x22, true, "The server will restart in {0}", delay.ToSimpleString("h:m:s"));

                if (delay > WarningInterval)
                {
                    delay = WarningInterval;
                }

                _Timer = Timer.DelayCall(delay, DoRestart);
            }
            else
            {
                World.Broadcast(0x22, true, "The server is restarting now!");

                AutoSave.Save();

                _Timer = Timer.DelayCall(Core.Kill, true);
            }
        }
Пример #20
0
        protected override void OnTick()
        {
            if (m_Restarting || !Enabled)
            {
                return;
            }

            if (DateTime.UtcNow < m_RestartTime)
            {
                return;
            }

            if (WarningDelay > TimeSpan.Zero)
            {
                this.Warning_Callback();
                Timer.DelayCall(WarningDelay, WarningDelay, new TimerCallback(Warning_Callback));
            }

            AutoSave.Save();

            m_Restarting = true;

            Timer.DelayCall(RestartDelay, new TimerCallback(Restart_Callback));
        }
Пример #21
0
        private static void ProcessCommand(string input)
        {
            input = input.Trim();

            if (_Pages != null)
            {
                HandlePaging(input);
                return;
            }

            if (input.StartsWith("pages", StringComparison.OrdinalIgnoreCase))
            {
                HandlePaging(input.Substring(5).Trim());
                return;
            }

            if (input.StartsWith("bc", StringComparison.OrdinalIgnoreCase))
            {
                var sub = input.Substring(2).Trim();

                BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Admin] {0}", sub));

                Console.WriteLine("[World]: {0}", sub);
                return;
            }

            if (input.StartsWith("sc", StringComparison.OrdinalIgnoreCase))
            {
                var sub = input.Substring(2).Trim();

                BroadcastMessage(AccessLevel.Counselor, 0x32, String.Format("[Admin] {0}", sub));

                Console.WriteLine("[Staff]: {0}", sub);
                return;
            }

            if (input.StartsWith("ban", StringComparison.OrdinalIgnoreCase))
            {
                var sub = input.Substring(3).Trim();

                var states = NetState.Instances;

                if (states.Count == 0)
                {
                    Console.WriteLine("There are no players online.");
                    return;
                }

                var ns = states.Find(o => o.Account != null && o.Mobile != null && Insensitive.StartsWith(sub, o.Mobile.RawName));

                if (ns != null)
                {
                    Console.WriteLine("[Ban]: {0}: Mobile: '{1}' Account: '{2}'", ns, ns.Mobile.RawName, ns.Account.Username);

                    ns.Dispose();
                }

                return;
            }

            if (input.StartsWith("kick", StringComparison.OrdinalIgnoreCase))
            {
                var sub = input.Substring(4).Trim();

                var states = NetState.Instances;

                if (states.Count == 0)
                {
                    Console.WriteLine("There are no players online.");
                    return;
                }

                var ns = states.Find(o => o.Account != null && o.Mobile != null && Insensitive.StartsWith(sub, o.Mobile.RawName));

                if (ns != null)
                {
                    Console.WriteLine("[Kick]: {0}: Mobile: '{1}' Account: '{2}'", ns, ns.Mobile.RawName, ns.Account.Username);

                    ns.Dispose();
                }

                return;
            }

            switch (input.Trim())
            {
            case "crash":
            {
                Timer.DelayCall(() => { throw new Exception("Forced Crash"); });
            }
            break;

            case "shutdown":
            {
                AutoSave.Save();
                Core.Kill(false);
            }
            break;

            case "shutdown nosave":
            {
                Core.Kill(false);
            }
            break;

            case "restart":
            {
                AutoSave.Save();
                Core.Kill(true);
            }
            break;

            case "restart nosave":
            {
                Core.Kill(true);
            }
            break;

            case "online":
            {
                var states = NetState.Instances;

                if (states.Count == 0)
                {
                    Console.WriteLine("There are no users online at this time.");
                }

                foreach (var t in states)
                {
                    var a = t.Account as Account;

                    if (a == null)
                    {
                        continue;
                    }

                    var m = t.Mobile;

                    if (m != null)
                    {
                        Console.WriteLine("- Account: {0}, Name: {1}, IP: {2}", a.Username, m.Name, t);
                    }
                }
            }
            break;

            case "save":
                AutoSave.Save();
                break;

            case "hear":                     // Credit to Zippy for the HearAll script!
            {
                _HearConsole = !_HearConsole;

                Console.WriteLine("{0} sending speech to the console.", _HearConsole ? "Now" : "No longer");
            }
            break;

            default:
                DisplayHelp();
                break;
            }
        }
Пример #22
0
        public static void Archive(string originDir)
        {
            if (ArchiveDuration == -1 || DateTime.UtcNow > LastArchive + TimeSpan.FromHours(ArchiveDuration))
            {
                var destination = !String.IsNullOrEmpty(Destination) && Destination.Length > 0 ? Destination : DefaultDestination;

                if (!Directory.Exists(destination))
                {
                    Directory.CreateDirectory(destination);
                }

                var year  = DateTime.UtcNow.Year.ToString();
                var month = new DateTimeFormatInfo().GetMonthName(DateTime.UtcNow.Month);

                if (!Directory.Exists(Path.Combine(destination, year)))
                {
                    Directory.CreateDirectory(Path.Combine(destination, year));
                }

                if (!Directory.Exists(Path.Combine(destination, year, month)))
                {
                    Directory.CreateDirectory(Path.Combine(destination, year, month));
                }

                ZipFile.CreateFromDirectory(originDir, Path.Combine(destination, year, month, AutoSave.GetTimeStamp() + ".zip"), CompressionLevel.Optimal, true);

                Utility.WriteConsoleColor(ConsoleColor.Yellow, "New save archive created. Next Archive: {0}", DateTime.UtcNow + TimeSpan.FromHours(ArchiveDuration));

                LastArchive = DateTime.UtcNow;
            }
        }
Пример #23
0
 public static void Save()
 {
     AutoSave.Save(true);
 }
Пример #24
0
        public static string Archive(string originDir)
        {
            var destination = !String.IsNullOrEmpty(Destination) && Destination.Length > 0 ? Destination : DefaultDestination;

            if (!Directory.Exists(destination))
            {
                Directory.CreateDirectory(destination);
            }

            var year  = DateTime.UtcNow.Year.ToString();
            var month = new DateTimeFormatInfo().GetMonthName(DateTime.UtcNow.Month);

            if (!Directory.Exists(Path.Combine(destination, year)))
            {
                Directory.CreateDirectory(Path.Combine(destination, year));
            }

            if (!Directory.Exists(Path.Combine(destination, year, month)))
            {
                Directory.CreateDirectory(Path.Combine(destination, year, month));
            }

            ZipFile.CreateFromDirectory(originDir, Path.Combine(destination, year, month, AutoSave.GetTimeStamp() + ".zip"), CompressionLevel.Optimal, true);

            return(destination);
        }
Пример #25
0
 private void Restart_Callback()
 {
     World.Broadcast(0x22, true, "Redemarrage!");
     AutoSave.SaveForRestart();
     Core.Kill(true);
 }
Пример #26
0
        public static void Next(string input)
        {
            input = input.ToLower();

            if (input.StartsWith("bc"))
            {
                string sub = input.Replace("bc", "");

                BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Admin] {0}", sub));
                Console.WriteLine("Players will see: {0}", sub);
            }
            else if (input.StartsWith("sc"))
            {
                string sub = input.Replace("staff", "");

                BroadcastMessage(AccessLevel.Counselor, 0x32, String.Format("[Admin] {0}", sub));
                Console.WriteLine("Staff will see: {0}", sub);
            }
            else if (input.StartsWith("ban"))
            {
                string sub    = input.Replace("ban", "");
                var    states = NetState.Instances;

                if (states.Count == 0)
                {
                    Console.WriteLine("There are no players online.");
                }

                foreach (NetState t in states)
                {
                    Account a = t.Account as Account;

                    if (a == null)
                    {
                        continue;
                    }

                    Mobile m = t.Mobile;

                    if (m == null)
                    {
                        continue;
                    }

                    sub = sub.ToLower();

                    if (m.Name.ToLower() != sub.Trim())
                    {
                        continue;
                    }

                    NetState m_ns = m.NetState;

                    Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username);

                    a.Banned = true;
                    m_ns.Dispose();

                    Console.WriteLine("Banning complete.");
                }
            }
            else if (input.StartsWith("kick"))
            {
                string sub    = input.Replace("kick", "");
                var    states = NetState.Instances;

                if (states.Count == 0)
                {
                    Console.WriteLine("There are no players online.");
                }

                foreach (NetState t in states)
                {
                    Account a = t.Account as Account;

                    if (a == null)
                    {
                        continue;
                    }

                    Mobile m = t.Mobile;

                    if (m == null)
                    {
                        continue;
                    }

                    sub = sub.ToLower();

                    if (m.Name.ToLower() != sub.Trim())
                    {
                        continue;
                    }

                    NetState m_ns = m.NetState;

                    Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username);

                    m_ns.Dispose();

                    Console.WriteLine("Kicking complete.");
                }
            }
            else
            {
                switch (input.Trim())
                {
                case "shutdown":
                {
                    AutoSave.Save();
                    Core.Process.Kill();
                }
                break;

                case "shutdown nosave":
                    Core.Process.Kill();
                    break;

                case "restart":
                {
                    BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Server] We are restarting..."));
                    AutoSave.Save();
                    Process.Start(Core.ExePath, Core.Arguments);
                    Core.Process.Kill();
                }
                break;

                case "restart nosave":
                {
                    Process.Start(Core.ExePath, Core.Arguments);
                    Core.Process.Kill();
                }
                break;

                case "online":
                {
                    var states = NetState.Instances;

                    if (states.Count == 0)
                    {
                        Console.WriteLine("There are no users online at this time.");
                    }

                    foreach (NetState t in states)
                    {
                        Account a = t.Account as Account;

                        if (a == null)
                        {
                            continue;
                        }

                        Mobile m = t.Mobile;

                        if (m != null)
                        {
                            Console.WriteLine("- Account: {0}, Name: {1}, IP: {2}", a.Username, m.Name, t);
                        }
                    }
                }
                break;

                case "save":
                    AutoSave.Save();
                    break;

                case "hear":                         //credit to Zippy for the HearAll script!
                {
                    _HearConsole = !_HearConsole;

                    Console.WriteLine(
                        _HearConsole ? "Now sending all speech to the console." : "No longer sending speech to the console.");
                }
                break;

                case "pages":
                {
                    Paging = true;

                    ArrayList list = PageQueue.List;
                    PageEntry e;

                    for (int i = 0; i < list.Count;)
                    {
                        e = (PageEntry)list[i];

                        if (e.Sender.Deleted || e.Sender.NetState == null)
                        {
                            e.AddResponse(e.Sender, "[Logout]");
                            PageQueue.Remove(e);
                        }
                        else
                        {
                            ++i;
                        }
                    }

                    _List = (PageEntry[])list.ToArray(typeof(PageEntry));

                    if (_List.Length > 0)
                    {
                        for (int i = 0; i < _List.Length; ++i)
                        {
                            e = _List[i];

                            string type = PageQueue.GetPageTypeName(e.Type);

                            Console.WriteLine("--------------Page Number: " + i + " --------------------");
                            Console.WriteLine("Player   :" + e.Sender.Name);
                            Console.WriteLine("Catagory :" + type);
                            Console.WriteLine("Message  :" + e.Message);
                        }

                        Console.WriteLine("Type the number of the page to respond to.");

                        ThreadPool.QueueUserWorkItem(PageResp, new object[] { 1, 2 });
                    }
                    else
                    {
                        Console.WriteLine("No pages to display.");

                        Paging = false;
                    }
                }
                break;

                //case "help":
                //case "list":
                default:
                {
                    Console.WriteLine(" ");
                    Console.WriteLine("Commands:");
                    Console.WriteLine("save            - Performs a forced save.");
                    Console.WriteLine("shutdown        - Performs a forced save then shuts down the server.");
                    Console.WriteLine("shutdown nosave - Shuts down the server without saving.");
                    Console.WriteLine("restart         - Sends a message to players informing them that the server is");
                    Console.WriteLine("                      restarting, performs a forced save, then shuts down and");
                    Console.WriteLine("                      restarts the server.");
                    Console.WriteLine("restart nosave  - Restarts the server without saving.");
                    Console.WriteLine("online          - Shows a list of every person online:");
                    Console.WriteLine("                      Account, Char Name, IP.");
                    Console.WriteLine("bc <message>    - Type this command and your message after it. It will then be");
                    Console.WriteLine("                      sent to all players.");
                    Console.WriteLine("sc <message>    - Type this command and your message after it. It will then be");
                    Console.WriteLine("                      sent to all staff.");
                    Console.WriteLine("hear            - Copies all local speech to this console:");
                    Console.WriteLine("                      Char Name (Region name): Speech.");
                    Console.WriteLine("pages           - Shows all the pages in the page queue,you type the page");
                    Console.WriteLine("                      number ,then you type your response to the player.");
                    Console.WriteLine("ban <playername>- Kicks and bans the users account.");
                    Console.WriteLine("kick <playername>- Kicks the user.");
                    Console.WriteLine("list or help    - Shows this list.");
                    Console.WriteLine(" ");
                }
                break;
                }
            }

            if (!Paging)
            {
                ThreadPool.QueueUserWorkItem(ConsoleListen);
            }
        }
Пример #27
0
 public static void Save()
 {
     AutoSave.Save(false);
 }
Пример #28
0
        private void Restart_Callback()
        {
            AutoSave.Save();

            Core.Kill(true);
        }