コード例 #1
0
 public PacketLogWriter(Stream stream, bool ownsStream, LogHeader header)
 {
     _stream     = stream;
     _ownsStream = ownsStream;
     StreamHelper.WriteBlock(_stream, BlockType.MagicBytes,
                             new ArraySegment <byte>(LogHelper.Encoding.GetBytes(LogHelper.MagicBytes)));
     StreamHelper.WriteBlock(_stream, BlockType.Region,
                             new ArraySegment <byte>(Encoding.UTF8.GetBytes(header.Region)));
     StreamHelper.WriteBlock(_stream, BlockType.Start, new ArraySegment <byte>(new byte[0]));
 }
コード例 #2
0
 public PacketLogWriter(string filename, LogHeader header)
     : this(new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read), true, header)
 {
 }
コード例 #3
0
 internal PacketLogReader(Stream stream)
 {
     _stream = stream;
     Header  = new LogHeader();
     ReadHeader();
 }