protected override void SettingsToPage() { CommonLogic.EncodingToCombo(CurrentSettings.FilesEncoding, Global_FilesEncoding); GlobalUserName.Text = CurrentSettings.GetValue(SettingKeyString.UserName); GlobalUserEmail.Text = CurrentSettings.GetValue(SettingKeyString.UserEmail); GlobalEditor.Text = CurrentSettings.GetValue("core.editor"); _NO_TRANSLATE_GlobalMergeTool.Text = CurrentSettings.GetValue("merge.tool"); CommitTemplatePath.Text = CurrentSettings.GetValue("commit.template"); MergetoolPath.Text = CurrentSettings.GetValue(string.Format("mergetool.{0}.path", _NO_TRANSLATE_GlobalMergeTool.Text)); MergeToolCmd.Text = CurrentSettings.GetValue(string.Format("mergetool.{0}.cmd", _NO_TRANSLATE_GlobalMergeTool.Text)); _NO_TRANSLATE_GlobalDiffTool.Text = CheckSettingsLogic.GetDiffToolFromConfig(CurrentSettings); DifftoolPath.Text = CurrentSettings.GetValue(string.Format("difftool.{0}.path", _NO_TRANSLATE_GlobalDiffTool.Text)); DifftoolCmd.Text = CurrentSettings.GetValue(string.Format("difftool.{0}.cmd", _NO_TRANSLATE_GlobalDiffTool.Text)); GlobalKeepMergeBackup.SetNullableChecked(CurrentSettings.mergetool.keepBackup.Value); globalAutoCrlfFalse.Checked = CurrentSettings.core.autocrlf.Value == AutoCRLFType.@false; globalAutoCrlfInput.Checked = CurrentSettings.core.autocrlf.Value == AutoCRLFType.input; globalAutoCrlfTrue.Checked = CurrentSettings.core.autocrlf.Value == AutoCRLFType.@true; globalAutoCrlfNotSet.Checked = !CurrentSettings.core.autocrlf.Value.HasValue; }
protected override void OnLoadSettings() { _commonLogic.EncodingToCombo(_gitModule.GetFilesEncoding(true), Local_FilesEncoding); ConfigFile localConfig = _gitModule.GetLocalConfig(); UserName.Text = localConfig.GetValue("user.name"); UserEmail.Text = localConfig.GetValue("user.email"); Editor.Text = localConfig.GetPathValue("core.editor"); LocalMergeTool.Text = localConfig.GetValue("merge.tool"); CommonLogic.SetCheckboxFromString(KeepMergeBackup, localConfig.GetValue("mergetool.keepBackup")); string autocrlf = localConfig.GetValue("core.autocrlf").ToLower(); localAutoCrlfFalse.Checked = autocrlf == "false"; localAutoCrlfInput.Checked = autocrlf == "input"; localAutoCrlfTrue.Checked = autocrlf == "true"; }
protected override void OnLoadSettings() { ConfigFile globalConfig = GitCommandHelpers.GetGlobalConfig(); _commonLogic.EncodingToCombo(_gitModule.GetFilesEncoding(false), Global_FilesEncoding); GlobalUserName.Text = globalConfig.GetValue("user.name"); GlobalUserEmail.Text = globalConfig.GetValue("user.email"); GlobalEditor.Text = globalConfig.GetPathValue("core.editor"); GlobalMergeTool.Text = globalConfig.GetValue("merge.tool"); CommitTemplatePath.Text = globalConfig.GetValue("commit.template"); if (!string.IsNullOrEmpty(GlobalMergeTool.Text)) { MergetoolPath.Text = globalConfig.GetPathValue(string.Format("mergetool.{0}.path", GlobalMergeTool.Text)); } if (!string.IsNullOrEmpty(GlobalMergeTool.Text)) { MergeToolCmd.Text = globalConfig.GetPathValue(string.Format("mergetool.{0}.cmd", GlobalMergeTool.Text)); } GlobalDiffTool.Text = CheckSettingsLogic.GetGlobalDiffToolFromConfig(); if (!string.IsNullOrEmpty(GlobalDiffTool.Text)) { DifftoolPath.Text = globalConfig.GetPathValue(string.Format("difftool.{0}.path", GlobalDiffTool.Text)); } if (!string.IsNullOrEmpty(GlobalDiffTool.Text)) { DifftoolCmd.Text = globalConfig.GetPathValue(string.Format("difftool.{0}.cmd", GlobalDiffTool.Text)); } CommonLogic.SetCheckboxFromString(GlobalKeepMergeBackup, globalConfig.GetValue("mergetool.keepBackup")); string globalAutocrlf = string.Empty; if (globalConfig.HasValue("core.autocrlf")) { globalAutocrlf = globalConfig.GetValue("core.autocrlf").ToLower(); } else if (!string.IsNullOrEmpty(Settings.GitBinDir)) { try { //the following lines only work for msysgit (i think). MSysgit has a config file //in the etc directory which is checked after the local and global config. In //practice this is only used to core.autocrlf. If there are more cases, we might //need to consider a better solution. var configFile = new ConfigFile(Path.GetDirectoryName(Settings.GitBinDir).Replace("bin", "etc\\gitconfig"), false); globalAutocrlf = configFile.GetValue("core.autocrlf").ToLower(); } catch { } } globalAutoCrlfFalse.Checked = globalAutocrlf == "false"; globalAutoCrlfInput.Checked = globalAutocrlf == "input"; globalAutoCrlfTrue.Checked = globalAutocrlf == "true"; }