public bool GetReplInfo(int id, out string evaluator, out string evalType, out string contentType, out string title, out Guid languageServiceGuid, out Guid guid) { using (var repl = UserRegistryRoot.OpenSubKey(ActiveReplsKey)) { if (repl != null) { using (var curRepl = repl.OpenSubKey(id.ToString())) { if (curRepl != null) { evaluator = (string)curRepl.GetValue("EvaluatorAssembly"); evalType = (string)curRepl.GetValue("EvaluatorType"); contentType = (string)curRepl.GetValue("ContentType"); title = (string)curRepl.GetValue("Title"); guid = Guid.Parse((string)curRepl.GetValue("Guid")); languageServiceGuid = Guid.Parse((string)curRepl.GetValue("LanguageServiceGuid")); return(true); } } } } evaluator = null; contentType = null; title = null; evalType = null; guid = Guid.Empty; languageServiceGuid = Guid.Empty; return(false); }
/// <summary>Applies a given <see cref="Theme" />.</summary> /// <param name="theme">The theme to apply.</param> /// <exception cref="ArgumentNullException">Occurs if <paramref name="theme" /> is null.</exception> public void ApplyTheme(string themeID) { if (themeID == null) { throw new ArgumentNullException(nameof(themeID)); } var key = UserRegistryRoot.OpenSubKey(@"ApplicationPrivateSettings\Microsoft\VisualStudio", true); if (key != null) { object oldColorTheme = key.GetValue("ColorTheme"); object oldColorThemeNew = key.GetValue("ColorThemeNew"); object newColorTheme = "0*System.String*" + themeID.Trim('{', '}'); object newColorThemeNew = "0*System.String*" + themeID; if (oldColorTheme != newColorTheme || oldColorThemeNew != newColorThemeNew) { key.SetValue("ColorTheme", newColorTheme); key.SetValue("ColorThemeNew", newColorThemeNew); NativeMethods.SendNotifyMessage(new IntPtr(NativeMethods.HWND_BROADCAST), NativeMethods.WM_SYSCOLORCHANGE, IntPtr.Zero, IntPtr.Zero); RestoreColorThemeAsync(key, oldColorTheme, oldColorThemeNew).FireAndForget(); } } }
private void SaveSettings() { var key = UserRegistryRoot.OpenSubKey(RegistryRoot, true); if (key == null) { UserRegistryRoot.CreateSubKey(RegistryRoot); key = UserRegistryRoot.OpenSubKey(RegistryRoot, true); } Debug.Assert(key != null); key.SetValue(RegistryProgram, _program); key.SetValue(RegistryArguments, _arguments); }
private void LoadSettings() { var subKey = UserRegistryRoot.OpenSubKey(RegistryRoot); if (subKey != null) { _program = (string)subKey.GetValue(RegistryProgram); _arguments = (string)subKey.GetValue(RegistryArguments); } //Didn't exist, try default paths if (string.IsNullOrEmpty(_program)) { foreach (var diffTool in DiffTools.GetCandidates()) { if (File.Exists(diffTool.Path)) { _program = diffTool.Path; _arguments = diffTool.Arguments; return; } } } }