Example #1
0
 public void AppendToStream(byte[] bts, Stream stream)
 {
     Offset = (int)stream.Position;
     byte[] comp = ZlibWrapper.Zlib(bts);
     Size     = comp.Length;
     RealSize = bts.Length;
     stream.Write(comp, 0, Size);
 }
Example #2
0
 public void SaveToStream(Stream input, Stream output)
 {
     if (!HasChanged || Created)
     {
         int    len   = Size == 0 ? RealSize : Size;
         byte[] bytes = new byte[len];
         input.Position = Offset;
         input.Read(bytes, 0, len);
         Offset = (int)output.Position;
         output.Write(bytes, 0, len);
     }
     else
     {
         var temp = ZlibWrapper.Zlib(newVal);
         Size   = temp.Length;
         Offset = (int)output.Position;
         output.Write(temp, 0, temp.Length);
     }
 }