コード例 #1
0
        /// <inheritdoc />
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            try
            {
                var regInfo1 =
                    ApplicationRegistryRoot.OpenSubKey(@"AD7Metrics\Engine\{BE99C8E2-969A-450C-8FAB-73BECCC53DF4}");
                if (regInfo1 != null)
                {
                    DebugAdapterPath = regInfo1.GetValue("Adapter").ToString();

                    /*
                     * File.AppendAllText(
                     *  @"C:\Development\Development\Projects\GBDKProjects\GBDKEngine\Debug\PackageLog.log",
                     *  "App Reg: " + DebugAdapterPath + "\n" + regInfo1.Name);
                     */
                }
            }
            catch (Exception err)
            {
                /*
                 * File.AppendAllText(
                 *  @"C:\Development\Development\Projects\GBDKProjects\GBDKEngine\Debug\PackageLog.log",
                 *  "App Ex: " + err.ToString());
                 */
            }
        }
コード例 #2
0
        /// <summary>Gets all themes installed in Visual Studio.</summary>
        /// <returns>All themes installed in Visual Studio.</returns>
        /// Source: https://github.com/frankschierle/ThemeSwitcher/blob/master/ThemeSwitcher/Logic/ThemeManager.cs
        public Dictionary <string, string> GetInstalledThemes()
        {
            string[] installedThemesKeys;

            var themes = new List <(string id, string displayname)>();

            using (var themesKey = ApplicationRegistryRoot.OpenSubKey("Themes"))
            {
                if (themesKey != null)
                {
                    installedThemesKeys = themesKey.GetSubKeyNames();

                    foreach (string key in installedThemesKeys)
                    {
                        using (RegistryKey themeKey = themesKey.OpenSubKey(key))
                        {
                            if (themeKey != null)
                            {
                                if (themeKey.GetValue("")?.ToString() is string value)
                                {
                                    themes.Add((key, value));
                                }
                            }
                        }
                    }
                }
            }
            return(themes.ToDictionary(t => t.displayname, t => t.id));
        }