Beispiel #1
0
 public PkgFile(PkgStream pkgStream)
 {
     this._pkgStream = pkgStream;
     this.GetPkgFile();
     this.Nonce     = pkgStream.Nonce;
     this.PackageId = pkgStream.Header.PackageId;
     this.LangId    = pkgStream.Header.LangId;
 }
Beispiel #2
0
        public static PkgStream PkgStreamFromFile(string pkgFile)
        {
            PkgStream result;

            using (FileStream fileStream = File.OpenRead(pkgFile))
            {
                result = new PkgStream(fileStream);
                fileStream.Close();
            }
            return(result);
        }
        private List <PkgFile> GetD2Files(PkgStream pkgStream)
        {
            PkgText.GetFilesHelper0 getFilesHelper = new PkgText.GetFilesHelper0
            {
                PkgStream    = pkgStream,
                TextInstance = this
            };

            Parallel.ForEach <PkgEntry>(getFilesHelper.PkgStream.PkgEntryList, new Action <PkgEntry>(getFilesHelper.GetFiles0));
            return(this._d2Files);
        }
Beispiel #4
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();
 }
Beispiel #5
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);
                }
            }
Beispiel #6
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);
                }
            }
Beispiel #7
0
 internal void generateTranscriptDbb__3(PkgStream pkgStream)
 {
     foreach (PkgEntry pkgEntry in pkgStream.PkgEntryList)
     {
         if (pkgEntry.FileType == "Voice Lines Files")
         {
             List <VoiceEntryLtd> voiceEntriesLtd = new VoiceLines(pkgEntry.Filename).VoiceEntriesLtd;
             if (voiceEntriesLtd.Count > 0)
             {
                 List <List <VoiceEntryLtd> > allVoiceListLtdTmp = this.AllVoiceListLtdTmp;
                 lock (allVoiceListLtdTmp)
                 {
                     this.AllVoiceListLtdTmp.Add(voiceEntriesLtd);
                 }
             }
         }
     }
 }
 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;
                 }
             }
         }
     }
 }
Beispiel #9
0
 private void GetPkgStream()
 {
     this._pkgStream = PkgStream.PkgStreamFromFile(this.Pkg);
 }
 public PkgText(PkgStream pkgStreamInput)
 {
     this._d2Files = this.GetD2Files(pkgStreamInput);
 }
 public PkgExtract(PkgStream pkgStreamInput)
 {
     this._pkgStream = pkgStreamInput;
 }