private int CountPackages(EA.IDualPackage ParentPackage, bool includeInformative) { int counter = 0; if (includeInformative || !ParentPackage.Name.StartsWith("Inf")) { counter++; foreach (EA.IDualPackage child in ParentPackage.Packages) { counter += CountPackages(child, includeInformative); } } return(counter); }
private void RecursePackages(EA.IDualPackage ParentPackage, string path, bool includeInformative) { if (includeInformative || !ParentPackage.Name.StartsWith("Inf")) { progressBar1.Increment(1); System.Windows.Forms.Application.DoEvents(); string newpath = path + "/" + ParentPackage.Name; if (string.IsNullOrWhiteSpace(ParentPackage.Notes)) { MissingDescriptionInfo newinfo = new MissingDescriptionInfo() { Name = ParentPackage.Name, Path = path, Type = "Package" }; m_SortedDescriptions.Add(newinfo, newinfo); } foreach (EA.IDualElement e in ParentPackage.Elements) { if (e.Type == "Object" || e.Type == "Boundary" || e.Type == "Text") { } else //if (e.Type == "Class" || e.Type == "Enumeration") { if (string.IsNullOrWhiteSpace(e.Notes)) { MissingDescriptionInfo newinfo = new MissingDescriptionInfo() { Name = e.Name, Path = newpath, Type = e.Type }; m_SortedDescriptions.Add(newinfo, newinfo); } foreach (EA.IDualAttribute a in e.Attributes) { if (string.IsNullOrWhiteSpace(a.Notes)) { MissingDescriptionInfo newinfo = new MissingDescriptionInfo() { Name = a.Name, Path = newpath + "/" + e.Name, Type = "Attribute" }; m_SortedDescriptions.Add(newinfo, newinfo); } } if (e.Type == "Class") { foreach (EA.IDualConnector c in e.Connectors) { EA.IDualConnectorEnd cce = c.ClientEnd; EA.IDualElement targetc = m_Repository.GetElementByID(c.ClientID); EA.IDualElement targets = m_Repository.GetElementByID(c.SupplierID); if (string.IsNullOrWhiteSpace(cce.RoleNote) && !string.IsNullOrWhiteSpace(cce.Role)) { MissingDescriptionInfo newinfo = new MissingDescriptionInfo() { Name = cce.Role, Path = newpath + "/" + targets.Name, Type = "Role:" + cce.RoleType }; try { m_SortedDescriptions.Add(newinfo, newinfo); } catch { } } EA.IDualConnectorEnd cse = c.SupplierEnd; if (string.IsNullOrWhiteSpace(cse.RoleNote) && !string.IsNullOrWhiteSpace(cse.Role)) { MissingDescriptionInfo newinfo = new MissingDescriptionInfo() { Name = cse.Role, Path = newpath + "/" + targetc.Name, Type = "Role:" + cse.RoleType }; try { m_SortedDescriptions.Add(newinfo, newinfo); } catch { } } } } } } foreach (EA.IDualPackage child in ParentPackage.Packages) { RecursePackages(child, newpath, includeInformative); } } }