From 1b50e9793464e9704dc7dbcfd0c342b072ca40e9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 2 Jan 2019 18:18:24 -0800 Subject: [PATCH] Remove cgse fixed path can restore behavior by adding it as a custom user path; cgse isn't very prevalent nowadays now the only registry key checks are for checking net framework version --- PKHeX.WinForms/MainWindow/Main.cs | 17 ++-------- PKHeX.WinForms/PKHeX.WinForms.csproj | 1 - PKHeX.WinForms/Subforms/SAV_FolderList.cs | 8 ----- PKHeX.WinForms/Util/CyberGadgetUtil.cs | 39 ----------------------- 4 files changed, 2 insertions(+), 63 deletions(-) delete mode 100644 PKHeX.WinForms/Util/CyberGadgetUtil.cs diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index f8291f319..1ef106034 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -137,21 +137,8 @@ private void FormLoadInitialSettings(string[] args, out bool showChangelog, out private static void FormLoadCustomBackupPaths() { SaveDetection.CustomBackupPaths.Clear(); - try - { - // cybergadget paths - string pathCache = CyberGadgetUtil.GetCacheFolder(); - if (Directory.Exists(pathCache)) - SaveDetection.CustomBackupPaths.Add(Path.Combine(pathCache)); - string pathTemp = CyberGadgetUtil.GetTempFolder(); - if (Directory.Exists(pathTemp)) - SaveDetection.CustomBackupPaths.Add(Path.Combine(pathTemp)); - - // custom user paths - if (File.Exists(SAVPaths)) - SaveDetection.CustomBackupPaths.AddRange(File.ReadAllLines(SAVPaths).Where(Directory.Exists)); - } - catch { } + if (File.Exists(SAVPaths)) // custom user paths + SaveDetection.CustomBackupPaths.AddRange(File.ReadAllLines(SAVPaths).Where(Directory.Exists)); } private void FormLoadAddEvents() diff --git a/PKHeX.WinForms/PKHeX.WinForms.csproj b/PKHeX.WinForms/PKHeX.WinForms.csproj index 9852ae34c..6c3276b2d 100644 --- a/PKHeX.WinForms/PKHeX.WinForms.csproj +++ b/PKHeX.WinForms/PKHeX.WinForms.csproj @@ -627,7 +627,6 @@ - diff --git a/PKHeX.WinForms/Subforms/SAV_FolderList.cs b/PKHeX.WinForms/Subforms/SAV_FolderList.cs index a15189eb2..847b8e6f2 100644 --- a/PKHeX.WinForms/Subforms/SAV_FolderList.cs +++ b/PKHeX.WinForms/Subforms/SAV_FolderList.cs @@ -80,16 +80,8 @@ private static List GetPathList(IReadOnlyList drives) new CustomFolderPath(Main.BackupPath, "PKHeX Backups") }; locs.AddRange(GetUserPaths()); - locs.AddRange(GetConsolePaths(drives)); locs.AddRange(GetSwitchPaths(drives)); - addIfExists(CyberGadgetUtil.GetCacheFolder(), "CGSE Cache"); - addIfExists(CyberGadgetUtil.GetTempFolder(), "CGSE Temp"); - void addIfExists(string path, string text) - { - if (Directory.Exists(path)) - locs.Add(new CustomFolderPath(path, text)); - } return locs.GroupBy(z => z.Path).Select(z => z.First()) .OrderByDescending(z => Directory.Exists(z.Path)).ToList(); } diff --git a/PKHeX.WinForms/Util/CyberGadgetUtil.cs b/PKHeX.WinForms/Util/CyberGadgetUtil.cs deleted file mode 100644 index 97b808a7f..000000000 --- a/PKHeX.WinForms/Util/CyberGadgetUtil.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.IO; - -namespace PKHeX.WinForms -{ - public static class CyberGadgetUtil - { - public static string GetTempFolder() => Path.Combine(Path.GetTempPath(), "3DSSE"); - public static string GetCacheFolder() => Path.Combine(GetBackupLocation(), "cache"); - private static string GetRegistryBase() => @"SOFTWARE\CYBER Gadget\3DSSaveEditor"; - - private static string GetRegistryValue(string key) - { - Microsoft.Win32.RegistryKey currentUser = Microsoft.Win32.Registry.CurrentUser; - Microsoft.Win32.RegistryKey key3 = currentUser.OpenSubKey(GetRegistryBase()); - if (key3 == null) - return null; - - string str = key3.GetValue(key) as string; - key3.Close(); - currentUser.Close(); - return str; - } - - private static string GetBackupLocation() - { - string registryValue = GetRegistryValue("Location"); - if (!string.IsNullOrEmpty(registryValue)) - { - Directory.CreateDirectory(registryValue); - return registryValue; - } - string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "3DSSaveBank"); - if (Directory.Exists(GetRegistryBase())) - Directory.CreateDirectory(path); - return path; - } - } -}