/// <summary> /// Creates a new instance of the VPKIndexEntry class from the provided /// DirectoryEntry and VPK filespec. /// </summary> /// <param name="Entry">The entry to create index information from.</param> /// <param name="VPK">The path to the VPK file that contains this entry.</param> internal VPKIndexEntry(DirectoryEntry Entry, string VPK) { FileName = Entry.FileName; FileOffset = (int)Entry.FileOffset; FileLength = Entry.FileLength; VPKPath = VPK; }
/// <summary> /// Reads the contents of the file inside the VPK and returns then in a byte array. /// </summary> /// <param name="entry">Entry that specifies the file details.</param> /// <param name="VPKReader">BinaryReader stream to read from.</param> /// <returns></returns> private byte[] readContents(DirectoryEntry entry, BinaryReader VPKReader) { VPKReader.BaseStream.Seek(entry.FileOffset, SeekOrigin.Begin); byte[] contents = VPKReader.ReadBytes(entry.FileLength); return contents; }