/// <summary> /// Run the delegates for Element and Diagram for the current element. /// - changeScope.Item Only Element itself and Diagrams of element, not beneath element /// - changeScope... Element and all beneath Element /// </summary> /// <param name="rep"></param> /// <param name="el"></param> /// <param name="setEl"></param> /// <param name="setDia"></param> /// <param name="parameterStrings"></param> /// <param name="changeScope"></param> public static void DoRecursiveEl(Repository rep, EA.Element el, SetElement setEl, SetDiagram setDia, string[] parameterStrings, ChangeScope changeScope) { // perform change for element setEl?.Invoke(rep, el, parameterStrings); // perform changes for diagrams beneath element foreach (EA.Diagram dia in el.Diagrams) { if (dia != null) { setDia?.Invoke(rep, dia, parameterStrings); } } // only the item itself, no recursion if (changeScope == ChangeScope.Item) { return; } //run all elements foreach (EA.Element elTrgt in el.Elements) { DoRecursiveEl(rep, elTrgt, setEl, setDia, parameterStrings, changeScope); } }
public static void DoRecursivePkg(Repository rep, EA.Package pkg, SetPackage setPkg, SetElement setEl, SetDiagram setDia, string[] parameterStrings, ChangeScope changeScope) { // Change package setPkg?.Invoke(rep, pkg, parameterStrings); // only the package itself if (changeScope == ChangeScope.Item) { return; } // perform diagrams of package foreach (EA.Diagram dia in pkg.Diagrams) { if (dia != null) { setDia?.Invoke(rep, dia, parameterStrings); } } // run elements of package foreach (EA.Element el in pkg.Elements) { DoRecursiveEl(rep, el, setEl, setDia, parameterStrings, changeScope); } // run packages of package if (changeScope != ChangeScope.Item) { if (changeScope == ChangeScope.Package) { // inside package only the items changeScope = ChangeScope.Item; } foreach (EA.Package pkgTrgt in pkg.Packages) { DoRecursivePkg(rep, pkgTrgt, setPkg, setEl, setDia, parameterStrings, changeScope); } } }