Ejemplo n.º 1
0
        internal static int StepExecuter(IEnumerable <IInstallationStep> procedure, IsCanceledHandler isCanceled, bool bInterruptOnReportError = true)
        {
            try
            {
                foreach (var step in procedure)
                {
                    if (isCanceled())
                    {
                        return(1); // canceled
                    }

                    InstallUtils.SafeCallInterruptable(bInterruptOnReportError, () => step.Init());

                    step.Perform();

                    InstallUtils.SafeCallInterruptable(bInterruptOnReportError, () => step.Report());
                }
            }
            catch (GenericException ex)
            {
                // report installation failure

                InstallUtils.SafeCallInterruptable(false, () => ex.Report());

                return(-1);
            }

            // report success

            return(0);
        }
Ejemplo n.º 2
0
 public static int RunUpdate(IsCanceledHandler isCanceled, params string[] args)
 {
     CommunicationUtils.CurrentScenario = CommunicationUtils.Scenarion.Update;
     return(StepExecuter(GetUpdateProcedure(args), isCanceled));
 }
Ejemplo n.º 3
0
 internal static int RunInstallation(IsCanceledHandler isCanceled, params string[] args)
 {
     CommunicationUtils.CurrentScenario = CommunicationUtils.Scenarion.Install;
     return(StepExecuter(GetInstallationProcedure(args), isCanceled));
 }
Ejemplo n.º 4
0
 internal static int RunUninstall(IsCanceledHandler isCanceled, params string[] args)
 {
     CommunicationUtils.CurrentScenario = CommunicationUtils.Scenarion.Uninstall;
     return(StepExecuter(GetUnInstallationProcedure(args), isCanceled, false)); // uninstall will not fail if the report cannot be sent
 }