public static void DataBoxTest(Type element, string testFileName) { FileInfo boxTestFile = new FileInfo(Path.Combine(GetTestDir(), testFileName)); int dataSize = (int)boxTestFile.Length; DataBox boxTest = new DataBox(dataSize); FileStream fs = boxTestFile.Open(FileMode.Open); BinaryReader br = new BinaryReader(fs); byte[] inData = br.ReadBytes(dataSize); br.BaseStream.Seek(0, SeekOrigin.Begin); boxTest.Read(br); br.Close(); fs.Close(); byte[] outData = new byte[dataSize]; MemoryStream ms = new MemoryStream(outData); BinaryWriter bw = new BinaryWriter(ms); boxTest.Write(bw); bw.Close(); ms.Close(); Debug.Assert(inData.SequenceEqual(outData), "Input/output replication test failed for " + element.ToString()); }
public bool Write(BinaryWriter bw) { fileNumber.Write(bw); bw.Write(sequentialChoiceNumber); bw.Write(unknown1); offset = HandleOffsetOnWrite(offset); bw.Write(offset); bw.Write(unknown2); bw.Write(unknown3); bw.Write(lookupCode); bw.Write(unknown4); bw.Write(unknown5); trailingBlock.Write(bw); return(true); }
public bool Write(BinaryWriter bw) { footerContents.Write(bw); return(true); }
public bool Write(BinaryWriter bw) { bw.Write((short)opcode); box1.Write(bw); return(true); }
public bool Write(BinaryWriter bw) { bw.Write(fileNumber); box1.Write(bw); return(true); }