示例#1
0
        public static PkgFile Hash2File(string hashString)
        {
            Calculation.Hash2FileHelper0 hash2FileHelper = new Calculation.Hash2FileHelper0();
            hashString = hashString.Replace(" ", "");
            uint num = Helpers.InvertUint32(Convert.ToUInt32(hashString, 0x10));

            hash2FileHelper.PackageId = Calculation.CalcPackageId(num);
            Calculation.CalcFilenumber(num);
            List <PkgListEntry> list = Form1.RecvPkgListEntries();
            int num2 = list.FindIndex(new Predicate <PkgListEntry>(hash2FileHelper.Hash2File0));

            if (num2 == -1)
            {
                num = Helpers.InvertUint32(num);
                hash2FileHelper.PackageId = Calculation.CalcPackageId(num);
                num2 = list.FindIndex(new Predicate <PkgListEntry>(hash2FileHelper.Hash2File1));
            }
            PkgListEntry pkgListEntry = list[num2];
            string       text         = Form1.RecD2PkgDir();

            string.Concat(new string[]
            {
                text,
                pkgListEntry.Basename,
                "_",
                pkgListEntry.PatchId.ToString(""),
                ".pkg"
            });
            return(new PkgFile(num));
        }
示例#2
0
        private void GetPkgFile()
        {
            List <PkgListEntry> list  = Form1.RecvPkgListEntries();
            int          index        = list.FindIndex(new Predicate <PkgListEntry>(this.GetPkgFile21));
            PkgListEntry pkgListEntry = list[index];
            string       text         = Form1.RecD2PkgDir();

            this.Pkg = string.Concat(new string[]
            {
                text,
                pkgListEntry.Basename,
                "_",
                pkgListEntry.PatchId.ToString(""),
                ".pkg"
            });
        }
示例#3
0
            internal void generateTranscriptDbb__2(PkgListEntry pkgListEntry)
            {
                PkgStream item = PkgStream.PkgStreamFromFile(string.Concat(new string[]
                {
                    Form1.D2PkgDir,
                    pkgListEntry.Basename,
                    "_",
                    pkgListEntry.PatchId.ToString(""),
                    ".pkg"
                }));
                List <PkgStream> obj = this.PkgStreamList;

                lock (obj)
                {
                    this.PkgStreamList.Add(item);
                }
            }
示例#4
0
            internal void GenerateList0(PkgListEntry pkgListEntry)
            {
                PkgStream item = PkgStream.PkgStreamFromFile(string.Concat(new string[]
                {
                    this.D2PkgDir,
                    pkgListEntry.Basename,
                    "_",
                    pkgListEntry.PatchId.ToString(""),
                    ".pkg"
                }));
                List <PkgStream> list = this.PkgStreamList;
                List <PkgStream> obj  = list;

                lock (obj)
                {
                    list.Add(item);
                }
            }
示例#5
0
        private void GetPkgFile(uint filehashIn)
        {
            PkgFile.GetPkgFileHelper0 getPkgFileHelper = new PkgFile.GetPkgFileHelper0
            {
                PackageId = Calculation.CalcPackageId(filehashIn)
            };
            List <PkgListEntry> list  = Form1.RecvPkgListEntries();
            int          index        = list.FindIndex(new Predicate <PkgListEntry>(getPkgFileHelper.GetPkgFile0));
            PkgListEntry pkgListEntry = list[index];
            string       text         = Form1.RecD2PkgDir();

            this.Pkg = string.Concat(new string[]
            {
                text,
                pkgListEntry.Basename,
                "_",
                pkgListEntry.PatchId.ToString(""),
                ".pkg"
            });
        }
