public void Dispose() { this.hole = null; this.index = null; this.reserved_00 = null; this.reserved_02 = null; this.id = null; }
public void UseIndexData(HeaderIndex hi) { if (hi.Parent == pkg.Header && Package != null) { hi.UseInParent(); ((HeaderData)hi.Parent).LockIndexDuringLoad = true; Package.Reload(); ((HeaderData)hi.Parent).LockIndexDuringLoad = false; } }
/// <summary> /// Constructor for the class /// </summary> internal HeaderData() { lidl = false; index = new HeaderIndex(this); hole = new HeaderHole(); id = new char[4]; reserved_00 = new Int32[3]; reserved_02 = new Int32[8]; id[0] = 'D'; id[1] = 'B'; id[2] = 'P'; id[3] = 'F'; majorversion = 1; minorversion = 1; index.Type = 7; indextype = Data.MetaData.IndexTypes.ptLongFileIndex; }
/// <summary> /// Returns the Offset of the ResourceIndex in the current package /// </summary> /// <returns></returns> public HeaderIndex FindIndexOffset() { HeaderIndex hi = new HeaderIndex(pkg.Header); if (pkg is File) { ((File)pkg).ReloadReader(); } BinaryReader br = pkg.Reader; int step = 0x18; if (pkg.Header.IndexType == SimPe.Data.MetaData.IndexTypes.ptShortFileIndex) { step = 0x14; } long pos = br.BaseStream.Length - (4 * step + 1); long lastitem = -1; long firstitem = -1; SimPe.WaitingScreen.Wait(); try { while (pos > 0x04) { WaitingScreen.UpdateMessage("0x" + Helper.HexString(pos) + " / 0x" + Helper.HexString(br.BaseStream.Length)); bool hit = CouldBeIndexItem(br, pos, step, lastitem == -1); if (hit && lastitem == -1) { lastitem = br.BaseStream.Position; } if (!hit && lastitem != -1) { firstitem = pos + step; break; } if (lastitem == -1) { pos--; } else { pos -= step; } } } finally { WaitingScreen.Stop(); } hi.offset = (uint)firstitem; hi.size = (int)(lastitem - firstitem); hi.count = hi.size / step; if (firstitem == -1) { hi = pkg.Header.Index as HeaderIndex; } return(hi); }