Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case "et":
- {
- if (data.Length == 1)
- {
- MyConsole.WriteLine("\t\tReceivePool-> et rp 'Priority' 'ThreadCount'.\n\t\tSendPool-> et sp 'Priority' 'ThreadCount'.\n\t\tConnectionReceive-> et cr 'Priority'.\n\t\tConnectionSend-> et cs 'Priority'.");
- return;
- }
- //Lowest = 0, BelowNormal = 1, Normal = 2, AboveNormal = 3, Highest = 4
- int ThreadCount;
- System.Threading.ThreadPriority Priority;
- if (!System.Threading.ThreadPriority.TryParse(data[2], out Priority))
- {
- MyConsole.WriteLine("Please Set Thread Priority.");
- return;
- }
- switch (data[1].ToLower())
- {
- case "rp"://ReceivePool
- {
- if (!int.TryParse(data[2], out ThreadCount))
- {
- MyConsole.WriteLine("Please Set Thread Count.");
- return;
- }
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[0].Dispose();
- World.ReceivePool.cleanUp(true);
- World.ReceivePool = new StaticPool(ThreadCount, Priority);
- World.ReceivePool.Run();
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[0] = World.Subscribe<ClientWrapper>(Program.World.ConnectionReceive, user.Socket, World.ReceivePool);
- break;
- }
- case "sp"://SendPool
- {
- if (!int.TryParse(data[2], out ThreadCount))
- {
- MyConsole.WriteLine("Please Set Thread Count.");
- return;
- }
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[1].Dispose();
- World.SendPool.cleanUp(true);
- World.SendPool = new StaticPool(ThreadCount, Priority);
- World.SendPool.Run();
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[1] = World.Subscribe<ClientWrapper>(Program.World.ConnectionSend, user.Socket, World.SendPool);
- break;
- }
- case "cr"://ConnectionReceive
- {
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[0].Dispose();
- World.ConnectionReceive = new Generic.TimerRule<ClientWrapper>(World.connectionReceive, 1, Priority);
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[0] = World.Subscribe<ClientWrapper>(Program.World.ConnectionReceive, user.Socket, World.ReceivePool);
- break;
- }
- case "cs"://ConnectionSend
- {
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[1].Dispose();
- World.ConnectionSend = new Generic.TimerRule<ClientWrapper>(World.connectionSend, 1, Priority);
- foreach (var user in Kernel.GamePool.Values)
- user.Socket.TimerSubscriptions[1] = World.Subscribe<ClientWrapper>(Program.World.ConnectionSend, user.Socket, World.SendPool);
- break;
- }
- }
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment