public static string EmulatorExecutable() { string title = "Please select an executable..."; if (Literal.Emulator(Properties.Settings.Default.Path_GameExecutable) != "unspecified") { title = $"Please select an executable for {Literal.Emulator(Properties.Settings.Default.Path_GameExecutable)}..."; } OpenFileDialog browseEmulator = new OpenFileDialog() { Title = title, Filter = "Programs (*.exe)|*.exe" }; if (browseEmulator.ShowDialog() == DialogResult.OK) { return(browseEmulator.FileName); } else { return(string.Empty); } }
/// <summary> /// Removes redirected save data. /// </summary> public static void UninstallSaves(ListView.ListViewItemCollection listViewItems) { if (Properties.Settings.Default.Path_SaveData != string.Empty || File.Exists(Properties.Settings.Default.Path_SaveData)) { foreach (ListViewItem mod in listViewItems) { // Basically just to check 'SYS-DATA' as a directory string saveLocation = Path.GetDirectoryName(Path.GetDirectoryName(Properties.Settings.Default.Path_SaveData)); // Deserialise 'Save' key string savedata = INI.DeserialiseKey("Save", mod.SubItems[6].Text); if (savedata != string.Empty) // Speeds things up a bit - ensures it's not checking a default null parameter { if (Literal.Emulator(Properties.Settings.Default.Path_GameDirectory) == "Xenia") { string[] saves = Array.Empty <string>(); // Get all backup directories if (Directory.Exists(saveLocation)) { saves = Directory.GetDirectories(saveLocation, "SYS-DATA_back", SearchOption.AllDirectories); } foreach (var dir in saves) { // Original save data path string saveFile = Path.Combine(dir.ToString().Remove(dir.Length - 5), Path.GetFileName(dir.ToString().Remove(dir.Length - 5))); // Copy redirected save data back to the mod's directory (keeps user progress) if (File.Exists(saveFile)) { Console.WriteLine($"Removing: {dir}"); if (savedata != string.Empty) { File.Copy(saveFile, Path.Combine(Path.GetDirectoryName(mod.SubItems[6].Text), "savedata.360"), true); } } // Recursively erase redirected save data if (Directory.Exists(dir.ToString().Remove(dir.Length - 5))) { Console.WriteLine($"Removing: {dir}"); Directory.Delete(dir.ToString().Remove(dir.Length - 5), true); } // Restore original save data Directory.Move(dir.ToString(), dir.ToString().Remove(dir.Length - 5)); } } else if (Literal.Emulator(Properties.Settings.Default.Path_GameDirectory) == "RPCS3") { string[] saves = Array.Empty <string>(); // Original save data path if (Directory.Exists(saveLocation)) { saves = Directory.GetFiles(saveLocation, "SYS-DATA_back", SearchOption.AllDirectories); } foreach (var file in saves) { string saveFile = Path.Combine(file.ToString().Remove(file.Length - 5), Path.GetFileName(file.ToString().Remove(file.Length - 5))); // Copy redirected save data back to the mod's directory (keeps user progress) if (File.Exists(saveFile)) { Console.WriteLine($"Removing: {file}"); if (savedata != string.Empty) { File.Copy(saveFile, Path.Combine(Path.GetDirectoryName(mod.SubItems[6].Text), "savedata.ps3"), true); } } // Erase redirected save data if (File.Exists(file.ToString().Remove(file.Length - 5))) { Console.WriteLine($"Removing: {file}"); File.Delete(file.ToString().Remove(file.Length - 5)); } // Restore original save data File.Move(file.ToString(), file.ToString().Remove(file.Length - 5)); } } } } } }