Ejemplo n.º 1
0
 /// <summary>
 /// 流转化为字节数组
 /// </summary>
 /// <param name="theStream">流</param>
 /// <returns>字节数组</returns>
 public byte[] ConvertStreamToByteBuffer(System.IO.Stream theStream)
 {
     int bi;
     MemoryStream tempStream = new System.IO.MemoryStream();
     try
     {
         while ((bi = theStream.ReadByte()) != -1)
         {
             tempStream.WriteByte(((byte)bi));
         }
         return tempStream.ToArray();
     }
     catch
     {
         return new byte[0];
     }
     finally
     {
         tempStream.Close();
     }
 }
Ejemplo n.º 2
0
 public void Load(System.IO.BinaryReader reader)
 {
     this.Type = (Types)reader.ReadByte();
     this.DateTime = ReadDateTime(reader);
     this.Message = reader.ReadString();
 }