public static void ToBinary( ChunkCompressedInfo info, byte[] buffer, int offset) { Array.Copy(BitConverter.GetBytes(info.size), 0, buffer, offset, 4); ChunkInfo.ToBinary(info.target, buffer, offset + 4); }
public static void ToBinary( ChunkDecompressionInfo info, byte[] buffer, int offset) { ChunkInfo.ToBinary(info.source, buffer, offset); ChunkInfo.ToBinary(info.target, buffer, offset + ChunkInfo.SIZE); }
public void ShouldSerializeDeserialize(long offset, int size) { var chunk = new ChunkInfo(offset, size); var buffer = new byte[ChunkInfo.SIZE]; ChunkInfo.ToBinary(chunk, buffer, 0); var result = ChunkInfo.FromBinary(buffer, 0); Assert.Equal(offset, result.offset); Assert.Equal(size, result.size); }