示例#6
0
 public void GenerateList()
 {
     foreach (string path in Directory.GetFiles(Form1.RecD2PkgDir(), "*.pkg"))
     {
         using (FileStream fileStream = File.OpenRead(path))
         {
             PkgList.GenerateListHelper2 generateListHelper = new PkgList.GenerateListHelper2();
             PkgStream pkgStream = new PkgStream(fileStream);
             generateListHelper.PkgListEntry           = default(PkgListEntry);
             generateListHelper.PkgListEntry.PackageId = pkgStream.Header.PackageId;
             generateListHelper.PkgListEntry.PatchId   = pkgStream.Header.PatchId;
             generateListHelper.PkgListEntry.LangId    = pkgStream.Header.LangId;
             string[] array = Path.GetFileNameWithoutExtension(path).Split(new char[]
             {
                 '_'
             });
             string[] array2 = new string[array.Length - 1];
             Array.Copy(array, array2, array2.Length);
             generateListHelper.PkgListEntry.Basename = string.Join("_", array2);
             PkgListEntry pkgListEntry = this.PkgListEntryList.Find(new Predicate <PkgListEntry>(generateListHelper.GenerateList0));
             bool         flag         = pkgListEntry.Equals(default(PkgListEntry));
             if (flag)
             {
                 this.PkgListEntryList.Add(generateListHelper.PkgListEntry);
             }
             else
             {
                 bool flag2 = pkgListEntry.PatchId < generateListHelper.PkgListEntry.PatchId;
                 if (flag2)
                 {
                     pkgListEntry.PackageId = generateListHelper.PkgListEntry.PackageId;
                     pkgListEntry.PatchId   = generateListHelper.PkgListEntry.PatchId;
                     pkgListEntry.LangId    = generateListHelper.PkgListEntry.LangId;
                     pkgListEntry.Basename  = generateListHelper.PkgListEntry.Basename;
                     int index = this.PkgListEntryList.FindIndex(new Predicate <PkgListEntry>(generateListHelper.GenerateList1));
                     this.PkgListEntryList[index] = pkgListEntry;
                 }
             }
         }
     }
 }
示例#7
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);
     }
 }
示例#8
0
        public static PkgFile Hash2File(uint hash)
        {
            Calculation.HashToFileHelper1 hashToFileHelper = new Calculation.HashToFileHelper1
            {
                PackageId = Calculation.CalcPackageId(hash)
            };
            bool flag = hashToFileHelper.PackageId == 0x513U;

            if (flag)
            {
                hashToFileHelper.PackageId = 0x913U;
            }
            Calculation.CalcFilenumber(hash);
            List <PkgListEntry> list = Form1.RecvPkgListEntries();
            int  num   = list.FindIndex(new Predicate <PkgListEntry>(hashToFileHelper.HashToFile0));
            bool flag2 = num == -1;

            if (flag2)
            {
                hash = Helpers.InvertUint32(hash);
                hashToFileHelper.PackageId = Calculation.CalcPackageId(hash);
                num = list.FindIndex(new Predicate <PkgListEntry>(hashToFileHelper.Hash2File1));
            }
            PkgListEntry pkgListEntry = list[num];
            string       text         = Form1.RecD2PkgDir();

            string.Concat(new string[]
            {
                text,
                pkgListEntry.Basename,
                "_",
                pkgListEntry.PatchId.ToString(""),
                ".pkg"
            });
            return(new PkgFile(hash));
        }
示例#9
0
 internal bool GenerateList1(PkgListEntry c)
 {
     return(c.PackageId == this.PkgListEntry.PackageId && c.LangId == this.PkgListEntry.LangId);
 }
示例#10
0
 internal bool GetPkgFile0(PkgListEntry c)
 {
     return(c.PackageId == this.PackageId && (c.LangId == 0 || c.LangId == 1));
 }
示例#11
0
 private bool GetPkgFile21(PkgListEntry c)
 {
     return(c.PackageId == this._pkgStream.Header.PackageId && c.LangId == this._pkgStream.Header.LangId);
 }
示例#12
0
 private bool ReadEntries19(PkgListEntry c)
 {
     return(c.PackageId == this.Header.PackageId && c.LangId == this.Header.LangId);
 }
示例#13
0
 internal bool Hash2File1(PkgListEntry c)
 {
     return(c.PackageId == this.PackageId && (c.LangId == 0 || c.LangId == 1));
 }