Ejemplo n.º 1
0
        private static void PrintNodes(Handle baseHandle, HandleGroup g)
        {
            var defNames     = Elements.GetDefNames(baseHandle);
            var virtualNodes = Records.GetNodes(baseHandle);
            var elementArray = g.AddHandles(Records.GetNodeElements(virtualNodes, baseHandle));

            PrintStructNodes(virtualNodes, 0, defNames, elementArray, g);
            Meta.ReleaseNodes(virtualNodes);
        }
Ejemplo n.º 2
0
 private static void PrintArrayNodes(Handle virtualNodes, Int32 depth, String[] defNames, Handle[] elementArray, HandleGroup g)
 {
     foreach (var t in elementArray)
     {
         var doesntExist = t == 0;
         var valueType   = doesntExist ? Elements.ValueTypes.VtNoValue : Elements.ValueType(t);
         var isFlags     = valueType == Elements.ValueTypes.VtFlags;
         var canExpand   = !doesntExist && !isFlags && Elements.ElementCount(t) > 0;
         Console.WriteLine($"{new String(' ', depth * 4)}{defNames[0]} - {valueType:G}");
         if (valueType == Elements.ValueTypes.VtFlags)
         {
             Console.WriteLine(
                 $"{new String(' ', depth * 4)}{defNames[0]} type is : {Elements.DefType(t):G} and value is : {String.Join(", ", ElementValues.GetEnabledFlags(t))}");
             Console.WriteLine(
                 $"{new String(' ', depth * 4)}All possible flag values are : {String.Join(", ", ElementValues.GetAllFlags(t))}");
         }
         else if (!canExpand && !doesntExist)
         {
             Console.WriteLine(
                 $"{new String(' ', depth * 4)}{defNames[0]} type is : {Elements.DefType(t):G} and value is : {ElementValues.GetValue(t)}");
         }
         else if (canExpand)
         {
             var expandDefNames     = Elements.GetDefNames(t);
             var expandElementArray = g.AddHandles(Records.GetNodeElements(virtualNodes, t));
             if (valueType == Elements.ValueTypes.VtArray)
             {
                 PrintArrayNodes(virtualNodes, depth + 1, expandDefNames, expandElementArray, g);
             }
             else
             {
                 PrintStructNodes(virtualNodes, depth + 1, expandDefNames, expandElementArray, g);
             }
         }
     }
 }