public static void Init() { Cipher.InitTable(); using (var dbContext = Database.For <ThePalaceEntities>()) { try { dbContext.Users1.Clear(); dbContext.UserData.Clear(); dbContext.Assets1.Clear(); dbContext.Rooms .Where(r => (r.Flags & (int)RoomFlags.RF_Closed) != 0) .ToList() .ForEach(r => { r.Flags &= ~(int)RoomFlags.RF_Closed; }); if (dbContext.HasUnsavedChanges()) { dbContext.SaveChanges(); } } catch (Exception ex) { ex.DebugLog(); } } PluginManager.Init(); SessionManager.Init(); ThreadController.Init(); }
public static void Shutdown() { var threadShutdownWait_InMilliseconds = ConfigManager.GetValue <int>("ThreadShutdownWait_InMilliseconds", 2500).Value; isShutDown = true; new Business.MSG_SERVERDOWN { reason = ServerDownFlags.SD_ServerDown, whyMessage = "Server going down!", }.SendToServer(null, null); Thread.Sleep(threadShutdownWait_InMilliseconds); PalaceAsyncSocket.Shutdown(); PalaceAsyncSocket.Dispose(); WebAsyncSocket.Shutdown(); WebAsyncSocket.Dispose(); SessionManager.Dispose(); PluginManager.Dispose(); ThreadController.serverShutdown.Set(); ThreadController.Dispose(); }