public void LoadPackages(string filename) { this.CurrentProgressString = "Beginning Operation"; this.PackageHeaders = new SortedDictionary <Idstring, PackageHeader>(); this.CurrentProgressString = "Loading Existing Hashes"; App.Instance.LoadHashlists(); this.CurrentProgressString = "Loading Database"; //Load Bundle Database this.BundleDB = new PackageDatabase(filename); this.CurrentProgressString = "Loading Hashlist"; General.LoadHashlist(this.WorkingDirectory, this.BundleDB); this.CurrentProgressString = "Registering File Entries"; Dictionary <uint, FileEntry> fileEntries = this.DatabaseEntryToFileEntry(this.BundleDB.GetDatabaseEntries()); this.CurrentProgressString = "Loading Packages"; List <string> files = Directory.EnumerateFiles(this.WorkingDirectory, "*.bundle").ToList(); for (int i = 0; i < files.Count; i++) { string file = files[i]; if (file.EndsWith("_h.bundle")) { continue; } PackageHeader bundle = new PackageHeader(); if (!bundle.Load(file)) { continue; } this.CurrentProgressString = String.Format("Loading Package {0}/{1}", i, files.Count); this.AddBundleEntriesToFileEntries(fileEntries, bundle.Entries); this.PackageHeaders.Add(bundle.Name, bundle); } this.CurrentProgressString = "Registring Folder Layout"; this.Root = new FolderItem(fileEntries) { Path = "assets", Name = "assets" }; foreach (FileEntry entry in fileEntries.Values) { this.RawFiles.Add(new Tuple <Idstring, Idstring, Idstring> (entry._path, entry._language, entry._extension), entry); } this.finishedLoad = true; HashIndex.Clear(); GC.Collect(); this.CurrentProgressString = "Finishing"; }
public void Start() { List <string> files; if (single_bundle != null) { files = new List <string> { Path.Combine(StaticStorage.settings.AssetsFolder, single_bundle) } } ; else { files = Directory.EnumerateFiles(StaticStorage.settings.AssetsFolder, "*.bundle").ToList(); } total_bundle = (uint)files.Count(); foreach (string file in files) { if (this.terminate) { break; } if (file.EndsWith("_h.bundle")) { continue; } PackageHeader bundle; string bundle_path = file.Replace(".bundle", ""); string bundle_id = Path.GetFileName(bundle_path); bundle = new PackageHeader(); TextWriteLine("Loading bundle header " + bundle_id); if (!bundle.Load(file)) { TextWriteLine("Failed to parse bundle header."); continue; } if (bundle.Entries.Count == 0) { continue; } current_bundle_name = bundle_id; current_bundle_progress = 0; current_bundle_total_progress = list && this.ListOutput.ListOptions.EntryInfo.Count == 0 ? 1 : bundle.Entries.Count; if (list) { ListBundle(bundle, bundle_id); } else { TextWriteLine("Extracting bundle: " + bundle_id); ExtractBundle(bundle, bundle_id); } current_bundle++; } if (ListOutput != null) { TextWriteLine("Writing List information to file"); ListOutput.Write(); ListOutput = null; } Finished = true; }