private void LoadSettings() { CheckIfAdmin(); if (!IsAdministrator) { PanelTooltip = "To change these options run dnGREP as Administrator."; } else { WindowsIntegrationTooltip = "Enables starting dnGrep from the Windows Explorer right-click context menu."; StartupAccelerationTooltip = "Startup acceleration loads application libraries on machine start to improve application startup time."; } EnableWindowsIntegration = IsShellRegistered("Directory"); EnableStartupAcceleration = IsStartupRegistered(); EnableCheckForUpdates = Settings.Get <bool>(GrepSettings.Key.EnableUpdateChecking); CheckForUpdatesInterval = Settings.Get <int>(GrepSettings.Key.UpdateCheckInterval); CustomEditorPath = Settings.Get <string>(GrepSettings.Key.CustomEditor); CustomEditorArgs = Settings.Get <string>(GrepSettings.Key.CustomEditorArgs); CompareApplicationPath = Settings.Get <string>(GrepSettings.Key.CompareApplication); CompareApplicationArgs = Settings.Get <string>(GrepSettings.Key.CompareApplicationArgs); ShowFilePathInResults = Settings.Get <bool>(GrepSettings.Key.ShowFilePathInResults); AllowSearchWithEmptyPattern = Settings.Get <bool>(GrepSettings.Key.AllowSearchingForFileNamePattern); DetectEncodingForFileNamePattern = Settings.Get <bool>(GrepSettings.Key.DetectEncodingForFileNamePattern); AutoExpandSearchTree = Settings.Get <bool>(GrepSettings.Key.ExpandResults); ShowVerboseMatchCount = Settings.Get <bool>(GrepSettings.Key.ShowVerboseMatchCount); ShowFileInfoTooltips = Settings.Get <bool>(GrepSettings.Key.ShowFileInfoTooltips); MatchTimeout = Settings.Get <double>(GrepSettings.Key.MatchTimeout); MatchThreshold = Settings.Get <double>(GrepSettings.Key.FuzzyMatchThreshold); ShowLinesInContext = Settings.Get <bool>(GrepSettings.Key.ShowLinesInContext); ContextLinesBefore = Settings.Get <int>(GrepSettings.Key.ContextLinesBefore); ContextLinesAfter = Settings.Get <int>(GrepSettings.Key.ContextLinesAfter); MaxSearchBookmarks = Settings.Get <int>(GrepSettings.Key.MaxSearchBookmarks); MaxPathBookmarks = Settings.Get <int>(GrepSettings.Key.MaxPathBookmarks); MaxExtensionBookmarks = Settings.Get <int>(GrepSettings.Key.MaxExtensionBookmarks); OptionsLocation = Settings.Get <bool>(GrepSettings.Key.OptionsOnMainPanel) ? PanelSelection.MainPanel : PanelSelection.OptionsExpander; UseDefaultFont = Settings.Get <bool>(GrepSettings.Key.UseDefaultFont); ApplicationFontFamily = EditApplicationFontFamily = ValueOrDefault(GrepSettings.Key.ApplicationFontFamily, SystemFonts.MessageFontFamily.Source); MainFormFontSize = EditMainFormFontSize = ValueOrDefault(GrepSettings.Key.MainFormFontSize, SystemFonts.MessageFontSize); ReplaceFormFontSize = EditReplaceFormFontSize = ValueOrDefault(GrepSettings.Key.ReplaceFormFontSize, SystemFonts.MessageFontSize); DialogFontSize = EditDialogFontSize = ValueOrDefault(GrepSettings.Key.DialogFontSize, SystemFonts.MessageFontSize); // current values may not equal the saved settings value CurrentTheme = AppTheme.Instance.CurrentThemeName; FollowWindowsTheme = AppTheme.Instance.FollowWindowsTheme; PdfToTextOptions = Settings.Get <string>(GrepSettings.Key.PdfToTextOptions); { string nameKey = "Archive"; string addKey = "Add" + nameKey + "Extensions"; string remKey = "Rem" + nameKey + "Extensions"; string addCsv = string.Empty; if (GrepSettings.Instance.ContainsKey(addKey)) { addCsv = GrepSettings.Instance.Get <string>(addKey).Trim(); } string remCsv = string.Empty; if (GrepSettings.Instance.ContainsKey(remKey)) { remCsv = GrepSettings.Instance.Get <string>(remKey).Trim(); } ArchiveOptions = new PluginOptions("Archive", true, string.Join(", ", ArchiveDirectory.DefaultExtensions), addCsv, remCsv); } Plugins.Clear(); foreach (var plugin in GrepEngineFactory.AllPlugins.OrderBy(p => p.Name)) { string nameKey = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(plugin.Name); string enabledkey = nameKey + "Enabled"; string addKey = "Add" + nameKey + "Extensions"; string remKey = "Rem" + nameKey + "Extensions"; bool isEnabled = true; if (GrepSettings.Instance.ContainsKey(enabledkey)) { isEnabled = GrepSettings.Instance.Get <bool>(enabledkey); } string addCsv = string.Empty; if (GrepSettings.Instance.ContainsKey(addKey)) { addCsv = GrepSettings.Instance.Get <string>(addKey).Trim(); } string remCsv = string.Empty; if (GrepSettings.Instance.ContainsKey(remKey)) { remCsv = GrepSettings.Instance.Get <string>(remKey).Trim(); } var pluginOptions = new PluginOptions( plugin.Name, isEnabled, string.Join(", ", plugin.DefaultExtensions), addCsv, remCsv); Plugins.Add(pluginOptions); } }
private void LoadSetting() { CheckIfAdmin(); if (!IsAdministrator) { WindowsIntegrationTooltip = "To set shell integration run dnGREP with elevated privileges."; StartupAccelerationTooltip = "To enable startup acceleration run dnGREP with elevated privileges."; PanelTooltip = "To change shell integration and startup acceleration options run dnGREP with elevated privileges."; } else { WindowsIntegrationTooltip = "Shell integration enables running an application from shell context menu."; StartupAccelerationTooltip = "Startup acceleration loads application libraries on machine start to improve application startup time."; PanelTooltip = "Shell integration enables running an application from shell context menu."; } EnableWindowsIntegration = IsShellRegistered("Directory"); EnableStartupAcceleration = IsStartupRegistered(); EnableCheckForUpdates = Settings.Get <bool>(GrepSettings.Key.EnableUpdateChecking); CheckForUpdatesInterval = Settings.Get <int>(GrepSettings.Key.UpdateCheckInterval); CustomEditorPath = Settings.Get <string>(GrepSettings.Key.CustomEditor); CustomEditorArgs = Settings.Get <string>(GrepSettings.Key.CustomEditorArgs); ShowFilePathInResults = Settings.Get <bool>(GrepSettings.Key.ShowFilePathInResults); AllowSearchWithEmptyPattern = Settings.Get <bool>(GrepSettings.Key.AllowSearchingForFileNamePattern); AutoExpandSearchTree = Settings.Get <bool>(GrepSettings.Key.ExpandResults); showVerboseMatchCount = Settings.Get <bool>(GrepSettings.Key.ShowVerboseMatchCount); MatchTimeout = Settings.Get <double>(GrepSettings.Key.MatchTimeout); MatchThreshold = Settings.Get <double>(GrepSettings.Key.FuzzyMatchThreshold); ShowLinesInContext = Settings.Get <bool>(GrepSettings.Key.ShowLinesInContext); ContextLinesBefore = Settings.Get <int>(GrepSettings.Key.ContextLinesBefore); ContextLinesAfter = Settings.Get <int>(GrepSettings.Key.ContextLinesAfter); MaxSearchBookmarks = Settings.Get <int>(GrepSettings.Key.MaxSearchBookmarks); MaxPathBookmarks = Settings.Get <int>(GrepSettings.Key.MaxPathBookmarks); MaxExtensionBookmarks = Settings.Get <int>(GrepSettings.Key.MaxExtensionBookmarks); OptionsLocation = Settings.Get <bool>(GrepSettings.Key.OptionsOnMainPanel) ? PanelSelection.MainPanel : PanelSelection.OptionsExpander; // current values may not equal the saved settings value CurrentTheme = AppTheme.Instance.CurrentThemeName; FollowWindowsTheme = AppTheme.Instance.FollowWindowsTheme; Plugins.Clear(); foreach (var plugin in GrepEngineFactory.AllPlugins.OrderBy(p => p.Name)) { string nameKey = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(plugin.Name); string enabledkey = nameKey + "Enabled"; string addKey = "Add" + nameKey + "Extensions"; string remKey = "Rem" + nameKey + "Extensions"; bool isEnabled = true; if (GrepSettings.Instance.ContainsKey(enabledkey)) { isEnabled = GrepSettings.Instance.Get <bool>(enabledkey); } string addCsv = string.Empty; if (GrepSettings.Instance.ContainsKey(addKey)) { addCsv = GrepSettings.Instance.Get <string>(addKey).Trim(); } string remCsv = string.Empty; if (GrepSettings.Instance.ContainsKey(remKey)) { remCsv = GrepSettings.Instance.Get <string>(remKey).Trim(); } var pluginOptions = new PluginOptions( plugin.Name, isEnabled, string.Join(", ", plugin.DefaultExtensions), addCsv, remCsv); Plugins.Add(pluginOptions); } }