void Traverse(ListTreeNode <JsonValue> node, JsonFormatter f, Utf8String parentKey) { if (node.IsMap()) { f.BeginMap(); foreach (var kv in node.ObjectItems()) { if (parentKey == s_extensions) { if (!UsedExtension(kv.Key.GetString())) { continue; } } f.Key(kv.Key.GetUtf8String()); Traverse(kv.Value, f, kv.Key.GetUtf8String()); } f.EndMap(); } else if (node.IsArray()) { f.BeginList(); foreach (var x in node.ArrayItems()) { Traverse(x, f, default(Utf8String)); } f.EndList(); } else { f.Value(node); } }
static void Traverse(ListTreeNode <JsonValue> node, JsonFormatter f, UnityPath dir) { if (node.IsArray()) { f.BeginList(); foreach (var x in node.ArrayItems()) { TraverseItem(x, f, dir); } f.EndList(); } else if (node.IsMap()) { f.BeginMap(); foreach (var kv in node.ObjectItems()) { f.Key(kv.Key.GetUtf8String()); TraverseItem(kv.Value, f, dir); } f.EndMap(); } else { f.Value(node); } }
public void Dispatch(ListTreeNode <MsgPackValue> parsed) { if (!parsed.IsArray()) { return; } if (parsed.GetArrayCount() != 3) { return; } if (parsed[0].GetInt32() != MsgPackFormatter.NOTIFY_TYPE) { return; } Notify(parsed[1].GetUtf8String(), parsed[2]); }
TreeNode Traverse(TreeNodeCollection parent, string key, ListTreeNode <JsonValue> node) { if (node.IsArray()) { var current = new TreeNode($"{key}({node.GetArrayCount()})"); parent.Add(current); m_nodeMap.Add(current, node); int i = 0; foreach (var x in node.ArrayItems()) { Traverse(current.Nodes, (i++).ToString(), x); } return(current); } else if (node.IsMap()) { var current = new TreeNode(key); parent.Add(current); m_nodeMap.Add(current, node); foreach (var kv in node.ObjectItems()) { Traverse(current.Nodes, kv.Key.GetString(), kv.Value); } return(current); } else { var current = new TreeNode($"{key}: {node.ToString()}"); parent.Add(current); m_nodeMap.Add(current, node); return(current); } }