Exemplo n.º 1
0
 private void timer_0_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (Interlocked.Exchange(ref int_1, 1) == 0)
     {
         try
         {
             if (tcpClient_0.Available > 0 && networkStream_0.CanRead)
             {
                 byte[] array = new byte[8192];
                 int    num   = networkStream_0.Read(array, 0, array.Length);
                 if (num != 0)
                 {
                     byte[] bytes = array.Take(num).ToArray();
                     if (arc4_1 != null)
                     {
                         arc4_1.decrypt(bytes);
                     }
                     OnRecieved onRecieved = onRecieved_0;
                     if (onRecieved != null)
                     {
                         onRecieved(bytes);
                     }
                 }
             }
         }
         catch
         {
         }
         finally
         {
             Interlocked.Exchange(ref int_1, 0);
         }
     }
 }
Exemplo n.º 2
0
 public byte[] recive()
 {
     try
     {
         if (client.Available > 0)
         {
             if (networkStream_0.CanRead)
             {
                 byte[] array = new byte[16384];
                 int    num   = networkStream_0.Read(array, 0, array.Length);
                 if (num != 0)
                 {
                     Thread.Sleep(100);
                     byte[] array2 = array.Take(num).ToArray();
                     if (arc4_1 != null)
                     {
                         arc4_1.decrypt(array2);
                     }
                     return(array2);
                 }
                 return(null);
             }
             return(null);
         }
         return(null);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 3
0
 public byte[] recive()
 {
     try
     {
         if (!client.Connected && !client.IsOnline())
         {
             throw new Exception("tcp close");
         }
         if (client.Available > 0)
         {
             if (networkStream_0.CanRead)
             {
                 byte[] array = new byte[16384];
                 int    num   = networkStream_0.Read(array, 0, array.Length);
                 Thread.Sleep(50);
                 if (num != 0)
                 {
                     byte[] array2 = array.Take(num).ToArray();
                     if (arc4_1 != null)
                     {
                         arc4_1.decrypt(array2);
                     }
                     return(array2);
                 }
                 return(null);
             }
             return(null);
         }
         return(null);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 4
0
 private void method_5(SocketAsyncEventArgs socketAsyncEventArgs_2)
 {
     if (socketAsyncEventArgs_2.SocketError == SocketError.Success)
     {
         if (socketAsyncEventArgs_2.BytesTransferred > 0)
         {
             Socket obj = (Socket)socketAsyncEventArgs_2.UserToken;
             if (obj.Available == 0)
             {
                 byte[] array = new byte[socketAsyncEventArgs_2.BytesTransferred];
                 Array.Copy(socketAsyncEventArgs_2.Buffer, socketAsyncEventArgs_2.Offset, array, 0, array.Length);
                 if (arc4_1 != null)
                 {
                     arc4_1.decrypt(array);
                 }
                 OnRecieved onRecieved = onRecieved_0;
                 if (onRecieved != null)
                 {
                     onRecieved.BeginInvoke(array, null, null);
                 }
             }
             if (!obj.ReceiveAsync(socketAsyncEventArgs_2))
             {
                 method_5(socketAsyncEventArgs_2);
             }
         }
         else
         {
             method_6();
         }
     }
 }
Exemplo n.º 5
0
 private void method_3(SocketAsyncEventArgs socketAsyncEventArgs_0)
 {
     try
     {
         Socket socket = (Socket)socketAsyncEventArgs_0.UserToken;
         if (socketAsyncEventArgs_0.SocketError == SocketError.Success && socketAsyncEventArgs_0.BytesTransferred > 0)
         {
             byte[] array = new byte[socketAsyncEventArgs_0.BytesTransferred];
             Array.Copy(socketAsyncEventArgs_0.Buffer, socketAsyncEventArgs_0.Offset, array, 0, socketAsyncEventArgs_0.BytesTransferred);
             if (arc4_1 != null)
             {
                 arc4_1.decrypt(array);
             }
             lock (list_0)
             {
                 list_0.AddRange(array);
             }
             do
             {
                 int num = BitConverter.ToInt32(list_0.GetRange(0, 4).ToArray(), 0);
                 if (num > list_0.Count)
                 {
                     break;
                 }
                 byte[] data = list_0.GetRange(0, num).ToArray();
                 lock (list_0)
                 {
                     list_0.RemoveRange(0, num);
                 }
                 if (onRecive_0 != null)
                 {
                     onRecive_0(data);
                 }
                 data = null;
             }while (list_0.Count > 4);
             array = null;
             if (!socket.ReceiveAsync(socketAsyncEventArgs_0))
             {
                 method_3(socketAsyncEventArgs_0);
             }
         }
         else
         {
             method_4();
         }
     }
     catch
     {
     }
 }