Пример #1
0
 // Token: 0x0600018F RID: 399 RVA: 0x0000935C File Offset: 0x0000755C
 public void method_54(byte[] byte_4)
 {
     if (!this.bool_2)
     {
         return;
     }
     try
     {
         object obj = this.object_0;
         ObjectFlowControl.CheckForSyncLockOnValueType(obj);
         lock (obj)
         {
             this.queue_0.Enqueue(byte_4);
             if (!this.bool_7)
             {
                 this.bool_7 = true;
                 this.method_55();
             }
         }
     }
     catch (Exception exception_)
     {
         Client.GDelegate9 gdelegate = this.gdelegate9_0;
         if (gdelegate != null)
         {
             gdelegate(this, exception_);
         }
         this.method_56();
     }
 }
Пример #2
0
 // Token: 0x06000188 RID: 392 RVA: 0x00008D88 File Offset: 0x00006F88
 private void method_47(IPAddress ipaddress_1, ushort ushort_1)
 {
     try
     {
         this.socket_0             = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
         this.socket_0.LingerState = new LingerOption(true, 0);
         this.socketAsyncEventArgs_2.RemoteEndPoint = new IPEndPoint(ipaddress_1, (int)ushort_1);
         if (Class0.smethod_0(ipaddress_1))
         {
             this.method_48(this.int_3);
         }
         else
         {
             this.method_48(this.int_4);
         }
         if (!this.socket_0.ConnectAsync(this.socketAsyncEventArgs_2))
         {
             this.method_52(this.socket_0, this.socketAsyncEventArgs_2);
         }
     }
     catch (Exception exception_)
     {
         Client.GDelegate9 gdelegate = this.gdelegate9_0;
         if (gdelegate != null)
         {
             gdelegate(this, exception_);
         }
         this.method_56();
     }
 }
Пример #3
0
 // Token: 0x0600018B RID: 395 RVA: 0x00008EB8 File Offset: 0x000070B8
 private void method_50(Socket socket_1)
 {
     try
     {
         this.socketAsyncEventArgs_2.Dispose();
         this.socketAsyncEventArgs_2 = null;
         this.ipendPoint_0           = (IPEndPoint)socket_1.RemoteEndPoint;
         this.bool_3 = false;
         this.bool_2 = true;
         if (this.method_37())
         {
             Client.GDelegate7 gdelegate = this.gdelegate7_0;
             if (gdelegate != null)
             {
                 gdelegate(this, true);
             }
             this.method_51();
         }
     }
     catch (Exception exception_)
     {
         Client.GDelegate9 gdelegate2 = this.gdelegate9_0;
         if (gdelegate2 != null)
         {
             gdelegate2(this, exception_);
         }
         this.method_56();
     }
 }
Пример #4
0
 // Token: 0x06000187 RID: 391 RVA: 0x00008CEC File Offset: 0x00006EEC
 private void method_46(string string_2, ushort ushort_1, IPAddress[] ipaddress_1)
 {
     try
     {
         if (this.socket_0 == null)
         {
             foreach (IPAddress ipaddress in ipaddress_1)
             {
                 if (ipaddress.AddressFamily == AddressFamily.InterNetwork)
                 {
                     Client.GDelegate6 gdelegate = this.gdelegate6_0;
                     if (gdelegate != null)
                     {
                         gdelegate(this, string_2, ipaddress);
                     }
                     this.method_47(ipaddress, ushort_1);
                     return;
                 }
             }
             throw new Exception("Unable to resolve remote host.");
         }
     }
     catch (Exception exception_)
     {
         Client.GDelegate9 gdelegate2 = this.gdelegate9_0;
         if (gdelegate2 != null)
         {
             gdelegate2(this, exception_);
         }
         this.method_56();
     }
 }
