/// <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(); } }
public void Load(System.IO.BinaryReader reader) { this.Type = (Types)reader.ReadByte(); this.DateTime = ReadDateTime(reader); this.Message = reader.ReadString(); }