FlatRedBall.Glue.ProjectManager.InheritanceVerificationHelper C# (CSharp) Method

InheritanceVerificationHelper() private static method

private static InheritanceVerificationHelper ( INamedObjectContainer &node, string &cycleString ) : CheckResult
node INamedObjectContainer
cycleString string
return CheckResult
        private static CheckResult InheritanceVerificationHelper(ref INamedObjectContainer node, ref string cycleString)
        {
            //Assign the current VerificationId to identify nodes that have been visited
            node.VerificationIndex = VerificationId;

            //Travel upward through the inheritence tree from this object, stopping when either the
            //tree stops, or you reach a node that's already been visited.
            if (!string.IsNullOrEmpty(node.BaseObject))
            {
                INamedObjectContainer baseNode = ObjectFinder.Self.GetNamedObjectContainer(node.BaseObject);

                if (baseNode == null)
                {
                    // We do nothing - the base object for this
                    // Entity doesn't exist, so we'll continue as if this thing doesn't really have
                    // a base Entity.  The user will have to address this in the Glue UI
                }
                else if (baseNode.VerificationIndex != VerificationId)
                {

                    //If baseNode verification failed, add this node's name to the list and return Failed
                    if (InheritanceVerificationHelper(ref baseNode, ref cycleString) == CheckResult.Failed)
                    {
                        cycleString = (node as FlatRedBall.Utilities.INameable).Name + "\n" + cycleString;
                        return CheckResult.Failed;
                    }

                }
                else
                {
                    //If the basenode has already been visited, begin the cycleString and return Failed

                    cycleString = (node as FlatRedBall.Utilities.INameable).Name + "\n" +
                                    (baseNode as FlatRedBall.Utilities.INameable).Name + "\n";

                    return CheckResult.Failed;
                }
            }


            return CheckResult.Passed;
        }