private static void ActivateFullMaintenance(object sender, EventArgs e) { Timer.Stop(); Timer2.Stop(); Timer3.Elapsed += DisableMaintenance; Timer3.Interval = Time; Timer3.Start(); ForegroundColor = ConsoleColor.Yellow; Say("Full Maintenance has been started!"); ResetColor(); if (Time >= 7000) { Say(); Error("Please type in a valid time!"); Error("20min = 1200, 10min = 600"); Say(); StartMaintenance(); } MemoryThread.Stop(); Parallel.ForEach(ResourcesManager.GetInMemoryLevels(), p => { new OutOfSyncMessage(p.GetClient()).Send(); ResourcesManager.DropClient(p.GetClient().GetSocketHandle()); }); var clans = DatabaseManager.Single().Save(ResourcesManager.GetInMemoryAlliances()); clans.Wait(); MemoryThread.Start(); }
public static void UCSClose() { Thread T = new Thread(() => { Say("Closing UCS..."); NetworkThread.Stop(); MemoryThread.Stop(); Environment.Exit(0); }); T.Start(); }
public static void UCSRestart() { Thread T = new Thread(() => { Say("Restarting UCS..."); NetworkThread.Stop(); MemoryThread.Stop(); Thread.Sleep(1000); Process.Start("UCS.exe"); Environment.Exit(0); }); T.Start(); }