Exemplo n.º 1
0
 public void method_2(GClass91.GClass92.GDelegate7 gdelegate7_1)
 {
     GClass91.GClass92.GDelegate7 gdelegate = this.gdelegate7_0;
     GClass91.GClass92.GDelegate7 gdelegate2;
     do
     {
         gdelegate2 = gdelegate;
         GClass91.GClass92.GDelegate7 value = (GClass91.GClass92.GDelegate7)Delegate.Remove(gdelegate2, gdelegate7_1);
         gdelegate = Interlocked.CompareExchange <GClass91.GClass92.GDelegate7>(ref this.gdelegate7_0, value, gdelegate2);
     }while (gdelegate != gdelegate2);
 }
Exemplo n.º 2
0
    private void method_7()
    {
        try
        {
            TcpClient tcpClient = this.method_3();
            if (tcpClient == null || tcpClient.Client == null)
            {
                return;
            }
            GClass91.GClass92.GDelegate5 connected = this.Connected;
            if (connected != null)
            {
                connected(this);
            }
            if (tcpClient == null || !tcpClient.Connected)
            {
                GClass91.GClass92.GDelegate6 disconnected = this.Disconnected;
                if (disconnected != null)
                {
                    disconnected(this, ErrorReason.ConnectionLost, null);
                }
                return;
            }
            NetworkStream stream = tcpClient.GetStream();
            byte[]        array  = new byte[4096];
            using (MemoryStream memoryStream = new MemoryStream(array))
            {
                using (BinaryStream binaryStream = memoryStream.smethod_2(true))
                {
                    for (;;)
                    {
                        TcpClient tcpClient2 = this.method_3();
                        if (tcpClient2 == null)
                        {
                            goto IL_120;
                        }
                        bool flag = tcpClient2.Connected;
IL_70:
                        if (!flag)
                        {
                            break;
                        }
                        try
                        {
                            memoryStream.Position = 0L;
                            int num = stream.Read(array, (int)memoryStream.Position, (int)(4096L - memoryStream.Position));
                            if (num == 0)
                            {
                                GClass91.GClass92.GDelegate6 disconnected2 = this.Disconnected;
                                if (disconnected2 != null)
                                {
                                    disconnected2(this, ErrorReason.ConnectionLost, new Exception("Socket has been closed"));
                                }
                                return;
                            }
                            Stream stream2 = binaryStream;
                            memoryStream.Position = 0L;
                            stream2.Position      = 0L;
                            GClass91.GClass92.GDelegate7 gdelegate = this.gdelegate7_0;
                            if (gdelegate != null)
                            {
                                gdelegate(this, binaryStream, array, num);
                            }
                            continue;
                        }
                        catch (Exception exception)
                        {
                            GClass91.GClass92.GDelegate6 disconnected3 = this.Disconnected;
                            if (disconnected3 != null)
                            {
                                disconnected3(this, ErrorReason.ConnectionLost, exception);
                            }
                            return;
                        }
IL_120:
                        flag = false;
                        goto IL_70;
                    }
                }
            }
        }
        catch
        {
        }
        GClass91.GClass92.GDelegate6 disconnected4 = this.Disconnected;
        if (disconnected4 == null)
        {
            return;
        }
        disconnected4(this, ErrorReason.ConnectionLost, null);
    }