Ejemplo n.º 1
0
 public static IEnumerable EnumerateFields(this INoggolloquyObjectGetter obj)
 {
     for (ushort i = 0; i < obj.FieldCount; i++)
     {
         yield return(obj.GetNthObject(i));
     }
 }
Ejemplo n.º 2
0
        private static string PrintPrettyInternal(this INoggolloquyObjectGetter nogg, DepthPrinter depthPrinter)
        {
            depthPrinter.AddLine("[");
            using (depthPrinter.IncrementDepth())
            {
                for (ushort i = 0; i < nogg.FieldCount; i++)
                {
                    var obj = nogg.GetNthObject(i);
                    if (nogg.GetNthIsEnumerable(i))
                    {
                        if (obj is IEnumerable listObj)
                        {
                            bool hasItems = listObj.Any();
                            depthPrinter.AddLine(nogg.GetNthName(i) + " => " + (hasItems ? string.Empty : "[ ]"));
                            if (hasItems)
                            {
                                depthPrinter.AddLine("[");
                                using (depthPrinter.IncrementDepth())
                                {
                                    foreach (var listItem in listObj)
                                    {
                                        if (nogg.GetNthIsNoggolloquy(i))
                                        {
                                            if (listItem is INoggolloquyObjectGetter subNogg)
                                            {
                                                depthPrinter.AddLine(PrintNoggName(nogg, i));
                                                PrintPrettyInternal(subNogg, depthPrinter);
                                            }
                                            continue;
                                        }

                                        depthPrinter.AddLine(obj.ToStringSafe() + ",");
                                    }
                                }
                                depthPrinter.AddLine("]");
                            }
                        }
                        continue;
                    }

                    if (nogg.GetNthIsNoggolloquy(i))
                    {
                        if (obj is INoggolloquyObjectGetter subNogg)
                        {
                            depthPrinter.AddLine(PrintNoggName(nogg, i));
                            PrintPrettyInternal(subNogg, depthPrinter);
                        }
                        continue;
                    }

                    depthPrinter.AddLine(nogg.GetNthName(i) + ": " + obj.ToStringSafe());
                }
            }
            depthPrinter.AddLine("]");
            return(depthPrinter.ToString());
        }
Ejemplo n.º 3
0
 private static string PrintNoggName(INoggolloquyObjectGetter obj, ushort i)
 {
     return(obj.GetNthName(i) + "(" + obj.GetNthType(i).Name + ")" + " => ");
 }
Ejemplo n.º 4
0
 public static string PrintPretty(this INoggolloquyObjectGetter obj, DepthPrinter depthPrinter)
 {
     depthPrinter.AddLine(obj.NoggolloquyName + "=>");
     return(PrintPrettyInternal(obj, depthPrinter));
 }
Ejemplo n.º 5
0
 public static string PrintPretty(this INoggolloquyObjectGetter obj)
 {
     return(obj.PrintPretty(new DepthPrinter()));
 }
Ejemplo n.º 6
0
 public static bool HasFieldWithName(this INoggolloquyObjectGetter obj, StringCaseAgnostic name)
 {
     return(-1 != obj.GetNameIndex(name));
 }
Ejemplo n.º 7
0
 private static void PrintItem(INoggolloquyObjectGetter nogg, ushort i, object o, DepthPrinter dp)
 {
 }