Example #1
0
 private void method_12(GClass91 gclass91_1)
 {
     this.bool_1 = false;
     if (!ConnectionManager.Instance.IsValueCreated)
     {
         ConnectionManager.Instance.Value = this.Connection;
     }
     if (!GameManager.Instance.IsValueCreated)
     {
         ThreadLocal <GameManager> instance   = GameManager.Instance;
         ConnectionManager         connection = this.Connection;
         instance.Value = ((connection != null) ? connection.Game : null);
     }
     GClass91.GClass92.GDelegate5 connected = this.Connected;
     if (connected == null)
     {
         return;
     }
     connected(gclass91_1);
 }
Example #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);
    }