From 7bba63fed1bfdb96bfda16781aca42f73c005355 Mon Sep 17 00:00:00 2001 From: Alfonso Jesus Flores Alvarado Date: Mon, 1 Oct 2018 10:44:10 -0500 Subject: [PATCH 1/2] Move code to a new function Improve code readability by moving code to a new private function. --- src/VS.ConfigurationManager/Bundle.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/VS.ConfigurationManager/Bundle.cs b/src/VS.ConfigurationManager/Bundle.cs index e9e48dc..608224b 100644 --- a/src/VS.ConfigurationManager/Bundle.cs +++ b/src/VS.ConfigurationManager/Bundle.cs @@ -179,13 +179,7 @@ public int Uninstall() Logger.Log("Bundle uninstall called and bundle is installed.", Logger.MessageLevel.Information, AppName); foreach (string file in Directory.GetFiles(LocalInstallLocation, "*.exe")) { - var bundlelogfilename = LogLocation + "_" + System.IO.Path.ChangeExtension(System.IO.Path.GetFileNameWithoutExtension(file), "log"); - Logger.Log(String.Format(CultureInfo.InvariantCulture, "Installer: {0}", file), Logger.MessageLevel.Information, AppName); - var args = String.Format(CultureInfo.InvariantCulture, BundleUninstallArguments, bundlelogfilename); - Logger.Log(String.Format(CultureInfo.InvariantCulture, "Arguments: {0}", args), Logger.MessageLevel.Information, AppName); - - Logger.LogWithOutput(string.Format("Uninstalling: {0}", file)); - exitcode = Utility.ExecuteProcess(file, args); + exitcode = ExecuteUninstallProcess(file); if (exitcode == 0) Logger.Log("Uninstall succeeded"); else @@ -205,5 +199,16 @@ public int Uninstall() return exitcode; } + + private int ExecuteUninstallProcess(string file) + { + var bundlelogfilename = LogLocation + "_" + System.IO.Path.ChangeExtension(System.IO.Path.GetFileNameWithoutExtension(file), "log"); + Logger.Log(String.Format(CultureInfo.InvariantCulture, "Installer: {0}", file), Logger.MessageLevel.Information, AppName); + var args = String.Format(CultureInfo.InvariantCulture, BundleUninstallArguments, bundlelogfilename); + Logger.Log(String.Format(CultureInfo.InvariantCulture, "Arguments: {0}", args), Logger.MessageLevel.Information, AppName); + + Logger.LogWithOutput(string.Format("Uninstalling: {0}", file)); + return Utility.ExecuteProcess(file, args); + } } } From 07f2eaed830ed4ef62ce6ff017a1a441e4589942 Mon Sep 17 00:00:00 2001 From: Alfonso Jesus Flores Alvarado Date: Mon, 1 Oct 2018 16:03:14 -0500 Subject: [PATCH 2/2] Fix indentation --- src/VS.ConfigurationManager/Bundle.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/VS.ConfigurationManager/Bundle.cs b/src/VS.ConfigurationManager/Bundle.cs index 608224b..48be243 100644 --- a/src/VS.ConfigurationManager/Bundle.cs +++ b/src/VS.ConfigurationManager/Bundle.cs @@ -201,14 +201,14 @@ public int Uninstall() } private int ExecuteUninstallProcess(string file) - { - var bundlelogfilename = LogLocation + "_" + System.IO.Path.ChangeExtension(System.IO.Path.GetFileNameWithoutExtension(file), "log"); - Logger.Log(String.Format(CultureInfo.InvariantCulture, "Installer: {0}", file), Logger.MessageLevel.Information, AppName); - var args = String.Format(CultureInfo.InvariantCulture, BundleUninstallArguments, bundlelogfilename); - Logger.Log(String.Format(CultureInfo.InvariantCulture, "Arguments: {0}", args), Logger.MessageLevel.Information, AppName); - - Logger.LogWithOutput(string.Format("Uninstalling: {0}", file)); - return Utility.ExecuteProcess(file, args); - } + { + var bundlelogfilename = LogLocation + "_" + System.IO.Path.ChangeExtension(System.IO.Path.GetFileNameWithoutExtension(file), "log"); + Logger.Log(String.Format(CultureInfo.InvariantCulture, "Installer: {0}", file), Logger.MessageLevel.Information, AppName); + var args = String.Format(CultureInfo.InvariantCulture, BundleUninstallArguments, bundlelogfilename); + Logger.Log(String.Format(CultureInfo.InvariantCulture, "Arguments: {0}", args), Logger.MessageLevel.Information, AppName); + + Logger.LogWithOutput(string.Format("Uninstalling: {0}", file)); + return Utility.ExecuteProcess(file, args); + } } }