示例#1
0
        public static void Exec()
        {
            try
            {
                if (Schedule.Count > 0)
                {
                    foreach (var entry in Schedule.ToArray())
                    {
                        switch (entry.Key)
                        {
                        case "AutoBackup":
                            if (DateTime.Now >= entry.Value)
                            {
                                autoBackup = "";
                                AutoBackup.SetDelay();
                                AutoBackup.Exec();
                            }
                            continue;

                        case "AutoSaveWorld":
                            if (DateTime.Now >= entry.Value)
                            {
                                autoSaveWorld = "";
                                AutoSaveWorld.SetDelay();
                                AutoSaveWorld.Save();
                            }
                            continue;

                        case "Bloodmoon":
                            if (DateTime.Now >= entry.Value)
                            {
                                bloodmoon = "";
                                Bloodmoon.SetDelay();
                                Bloodmoon.StatusCheck();
                            }
                            continue;

                        case "BreakTime":
                            if (DateTime.Now >= entry.Value)
                            {
                                breakTime = "";
                                BreakTime.SetDelay();
                                BreakTime.Exec();
                            }
                            continue;

                        case "InfoTicker":
                            if (DateTime.Now >= entry.Value)
                            {
                                infoTicker = "";
                                InfoTicker.SetDelay();
                                InfoTicker.Exec();
                            }
                            continue;

                        case "NightAlert":
                            if (DateTime.Now >= entry.Value)
                            {
                                nightAlert = "";
                                NightAlert.SetDelay();
                                NightAlert.Exec();
                            }
                            continue;

                        case "PlayerLogs":
                            if (DateTime.Now >= entry.Value)
                            {
                                playerLogs = "";
                                PlayerLogs.SetDelay();
                                PlayerLogs.Exec();
                            }
                            continue;

                        case "RealWorldTime":
                            if (DateTime.Now >= entry.Value)
                            {
                                realWorldTime = "";
                                RealWorldTime.SetDelay();
                                RealWorldTime.Exec();
                            }
                            continue;

                        case "Shutdown":
                            if (DateTime.Now >= entry.Value)
                            {
                                Remove("Shutdown");
                                Shutdown.PrepareShutdown();
                            }
                            continue;

                        case "WatchList":
                            if (DateTime.Now >= entry.Value)
                            {
                                watchList = "";
                                WatchList.SetDelay();
                                WatchList.Exec();
                            }
                            continue;

                        case "Zones":
                            if (DateTime.Now >= entry.Value)
                            {
                                zones = "";
                                Zones.SetDelay();
                                Zones.ReminderExec();
                            }
                            continue;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in EventSchedule.Exec: {0}", e.Message));
            }
        }