public void execute(PackageBrowser browser) { hashlist_tag = _hashlist_tag + Directory.EnumerateFiles(Definitions.HashDir, _hashlist_tag + "*").ToList().Count; error_output = new StreamWriter(hashlist_tag + ".log"); System.Diagnostics.Stopwatch clock = new System.Diagnostics.Stopwatch(); clock.Start(); error_output.Write("Hashlist Scraper executed" + "\n"); error_output.Flush(); HashIndex.Load(Path.Combine(Definitions.HashDir, "others"), null, true); foreach (string file in Directory.EnumerateFiles(Path.Combine(Definitions.HashDir, Definitions.AddedHashDir))) { HashIndex.Load(file, HashIndex.HashType.Others, true); } foreach (KeyValuePair <Tuple <Idstring, Idstring, Idstring>, FileEntry> entry in browser.RawFiles) { this.ProcessFile(entry.Value); } //this.ProcessFolder(browser.Root); //Path.Combine(Definitions.HashDir, hashlist_tag) HashIndex.GenerateHashList(Path.Combine(Definitions.HashDir, "paths"), "paths"); HashIndex.GenerateHashList(Path.Combine(Definitions.HashDir, "others"), "others"); HashIndex.temp = new Dictionary <ulong, Idstring>(); clock.Stop(); error_output.Write("Scrape operation took {0} seconds" + "\n", clock.Elapsed.TotalSeconds.ToString()); error_output.Close(); }
public static void LoadHashlist(string workingPath, PackageDatabase bundleDB) { string hashlistPath = Path.Combine(workingPath, HashlistFile); if (File.Exists(hashlistPath)) { string gameverPath; if (File.Exists(gameverPath = Path.GetFullPath(Path.Combine(workingPath, "../game.ver")))) { string ver = File.ReadAllText(gameverPath); HashIndex.version = ver; if (!ver.Equals(HashlistVersion(hashlistPath))) { File.Delete(hashlistPath); } } else { Console.WriteLine("game.ver could not be found, the Hashlist will not automatically update without this!"); } if (File.Exists(hashlistPath)) { HashIndex.Load(hashlistPath); } } if (!File.Exists(hashlistPath)) { GenerateHashlist(workingPath, bundleDB); } }
public void execute() { var window = Utils.CurrentWindow; hashlist_tag = _hashlist_tag + Directory.EnumerateFiles(Definitions.DataDir, _hashlist_tag + "*").ToList().Count; error_output = new StreamWriter(hashlist_tag + ".log"); System.Diagnostics.Stopwatch clock = new System.Diagnostics.Stopwatch(); clock.Start(); error_output.Write("Hashlist Scraper executed" + "\n"); error_output.Flush(); HashIndex.Load(Path.Combine(Definitions.DataDir, "others"), null, true); foreach (string file in Directory.EnumerateFiles(Definitions.DataDir)) { HashIndex.Load(file, HashIndex.HashType.Others, true); } foreach (var entry in window.FileEntries) { this.ProcessFile(entry.Value); } //this.ProcessFolder(window.Root); //Path.Combine(Definitions.DataDir, hashlist_tag) HashIndex.GenerateHashList(Path.Combine(Definitions.DataDir, "paths"), "paths"); HashIndex.GenerateHashList(Path.Combine(Definitions.DataDir, "others"), "others"); HashIndex.temp = new Dictionary <ulong, Idstring>(); clock.Stop(); error_output.Write("Scrape operation took {0} seconds" + "\n", clock.Elapsed.TotalSeconds.ToString()); error_output.Close(); }
public void LoadHashlists() { HashIndex.Load(Path.Combine(Definitions.HashDir, "paths"), HashIndex.HashType.Path); HashIndex.Load(Path.Combine(Definitions.HashDir, "exts")); //HashIndex.Load(Path.Combine(Definitions.HashDir, "others")); foreach (string file in Directory.EnumerateFiles(Path.Combine(Definitions.HashDir, Definitions.AddedHashDir))) { HashIndex.Load(file, HashIndex.HashType.Path); } }
public static void GenerateHashlist(string workingPath, string file, PackageFileEntry be) { using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read)) { using (BinaryReader br = new BinaryReader(fs)) { byte[] data; StringBuilder sb = new StringBuilder(); string[] idstring_data; HashSet <string> new_paths = new HashSet <string>(); fs.Position = be.Address; if (be.Length == -1) { data = br.ReadBytes((int)(fs.Length - fs.Position)); } else { data = br.ReadBytes((int)be.Length); } foreach (byte read in data) { sb.Append((char)read); } idstring_data = sb.ToString().Split('\0'); sb.Clear(); foreach (string idstring in idstring_data) { new_paths.Add(idstring); } new_paths.Add("idstring_lookup"); new_paths.Add("existing_banks"); new_paths.Add("engine-package"); HashIndex.Clear(); HashIndex.Load(ref new_paths); HashIndex.GenerateHashList(Path.Combine(workingPath, HashlistFile)); new_paths.Clear(); } } }