public static int[] GonToIntArray(GonObject gon)
 {
     int[] ret = new int[gon.Size()];
     for (int i = 0; i < gon.Size(); i++)
     {
         ret[i] = gon[i].Int();
     }
     return(ret);
 }
 public static string[][] GonTo2DStringArray(GonObject gon)
 {
     try
     {
         string[][] ret = new string[gon.Size()][];
         for (int i = 0; i < gon.Size(); i++)
         {
             ret[i] = GonToStringArray(gon[i]);
         }
         return(ret);
     }
     catch (GonException ge)
     {
         Console.Write(ge);
         throw;
     }
 }
            public static GonObject PriorityMerge(GonObject low, GonObject high)
            {
                // create new gonObject to return
                GonObject ret = new GonObject();

                // iterate over the low-priority object's children
                for (int i = 0; i < low.Size(); i++)
                {
                    string childName = low[i].Name;
                    var    lowChild  = low[childName];

                    // step into if the same child exists in high priority object
                    if (high[childName] != null)
                    {
                        var highChild = high[childName];

                        // special case for art_alts
                        if (childName == "art_alts")
                        {
                            ret.InsertChild("art_alts", ArtAltsMerge(lowChild, highChild));
                        }

                        // recurse if type is object
                        else if (lowChild.Type == FieldType.OBJECT && highChild.Type == FieldType.OBJECT)
                        {
                            ret.InsertChild(PriorityMerge(lowChild, highChild));
                        }

                        // otherwise just use the high-priority child
                        else
                        {
                            ret.InsertChild(highChild);
                        }
                    }
                    else
                    {
                        ret.InsertChild(lowChild);  // if no high-priority child available, use low-priority child
                    }
                }

                // iterate over high-priority object's children
                // copy those that do not already exist in low-priority object to return object
                for (int i = 0; i < high.Size(); i++)
                {
                    string childName = high[i].Name;

                    if (low[childName] == null)
                    {
                        ret.InsertChild(high[childName]);
                    }
                }
                return(ret);
            }
        static Dictionary <int, int[]> LoadDictionary(GonObject gon)
        {
            var dict = new Dictionary <int, int[]>();

            for (int i = 0; i < gon.Size(); i++)
            {
                var   item = gon[i];
                int   id   = item["id"].Int();
                int[] alts = GonObject.Manip.GonToIntArray(item["alts"]);

                dict.Add(id, alts);
            }
            return(dict);
        }