Example #1
0
 public void Test(uint fnumber)
 {
     this.Fnumber = fnumber;
     this.GetFilename(fnumber);
     this.Filehash    = Helpers.InvertUint32(Calculation.GetHash(this.Filename));
     this.PkgEntry    = this._pkgStream.PkgEntryList[(int)fnumber];
     this.PkgFileType = FileClassification.SetD2Filetype(this.PkgEntry);
     this.GetBlockEntries();
 }
Example #2
0
 public PkgFile(PkgStream pkgStream, uint fnumber)
 {
     this.Fnumber    = fnumber;
     this._pkgStream = pkgStream;
     this.GetPkgFile();
     this.GetFilename(fnumber);
     this.Filehash    = Helpers.InvertUint32(Calculation.GetHash(this.Filename));
     this.PkgEntry    = this._pkgStream.PkgEntryList[(int)fnumber];
     this.Nonce       = pkgStream.Nonce;
     this.PackageId   = pkgStream.Header.PackageId;
     this.LangId      = pkgStream.Header.LangId;
     this.PkgFileType = FileClassification.SetD2Filetype(this.PkgEntry);
     this.GetBlockEntries();
 }
Example #3
0
        public void StartProcess()
        {
            while (this._state != 0xA && this._state != -1)
            {
                try
                {
                    switch (this._state)
                    {
                    case 0:
                        this.GetPkgEntry();
                        this._state = 1;
                        break;

                    case 1:
                        this.PkgFileType = FileClassification.SetD2Filetype(this.PkgEntry);
                        this._state      = 2;
                        break;

                    case 2:
                        this.GetBlockEntries();
                        this._state = 3;
                        break;

                    case 3:
                        this.MakeNonce(this._pkgStream.Header.PackageId);
                        this._state = 4;
                        break;

                    case 4:
                        this.GetPackageId();
                        this._state = 5;
                        break;

                    case 5:
                        this.GetLangId();
                        this._state = 7;
                        break;

                    case 7:
                        this._state = 0xA;
                        break;
                    }
                }
                catch (Exception)
                {
                    this._state = -1;
                }
            }
        }
Example #4
0
 public void ReadEntries(Stream s)
 {
     s.Seek((long)((ulong)this.Entries.Offset), SeekOrigin.Begin);
     for (uint num = 0U; num < this.Entries.Size; num += 1U)
     {
         PkgEntry pkgEntry = default(PkgEntry);
         pkgEntry.EntryNumber      = num;
         pkgEntry.EntryA           = Helpers.ReadUInt(s);
         pkgEntry.TypeA            = Helpers.ReadUInt(s);
         pkgEntry.EntryB           = Helpers.ReadULong(s);
         pkgEntry.StartBlock       = (uint)(pkgEntry.EntryB & 0x3FFFUL);
         pkgEntry.StartBlockOffset = this.Blocks.Offset + pkgEntry.StartBlock * 0x30U;
         int          index        = this._pkgListEntries.FindIndex(new Predicate <PkgListEntry>(this.ReadEntries19));
         PkgListEntry pkgListEntry = this._pkgListEntries[index];
         BlockEntry   blockEntry   = this.BlockEntryList[(int)pkgEntry.StartBlock];
         pkgEntry.StartBlockPkg = string.Concat(new object[]
         {
             pkgListEntry.Basename,
             "_",
             blockEntry.PatchId,
             ".pkg"
         });
         pkgEntry.InBlockOffset = (uint)((pkgEntry.EntryB >> 0xE & 0x3FFFUL) * 0x10UL);
         pkgEntry.EntrySize     = (uint)(pkgEntry.EntryB >> 0x1C & 0x3FFFFFFFUL);
         pkgEntry.BlockCount    = this.CalcBlockCount(pkgEntry.InBlockOffset, pkgEntry.EntrySize);
         pkgEntry.UnkEntryInfo  = (uint)(pkgEntry.EntryB >> 0x3A & 0x3FUL);
         pkgEntry.Filename      = string.Concat(new string[]
         {
             this.Header.PackageId.ToString("X4"),
             "_",
             pkgEntry.EntryNumber.ToString("X4"),
             "_",
             this.Header.LangId.ToString("X2")
         });
         pkgEntry.FileType = FileClassification.FileClassify(pkgEntry.EntryA, pkgEntry.TypeA);
         this.PkgEntryList.Add(pkgEntry);
     }
 }