/// <summary> /// Get a dictionary of all DtoAttributeTopologies. /// </summary> /// <param name="integrationBase"></param> /// <param name="tenant"></param> /// <returns></returns> public static Dictionary <Guid, DtoAttributeTopology> ReadAttributeTopology(IntegrationBase integrationBase, bool tenant = false) { DtoAttributeTopology topology = integrationBase.ApiCore.GetAttributes(tenant); Dictionary <Guid, DtoAttributeTopology> dictionary = new Dictionary <Guid, DtoAttributeTopology>(); WalkToTree(topology, ref dictionary); return(dictionary); }
private static void WalkToTree(DtoAttributeTopology topology, ref Dictionary <Guid, DtoAttributeTopology> dictionary) { if (topology != null && topology.Children != null) { foreach (DtoAttributeTopology child in topology.Children) { if (!dictionary.ContainsKey(child.Id)) { dictionary.Add(child.Id, child); } else { #if DEBUG Trace.WriteLine("WalkToTree - Unexpected branch"); #endif } if (child.Children != null) { WalkToTree(child, ref dictionary); } } } }