/// <summary> /// silently does not save some settings if Git is not configured correctly /// (user notification is done elsewhere) /// </summary> protected override void PageToSettings() { CurrentSettings.FilesEncoding = CommonLogic.ComboToEncoding(Global_FilesEncoding); if (!CheckSettingsLogic.CanFindGitCmd()) { return; } CurrentSettings.SetValue(SettingKeyString.UserName, GlobalUserName.Text); CurrentSettings.SetValue(SettingKeyString.UserEmail, GlobalUserEmail.Text); CurrentSettings.SetValue("commit.template", txtCommitTemplatePath.Text); CurrentSettings.SetPathValue("core.editor", GlobalEditor.Text); // TODO: why use GUI??? var diffTool = _NO_TRANSLATE_cboDiffTool.Text; if (!string.IsNullOrWhiteSpace(diffTool)) { _diffMergeToolConfigurationManager.ConfigureDiffMergeTool(diffTool, DiffMergeToolType.Diff, txtDiffToolPath.Text, txtDiffToolCommand.Text); } else { _diffMergeToolConfigurationManager.UnsetCurrentTool(DiffMergeToolType.Diff); } // TODO: merge.guitool??? var mergeTool = _NO_TRANSLATE_cboMergeTool.Text; if (!string.IsNullOrWhiteSpace(mergeTool)) { _diffMergeToolConfigurationManager.ConfigureDiffMergeTool(mergeTool, DiffMergeToolType.Merge, txtMergeToolPath.Text, txtMergeToolCommand.Text); } else { _diffMergeToolConfigurationManager.UnsetCurrentTool(DiffMergeToolType.Merge); } if (globalAutoCrlfFalse.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.@false; } if (globalAutoCrlfInput.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.input; } if (globalAutoCrlfTrue.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.@true; } if (globalAutoCrlfNotSet.Checked) { CurrentSettings.core.autocrlf.Value = null; } }
public override void SaveSettings() { _gitModule.SetFilesEncoding(true, _commonLogic.ComboToEncoding(Local_FilesEncoding)); if (_checkSettingsLogic.CanFindGitCmd()) { ConfigFile localConfig = _gitModule.GetLocalConfig(); if (string.IsNullOrEmpty(UserName.Text) || !UserName.Text.Equals(localConfig.GetValue("user.name"))) { localConfig.SetValue("user.name", UserName.Text); } if (string.IsNullOrEmpty(UserEmail.Text) || !UserEmail.Text.Equals(localConfig.GetValue("user.email"))) { localConfig.SetValue("user.email", UserEmail.Text); } localConfig.SetPathValue("core.editor", Editor.Text); localConfig.SetValue("merge.tool", LocalMergeTool.Text); if (KeepMergeBackup.CheckState == CheckState.Checked) { localConfig.SetValue("mergetool.keepBackup", "true"); } else if (KeepMergeBackup.CheckState == CheckState.Unchecked) { localConfig.SetValue("mergetool.keepBackup", "false"); } if (localAutoCrlfFalse.Checked) { localConfig.SetValue("core.autocrlf", "false"); } if (localAutoCrlfInput.Checked) { localConfig.SetValue("core.autocrlf", "input"); } if (localAutoCrlfTrue.Checked) { localConfig.SetValue("core.autocrlf", "true"); } CommonLogic.SetEncoding(_gitModule.GetFilesEncoding(true), localConfig, "i18n.filesEncoding"); //Only save local settings when we are inside a valid working dir if (_gitModule.ValidWorkingDir()) { localConfig.Save(); } } }
/// <summary> /// silently does not save some settings if Git is not configured correctly /// (user notification is done elsewhere) /// </summary> protected override void PageToSettings() { CurrentSettings.FilesEncoding = CommonLogic.ComboToEncoding(Global_FilesEncoding); if (!CheckSettingsLogic.CanFindGitCmd()) { return; } CurrentSettings.SetValue(SettingKeyString.UserName, GlobalUserName.Text); CurrentSettings.SetValue(SettingKeyString.UserEmail, GlobalUserEmail.Text); CurrentSettings.SetValue("commit.template", CommitTemplatePath.Text); CurrentSettings.SetPathValue("core.editor", GlobalEditor.Text); var diffTool = _NO_TRANSLATE_GlobalDiffTool.Text; CheckSettingsLogic.SetDiffToolToConfig(CurrentSettings, diffTool); CurrentSettings.SetPathValue($"difftool.{diffTool}.path", DifftoolPath.Text); CurrentSettings.SetPathValue($"difftool.{diffTool}.cmd", DifftoolCmd.Text); var mergeTool = _NO_TRANSLATE_GlobalMergeTool.Text; CurrentSettings.SetValue("merge.tool", mergeTool); CurrentSettings.SetPathValue($"mergetool.{mergeTool}.path", MergetoolPath.Text); CurrentSettings.SetPathValue($"mergetool.{mergeTool}.cmd", MergeToolCmd.Text); CurrentSettings.mergetool.keepBackup.Value = GlobalKeepMergeBackup.GetNullableChecked(); if (globalAutoCrlfFalse.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.@false; } if (globalAutoCrlfInput.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.input; } if (globalAutoCrlfTrue.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.@true; } if (globalAutoCrlfNotSet.Checked) { CurrentSettings.core.autocrlf.Value = null; } }
/// <summary> /// silently does not save some settings if Git is not configured correctly /// (user notification is done elsewhere) /// </summary> protected override void PageToSettings() { CurrentSettings.FilesEncoding = CommonLogic.ComboToEncoding(Global_FilesEncoding); if (CheckSettingsLogic.CanFindGitCmd()) { CurrentSettings.SetValue("user.name", GlobalUserName.Text); CurrentSettings.SetValue("user.email", GlobalUserEmail.Text); CurrentSettings.SetValue("commit.template", CommitTemplatePath.Text); CurrentSettings.SetPathValue("core.editor", GlobalEditor.Text); CheckSettingsLogic.SetDiffToolToConfig(CurrentSettings, GlobalDiffTool.Text); CurrentSettings.SetPathValue(string.Format("difftool.{0}.path", GlobalDiffTool.Text), DifftoolPath.Text); CurrentSettings.SetPathValue(string.Format("difftool.{0}.cmd", GlobalDiffTool.Text), DifftoolCmd.Text); CurrentSettings.SetValue("merge.tool", GlobalMergeTool.Text); CurrentSettings.SetPathValue(string.Format("mergetool.{0}.path", GlobalMergeTool.Text), MergetoolPath.Text); CurrentSettings.SetPathValue(string.Format("mergetool.{0}.cmd", GlobalMergeTool.Text), MergeToolCmd.Text); CurrentSettings.mergetool.keepBackup.Value = GlobalKeepMergeBackup.GetNullableChecked(); if (globalAutoCrlfFalse.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.False; } if (globalAutoCrlfInput.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.Input; } if (globalAutoCrlfTrue.Checked) { CurrentSettings.core.autocrlf.Value = AutoCRLFType.True; } if (globalAutoCrlfNotSet.Checked) { CurrentSettings.core.autocrlf.Value = null; } } }
/// <summary> /// silently does not save some settings if Git is not configured correctly /// (user notification is done elsewhere) /// </summary> public override void SaveSettings() { _gitModule.SetFilesEncoding(false, _commonLogic.ComboToEncoding(Global_FilesEncoding)); if (_checkSettingsLogic.CanFindGitCmd()) { ConfigFile globalConfig = GitCommandHelpers.GetGlobalConfig(); if (string.IsNullOrEmpty(GlobalUserName.Text) || !GlobalUserName.Text.Equals(globalConfig.GetValue("user.name"))) { globalConfig.SetValue("user.name", GlobalUserName.Text); } if (string.IsNullOrEmpty(GlobalUserEmail.Text) || !GlobalUserEmail.Text.Equals(globalConfig.GetValue("user.email"))) { globalConfig.SetValue("user.email", GlobalUserEmail.Text); } if (string.IsNullOrEmpty(CommitTemplatePath.Text) || !CommitTemplatePath.Text.Equals(globalConfig.GetValue("commit.template"))) { globalConfig.SetValue("commit.template", CommitTemplatePath.Text); } globalConfig.SetPathValue("core.editor", GlobalEditor.Text); CheckSettingsLogic.SetGlobalDiffToolToConfig(globalConfig, GlobalDiffTool.Text); if (!string.IsNullOrEmpty(GlobalDiffTool.Text)) { globalConfig.SetPathValue(string.Format("difftool.{0}.path", GlobalDiffTool.Text), DifftoolPath.Text); } if (!string.IsNullOrEmpty(GlobalDiffTool.Text)) { globalConfig.SetPathValue(string.Format("difftool.{0}.cmd", GlobalDiffTool.Text), DifftoolCmd.Text); } globalConfig.SetValue("merge.tool", GlobalMergeTool.Text); if (!string.IsNullOrEmpty(GlobalMergeTool.Text)) { globalConfig.SetPathValue(string.Format("mergetool.{0}.path", GlobalMergeTool.Text), MergetoolPath.Text); } if (!string.IsNullOrEmpty(GlobalMergeTool.Text)) { globalConfig.SetPathValue(string.Format("mergetool.{0}.cmd", GlobalMergeTool.Text), MergeToolCmd.Text); } if (GlobalKeepMergeBackup.CheckState == CheckState.Checked) { globalConfig.SetValue("mergetool.keepBackup", "true"); } else if (GlobalKeepMergeBackup.CheckState == CheckState.Unchecked) { globalConfig.SetValue("mergetool.keepBackup", "false"); } if (globalAutoCrlfFalse.Checked) { globalConfig.SetValue("core.autocrlf", "false"); } if (globalAutoCrlfInput.Checked) { globalConfig.SetValue("core.autocrlf", "input"); } if (globalAutoCrlfTrue.Checked) { globalConfig.SetValue("core.autocrlf", "true"); } CommonLogic.SetEncoding(_gitModule.GetFilesEncoding(false), globalConfig, "i18n.filesEncoding"); globalConfig.Save(); } }