/// <summary>
 /// Read a file from the package
 /// </summary>
 /// <param name="filenumber">The number of the file to read</param>
 /// <param name="file">The package file's IoBuffer</param>
 /// <returns></returns>
 public string Read(int filenumber, IoBuffer file)
 {
     // Read header
     int i = 1;
     string toReturn = "";
     DBPF dFile = new DBPF(filePath);
     DBPFEntry dEntry = new DBPFEntry();
     UInt32 lastPos = 0x00000000;
     file.Seek(SeekOrigin.Begin, 0);
     file.Skip(24);
     UInt32 numEntries = file.ReadUInt32();
     numFiles = (int) numEntries;
     //UInt32 indOffset = file.ReadUInt32();
     //file.Skip(16);
     file.Skip(20);
     UInt32 minVersion = file.ReadUInt32();
     //file.Seek(SeekOrigin.Begin, indOffset);            // Goto the start of the index
     file.Seek(SeekOrigin.Begin, 86);            // Goto the start of the index
     Byte[] fOffset;
     Byte[] fSize;
     while (i <= filenumber)
     {
         file.Seek(SeekOrigin.Begin, lastPos + 86);
         if ((int)minVersion == 1)
         {
             file.ReadBytes(11);
             fOffset = file.ReadBytes(2);
             String temp = BitConverter.ToString(fOffset).Replace("-", "");
             lastPos = lastPos + UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             dEntry.FileOffset = 0x00000066 + UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             //uifile1.FileOffset = fOffset;
             file.Seek(SeekOrigin.Current, -2);
             fSize = file.ReadBytes(3);
             temp = BitConverter.ToString(fSize).Replace("-", "");
             lastPos = lastPos + UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             //uifile1.FileSize = fSize;
             dEntry.FileSize = UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             //prevFileStop = BitConverter.ToInt64(fOffset, 0) + BitConverter.ToInt64(fSize, 0);
         }
         else
         {
             file.ReadBytes(16);
             fOffset = file.ReadBytes(2);
             String temp = BitConverter.ToString(fOffset).Replace("-", "");
             lastPos = lastPos + UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             dEntry.FileOffset = 0x00000066 + UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             //uifile1.FileOffset = fOffset;
             file.Seek(SeekOrigin.Current, -2);
             fSize = file.ReadBytes(3);
             temp = BitConverter.ToString(fSize).Replace("-", "");
             lastPos = lastPos + UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             //uifile1.FileSize = fSize;
             dEntry.FileSize = UInt32.Parse(temp, System.Globalization.NumberStyles.AllowHexSpecifier);
             //prevFileStop = BitConverter.ToInt64(fOffset, 0) + BitConverter.ToInt64(fSize, 0);
         }
         if (i != filenumber) i++;
         else break;
     }
     toReturn = Hex2Ascii(BitConverter.ToString(dFile.GetEntry(dEntry)).Replace("-", ""));
     return toReturn;
 }
 /// <summary>
 /// Read a file from the package
 /// </summary>
 /// <param name="fileSize">The size of the file</param>
 /// <param name="fileOffset">The offset of the file</param>
 /// <param name="file">The package file's IoBuffer</param>
 /// <returns></returns>
 public string Read(UInt32 fileSize, UInt32 fileOffset, IoBuffer file)
 {
     string toReturn = "";
     DBPF dFile = new DBPF(filePath);
     DBPFEntry dEntry = new DBPFEntry();
     file.Seek(SeekOrigin.Begin, 0);
     file.Skip(24);
     UInt32 numEntries = file.ReadUInt32();
     file.Skip(20);
     UInt32 minVersion = file.ReadUInt32();
     file.Seek(SeekOrigin.Begin, 86);            // Go to the start of the index
     dEntry.FileOffset = fileOffset;
     dEntry.FileSize = fileSize;
     toReturn = Hex2Ascii(BitConverter.ToString(dFile.GetEntry(dEntry)).Replace("-", ""));
     return toReturn;
 }