public int Open(string filename) { _stream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); var br = new BigEndianBinaryReader(_stream); Header.Read(br); /* _stream.Position = 204410912; * var br1 = new BinaryReader(_stream); * int tocSize = 12320; * * byte[] tocData1 = br.ReadBytes(tocSize); * System.IO.File.WriteAllBytes(@"C:\Users\Dageron\Desktop\test0.bin", tocData1); * * _stream.Position = 204410912; * byte[] tocData2 = br.ReadBytes(tocSize); * * tocData2 = DataUtil.Decrypt(tocData2); * System.IO.File.WriteAllBytes(@"C:\Users\Dageron\Desktop\test1.bin", tocData2); */ if (!Enum.IsDefined(typeof(HeaderIDs), (int)Header.Identifier)) { _stream.Close(); return(0); } _stream.Seek(0x10, SeekOrigin.Begin); TOC.Read(br); return(Header.EntryCount); }
public int Open(string filename) { _stream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); var br = new BigEndianBinaryReader(_stream); Header.Read(br); if (!Enum.IsDefined(typeof(HeaderIDs), (int)Header.Identifier)) { _stream.Close(); return(0); } _stream.Seek(0x10, SeekOrigin.Begin); TOC.Read(br); return(Header.EntryCount); }