Example #1
0
        /* Display an entity hierarchy as a string */
        public static string HierarchyToString(List <cGUID> hierarchy)
        {
            CathodeFlowgraph currentFlowgraphToSearch = CurrentInstance.selectedFlowgraph;
            CathodeEntity    entity         = null;
            string           combinedString = "";

            for (int i = 0; i < hierarchy.Count; i++)
            {
                if (hierarchy[i] == new cGUID("00-00-00-00"))
                {
                    break;
                }
                entity = currentFlowgraphToSearch.GetEntityByID(hierarchy[i]);
                if (entity != null)
                {
                    combinedString += NodeDBEx.GetEntityName(entity.nodeID) + " -> ";
                }
                if (entity != null && entity.variant == EntityVariant.FUNCTION)
                {
                    CathodeFlowgraph flowRef = CurrentInstance.commandsPAK.GetFlowgraph(((FunctionEntity)entity).function);
                    if (flowRef != null)
                    {
                        currentFlowgraphToSearch = flowRef;
                    }
                }
            }
            if (combinedString.Length >= 4)
            {
                combinedString = combinedString.Substring(0, combinedString.Length - 4);
            }
            return(combinedString);
        }
Example #2
0
        /* Resolve a node hierarchy */
        public static CathodeEntity ResolveHierarchy(List <cGUID> hierarchy, out CathodeFlowgraph containedFlowgraph)
        {
            CathodeFlowgraph currentFlowgraphToSearch = CurrentInstance.selectedFlowgraph;
            CathodeEntity    entity = null;

            for (int i = 0; i < hierarchy.Count; i++)
            {
                if (hierarchy[i] == new cGUID("00-00-00-00"))
                {
                    break;
                }
                entity = currentFlowgraphToSearch.GetEntityByID(hierarchy[i]);
                if (entity != null && entity.variant == EntityVariant.FUNCTION)
                {
                    CathodeFlowgraph flowRef = CurrentInstance.commandsPAK.GetFlowgraph(((FunctionEntity)entity).function);
                    if (flowRef != null)
                    {
                        currentFlowgraphToSearch = flowRef;
                    }
                }
            }
            containedFlowgraph = currentFlowgraphToSearch;
            return(entity);
        }