public static void ManageClient(object clientThreadObj) { ClientThread clientThread = (ClientThread)clientThreadObj; try { clientThread.Run(clientThread.sock.GetStream()); } catch (Exception ex) { } clientThread.Cleanup(); }
public void Run(NetworkStream sock) { ClientThread.\u003C\u003Ec__DisplayClass10_0 cDisplayClass100; cDisplayClass100.sock = sock; this.ramseyThread.Start((object)this); this.flagThread.Start((object)this); label_1: int num1; while (true) { string s = ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100); if (s.Length != 0) { switch (int.Parse(s)) { case 1: ClientThread.\u003CRun\u003Eg__sendline\u007C10_1(ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100), ref cDisplayClass100); continue; case 2: int num2 = int.Parse(ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100)); int num3 = int.Parse(ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100)); int num4 = int.Parse(ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100)); if (num2 >= 0 && num2 <= 100 && (num3 >= 5 && num3 <= 10) && num4 >= 0) { this.comm[0] = (byte)num2; this.comm[1] = (byte)num3; int num5 = (num2 * num2 - num2) / 2 / 8; for (int index = 0; index < num5; ++index) { this.comm[2 + index] = (byte)0; } for (int index = 0; index < num4; ++index) { string[] strArray = ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100).Split((char[])null); if (strArray.Length != 2) { return; } int num6 = int.Parse(strArray[0]); int num7 = int.Parse(strArray[1]); if (num6 < 0 || num6 >= num2 || (num7 < 0 || num7 >= num2) || num6 == num7) { return; } int num8; int num9; if (num6 > num7) { num8 = num7; num9 = num6; } else { num9 = num7; num8 = num6; } int num10 = num8 * num2 + num9; for (; num8 >= 0; --num8) { num10 -= num8 + 1; } this.comm[2 + num10 / 8] |= (byte)(1 << num10 % 8); } this.ramseySemaphore.Release(); this.mainSemaphore.WaitOne(); if (this.comm[0] == (byte)0 && this.comm[1] == (byte)0 && (this.comm[2] == (byte)0 && this.comm[3] == (byte)0)) { ClientThread.\u003CRun\u003Eg__sendline\u007C10_1("Paul Erdos approves of this party!", ref cDisplayClass100); continue; } ClientThread.\u003CRun\u003Eg__sendline\u007C10_1("Paul Erdos does not approve of this party...", ref cDisplayClass100); continue; } goto label_4; case 3: num1 = int.Parse(ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100)); if (num1 >= 0 && num1 <= 100) { this.comm[0] = (byte)num1; int index1 = 1; for (int index2 = 0; index2 < num1 && index1 < 4096; ++index2) { string str = ClientThread.\u003CRun\u003Eg__readline\u007C10_0(ref cDisplayClass100); for (int index3 = 0; index3 < str.Length && index1 < 4096; ++index1) { this.comm[index1] = (byte)str[index3]; ++index3; } if (index1 < 4096) { this.comm[index1] = (byte)0; ++index1; } } if (index1 >= 4096) { ClientThread.\u003CRun\u003Eg__sendline\u007C10_1("Your flags are too large!", ref cDisplayClass100); continue; } goto label_38; } else { goto label_15; } default: goto label_2; } } else { break; } } return; label_2: return; label_4: return; label_15: return; label_38: this.flagSemaphore.Release(); this.mainSemaphore.WaitOne(); for (int index = 0; index < num1; ++index) { if (this.comm[index * 4] == (byte)0 && this.comm[1 + index * 4] == (byte)0 && (this.comm[2 + index * 4] == (byte)0 && this.comm[3 + index * 4] == (byte)0)) { ClientThread.\u003CRun\u003Eg__sendline\u007C10_1("Correct!", ref cDisplayClass100); } else { ClientThread.\u003CRun\u003Eg__sendline\u007C10_1("Incorrect!", ref cDisplayClass100); } } goto label_1; }