/// <summary> /// Manages instruction execution /// </summary> /// <param name="currentLogger">Logger to write execution events (optional)</param> /// <returns>A run result</returns> public PatchHelper.RunResult Run(Log currentLogger) { PatchHelper.RunResult runResult = PatchHelper.RunResult.OK; try { // Instruction _Process(); } catch (Exception ex) { // Error logged Exception2.PrintStackTrace(ex); if (currentLogger != null) { currentLogger.WriteEvent(string.Format(_MSG_SPOTTED_EXCEPTION, ex.Message)); } if (FailOnError) { runResult = PatchHelper.RunResult.RunWithErrors; } else { runResult = PatchHelper.RunResult.RunWithWarnings; } } return(runResult); }
/// <summary> /// What the task must do /// </summary> internal static void Run() { try { // Running PatchHelper.RunResult result = PatchHelper.RunPatch(InstallHelper.CurrentPatch, InstallHelper.Log, Application.StartupPath, InstallHelper.Culture, InstallHelper.InstallGroups); // Result analysis switch (result) { case PatchHelper.RunResult.NotRun: throw new Exception(_WARNING_NO_INSTRUCTION); case PatchHelper.RunResult.RunWithErrors: throw new Exception(_MESSAGE_PATCH_ERROR); case PatchHelper.RunResult.RunWithWarnings: // Not critical PatchHelper.AddMessage(_MESSAGE_PATCH_WARNINGS); break; default: break; } } catch (Exception ex) { // Critical error string errorMessage = string.Format(_ERROR_RUN_FAILED, ex.Message); throw new Exception(errorMessage, ex); } }