/// <summary> /// Throws DiffToolNotInstalledException if diff tool is not installed /// Throws DiffToolIntegrationException if integration failed /// </summary> public void Integrate(IIntegratedDiffTool diffTool, string self) { AppFinder.AppInfo appInfo = AppFinder.GetApplicationInfo(diffTool.GetToolRegistryNames()); if (appInfo == null || !isInstalled(appInfo.InstallPath)) { throw new DiffToolNotInstalledException("Diff tool not installed"); } string toolpath = appInfo.InstallPath; Trace.TraceInformation(String.Format("Diff Tool installed at: {0}", toolpath)); registerInGit(diffTool, toolpath); try { registerInTool(diffTool, self); } catch (DiffToolIntegrationException) { Trace.TraceError(String.Format("Cannot register the application in \"{0}\"", Constants.GitDiffToolName)); try { string key = String.Format("difftool.{0}.cmd", Constants.GitDiffToolName); GitTools.SetConfigKeyValue(GitTools.ConfigScope.Global, key, null, String.Empty); } catch (ExternalProcessSystemException) { Trace.TraceError(String.Format("Cannot remove \"{0}\" from git config", Constants.GitDiffToolName)); } catch (ExternalProcessFailureException) { Trace.TraceError(String.Format("Cannot remove \"{0}\" from git config", Constants.GitDiffToolName)); } throw; } }
private string getToolPath(IIntegratedDiffTool diffTool) { return(getInstallPath(diffTool.GetToolRegistryNames())); }