private void OpenDBPF(string Path) { BinaryReader Reader = new BinaryReader(File.Open(Path, FileMode.Open)); string Header = Encoding.ASCII.GetString(Reader.ReadBytes(4)); uint MajVersion = Reader.ReadUInt32(); uint MinVersion = Reader.ReadUInt32(); Reader.ReadBytes(12); //Reserved uint DateCreated = Reader.ReadUInt32(); uint DateModified = Reader.ReadUInt32(); uint IndexMaj = Reader.ReadUInt32(); uint IndexEntryCount = Reader.ReadUInt32(); uint FirstEntryOffset = Reader.ReadUInt32(); uint IndexSize = Reader.ReadUInt32(); uint HoleEntryCount = Reader.ReadUInt32(); uint HoleOffset = Reader.ReadUInt32(); uint HoleSize = Reader.ReadUInt32(); //Size of all Holes in archive? uint IndexMin = Reader.ReadUInt32(); LstFiles.Items.Clear(); LstFiles.Items.Add("Number of files: " + IndexEntryCount.ToString()); LstFiles.Items.Add(""); Reader.BaseStream.Seek(FirstEntryOffset, SeekOrigin.Begin); for (int i = 0; i < IndexEntryCount; i++) { DBPFEntry Entry = new DBPFEntry(); Entry.TypeID = Reader.ReadUInt32(); Entry.GroupID = Reader.ReadUInt32(); Entry.InstanceID = Reader.ReadUInt32(); if (IndexMaj == 7 && IndexMin == 1) { Entry.InstanceID2 = Reader.ReadUInt32(); } Entry.DataOffset = Reader.ReadUInt32(); Entry.DataSize = Reader.ReadUInt32(); m_DBPFEntries.Add(Entry); } Reader.Close(); }
private void OpenDBPF(string Path) { BinaryReader Reader = new BinaryReader(File.Open(Path, FileMode.Open)); string Header = Encoding.ASCII.GetString(Reader.ReadBytes(4)); uint MajVersion = Reader.ReadUInt32(); uint MinVersion = Reader.ReadUInt32(); Reader.ReadBytes(12); //Reserved uint DateCreated = Reader.ReadUInt32(); uint DateModified = Reader.ReadUInt32(); uint IndexMaj = Reader.ReadUInt32(); uint IndexEntryCount = Reader.ReadUInt32(); uint FirstEntryOffset = Reader.ReadUInt32(); uint IndexSize = Reader.ReadUInt32(); uint HoleEntryCount = Reader.ReadUInt32(); uint HoleOffset = Reader.ReadUInt32(); uint HoleSize = Reader.ReadUInt32(); //Size of all Holes in archive? uint IndexMin = Reader.ReadUInt32(); LstFiles.Items.Clear(); LstFiles.Items.Add("Number of files: " + IndexEntryCount.ToString()); LstFiles.Items.Add(""); Reader.BaseStream.Seek(FirstEntryOffset, SeekOrigin.Begin); for (int i = 0; i < IndexEntryCount; i++) { DBPFEntry Entry = new DBPFEntry(); Entry.TypeID = Reader.ReadUInt32(); Entry.GroupID = Reader.ReadUInt32(); Entry.InstanceID = Reader.ReadUInt32(); if(IndexMaj == 7 && IndexMin == 1) Entry.InstanceID2 = Reader.ReadUInt32(); Entry.DataOffset = Reader.ReadUInt32(); Entry.DataSize = Reader.ReadUInt32(); m_DBPFEntries.Add(Entry); } Reader.Close(); }