2021-05-25 06:44:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Path = System.IO.Path;
|
|
|
|
|
using File = System.IO.File;
|
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
|
|
|
|
|
namespace EZPPClient_Installer
|
|
|
|
|
{
|
2021-05-27 04:02:37 +00:00
|
|
|
|
class OsuUtil
|
2021-05-25 06:44:50 +00:00
|
|
|
|
{
|
|
|
|
|
public static string osuInstallDir()
|
|
|
|
|
{
|
|
|
|
|
string path = "";
|
|
|
|
|
string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
|
|
|
|
|
string second_registry_key = @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
|
|
|
|
|
|
|
|
|
|
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
|
|
|
|
|
{
|
|
|
|
|
foreach (string subkey_name in key.GetSubKeyNames())
|
|
|
|
|
{
|
|
|
|
|
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
|
|
|
|
{
|
|
|
|
|
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
|
|
|
|
{
|
|
|
|
|
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(path))
|
|
|
|
|
{
|
|
|
|
|
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(second_registry_key))
|
|
|
|
|
{
|
|
|
|
|
foreach (string subkey_name in key.GetSubKeyNames())
|
|
|
|
|
{
|
|
|
|
|
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
|
|
|
|
{
|
|
|
|
|
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
|
|
|
|
{
|
|
|
|
|
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|