Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Move code to a new function #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/VS.ConfigurationManager/Bundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -205,5 +199,16 @@ public int Uninstall()

return exitcode;
}

private int ExecuteUninstallProcess(string file)
ajesusflores marked this conversation as resolved.
Show resolved Hide resolved
{
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);
ajesusflores marked this conversation as resolved.
Show resolved Hide resolved
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);
}
}
}