PageRenderTime 57ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 1ms

/GitUI/FormSettings.cs

https://github.com/eisnerd/gitextensions
C# | 2343 lines | 2041 code | 277 blank | 25 comment | 203 complexity | 843cdb74fc5cb02984f60e537aa04782 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Drawing;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Reflection;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using GitCommands;
  11. using GitCommands.Config;
  12. using GitUI.Editor;
  13. using GitUI.Script;
  14. using Gravatar;
  15. using Microsoft.Win32;
  16. using ResourceManager.Translation;
  17. namespace GitUI
  18. {
  19. public sealed partial class FormSettings : GitExtensionsForm
  20. {
  21. #region Translation
  22. private readonly TranslationString _homeIsSetToString = new TranslationString("HOME is set to:");
  23. private readonly TranslationString __diffToolSuggestCaption = new TranslationString("Suggest difftool cmd");
  24. private readonly TranslationString __mergeToolSuggestCaption = new TranslationString("Suggest mergetool cmd");
  25. private readonly TranslationString _loadingSettingsFailed =
  26. new TranslationString("Could not load settings.");
  27. private readonly TranslationString _cantFindGitMessage =
  28. new TranslationString("The command to run git is not configured correct." + Environment.NewLine +
  29. "You need to set the correct path to be able to use GitExtensions." + Environment.NewLine +
  30. Environment.NewLine + "Do you want to set the correct command now?");
  31. private readonly TranslationString _cantFindGitMessageCaption =
  32. new TranslationString("Incorrect path");
  33. private static readonly TranslationString _cantReadRegistry =
  34. new TranslationString("GitExtensions has insufficient permissions to check the registry.");
  35. private static readonly TranslationString _cantReadRegistryAddEntryManually =
  36. new TranslationString("GitExtensions has insufficient permissions to modify the registry." +
  37. Environment.NewLine + "Please add this key to the registry manually." +
  38. Environment.NewLine + "Path: {0}\\{1}" + Environment.NewLine +
  39. "Value: {2} = {3}");
  40. private readonly TranslationString _cantRegisterShellExtension =
  41. new TranslationString("Could not register the shell extension because '{0}' could not be found.");
  42. private readonly TranslationString _noDiffToolConfigured =
  43. new TranslationString("There is no difftool configured. Do you want to configure kdiff3 as your difftool?" +
  44. Environment.NewLine + "Select no if you want to configure a different difftool yourself.");
  45. private readonly TranslationString _noDiffToolConfiguredCaption =
  46. new TranslationString("Difftool");
  47. private readonly TranslationString _kdiff3NotFoundAuto =
  48. new TranslationString("Path to kdiff3 could not be found automatically." + Environment.NewLine +
  49. "Please make sure KDiff3 is installed or set path manually.");
  50. private readonly TranslationString _noMergeToolConfigured =
  51. new TranslationString("There is no mergetool configured. Do you want to configure kdiff3 as your mergetool?" +
  52. Environment.NewLine + "Select no if you want to configure a different mergetool yourself.");
  53. private readonly TranslationString _noMergeToolConfiguredCaption =
  54. new TranslationString("Mergetool");
  55. private readonly TranslationString _solveGitCommandFailed =
  56. new TranslationString("The command to run git could not be determined automatically." + Environment.NewLine +
  57. "Please make sure git (msysgit or cygwin) is installed or set the correct command manually.");
  58. private readonly TranslationString _solveGitCommandFailedCaption =
  59. new TranslationString("Locate git");
  60. private readonly TranslationString _gitCanBeRun =
  61. new TranslationString("Git can be run using: {0}");
  62. private readonly TranslationString _gitCanBeRunCaption =
  63. new TranslationString("Locate git");
  64. private readonly TranslationString _linuxToolsShNotFound =
  65. new TranslationString("The path to linux tools (sh) could not be found automatically." + Environment.NewLine +
  66. "Please make sure there are linux tools installed (through msysgit or cygwin) or set the correct path manually.");
  67. private readonly TranslationString _linuxToolsShNotFoundCaption =
  68. new TranslationString("Locate linux tools");
  69. private readonly TranslationString _shCanBeRun =
  70. new TranslationString("Command sh can be run using: {0}sh");
  71. private readonly TranslationString _shCanBeRunCaption =
  72. new TranslationString("Locate linux tools");
  73. private static readonly TranslationString _selectFile =
  74. new TranslationString("Select file");
  75. private readonly TranslationString _puttyFoundAuto =
  76. new TranslationString("All paths needed for PuTTY could be automatically found and are set.");
  77. private readonly TranslationString _puttyFoundAutoCaption =
  78. new TranslationString("PuTTY");
  79. private readonly TranslationString _noDictFilesFound =
  80. new TranslationString("No dictionary files found in: {0}");
  81. private readonly TranslationString _noLanguageConfigured =
  82. new TranslationString("There is no language configured for Git Extensions.");
  83. private readonly TranslationString _languageConfigured =
  84. new TranslationString("The configured language is {0}.");
  85. private readonly TranslationString _plinkputtyGenpageantNotFound =
  86. new TranslationString("PuTTY is configured as SSH client but cannot find plink.exe, puttygen.exe or pageant.exe.");
  87. private readonly TranslationString _puttyConfigured =
  88. new TranslationString("SSH client PuTTY is configured properly.");
  89. private readonly TranslationString _opensshUsed =
  90. new TranslationString("Default SSH client, OpenSSH, will be used. (commandline window will appear on pull, push and clone operations)");
  91. private readonly TranslationString _unknownSshClient =
  92. new TranslationString("Unknown SSH client configured: {0}.");
  93. private readonly TranslationString _linuxToolsSshNotFound =
  94. new TranslationString("Linux tools (sh) not found. To solve this problem you can set the correct path in settings.");
  95. private readonly TranslationString _linuxToolsSshFound =
  96. new TranslationString("Linux tools (sh) found on your computer.");
  97. private readonly TranslationString _gitNotFound =
  98. new TranslationString("Git not found. To solve this problem you can set the correct path in settings.");
  99. private readonly TranslationString _wrongGitVersion =
  100. new TranslationString("Git found but version {0} is not supported. Upgrage to version {1} or later");
  101. private readonly TranslationString _gitVersionFound =
  102. new TranslationString("Git {0} is found on your computer.");
  103. private readonly TranslationString _adviceDiffToolConfiguration =
  104. new TranslationString("You should configure a diff tool to show file diff in external program (kdiff3 for example).");
  105. private readonly TranslationString _kdiffAsDiffConfiguredButNotFound =
  106. new TranslationString("KDiff3 is configured as difftool, but the path to kdiff.exe is not configured.");
  107. private readonly TranslationString _kdiffAsDiffConfigured =
  108. new TranslationString("KDiff3 is configured as difftool.");
  109. private readonly TranslationString _toolSuggestPath =
  110. new TranslationString("Please enter the path to {0} and press suggest.");
  111. private readonly TranslationString _diffToolXConfigured =
  112. new TranslationString("There is a difftool configured: {0}");
  113. private readonly TranslationString _configureMergeTool =
  114. new TranslationString("You need to configure merge tool in order to solve mergeconflicts (kdiff3 for example).");
  115. private readonly TranslationString _kdiffAsMergeConfiguredButNotFound =
  116. new TranslationString("KDiff3 is configured as mergetool, but the path to kdiff.exe is not configured.");
  117. private readonly TranslationString _kdiffAsMergeConfigured =
  118. new TranslationString("KDiff3 is configured as mergetool.");
  119. private readonly TranslationString _mergeToolXConfiguredNeedsCmd =
  120. new TranslationString("{0} is configured as mergetool, this is a custom mergetool and needs a custom cmd to be configured.");
  121. private readonly TranslationString _customMergeToolXConfigured =
  122. new TranslationString("There is a custom mergetool configured: {0}");
  123. private readonly TranslationString _mergeToolXConfigured =
  124. new TranslationString("There is a custom mergetool configured.");
  125. private readonly TranslationString _noEmailSet =
  126. new TranslationString("You need to configure a username and an email address.");
  127. private readonly TranslationString _emailSet =
  128. new TranslationString("A username and an email address are configured.");
  129. private readonly TranslationString _shellExtNoInstalled =
  130. new TranslationString("Shell extensions are not installed. Run the installer to install the shell extensions.");
  131. private readonly TranslationString _shellExtNeedsToBeRegistered =
  132. new TranslationString("{0} needs to be registered in order to use the shell extensions.");
  133. private readonly TranslationString _shellExtRegistered =
  134. new TranslationString("Shell extensions registered properly.");
  135. private readonly TranslationString _registryKeyGitExtensionsMissing =
  136. new TranslationString("Registry entry missing [Software\\GitExtensions\\GitExtensions\\InstallDir].");
  137. private readonly TranslationString _registryKeyGitExtensionsFaulty =
  138. new TranslationString("Invalid installation directory stored in [Software\\GitExtensions\\GitExtensions\\InstallDir].");
  139. private readonly TranslationString _registryKeyGitExtensionsCorrect =
  140. new TranslationString("GitExtensions is properly registered.");
  141. #endregion
  142. private Font diffFont;
  143. private const string GitExtensionsShellExName = "GitExtensionsShellEx32.dll";
  144. private string IconName = "bug";
  145. public FormSettings()
  146. {
  147. InitializeComponent();
  148. Translate();
  149. noImageService.Items.AddRange(GravatarService.DynamicServices.Cast<object>().ToArray());
  150. FillEncodings(Global_FilesEncoding);
  151. FillEncodings(Global_AppEncoding);
  152. FillEncodings(Local_FilesEncoding);
  153. FillEncodings(Local_AppEncoding);
  154. string npp = MergeToolsHelper.FindFileInFolders("notepad++.exe", "Notepad++");
  155. if (string.IsNullOrEmpty(npp))
  156. npp = "notepad++";
  157. else
  158. npp = "\"" + npp + "\"";
  159. GlobalEditor.Items.AddRange(new Object[] { "\"" + Settings.GetGitExtensionsFullPath() + "\" fileeditor", "vi", "notepad", npp + " -multiInst -nosession" });
  160. SetCurrentDiffFont(Settings.DiffFont);
  161. }
  162. protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
  163. {
  164. base.OnClosing(e);
  165. SavePosition("settings");
  166. }
  167. public static bool AutoSolveAllSettings()
  168. {
  169. if (!Settings.RunningOnWindows())
  170. return SolveGitCommand();
  171. return SolveGitCommand() &&
  172. SolveLinuxToolsDir() &&
  173. SolveMergeToolForKDiff() &&
  174. SolveDiffToolForKDiff() &&
  175. SolveGitExtensionsDir() &&
  176. SolveEditor();
  177. }
  178. private static string GetGlobalEditor()
  179. {
  180. string editor = Environment.GetEnvironmentVariable("GIT_EDITOR");
  181. if (!string.IsNullOrEmpty(editor))
  182. return editor;
  183. editor = Settings.Module.GetGlobalPathSetting("core.editor");
  184. if (!string.IsNullOrEmpty(editor))
  185. return editor;
  186. editor = Environment.GetEnvironmentVariable("VISUAL");
  187. if (!string.IsNullOrEmpty(editor))
  188. return editor;
  189. return Environment.GetEnvironmentVariable("EDITOR");
  190. }
  191. private static bool SolveEditor()
  192. {
  193. string editor = GetGlobalEditor();
  194. if (string.IsNullOrEmpty(editor))
  195. {
  196. Settings.Module.SetGlobalPathSetting("core.editor", "\"" + Settings.GetGitExtensionsFullPath() + "\" fileeditor");
  197. }
  198. return true;
  199. }
  200. private static void SetCheckboxFromString(CheckBox checkBox, string str)
  201. {
  202. str = str.Trim().ToLower();
  203. switch (str)
  204. {
  205. case "true":
  206. {
  207. checkBox.CheckState = CheckState.Checked;
  208. return;
  209. }
  210. case "false":
  211. {
  212. checkBox.CheckState = CheckState.Unchecked;
  213. return;
  214. }
  215. default:
  216. checkBox.CheckState = CheckState.Indeterminate;
  217. return;
  218. }
  219. }
  220. private static string GetGlobalDiffToolFromConfig()
  221. {
  222. if (GitCommandHelpers.VersionInUse.GuiDiffToolExist)
  223. return GitCommandHelpers.GetGlobalConfig().GetValue("diff.guitool");
  224. return GitCommandHelpers.GetGlobalConfig().GetValue("diff.tool");
  225. }
  226. private static void SetGlobalDiffToolToConfig(ConfigFile configFile, string diffTool)
  227. {
  228. if (GitCommandHelpers.VersionInUse.GuiDiffToolExist)
  229. {
  230. configFile.SetValue("diff.guitool", diffTool);
  231. return;
  232. }
  233. configFile.SetValue("diff.tool", diffTool);
  234. }
  235. private void EncodingToCombo(Encoding encoding, ComboBox combo)
  236. {
  237. if (encoding == null)
  238. combo.Text = "";
  239. else
  240. combo.Text = encoding.EncodingName;
  241. }
  242. private Encoding ComboToEncoding(ComboBox combo)
  243. {
  244. return combo.SelectedItem as Encoding;
  245. }
  246. private void FillEncodings(ComboBox combo)
  247. {
  248. combo.Items.AddRange(Settings.availableEncodings.Values.ToArray());
  249. combo.DisplayMember = "EncodingName";
  250. }
  251. private bool loadingSettings;
  252. public void LoadSettings()
  253. {
  254. loadingSettings = true;
  255. try
  256. {
  257. GitCommandHelpers.SetEnvironmentVariable();
  258. homeIsSetToLabel.Text = string.Concat(_homeIsSetToString.Text, " ", GitCommandHelpers.GetHomeDir());
  259. scriptEvent.DataSource = Enum.GetValues(typeof(ScriptEvent));
  260. EncodingToCombo(Settings.GetFilesEncoding(false), Global_FilesEncoding);
  261. EncodingToCombo(Settings.GetAppEncoding(false, false), Global_AppEncoding);
  262. EncodingToCombo(Settings.GetFilesEncoding(true), Local_FilesEncoding);
  263. EncodingToCombo(Settings.GetAppEncoding(true, false), Local_AppEncoding);
  264. chkStartWithRecentWorkingDir.Checked = Settings.StartWithRecentWorkingDir;
  265. chkPlaySpecialStartupSound.Checked = Settings.PlaySpecialStartupSound;
  266. chkUsePatienceDiffAlgorithm.Checked = Settings.UsePatienceDiffAlgorithm;
  267. chkShowCurrentBranchInVisualStudio.Checked = Settings.ShowCurrentBranchInVisualStudio;
  268. RevisionGridQuickSearchTimeout.Value = Settings.RevisionGridQuickSearchTimeout;
  269. chkFollowRenamesInFileHistory.Checked = Settings.FollowRenamesInFileHistory;
  270. _NO_TRANSLATE_DaysToCacheImages.Value = Settings.AuthorImageCacheDays;
  271. _NO_TRANSLATE_authorImageSize.Value = Settings.AuthorImageSize;
  272. ShowAuthorGravatar.Checked = Settings.ShowAuthorGravatar;
  273. noImageService.Text = Settings.GravatarFallbackService;
  274. chkShowErrorsWhenStagingFiles.Checked = Settings.ShowErrorsWhenStagingFiles;
  275. chkStashUntrackedFiles.Checked = Settings.IncludeUntrackedFilesInAutoStash;
  276. Language.Items.Clear();
  277. Language.Items.Add("English");
  278. Language.Items.AddRange(Translator.GetAllTranslations());
  279. Language.Text = Settings.Translation;
  280. MulticolorBranches.Checked = Settings.MulticolorBranches;
  281. MulticolorBranches_CheckedChanged(null, null);
  282. DrawNonRelativesGray.Checked = Settings.RevisionGraphDrawNonRelativesGray;
  283. DrawNonRelativesTextGray.Checked = Settings.RevisionGraphDrawNonRelativesTextGray;
  284. chkShowCurrentChangesInRevisionGraph.Checked = Settings.RevisionGraphShowWorkingDirChanges;
  285. chkShowStashCountInBrowseWindow.Checked = Settings.ShowStashCount;
  286. BranchBorders.Checked = Settings.BranchBorders;
  287. StripedBanchChange.Checked = Settings.StripedBranchChange;
  288. chkShowGitStatusInToolbar.Checked = Settings.ShowGitStatusInBrowseToolbar;
  289. _NO_TRANSLATE_truncatePathMethod.Text = Settings.TruncatePathMethod;
  290. _NO_TRANSLATE_ColorGraphLabel.BackColor = Settings.GraphColor;
  291. _NO_TRANSLATE_ColorGraphLabel.Text = Settings.GraphColor.Name;
  292. _NO_TRANSLATE_ColorGraphLabel.ForeColor =
  293. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorGraphLabel.BackColor);
  294. _NO_TRANSLATE_ColorTagLabel.BackColor = Settings.TagColor;
  295. _NO_TRANSLATE_ColorTagLabel.Text = Settings.TagColor.Name;
  296. _NO_TRANSLATE_ColorTagLabel.ForeColor =
  297. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorTagLabel.BackColor);
  298. _NO_TRANSLATE_ColorBranchLabel.BackColor = Settings.BranchColor;
  299. _NO_TRANSLATE_ColorBranchLabel.Text = Settings.BranchColor.Name;
  300. _NO_TRANSLATE_ColorBranchLabel.ForeColor =
  301. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorBranchLabel.BackColor);
  302. _NO_TRANSLATE_ColorRemoteBranchLabel.BackColor = Settings.RemoteBranchColor;
  303. _NO_TRANSLATE_ColorRemoteBranchLabel.Text = Settings.RemoteBranchColor.Name;
  304. _NO_TRANSLATE_ColorRemoteBranchLabel.ForeColor =
  305. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorRemoteBranchLabel.BackColor);
  306. _NO_TRANSLATE_ColorOtherLabel.BackColor = Settings.OtherTagColor;
  307. _NO_TRANSLATE_ColorOtherLabel.Text = Settings.OtherTagColor.Name;
  308. _NO_TRANSLATE_ColorOtherLabel.ForeColor =
  309. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorOtherLabel.BackColor);
  310. _NO_TRANSLATE_ColorAddedLineLabel.BackColor = Settings.DiffAddedColor;
  311. _NO_TRANSLATE_ColorAddedLineLabel.Text = Settings.DiffAddedColor.Name;
  312. _NO_TRANSLATE_ColorAddedLineLabel.ForeColor =
  313. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorAddedLineLabel.BackColor);
  314. _NO_TRANSLATE_ColorAddedLineDiffLabel.BackColor = Settings.DiffAddedExtraColor;
  315. _NO_TRANSLATE_ColorAddedLineDiffLabel.Text = Settings.DiffAddedExtraColor.Name;
  316. _NO_TRANSLATE_ColorAddedLineDiffLabel.ForeColor =
  317. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorAddedLineDiffLabel.BackColor);
  318. _NO_TRANSLATE_ColorRemovedLine.BackColor = Settings.DiffRemovedColor;
  319. _NO_TRANSLATE_ColorRemovedLine.Text = Settings.DiffRemovedColor.Name;
  320. _NO_TRANSLATE_ColorRemovedLine.ForeColor =
  321. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorRemovedLine.BackColor);
  322. _NO_TRANSLATE_ColorRemovedLineDiffLabel.BackColor = Settings.DiffRemovedExtraColor;
  323. _NO_TRANSLATE_ColorRemovedLineDiffLabel.Text = Settings.DiffRemovedExtraColor.Name;
  324. _NO_TRANSLATE_ColorRemovedLineDiffLabel.ForeColor =
  325. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorRemovedLineDiffLabel.BackColor);
  326. _NO_TRANSLATE_ColorSectionLabel.BackColor = Settings.DiffSectionColor;
  327. _NO_TRANSLATE_ColorSectionLabel.Text = Settings.DiffSectionColor.Name;
  328. _NO_TRANSLATE_ColorSectionLabel.ForeColor =
  329. ColorHelper.GetForeColorForBackColor(_NO_TRANSLATE_ColorSectionLabel.BackColor);
  330. SmtpServer.Text = Settings.Smtp;
  331. _NO_TRANSLATE_MaxCommits.Value = Settings.MaxRevisionGraphCommits;
  332. GitPath.Text = Settings.GitCommand;
  333. GitBinPath.Text = Settings.GitBinDir;
  334. ConfigFile localConfig = Settings.Module.GetLocalConfig();
  335. ConfigFile globalConfig = GitCommandHelpers.GetGlobalConfig();
  336. UserName.Text = localConfig.GetValue("user.name");
  337. UserEmail.Text = localConfig.GetValue("user.email");
  338. Editor.Text = localConfig.GetPathValue("core.editor");
  339. LocalMergeTool.Text = localConfig.GetValue("merge.tool");
  340. Dictionary.Text = Settings.Dictionary;
  341. GlobalUserName.Text = globalConfig.GetValue("user.name");
  342. GlobalUserEmail.Text = globalConfig.GetValue("user.email");
  343. GlobalEditor.Text = globalConfig.GetPathValue("core.editor");
  344. GlobalMergeTool.Text = globalConfig.GetValue("merge.tool");
  345. CommitTemplatePath.Text = globalConfig.GetValue("commit.template");
  346. SetCheckboxFromString(KeepMergeBackup, localConfig.GetValue("mergetool.keepBackup"));
  347. string autocrlf = localConfig.GetValue("core.autocrlf").ToLower();
  348. localAutoCrlfFalse.Checked = autocrlf == "false";
  349. localAutoCrlfInput.Checked = autocrlf == "input";
  350. localAutoCrlfTrue.Checked = autocrlf == "true";
  351. if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
  352. MergetoolPath.Text = globalConfig.GetPathValue(string.Format("mergetool.{0}.path", GlobalMergeTool.Text));
  353. if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
  354. MergeToolCmd.Text = globalConfig.GetPathValue(string.Format("mergetool.{0}.cmd", GlobalMergeTool.Text));
  355. string iconColor = Settings.IconColor.ToLower();
  356. DefaultIcon.Checked = iconColor == "default";
  357. BlueIcon.Checked = iconColor == "blue";
  358. GreenIcon.Checked = iconColor == "green";
  359. PurpleIcon.Checked = iconColor == "purple";
  360. RedIcon.Checked = iconColor == "red";
  361. YellowIcon.Checked = iconColor == "yellow";
  362. RandomIcon.Checked = iconColor == "random";
  363. IconStyle.Text = Settings.IconStyle;
  364. ShowIconPreview();
  365. GlobalDiffTool.Text = GetGlobalDiffToolFromConfig();
  366. if (!string.IsNullOrEmpty(GlobalDiffTool.Text))
  367. DifftoolPath.Text = globalConfig.GetPathValue(string.Format("difftool.{0}.path", GlobalDiffTool.Text));
  368. if (!string.IsNullOrEmpty(GlobalDiffTool.Text))
  369. DifftoolCmd.Text = globalConfig.GetPathValue(string.Format("difftool.{0}.cmd", GlobalDiffTool.Text));
  370. SetCheckboxFromString(GlobalKeepMergeBackup, globalConfig.GetValue("mergetool.keepBackup"));
  371. string globalAutocrlf = string.Empty;
  372. if (globalConfig.HasValue("core.autocrlf"))
  373. {
  374. globalAutocrlf = globalConfig.GetValue("core.autocrlf").ToLower();
  375. }
  376. else if (!string.IsNullOrEmpty(Settings.GitBinDir))
  377. {
  378. try
  379. {
  380. //the following lines only work for msysgit (i think). MSysgit has a config file
  381. //in the etc directory which is checked after the local and global config. In
  382. //practice this is only used to core.autocrlf. If there are more cases, we might
  383. //need to consider a better solution.
  384. var configFile =
  385. new ConfigFile(Path.GetDirectoryName(Settings.GitBinDir).Replace("bin", "etc\\gitconfig"), false);
  386. globalAutocrlf = configFile.GetValue("core.autocrlf").ToLower();
  387. }
  388. catch
  389. {
  390. }
  391. }
  392. globalAutoCrlfFalse.Checked = globalAutocrlf == "false";
  393. globalAutoCrlfInput.Checked = globalAutocrlf == "input";
  394. globalAutoCrlfTrue.Checked = globalAutocrlf == "true";
  395. PlinkPath.Text = Settings.Plink;
  396. PuttygenPath.Text = Settings.Puttygen;
  397. PageantPath.Text = Settings.Pageant;
  398. AutostartPageant.Checked = Settings.AutoStartPageant;
  399. chkCloseProcessDialog.Checked = Settings.CloseProcessDialog;
  400. chkShowGitCommandLine.Checked = Settings.ShowGitCommandLine;
  401. chkUseFastChecks.Checked = Settings.UseFastChecks;
  402. chkShowRelativeDate.Checked = Settings.RelativeDate;
  403. chkCascadedContextMenu.Checked = Settings.ShellCascadeContextMenu;
  404. for (int i = 0; i < Settings.ShellVisibleMenuItems.Length; i++)
  405. {
  406. chlMenuEntries.SetItemChecked(i, Settings.ShellVisibleMenuItems[i] == '1');
  407. }
  408. if (string.IsNullOrEmpty(GitCommandHelpers.GetSsh()))
  409. OpenSSH.Checked = true;
  410. else if (GitCommandHelpers.Plink())
  411. Putty.Checked = true;
  412. else
  413. {
  414. OtherSsh.Text = GitCommandHelpers.GetSsh();
  415. Other.Checked = true;
  416. }
  417. EnableSshOptions();
  418. LoadScripts();
  419. }
  420. catch (Exception ex)
  421. {
  422. MessageBox.Show(this, _loadingSettingsFailed.Text + Environment.NewLine + ex);
  423. // Bail out before the user saves the incompletely loaded settings
  424. // and has their day ruined.
  425. DialogResult = DialogResult.Abort;
  426. }
  427. loadingSettings = false;
  428. }
  429. private void Ok_Click(object sender, EventArgs e)
  430. {
  431. Close();
  432. }
  433. private bool Save()
  434. {
  435. SaveScripts();
  436. if (Settings.RunningOnWindows())
  437. FormFixHome.CheckHomePath();
  438. GitCommandHelpers.SetEnvironmentVariable(true);
  439. Settings.StartWithRecentWorkingDir = chkStartWithRecentWorkingDir.Checked;
  440. Settings.PlaySpecialStartupSound = chkPlaySpecialStartupSound.Checked;
  441. Settings.UsePatienceDiffAlgorithm = chkUsePatienceDiffAlgorithm.Checked;
  442. Settings.TruncatePathMethod = _NO_TRANSLATE_truncatePathMethod.Text;
  443. Settings.ShowCurrentBranchInVisualStudio = chkShowCurrentBranchInVisualStudio.Checked;
  444. Settings.ShowErrorsWhenStagingFiles = chkShowErrorsWhenStagingFiles.Checked;
  445. Settings.IncludeUntrackedFilesInAutoStash = chkStashUntrackedFiles.Checked;
  446. Settings.FollowRenamesInFileHistory = chkFollowRenamesInFileHistory.Checked;
  447. if ((int)_NO_TRANSLATE_authorImageSize.Value != Settings.AuthorImageSize)
  448. {
  449. Settings.AuthorImageSize = (int)_NO_TRANSLATE_authorImageSize.Value;
  450. GravatarService.ClearImageCache();
  451. }
  452. Settings.Translation = Language.Text;
  453. Strings.Reinit();
  454. Settings.ShowGitStatusInBrowseToolbar = chkShowGitStatusInToolbar.Checked;
  455. Settings.AuthorImageCacheDays = (int)_NO_TRANSLATE_DaysToCacheImages.Value;
  456. Settings.Smtp = SmtpServer.Text;
  457. Settings.GitCommand = GitPath.Text;
  458. Settings.GitBinDir = GitBinPath.Text;
  459. Settings.ShowAuthorGravatar = ShowAuthorGravatar.Checked;
  460. Settings.GravatarFallbackService = noImageService.Text;
  461. Settings.CloseProcessDialog = chkCloseProcessDialog.Checked;
  462. Settings.ShowGitCommandLine = chkShowGitCommandLine.Checked;
  463. Settings.UseFastChecks = chkUseFastChecks.Checked;
  464. Settings.RelativeDate = chkShowRelativeDate.Checked;
  465. Settings.Dictionary = Dictionary.Text;
  466. Settings.MaxRevisionGraphCommits = (int)_NO_TRANSLATE_MaxCommits.Value;
  467. Settings.Plink = PlinkPath.Text;
  468. Settings.Puttygen = PuttygenPath.Text;
  469. Settings.Pageant = PageantPath.Text;
  470. Settings.AutoStartPageant = AutostartPageant.Checked;
  471. Settings.SetFilesEncoding(false, ComboToEncoding(Global_FilesEncoding));
  472. Settings.SetAppEncoding(false, ComboToEncoding(Global_AppEncoding));
  473. Settings.SetFilesEncoding(true, ComboToEncoding(Local_FilesEncoding));
  474. Settings.SetAppEncoding(true, ComboToEncoding(Local_AppEncoding));
  475. Settings.RevisionGridQuickSearchTimeout = (int)RevisionGridQuickSearchTimeout.Value;
  476. Settings.MulticolorBranches = MulticolorBranches.Checked;
  477. Settings.RevisionGraphDrawNonRelativesGray = DrawNonRelativesGray.Checked;
  478. Settings.RevisionGraphDrawNonRelativesTextGray = DrawNonRelativesTextGray.Checked;
  479. Settings.RevisionGraphShowWorkingDirChanges = chkShowCurrentChangesInRevisionGraph.Checked;
  480. Settings.ShowStashCount = chkShowStashCountInBrowseWindow.Checked;
  481. Settings.BranchBorders = BranchBorders.Checked;
  482. Settings.StripedBranchChange = StripedBanchChange.Checked;
  483. Settings.GraphColor = _NO_TRANSLATE_ColorGraphLabel.BackColor;
  484. Settings.TagColor = _NO_TRANSLATE_ColorTagLabel.BackColor;
  485. Settings.BranchColor = _NO_TRANSLATE_ColorBranchLabel.BackColor;
  486. Settings.RemoteBranchColor = _NO_TRANSLATE_ColorRemoteBranchLabel.BackColor;
  487. Settings.OtherTagColor = _NO_TRANSLATE_ColorOtherLabel.BackColor;
  488. Settings.DiffAddedColor = _NO_TRANSLATE_ColorAddedLineLabel.BackColor;
  489. Settings.DiffRemovedColor = _NO_TRANSLATE_ColorRemovedLine.BackColor;
  490. Settings.DiffAddedExtraColor = _NO_TRANSLATE_ColorAddedLineDiffLabel.BackColor;
  491. Settings.DiffRemovedExtraColor = _NO_TRANSLATE_ColorRemovedLineDiffLabel.BackColor;
  492. Settings.DiffFont = diffFont;
  493. Settings.DiffSectionColor = _NO_TRANSLATE_ColorSectionLabel.BackColor;
  494. Settings.IconColor = GetSelectedApplicationIconColor();
  495. Settings.IconStyle = IconStyle.Text;
  496. // Shell Extension settings
  497. Settings.ShellCascadeContextMenu = chkCascadedContextMenu.Checked;
  498. String l_ShellVisibleMenuItems = "";
  499. for (int i = 0; i < chlMenuEntries.Items.Count; i++)
  500. {
  501. if (chlMenuEntries.GetItemChecked(i))
  502. {
  503. l_ShellVisibleMenuItems += "1";
  504. }
  505. else
  506. {
  507. l_ShellVisibleMenuItems += "0";
  508. }
  509. }
  510. Settings.ShellVisibleMenuItems = l_ShellVisibleMenuItems;
  511. EnableSettings();
  512. if (!CanFindGitCmd())
  513. {
  514. if (MessageBox.Show(this, _cantFindGitMessage.Text, _cantFindGitMessageCaption.Text,
  515. MessageBoxButtons.YesNo) == DialogResult.Yes)
  516. return false;
  517. }
  518. else
  519. {
  520. handleCanFindGitCommand();
  521. }
  522. if (OpenSSH.Checked)
  523. GitCommandHelpers.UnsetSsh();
  524. if (Putty.Checked)
  525. GitCommandHelpers.SetSsh(PlinkPath.Text);
  526. if (Other.Checked)
  527. GitCommandHelpers.SetSsh(OtherSsh.Text);
  528. Settings.SaveSettings();
  529. return true;
  530. }
  531. private string GetSelectedApplicationIconColor()
  532. {
  533. if (BlueIcon.Checked)
  534. return "blue";
  535. if (LightblueIcon.Checked)
  536. return "lightblue";
  537. if (GreenIcon.Checked)
  538. return "green";
  539. if (PurpleIcon.Checked)
  540. return "purple";
  541. if (RedIcon.Checked)
  542. return "red";
  543. if (YellowIcon.Checked)
  544. return "yellow";
  545. if (RandomIcon.Checked)
  546. return "random";
  547. return "default";
  548. }
  549. private void handleCanFindGitCommand()
  550. {
  551. ConfigFile localConfig = Settings.Module.GetLocalConfig();
  552. ConfigFile globalConfig = GitCommandHelpers.GetGlobalConfig();
  553. if (string.IsNullOrEmpty(UserName.Text) || !UserName.Text.Equals(localConfig.GetValue("user.name")))
  554. localConfig.SetValue("user.name", UserName.Text);
  555. if (string.IsNullOrEmpty(UserEmail.Text) || !UserEmail.Text.Equals(localConfig.GetValue("user.email")))
  556. localConfig.SetValue("user.email", UserEmail.Text);
  557. localConfig.SetPathValue("core.editor", Editor.Text);
  558. localConfig.SetValue("merge.tool", LocalMergeTool.Text);
  559. if (KeepMergeBackup.CheckState == CheckState.Checked)
  560. localConfig.SetValue("mergetool.keepBackup", "true");
  561. else if (KeepMergeBackup.CheckState == CheckState.Unchecked)
  562. localConfig.SetValue("mergetool.keepBackup", "false");
  563. if (localAutoCrlfFalse.Checked) localConfig.SetValue("core.autocrlf", "false");
  564. if (localAutoCrlfInput.Checked) localConfig.SetValue("core.autocrlf", "input");
  565. if (localAutoCrlfTrue.Checked) localConfig.SetValue("core.autocrlf", "true");
  566. if (string.IsNullOrEmpty(GlobalUserName.Text) ||
  567. !GlobalUserName.Text.Equals(globalConfig.GetValue("user.name")))
  568. globalConfig.SetValue("user.name", GlobalUserName.Text);
  569. if (string.IsNullOrEmpty(GlobalUserEmail.Text) ||
  570. !GlobalUserEmail.Text.Equals(globalConfig.GetValue("user.email")))
  571. globalConfig.SetValue("user.email", GlobalUserEmail.Text);
  572. if (string.IsNullOrEmpty(CommitTemplatePath.Text) ||
  573. !CommitTemplatePath.Text.Equals(globalConfig.GetValue("commit.template")))
  574. globalConfig.SetValue("commit.template", CommitTemplatePath.Text);
  575. globalConfig.SetPathValue("core.editor", GlobalEditor.Text);
  576. SetGlobalDiffToolToConfig(globalConfig, GlobalDiffTool.Text);
  577. if (!string.IsNullOrEmpty(GlobalDiffTool.Text))
  578. globalConfig.SetPathValue(string.Format("difftool.{0}.path", GlobalDiffTool.Text), DifftoolPath.Text);
  579. if (!string.IsNullOrEmpty(GlobalDiffTool.Text))
  580. globalConfig.SetPathValue(string.Format("difftool.{0}.cmd", GlobalDiffTool.Text), DifftoolCmd.Text);
  581. globalConfig.SetValue("merge.tool", GlobalMergeTool.Text);
  582. if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
  583. globalConfig.SetPathValue(string.Format("mergetool.{0}.path", GlobalMergeTool.Text), MergetoolPath.Text);
  584. if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
  585. globalConfig.SetPathValue(string.Format("mergetool.{0}.cmd", GlobalMergeTool.Text), MergeToolCmd.Text);
  586. if (GlobalKeepMergeBackup.CheckState == CheckState.Checked)
  587. globalConfig.SetValue("mergetool.keepBackup", "true");
  588. else if (GlobalKeepMergeBackup.CheckState == CheckState.Unchecked)
  589. globalConfig.SetValue("mergetool.keepBackup", "false");
  590. if (globalAutoCrlfFalse.Checked) globalConfig.SetValue("core.autocrlf", "false");
  591. if (globalAutoCrlfInput.Checked) globalConfig.SetValue("core.autocrlf", "input");
  592. if (globalAutoCrlfTrue.Checked) globalConfig.SetValue("core.autocrlf", "true");
  593. Action<Encoding, bool, string> setEncoding = delegate(Encoding e, bool local, string name)
  594. {
  595. string value = e == null ? "" : e.HeaderName;
  596. if (local)
  597. localConfig.SetValue(name, value);
  598. else
  599. globalConfig.SetValue(name, value);
  600. };
  601. setEncoding(Settings.GetLogOutputEncoding(false), false, "i18n.logoutputencoding");
  602. setEncoding(Settings.GetLogOutputEncoding(true), true, "i18n.logoutputencoding");
  603. setEncoding(Settings.GetCommitEncoding(false), false, "i18n.commitEncoding");
  604. setEncoding(Settings.GetCommitEncoding(true), true, "i18n.commitEncoding");
  605. setEncoding(Settings.GetFilesEncoding(false), false, "i18n.filesEncoding");
  606. setEncoding(Settings.GetFilesEncoding(true), true, "i18n.filesEncoding");
  607. globalConfig.Save();
  608. //Only save local settings when we are inside a valid working dir
  609. if (Settings.Module.ValidWorkingDir())
  610. localConfig.Save();
  611. }
  612. private static string GetRegistryValue(RegistryKey root, string subkey, string key)
  613. {
  614. string value = null;
  615. try
  616. {
  617. RegistryKey registryKey = root.OpenSubKey(subkey, false);
  618. if (registryKey != null)
  619. {
  620. using (registryKey)
  621. {
  622. value = registryKey.GetValue(key) as string;
  623. }
  624. }
  625. }
  626. catch (UnauthorizedAccessException)
  627. {
  628. MessageBox.Show(_cantReadRegistry.Text);
  629. }
  630. return value ?? string.Empty;
  631. }
  632. private static void SetRegistryValue(RegistryKey root, string subkey, string key, string value)
  633. {
  634. try
  635. {
  636. value = value.Replace("\\", "\\\\");
  637. string reg = "Windows Registry Editor Version 5.00" + Environment.NewLine + Environment.NewLine + "[" + root +
  638. "\\" + subkey + "]" + Environment.NewLine + "\"" + key + "\"=\"" + value + "\"";
  639. TextWriter tw = new StreamWriter(Path.GetTempPath() + "GitExtensions.reg", false);
  640. tw.Write(reg);
  641. tw.Close();
  642. Settings.Module.RunCmd("regedit", "\"" + Path.GetTempPath() + "GitExtensions.reg" + "\"");
  643. }
  644. catch (UnauthorizedAccessException)
  645. {
  646. MessageBox.Show(String.Format(_cantReadRegistryAddEntryManually.Text, root, subkey, key, value));
  647. }
  648. }
  649. public bool CheckSettings()
  650. {
  651. bool bValid = true;
  652. try
  653. {
  654. // once a check fails, we want bValid to stay false
  655. bValid = CheckGitCmdValid();
  656. bValid = CheckGlobalUserSettingsValid() && bValid;
  657. bValid = CheckMergeTool() && bValid;
  658. bValid = CheckDiffToolConfiguration() && bValid;
  659. bValid = CheckTranslationConfigSettings() && bValid;
  660. if (Settings.RunningOnWindows())
  661. {
  662. bValid = CheckGitExtensionsInstall() && bValid;
  663. bValid = CheckGitExtensionRegistrySettings() && bValid;
  664. bValid = CheckGitExe() && bValid;
  665. bValid = CheckSSHSettings() && bValid;
  666. }
  667. }
  668. catch (Exception ex)
  669. {
  670. MessageBox.Show(this, ex.Message);
  671. }
  672. CheckAtStartup.Checked = getCheckAtStartupChecked(bValid);
  673. return bValid;
  674. }
  675. private static bool CanFindGitCmd()
  676. {
  677. return !string.IsNullOrEmpty(Settings.Module.RunGitCmd(""));
  678. }
  679. private void GitExtensionsInstall_Click(object sender, EventArgs e)
  680. {
  681. SolveGitExtensionsDir();
  682. CheckSettings();
  683. }
  684. public static bool SolveGitExtensionsDir()
  685. {
  686. string fileName = Settings.GetGitExtensionsDirectory();
  687. if (Directory.Exists(fileName))
  688. {
  689. Settings.SetInstallDir(fileName);
  690. return true;
  691. }
  692. return false;
  693. }
  694. private void ShellExtensionsRegistered_Click(object sender, EventArgs e)
  695. {
  696. string path = Path.Combine(Settings.GetInstallDir(), GitExtensionsShellExName);
  697. if (!File.Exists(path))
  698. {
  699. path = Assembly.GetAssembly(GetType()).Location;
  700. path = Path.GetDirectoryName(path);
  701. path = Path.Combine(path, GitExtensionsShellExName);
  702. }
  703. if (File.Exists(path))
  704. {
  705. Settings.Module.RunCmd("regsvr32", string.Format("\"{0}\"", path));
  706. }
  707. else
  708. {
  709. MessageBox.Show(this, string.Format(_cantRegisterShellExtension.Text, GitExtensionsShellExName));
  710. }
  711. CheckSettings();
  712. }
  713. private void UserNameSet_Click(object sender, EventArgs e)
  714. {
  715. tabControl1.SelectTab(tpGlobalSettings);
  716. }
  717. private static string GetMergeTool()
  718. {
  719. return Settings.Module.GetGlobalSetting("merge.tool");
  720. }
  721. private static bool IsMergeTool(string toolName)
  722. {
  723. return GetMergeTool().Equals(toolName,
  724. StringComparison.CurrentCultureIgnoreCase);
  725. }
  726. public static bool SolveMergeToolForKDiff()
  727. {
  728. string mergeTool = GetMergeTool();
  729. if (string.IsNullOrEmpty(mergeTool))
  730. {
  731. mergeTool = "kdiff3";
  732. Settings.Module.SetGlobalSetting("merge.tool", mergeTool);
  733. }
  734. if (mergeTool.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
  735. return SolveMergeToolPathForKDiff();
  736. return true;
  737. }
  738. public static bool SolveDiffToolForKDiff()
  739. {
  740. string diffTool = GetGlobalDiffToolFromConfig();
  741. if (string.IsNullOrEmpty(diffTool))
  742. {
  743. diffTool = "kdiff3";
  744. ConfigFile globalConfig = GitCommandHelpers.GetGlobalConfig();
  745. SetGlobalDiffToolToConfig(globalConfig, diffTool);
  746. globalConfig.Save();
  747. }
  748. if (diffTool.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
  749. return SolveDiffToolPathForKDiff();
  750. return true;
  751. }
  752. public static bool SolveDiffToolPathForKDiff()
  753. {
  754. string kdiff3path = MergeToolsHelper.FindPathForKDiff(Settings.Module.GetGlobalSetting("difftool.kdiff3.path"));
  755. if (string.IsNullOrEmpty(kdiff3path))
  756. return false;
  757. Settings.Module.SetGlobalPathSetting("difftool.kdiff3.path", kdiff3path);
  758. return true;
  759. }
  760. public static bool SolveMergeToolPathForKDiff()
  761. {
  762. string kdiff3path = MergeToolsHelper.FindPathForKDiff(Settings.Module.GetGlobalSetting("mergetool.kdiff3.path"));
  763. if (string.IsNullOrEmpty(kdiff3path))
  764. return false;
  765. Settings.Module.SetGlobalPathSetting("mergetool.kdiff3.path", kdiff3path);
  766. return true;
  767. }
  768. private void ResolveDiffToolPath()
  769. {
  770. string kdiff3path = MergeToolsHelper.FindPathForKDiff(Settings.Module.GetGlobalSetting("difftool.kdiff3.path"));
  771. if (string.IsNullOrEmpty(kdiff3path))
  772. return;
  773. kdiff3path = MergeToolsHelper.FindFileInFolders("kdiff3.exe", MergetoolPath.Text);
  774. if (string.IsNullOrEmpty(kdiff3path))
  775. return;
  776. DifftoolPath.Text = kdiff3path;
  777. }
  778. private void DiffToolCmdSuggest_Click(object sender, EventArgs e)
  779. {
  780. if (!Settings.RunningOnWindows())
  781. return;
  782. string exeName;
  783. string exeFile = MergeToolsHelper.FindDiffToolExeFile(GlobalDiffTool.Text, out exeName);
  784. if (String.IsNullOrEmpty(exeFile))
  785. {
  786. DifftoolPath.SelectAll();
  787. DifftoolPath.SelectedText = "";
  788. DifftoolCmd.SelectAll();
  789. DifftoolCmd.SelectedText = "";
  790. if (sender != null)
  791. MessageBox.Show(this, String.Format(_toolSuggestPath.Text, exeName),
  792. __diffToolSuggestCaption.Text);
  793. return;
  794. }
  795. DifftoolPath.SelectAll(); // allow Undo action
  796. DifftoolPath.SelectedText = exeFile;
  797. DifftoolCmd.SelectAll();
  798. DifftoolCmd.SelectedText = MergeToolsHelper.DiffToolCmdSuggest(GlobalDiffTool.Text, exeFile);
  799. }
  800. private void MergeToolCmdSuggest_Click(object sender, EventArgs e)
  801. {
  802. if (!Settings.RunningOnWindows())
  803. return;
  804. string exeName;
  805. string exeFile = MergeToolsHelper.FindMergeToolExeFile(GlobalMergeTool.Text, out exeName);
  806. if (String.IsNullOrEmpty(exeFile))
  807. {
  808. MergetoolPath.SelectAll();
  809. MergetoolPath.SelectedText = "";
  810. MergeToolCmd.SelectAll();
  811. MergeToolCmd.SelectedText = "";
  812. if (sender != null)
  813. MessageBox.Show(this, String.Format(_toolSuggestPath.Text, exeName),
  814. __mergeToolSuggestCaption.Text);
  815. return;
  816. }
  817. MergetoolPath.SelectAll(); // allow Undo action
  818. MergetoolPath.SelectedText = exeFile;
  819. MergeToolCmd.SelectAll();
  820. MergeToolCmd.SelectedText = MergeToolsHelper.MergeToolcmdSuggest(GlobalMergeTool.Text, exeFile);
  821. }
  822. private void AutoConfigMergeToolCmd(bool silent)
  823. {
  824. string exeName;
  825. string exeFile = MergeToolsHelper.FindMergeToolExeFile(GlobalMergeTool.Text, out exeName);
  826. if (String.IsNullOrEmpty(exeFile))
  827. {
  828. MergetoolPath.Text = "";
  829. MergeToolCmd.Text = "";
  830. if (!silent)
  831. MessageBox.Show(this, String.Format(_toolSuggestPath.Text, exeName),
  832. __mergeToolSuggestCaption.Text);
  833. return;
  834. }
  835. MergetoolPath.Text = exeFile;
  836. MergeToolCmd.Text = MergeToolsHelper.AutoConfigMergeToolCmd(GlobalMergeTool.Text, exeFile);
  837. }
  838. private void DiffToolFix_Click(object sender, EventArgs e)
  839. {
  840. if (string.IsNullOrEmpty(GetGlobalDiffToolFromConfig()))
  841. {
  842. if (MessageBox.Show(this, _noDiffToolConfigured.Text, _noDiffToolConfiguredCaption.Text,
  843. MessageBoxButtons.YesNo) == DialogResult.Yes)
  844. {
  845. SolveDiffToolForKDiff();
  846. GlobalDiffTool.Text = "kdiff3";
  847. }
  848. else
  849. {
  850. tabControl1.SelectTab(tpGlobalSettings);
  851. return;
  852. }
  853. }
  854. if (GetGlobalDiffToolFromConfig().Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
  855. {
  856. SolveDiffToolPathForKDiff();
  857. }
  858. if (GetGlobalDiffToolFromConfig().Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase) &&
  859. string.IsNullOrEmpty(Settings.Module.GetGlobalSetting("difftool.kdiff3.path")))
  860. {
  861. MessageBox.Show(this, _kdiff3NotFoundAuto.Text);
  862. tabControl1.SelectTab(tpGlobalSettings);
  863. return;
  864. }
  865. Rescan_Click(null, null);
  866. }
  867. private void MergeToolFix_Click(object sender, EventArgs e)
  868. {
  869. if (string.IsNullOrEmpty(GetMergeTool()))
  870. {
  871. if (
  872. MessageBox.Show(this, _noMergeToolConfigured.Text

Large files files are truncated, but you can click here to view the full file