scheduler installer fix

This commit is contained in:
a.skorina 2014-12-15 11:35:56 +03:00
parent bc94c24ca4
commit 08de3dd338
2 changed files with 52 additions and 6 deletions

View file

@ -34,6 +34,7 @@ using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text.RegularExpressions;
using System.Threading;
using Microsoft.Deployment.WindowsInstaller;
using WebsitePanel.Setup;
@ -69,6 +70,14 @@ namespace WebsitePanel.SchedulerServiceInstaller
return ActionResult.Success;
}
[CustomAction]
public static ActionResult FinalizeUnInstall(Session session)
{
UnInstallService();
return ActionResult.Success;
}
private static void InstallService(string installFolder)
{
try
@ -93,6 +102,26 @@ namespace WebsitePanel.SchedulerServiceInstaller
}
}
private static void UnInstallService()
{
try
{
var schedulerService =
ServiceController.GetServices().FirstOrDefault(
s => s.DisplayName.Equals("WebsitePanel Scheduler", StringComparison.CurrentCultureIgnoreCase));
if (schedulerService != null)
{
StopService(schedulerService.ServiceName);
SecurityUtils.DeleteService(schedulerService.ServiceName);
}
}
catch (Exception)
{
}
}
private static void ChangeCryptoKey(string installFolder)
{
string path = Path.Combine(installFolder.Replace("SchedulerService", "Enterprise Server"), "web.config");