Fixed a issue where the Installer crashed when a invalid path is in registry.
This commit is contained in:
parent
e43782cfd6
commit
236de72895
@ -107,12 +107,15 @@ namespace EZPPClient_Installer
|
|||||||
folderTextbox.Text = osuPath;
|
folderTextbox.Text = osuPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
folderTextbox.Text = "";
|
||||||
await new ContentDialog()
|
await new ContentDialog()
|
||||||
{
|
{
|
||||||
Title = "Hmmm..",
|
Title = "Hmmm..",
|
||||||
Content = "We failed to locate your osu! Installation path, please define it manually qwq",
|
Content = "We failed to locate your osu! Installation path, please define it manually qwq",
|
||||||
PrimaryButtonText = "Okay qwq"
|
PrimaryButtonText = "Okay qwq"
|
||||||
}.ShowAsync();
|
}.ShowAsync();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,7 +636,7 @@ namespace EZPPClient_Installer
|
|||||||
|
|
||||||
private async Task<bool> isValidOsuFolder(string folder)
|
private async Task<bool> isValidOsuFolder(string folder)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(folder) || string.IsNullOrWhiteSpace(folder))
|
if (string.IsNullOrEmpty(folder) || string.IsNullOrWhiteSpace(folder) || !Directory.Exists(folder))
|
||||||
return false;
|
return false;
|
||||||
string[] files = Directory.GetFiles(folder, "*");
|
string[] files = Directory.GetFiles(folder, "*");
|
||||||
string[] subDirs = Directory.GetDirectories(folder, "*");
|
string[] subDirs = Directory.GetDirectories(folder, "*");
|
||||||
|
@ -13,13 +13,19 @@ namespace EZPPClient_Installer
|
|||||||
|
|
||||||
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
|
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
|
||||||
{
|
{
|
||||||
foreach (string subkey_name in key.GetSubKeyNames())
|
if (key != null && key.GetSubKeyNames() != null)
|
||||||
{
|
{
|
||||||
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
foreach (string subkey_name in key.GetSubKeyNames())
|
||||||
{
|
{
|
||||||
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
||||||
{
|
{
|
||||||
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
if (subkey != null)
|
||||||
|
{
|
||||||
|
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
||||||
|
{
|
||||||
|
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,13 +35,19 @@ namespace EZPPClient_Installer
|
|||||||
{
|
{
|
||||||
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(second_registry_key))
|
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(second_registry_key))
|
||||||
{
|
{
|
||||||
foreach (string subkey_name in key.GetSubKeyNames())
|
if (key != null && key.GetSubKeyNames() != null)
|
||||||
{
|
{
|
||||||
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
foreach (string subkey_name in key.GetSubKeyNames())
|
||||||
{
|
{
|
||||||
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
||||||
{
|
{
|
||||||
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
if (subkey != null)
|
||||||
|
{
|
||||||
|
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
||||||
|
{
|
||||||
|
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user