Ejemplo n.º 1
0
    private static void DumpInstanceDefinition(InstanceDefinition instanceDefinition, ref TextLog dump, bool isRoot)
    {
        if (instanceDefinition != null && !instanceDefinition.IsDeleted)
        {
            string node = isRoot ? "─" : "└";
            dump.Print(string.Format("{0} Instance definition {1} = {2}\n", node, instanceDefinition.Index, instanceDefinition.Name));

            if (instanceDefinition.ObjectCount > 0)
            {
                dump.PushIndent();
                for (int i = 0; i < instanceDefinition.ObjectCount; i++)
                {
                    var obj = instanceDefinition.Object(i);
                    if (obj == null)
                    {
                        continue;
                    }
                    if (obj is InstanceObject)
                    {
                        DumpInstanceDefinition((obj as InstanceObject).InstanceDefinition, ref dump, false); // Recursive...
                    }
                    else
                    {
                        dump.Print("\u2514 Object {0} = {1}\n", i, obj.ShortDescription(false));
                    }
                }
                dump.PopIndent();
            }
        }
    }