public static void WriteDontCareChunk(Stream output, uint blockLength) { ChunkHeader chunkHeader = new ChunkHeader(); chunkHeader.ChunkType = ChunkType.DontCare; chunkHeader.ChunkSize = blockLength; chunkHeader.TotalSize = ChunkHeader.Length; chunkHeader.WriteBytes(output); }
public static void WriteFillChunk(Stream output, byte[] fill, uint blockCount) { ChunkHeader chunkHeader = new ChunkHeader(); chunkHeader.ChunkType = ChunkType.Fill; chunkHeader.ChunkSize = blockCount; chunkHeader.TotalSize = ChunkHeader.Length + 4; chunkHeader.WriteBytes(output); ByteWriter.WriteBytes(output, fill); }
public static void WriteRawChunk(Stream output, Stream rawChunk) { ChunkHeader chunkHeader = new ChunkHeader(); chunkHeader.ChunkType = ChunkType.Raw; chunkHeader.ChunkSize = (uint)(rawChunk.Length / BlockSize); chunkHeader.TotalSize = ChunkHeader.Length + (uint)rawChunk.Length; chunkHeader.WriteBytes(output); rawChunk.Seek(0, SeekOrigin.Begin); long blockCount = rawChunk.Length / BlockSize; for (long blockIndex = 0; blockIndex < blockCount; blockIndex++) { byte[] block = new byte[BlockSize]; rawChunk.Read(block, 0, BlockSize); ByteWriter.WriteBytes(output, block); } }