コード例 #1
0
ファイル: IDEPage.xaml.cs プロジェクト: mushi2017/GiMiSi
 /// <summary>
 /// 获取自动搜索路径
 /// </summary>
 /// <returns>GMS2 安装路径</returns>
 private static void GetAutoSearchPath()
 {
     try
     {
         Log.WriteLog(Log.LogLevel.信息, "从注册表获取GameMaker Studio 2安装路径");
         installedDictionary.Clear();
         Log.WriteLog(Log.LogLevel.信息, "搜索官网下载版安装路径");
         RegistryKey standaloneKey = RegistryHelpers
                                     .GetRegistryKey(RegistryHive.CurrentUser, @"Software\GameMakerStudio2");
         if (standaloneKey != null)
         {
             // 官网下载板
             installedDictionary.Add("官网下载版", standaloneKey.GetValue("Install_Dir").ToString());
             standaloneKey.Close();
         }
         Log.WriteLog(Log.LogLevel.信息, "搜索 steam Desktop 版安装路径");
         RegistryKey steamDesktopKey = RegistryHelpers
                                       .GetRegistryKey(RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 585410");
         if (steamDesktopKey != null)
         {
             // Steam Desktop 板
             installedDictionary.Add("Steam Desktop 版", steamDesktopKey.GetValue("InstallLocation").ToString());
             steamDesktopKey.Close();
         }
         Log.WriteLog(Log.LogLevel.信息, "搜索 steam Web 版安装路径");
         RegistryKey steamWebKey = RegistryHelpers
                                   .GetRegistryKey(RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 585600");
         if (steamWebKey != null)
         {
             // Steam Web 版
             installedDictionary.Add("Steam Web 版", steamWebKey.GetValue("InstallLocation").ToString());
             steamWebKey.Close();
         }
         Log.WriteLog(Log.LogLevel.信息, "搜索 steam UWP 版安装路径");
         RegistryKey steamUwpKey = RegistryHelpers
                                   .GetRegistryKey(RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 585610");
         if (steamUwpKey != null)
         {
             // Steam UWP 版
             installedDictionary.Add("Steam UWP 版", steamUwpKey.GetValue("InstallLocation").ToString());
             steamUwpKey.Close();
         }
         Log.WriteLog(Log.LogLevel.信息, "搜索 steam Mobile 版安装路径");
         RegistryKey steamMobileKey = RegistryHelpers
                                      .GetRegistryKey(RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 585620");
         if (steamMobileKey != null)
         {
             // Steam Mobile 版
             installedDictionary.Add("Steam Mobile 版", steamMobileKey.GetValue("InstallLocation").ToString());
             steamMobileKey.Close();
         }
         Log.WriteLog(Log.LogLevel.信息, "搜索安装路径完毕");
     }
     catch
     {
         Log.WriteLog(Log.LogLevel.警告, "搜索安装路径失败");
         throw new Exception("搜索安装路径失败");
     }
 }
コード例 #2
0
        public static void SetLaunchAtLogin(bool launch)
        {
            var key = RegistryHelpers.GetRegistryKey(RegKeyPath, true);

            if (launch)
            {
                key?.SetValue(AppName, ExecutablePath);
            }
            else if (key?.GetValue(AppName) != null)
            {
                key.DeleteValue(AppName);
            }
        }
コード例 #3
0
        public static bool IsLaunchedAtLogin()
        {
            var key = RegistryHelpers.GetRegistryKey(RegKeyPath);

            return(key?.GetValue(AppName) != null);
        }