/// <summary> /// Runs the algorithm. /// </summary> public sealed override bool Run(Core core, ProgressReporter prog) { this.ClearResults(); try { this.OnRun(core, prog); } catch (Exception ex) { this.SetError(ex); prog.Log($"The following algorithm failed to complete: {{{this}}} due to the error {{{ex.Message}}}. Please see the algorithm results for specific details.", ELogLevel.Error); } switch (this.Status) { case EAlgoStatus.Completed: return(true); case EAlgoStatus.Failed: return(false); default: throw new ArgumentOutOfRangeException($"Expected Status to be Completed or Failed after {{{nameof( this.OnRun )}}} called, but {{{nameof( this.Status)}}} is {{{this.Status}}}."); } }
private bool GenericUpdate <T>(string title, List <T> current, ProgressReporter info) where T : ConfigurationBase { bool result = false; // Report using (info.Section(title)) { foreach (T item in current) { if (item.NeedsUpdate) { using (info.Section(item.DisplayName)) { result = true; info.Log($"Updating: {item.DisplayName}", ELogLevel.Information); item.Run(this, info); } } } } return(result); }