public int Uninstall()
{
var exitcode = -1;
try
{
Logger.Log("Bundle uninstall started.", Logger.MessageLevel.Information, AppName);
Logger.Log(String.Format(CultureInfo.InvariantCulture, "this.Installed: {0}", this.Installed), Logger.MessageLevel.Information, AppName);
if (this.Installed)
{
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);
if (exitcode == 0)
Logger.Log("Uninstall succeeded");
else
{
Logger.Log(String.Format(CultureInfo.InvariantCulture, "Uninstall failed with error code: {0}", exitcode), Logger.MessageLevel.Warning, AppName);
break;
}
}
}
}
catch (Exception ex)
{
Logger.Log(ex);
}
Logger.Log("Bundle uninstall ended.", Logger.MessageLevel.Information, AppName);
return exitcode;
}