public override void Read(BinaryReader br, int len, int[] blockSizes = null) { Byte[] ba = new byte[len]; br.Read(ba, 0, len); if (ba.Length > 8) { MemoryStream ms = new MemoryStream(ba); BinaryReader br1 = new BinaryReader(ms); this.subList = RiffConn.ReadRiff(this.Parent, br1, blockSizes); br1.Close(); ms.Close(); } else { this.content = ba; } }
public override void Read(BinaryReader br, int len, int[] bs = null) { if (this.Type != RiffType.LIST) { base.Read(br, len); } int zdataLen, dataLen, zblkLen, blocksLen4; zdataLen = br.ReadInt32(); dataLen = br.ReadInt32(); zblkLen = br.ReadInt32(); blocksLen4 = br.ReadInt32(); br.ReadInt64(); byte[] zdata = new byte[zdataLen - 8]; byte[] zblk = new byte[zblkLen - 8]; br.Read(zdata, 0, zdataLen - 8); br.ReadInt64(); br.Read(zblk, 0, zblkLen - 8); byte[] data = ZLibCompressor.DeCompress(zdata); //Zlib.deCompressBytes(zdata); byte[] blocks = ZLibCompressor.DeCompress(zblk); // Zlib.deCompressBytes(zblk); //byte[] data = ZLibNet.ZLibCompressor.DeCompress(zdata); //byte[] blocks = ZLibNet.ZLibCompressor.DeCompress(zblk); FileStream fs = File.Open("D:\\blocks", FileMode.Create); fs.Write(blocks, 0, blocks.Length); fs.Close(); fs = File.Open("D:\\data", FileMode.Create); fs.Write(data, 0, data.Length); fs.Close(); int[] blockSizes = new int[blocks.Length / 4]; for (int i = 0, j = 0; i < blocks.Length; i += 4, j++) { blockSizes[j] = BitConverter.ToInt32(blocks, i); } MemoryStream ms = new MemoryStream(data); BinaryReader br1 = new BinaryReader(ms); subList = RiffConn.ReadRiff(this.Parent, br1, blockSizes); br1.Close(); ms.Close(); }
public void Read() { CDRFile.verType = RiffParser.FromFourCC(m_parser.FileType); int length = Parser.DataSize; FileStream fs = Parser.Stream; BinaryReader br = new BinaryReader(fs); try { this.m_cdrFile.list = RiffConn.ReadRiff(this.m_cdrFile, br, m_parser.DataSize - 4); } catch { } finally { br.Close(); fs.Close(); } }