Advertisement
Jh0n-K3v1n

public static bool ProcessConsoleEvent

Jun 16th, 2025
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.09 KB | Writing | 0 0
  1. public  static bool ProcessConsoleEvent(int type)
  2. {
  3.     try
  4.     {
  5.         if (ServerConfig.IsInterServer)
  6.         {
  7.             foreach (var client in Database.Server.GamePoll.Values)
  8.             {
  9.                 try
  10.                 {
  11.                     if (client.Socket != null)//for my fake accounts !
  12.                         client.Socket.Disconnect();
  13.                 }
  14.                 catch (Exception e)
  15.                 {
  16.                     MyConsole.WriteLine(e.ToString());
  17.                 }
  18.             }
  19.             return true;
  20.         }
  21.         try
  22.         {
  23.             if (WebServer.Proces.AccServer != null)
  24.             {
  25.                 WebServer.Proces.Close();
  26.                 WebServer.Proces.AccServer.Close();
  27.             }
  28.             if (GameServer != null)
  29.                 GameServer.Close();
  30.  
  31.            
  32.         }
  33.       catch (Exception e) { MyConsole.SaveException(e); }
  34.  
  35.         try
  36.         {
  37.             foreach (var user in WebServer.LoaderServer.Clients.Values)
  38.                 user.Disconnect();
  39.         }
  40.         catch(Exception e)
  41.         {
  42.             MyConsole.SaveException(e);
  43.         }
  44.         Console.ForegroundColor = System.ConsoleColor.DarkGreen;
  45.         MyConsole.WriteLine("  " + "Guardando datos...");
  46.         Console.ForegroundColor = System.ConsoleColor.Yellow;
  47.  
  48.  
  49.         foreach (var client in Database.Server.GamePoll.Values)
  50.         {
  51.             try
  52.             {
  53.                 if (client.Socket != null)//for my fake accounts !
  54.                     client.Socket.Disconnect();
  55.             }
  56.             catch (Exception e)
  57.             {
  58.                 MyConsole.WriteLine(e.ToString());
  59.             }
  60.         }
  61.         Role.Instance.Clan.ProcessChangeNames();
  62.  
  63.         Database.Server.SaveDatabase();
  64.         if (Database.ServerDatabase.LoginQueue.Finish())
  65.         {
  66.             System.Threading.Thread.Sleep(1000);
  67.             MyConsole.WriteLine("  " + "Base de datos guardada correctamente.");
  68.         }
  69.     }
  70.     catch (Exception e)
  71.     {
  72.         MyConsole.SaveException(e);
  73.     }
  74.     return true;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement