Exemplo n.º 1
0
 private void RunReceiver()
 {
     //StopButton.BeginInvoke(new setButtonEnable(setButton), new object[] {StopButton, true });
     try {
         try {
             Socket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Raw, System.Net.Sockets.ProtocolType.IP);
             try {
                 Socket.Bind(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(selectip), 0));
                 Socket.SetSocketOption(System.Net.Sockets.SocketOptionLevel.IP, System.Net.Sockets.SocketOptionName.HeaderIncluded, 1);
                 Socket.IOControl(unchecked ((int)0x98000001), new byte[4] {
                     1, 0, 0, 0
                 }, new byte[4]);
                 while (StopButton.Enabled)
                 {
                     System.IAsyncResult ar = Socket.BeginReceive(PacketBuffer, 0, PacketBufferSize, System.Net.Sockets.SocketFlags.None, new System.AsyncCallback(CallReceive), this);
                     while (Socket.Available == 0)
                     {
                         System.Threading.Thread.Sleep(1);
                         if (!StopButton.Enabled)
                         {
                             break;
                         }
                     }
                     if (!StopButton.Enabled)
                     {
                         break;
                     }
                     int Size = Socket.EndReceive(ar);
                     if (!LooseQueue.Checked)
                     {
                         ExtractBuffer();
                     }
                 }
             } finally {
                 if (Socket != null)
                 {
                     Socket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
                     Socket.Close();
                 }
             }
         } finally {
             //StopButton.Enabled = false;
             //StartButton.Enabled = true;
             StartButton.BeginInvoke(new setButtonEnable(setButton), new object[] { StartButton, true });
             StopButton.BeginInvoke(new setButtonEnable(setButton), new object[] { StopButton, true });
         }
     } catch (System.Threading.ThreadAbortException) {
     } catch (System.Exception E) {
         System.Windows.Forms.MessageBox.Show(E.ToString());
     }
     //StartButton.BeginInvoke(new setButtonEnable(setButton), new object[] { StartButton, true });
     //StartButton.Enabled = true;
 }
 private void ResetUI(object sender, EventArgs e)
 {
     this.BeginInvoke((Action) delegate() { this.Enabled = true; this.Focus(); });
     StartButton.BeginInvoke((Action) delegate() { StartButton.Enabled = true; StartButton.Focus(); });
     StopButton.BeginInvoke((Action) delegate() { StopButton.Enabled = false; });
     numReplays.BeginInvoke((Action) delegate() { numReplays.Enabled = true; });
     InputRecordHotkey.BeginInvoke((Action) delegate() { InputRecordHotkey.Enabled = true; });
     InputStopHotkey.BeginInvoke((Action) delegate() { InputStopHotkey.Enabled = true; });
     menuStrip.BeginInvoke((Action) delegate() { menuStrip.Enabled = true; });
     SGSettings.BeginInvoke((Action) delegate() { SGSettings.Enabled = true; });
     BBTagSettings.BeginInvoke((Action) delegate() { BBTagSettings.Enabled = true; });
     GGXrdSettings.BeginInvoke((Action) delegate() { GGXrdSettings.Enabled = true; });
 }
Exemplo n.º 3
0
 private void ResetUI(object sender, EventArgs e)
 {
     this.BeginInvoke((Action) delegate() { this.Enabled = true; this.Focus(); });
     StartButton.BeginInvoke((Action) delegate() { StartButton.Enabled = true; StartButton.Focus(); });
     StopButton.BeginInvoke((Action) delegate() { StopButton.Enabled = false; });
     numReplays.BeginInvoke((Action) delegate() { numReplays.Enabled = true; });
     InputRecordHotkey.BeginInvoke((Action) delegate() { InputRecordHotkey.Enabled = true; });
     InputStopHotkey.BeginInvoke((Action) delegate() { InputStopHotkey.Enabled = true; });
     DisplayHitboxes.BeginInvoke((Action) delegate() { DisplayHitboxes.Enabled = true; });
     DisplayInputs.BeginInvoke((Action) delegate() { DisplayInputs.Enabled = true; });
     DisplayAttackData.BeginInvoke((Action) delegate() { DisplayAttackData.Enabled = true; });
     menuStrip.BeginInvoke((Action) delegate() { menuStrip.Enabled = true; });
 }