コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }
        }