mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
595c7eb4c5
resources still are associated with winforms, eh program still runs fine and I've replicated the mono build options. lmk if this breaks stuff
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace PKHeX.WinForms
|
|
{
|
|
public class CyberGadgetUtil
|
|
{
|
|
public static string GetTempFolder()
|
|
{
|
|
return Path.Combine(Path.GetTempPath(), "3DSSE");
|
|
}
|
|
public static string GetCacheFolder()
|
|
{
|
|
return Path.Combine(GetBackupLocation(), "cache");
|
|
}
|
|
public 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;
|
|
}
|
|
public static string GetRegistryBase()
|
|
{
|
|
return @"SOFTWARE\CYBER Gadget\3DSSaveEditor";
|
|
}
|
|
public 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;
|
|
}
|
|
}
|
|
}
|