Пример #1
0
 public byte[] Read()
 {
     byte[] buffer;
     try
     {
         int count = StreamFrom.Read(bufferRead, 0, bufferRead.Length);
         if (count == 0)
         {
             return(null);
         }
         else
         {
             if (userFrom != null)
             {
                 Conf.Users[userFrom].CheckSpeed(count);
             }
         }
         buffer = new byte[count];
         Array.Copy(bufferRead, buffer, count);
         if (EncryptFrom)
         {
             buffer = Decrypt(buffer);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         StreamFrom.Close();
         clientFrom.Close();
         return(null);
     }
     return(buffer);
 }
Пример #2
0
 public byte[] Read()
 {
     byte[] buffer;
     try
     {
         int count = StreamFrom.Read(bufferRead, 0, bufferRead.Length);
         if (count == 0)
         {
             return(null);
         }
         buffer = new byte[count];
         Array.Copy(bufferRead, buffer, count);
         if (EncryptFrom)
         {
             buffer = Decrypt(buffer);
         }
     }
     catch
     {
         StreamFrom.Close();
         clientFrom.Close();
         return(null);
     }
     return(buffer);
 }