private void addToReport(List <object> report, BuildTracker tracker, List <object> thisSection, string newSectionName) { if (!thisSection.Any()) { return; } report.Add(tracker.CreateRelativeStructureElement(newSectionName, 2)); report.AddRange(thisSection); }
private static IEnumerable <object> getObjectsToReport(SimulationProperties simulationProperties, BuildTracker buildTracker, Func <CompoundProperties, object> objectSelectionFunc) { foreach (var compoundProperties in simulationProperties.CompoundPropertiesList) { var objectsToAdd = objectSelectionFunc(compoundProperties); if (objectsToAdd == null) { continue; } // We are creating a relative structural element two levels below for the current tracker because in the calling method, we have already added a structural element // that's 1 level below but the tracker has not been updated for that. yield return(buildTracker.CreateRelativeStructureElement(compoundProperties.Compound.Name, 2)); yield return(objectsToAdd); } }