Пример #5
0
    // Token: 0x06000186 RID: 390 RVA: 0x00008C24 File Offset: 0x00006E24
    private void method_45(string string_2, ushort ushort_1)
    {
        try
        {
            IPAddress[] array = null;
            if (this.bool_5)
            {
                if (this.ipaddress_0 != null)
                {
                    if (this.ipaddress_0.Length != 0)
                    {
                        foreach (IPAddress ipaddress_ in this.ipaddress_0)
                        {
                            array = this.method_57(string_2, ipaddress_);
                            if (array.Length != 0)
                            {
                                break;
                            }
                        }
                        goto IL_55;
                    }
                }
                array = this.method_57(string_2, null);
IL_55:
                if (array.Length == 0)
                {
                    array = Dns.GetHostEntry(string_2).AddressList;
                }
            }
            else
            {
                array = Dns.GetHostEntry(string_2).AddressList;
            }
            this.method_46(string_2, ushort_1, array);
        }
        catch (Exception exception_)
        {
            Client.GDelegate9 gdelegate = this.gdelegate9_0;
            if (gdelegate != null)
            {
                gdelegate(this, exception_);
            }
            this.method_56();
        }
    }
Пример #6
0
 // Token: 0x06000185 RID: 389 RVA: 0x00008B78 File Offset: 0x00006D78
 public void method_44(string string_2, ushort ushort_1)
 {
     if (!this.bool_4)
     {
         return;
     }
     try
     {
         if (!this.method_36())
         {
             this.string_0 = string_2;
             this.ushort_0 = ushort_1;
             this.bool_3   = true;
             this.method_43();
             IPAddress none = IPAddress.None;
             if (IPAddress.TryParse(this.string_0, out none))
             {
                 this.method_47(none, this.ushort_0);
             }
             else
             {
                 ThreadPool.QueueUserWorkItem(delegate(object object_1)
                 {
                     delegate
                     {
                         this.method_45(this.string_0, this.ushort_0);
                     } ();
                 });
             }
         }
     }
     catch (Exception exception_)
     {
         Client.GDelegate9 gdelegate = this.gdelegate9_0;
         if (gdelegate != null)
         {
             gdelegate(this, exception_);
         }
         this.method_56();
     }
 }
Пример #7
0
 // Token: 0x0600018E RID: 398 RVA: 0x0000918C File Offset: 0x0000738C
 private void method_53(byte[] byte_4, int int_8, int int_9)
 {
     if (this.bool_0)
     {
         if (this.bool_6)
         {
             int num = Math.Min(this.byte_0.Length - this.int_5, int_9 - int_8);
             Buffer.BlockCopy(byte_4, int_8, this.byte_0, this.int_5, num);
             this.int_5 += num;
             if (this.int_5 == this.byte_0.Length)
             {
                 Client.GDelegate2 gdelegate = this.gdelegate2_0;
                 if (gdelegate != null)
                 {
                     gdelegate(this, this.byte_0);
                 }
                 this.bool_6 = false;
                 Array.Resize <byte>(ref this.byte_0, 0);
                 if (this.int_5 >= this.int_2)
                 {
                     GC.Collect();
                 }
             }
             if (num < int_9 - int_8)
             {
                 this.method_53(byte_4, int_8 + num, int_9);
             }
         }
         else
         {
             int num2 = Math.Min(int_9 - int_8, 4 - this.int_7);
             Buffer.BlockCopy(byte_4, int_8, this.byte_2, this.int_7, num2);
             int_8      += num2;
             this.int_7 += num2;
             if (this.int_7 == 4)
             {
                 int num3 = BitConverter.ToInt32(this.byte_2, 0);
                 if (num3 > this.int_1)
                 {
                     Client.GDelegate9 gdelegate2 = this.gdelegate9_0;
                     if (gdelegate2 != null)
                     {
                         gdelegate2(this, new Exception("Packet size exceeds MaxPacketSize."));
                     }
                     this.method_56();
                     return;
                 }
                 if (num3 <= 0)
                 {
                     Client.GDelegate9 gdelegate2 = this.gdelegate9_0;
                     if (gdelegate2 != null)
                     {
                         gdelegate2(this, new Exception("Packet size must be greater than 0."));
                     }
                     this.method_56();
                     return;
                 }
                 this.int_5  = 0;
                 this.int_7  = 0;
                 this.bool_6 = true;
                 Array.Resize <byte>(ref this.byte_0, num3);
                 if (int_8 < int_9)
                 {
                     this.method_53(byte_4, int_8, int_9);
                 }
             }
         }
     }
     else
     {
         Array.Resize <byte>(ref this.byte_0, int_9);
         Buffer.BlockCopy(byte_4, 0, this.byte_0, 0, int_9);
         Client.GDelegate2 gdelegate = this.gdelegate2_0;
         if (gdelegate != null)
         {
             gdelegate(this, this.byte_0);
         }
     }
 }
