private void LoadPaths() { _pathData = new DecryptionInfos(); bsPaths.Add(_pathData); txtSteamLocation.DataBindings[0].Parse += Path_Parse; txtOutputLocation.DataBindings[0].Parse += Path_Parse; //windows accepts both forward and back slashes, so i will use the ones that work everywhere string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string steamDir = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Valve\Steam", "SteamPath", "C:/Program Files (x86)/Steam"); steamDir = steamDir.Replace("/", "\\"); _pathData.SteamLocation = new DirectoryInfo(Path.Combine(steamDir, "SteamApps\\common\\The Binding of Isaac Rebirth")); _pathData.OutputLocation = new DirectoryInfo(Directory.GetCurrentDirectory() + "\\output"); }
private static void StartDecryption(DecryptionInfos dinfos) { dinfos.SteamLocation = new DirectoryInfo(Path.Combine(dinfos.SteamLocation.FullName, "resources\\packed")); var hashToFilename = GetFileNames(Path.Combine(dinfos.SteamLocation.FullName, "config.a")); var found = 0; var total = 0; foreach (var file in dinfos.SteamLocation.GetFiles("*.a")) { using (var fs = File.OpenRead(file.FullName)) { //var subDir = Path.GetFileNameWithoutExtension(fs.Name); //if (!Directory.Exists(subDir)) // Directory.CreateDirectory(subDir); foreach (var p in new FileReader().Read(fs)) { var fileName = (hashToFilename.ContainsKey(p.Hash)) ? hashToFilename[p.Hash] : "nothing"; dinfos.WriteLine(string.Format("Found for hash {0} file name {1}", p.Hash, fileName)); total++; string filePath; if (fileName != "nothing") { found++; filePath = fileName; } else { filePath = Path.Combine(file.Name, (total - found) + "." + p.RecordType.ToString().ToLower()); } filePath = Path.Combine(dinfos.OutputLocation.FullName, filePath); Directory.CreateDirectory(Path.GetDirectoryName(filePath)); File.WriteAllBytes(filePath, p.Data); } } } dinfos.WriteLine(string.Format("Done! {2} Found {0} of {1}", found, total, Environment.NewLine)); }
private void LoadPaths() { _pathData = new DecryptionInfos(); bsPaths.Add(_pathData); txtSteamLocation.DataBindings[0].Parse += Path_Parse; txtOutputLocation.DataBindings[0].Parse += Path_Parse; //windows accepts both forward and back slashes, so i will use the ones that work everywhere string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string steamDir = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Valve\Steam", "SteamPath", "C:/Program Files (x86)/Steam"); steamDir = steamDir.Replace("/", "\\"); _pathData.SteamLocation= new DirectoryInfo(Path.Combine(steamDir, "SteamApps\\common\\The Binding of Isaac Rebirth")); _pathData.OutputLocation = new DirectoryInfo(Directory.GetCurrentDirectory() + "\\output"); }