Пример #1
0
 static void Traverse(this glTF self, ListTreeNode <JsonValue> node, JsonFormatter f, Utf8String parentKey)
 {
     if (node.IsMap())
     {
         f.BeginMap();
         foreach (var kv in node.ObjectItems())
         {
             if (parentKey == s_extensions)
             {
                 if (!self.UsedExtension(kv.Key.GetString()))
                 {
                     continue;
                 }
             }
             f.Key(kv.Key.GetUtf8String());
             self.Traverse(kv.Value, f, kv.Key.GetUtf8String());
         }
         f.EndMap();
     }
     else if (node.IsArray())
     {
         f.BeginList();
         foreach (var x in node.ArrayItems())
         {
             self.Traverse(x, f, default(Utf8String));
         }
         f.EndList();
     }
     else
     {
         f.Value(node);
     }
 }
Пример #2
0
        static string RemoveUnusedExtensions(this glTF self, string json)
        {
            var f = new JsonFormatter();

            self.Traverse(JsonParser.Parse(json), f, default(Utf8String));
            return(f.ToString());
        }