/// <summary> /// Read the container header section. (The 'RIFF' or 'LIST' header.) /// This method verifies the header is well-formed and caches the /// container'stream FOURCC type. /// </summary> private void ReadRiffHeader() { try { RiffChunk header = new RiffChunk(); // Riff chunks must be WORD aligned if (!IsAligned(this.containerOffset, 2)) { //throw new InvalidOperationException("The chunk is not aligned"); } // Offset must be positive. if (this.containerOffset < 0) { //throw new InvalidOperationException("The container offset needs to be positive"); } // Seek to the start of the container. this.stream.Position = this.containerOffset; // Read the header header.FCC = (FourCC)this.br.ReadUInt32(); header.Size = this.br.ReadUInt32(); header.FCCList = (FourCC)this.br.ReadUInt32(); // Make sure the header ID matches what the caller expected. if (header.FCC != this.fccId) { // throw new InvalidOperationException("We don't have the right FourCC code"); } // The size given in the RIFF header does not include the 8-byte header. // However, our _containerOffset is the offset from the start of the // header. Therefore our container size = listed size + size of header. this.containerSize = header.Size + SizeOfRiffChunk; this.fccType = header.FCCList; this.currentChunkOffset = this.containerOffset + SizeOfRiffList; this.ReadChunkHeader(); } catch (Exception) {} }
private void ReadRiffHeader() { try { RiffChunk header = new RiffChunk(); if (!IsAligned(this.containerOffset, 2)) { } if (this.containerOffset < 0) { } this.stream.Position = this.containerOffset; header.FCC = (FourCC)this.br.ReadUInt32(); header.Size = this.br.ReadUInt32(); header.FCCList = (FourCC)this.br.ReadUInt32(); if (header.FCC != this.fccId) { } this.containerSize = header.Size + SizeOfRiffChunk; this.fccType = header.FCCList; this.currentChunkOffset = this.containerOffset + SizeOfRiffList; this.ReadChunkHeader(); } catch(Exception){} }
/// <summary> /// Read the container header section. (The 'RIFF' or 'LIST' header.) /// This method verifies the header is well-formed and caches the /// container'stream FOURCC type. /// </summary> private void ReadRiffHeader() { try { RiffChunk header = new RiffChunk(); // Riff chunks must be WORD aligned if (!IsAligned(this.containerOffset, 2)) { //throw new InvalidOperationException("The chunk is not aligned"); } // Offset must be positive. if (this.containerOffset < 0) { //throw new InvalidOperationException("The container offset needs to be positive"); } // Seek to the start of the container. this.stream.Position = this.containerOffset; // Read the header header.FCC = (FourCC)this.br.ReadUInt32(); header.Size = this.br.ReadUInt32(); header.FCCList = (FourCC)this.br.ReadUInt32(); // Make sure the header ID matches what the caller expected. if (header.FCC != this.fccId) { // throw new InvalidOperationException("We don't have the right FourCC code"); } // The size given in the RIFF header does not include the 8-byte header. // However, our _containerOffset is the offset from the start of the // header. Therefore our container size = listed size + size of header. this.containerSize = header.Size + SizeOfRiffChunk; this.fccType = header.FCCList; this.currentChunkOffset = this.containerOffset + SizeOfRiffList; this.ReadChunkHeader(); } catch(Exception){} }