Пример #8
0
    // Token: 0x0600018D RID: 397 RVA: 0x00008F50 File Offset: 0x00007150
    private void method_52(object sender, SocketAsyncEventArgs e)
    {
        try
        {
            if (this.socket_0 != null)
            {
                if (this.socket_0 == sender)
                {
                    if (e.SocketError == SocketError.Success)
                    {
                        switch (e.LastOperation)
                        {
                        case SocketAsyncOperation.Connect:
                            this.method_50(this.socket_0);
                            break;

                        case SocketAsyncOperation.Receive:
                            if (e.BytesTransferred == 0)
                            {
                                this.method_56();
                            }
                            else
                            {
                                if (this.bool_1)
                                {
                                    Client.GDelegate8 gdelegate = this.gdelegate8_0;
                                    if (gdelegate != null)
                                    {
                                        gdelegate(this, e.BytesTransferred);
                                    }
                                }
                                this.method_53(e.Buffer, 0, e.BytesTransferred);
                                if (!this.socket_0.ReceiveAsync(e))
                                {
                                    this.method_52(this.socket_0, e);
                                }
                            }
                            break;

                        case SocketAsyncOperation.Send:
                        {
                            if (this.bool_0 && this.int_6 == 0)
                            {
                                this.int_6 = -4;
                            }
                            this.int_6 += e.BytesTransferred;
                            if (this.bool_1)
                            {
                                Client.GDelegate5 gdelegate2 = this.gdelegate5_0;
                                if (gdelegate2 != null)
                                {
                                    gdelegate2(this, e.BytesTransferred);
                                }
                            }
                            bool flag;
                            if (this.int_6 == this.byte_1.Length)
                            {
                                flag = true;
                                Client.GDelegate3 gdelegate3 = this.gdelegate3_0;
                                if (gdelegate3 != null)
                                {
                                    gdelegate3(this, this.byte_1.Length);
                                }
                            }
                            object obj = this.object_0;
                            ObjectFlowControl.CheckForSyncLockOnValueType(obj);
                            lock (obj)
                            {
                                if (this.queue_0.Count == 0 && flag)
                                {
                                    this.bool_7 = false;
                                    Array.Resize <byte>(ref this.byte_1, 0);
                                    if (this.int_6 >= this.int_2)
                                    {
                                        GC.Collect();
                                    }
                                    this.int_6 = 0;
                                }
                                else
                                {
                                    this.method_55();
                                }
                            }
                            break;
                        }
                        }
                    }
                    else
                    {
                        Client.GDelegate9 gdelegate4 = this.gdelegate9_0;
                        if (gdelegate4 != null)
                        {
                            gdelegate4(this, new SocketException((int)e.SocketError));
                        }
                        this.method_56();
                    }
                }
            }
        }
        catch (Exception exception_)
        {
            Client.GDelegate9 gdelegate4 = this.gdelegate9_0;
            if (gdelegate4 != null)
            {
                gdelegate4(this, exception_);
            }
            this.method_56();
        }
    }
Пример #9
0
 public void method_15(Client.GDelegate9 gdelegate9_1)
 {
     this.gdelegate9_0 = (Client.GDelegate9)Delegate.Remove(this.gdelegate9_0, gdelegate9_1);
 }
Пример #10
0
 public void method_14(Client.GDelegate9 gdelegate9_1)
 {
     this.gdelegate9_0 = (Client.GDelegate9)Delegate.Combine(this.gdelegate9_0, gdelegate9_1);
 }