mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.7 KiB
77 lines
2.7 KiB
using System;
|
|
using System.Collections;
|
|
|
|
namespace ZeroLevel.Services.AsService
|
|
{
|
|
public class TransactedInstaller
|
|
: Installer
|
|
{
|
|
public override void Install(IDictionary savedState)
|
|
{
|
|
if (base.Context == null)
|
|
{
|
|
base.Context = new InstallContext();
|
|
}
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoTransacted"));
|
|
try
|
|
{
|
|
bool flag = true;
|
|
try
|
|
{
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoBeginInstall"));
|
|
base.Install(savedState);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
flag = false;
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoException"));
|
|
Installer.LogException(ex, base.Context);
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoBeginRollback"));
|
|
try
|
|
{
|
|
this.Rollback(savedState);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoRollbackDone"));
|
|
throw new InvalidOperationException(Res.GetString("InstallRollback"), ex);
|
|
}
|
|
if (flag)
|
|
{
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoBeginCommit"));
|
|
try
|
|
{
|
|
this.Commit(savedState);
|
|
}
|
|
finally
|
|
{
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoCommitDone"));
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoTransactedDone"));
|
|
}
|
|
}
|
|
|
|
public override void Uninstall(IDictionary savedState)
|
|
{
|
|
if (base.Context == null)
|
|
{
|
|
base.Context = new InstallContext();
|
|
}
|
|
base.Context.LogMessage(Environment.NewLine + Environment.NewLine + Res.GetString("InstallInfoBeginUninstall"));
|
|
try
|
|
{
|
|
base.Uninstall(savedState);
|
|
}
|
|
finally
|
|
{
|
|
base.Context.LogMessage(Environment.NewLine + Res.GetString("InstallInfoUninstallDone"));
|
|
}
|
|
}
|
|
}
|
|
}
|