PKHeX/PKHeX.WinForms/Util/CyberGadgetUtil.cs
Kurt 595c7eb4c5 Split winforms to separate project
resources still are associated with winforms, eh
program still runs fine and I've replicated the mono build options. lmk
if this breaks stuff
2017-01-07 23:54:09 -08:00

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;
}
}
}