protected override TsonNode VisitObject(TsonObjectNodeBase node)
        {
            var e = node.GetEnumerator();
            bool addComma = false;

            sb.Append("{ ");

            while (e.MoveNext())
            {
                var kv = e.Current;

                if (addComma)
                    sb.Append(", ");
                else
                    addComma = true;

                Visit(kv.Key);
                sb.Append(": ");
                Visit(kv.Value);
            }

            sb.Append(" }");

            return node;
        }
        protected override TsonNode VisitRootObject(TsonObjectNodeBase node)
        {
            action(node);

            foreach (var childNode in node)
            {
                Visit(childNode.Key);
                Visit(childNode.Value);
            }

            return node;
        }
        protected override TsonNode VisitObject(TsonObjectNodeBase node)
        {
            var e = node.GetEnumerator();

            sb.Append("<object>");

            while (e.MoveNext())
            {
                var kv = e.Current;

                sb.AppendFormat("<{0}>", kv.Key.Value);
                Visit(kv.Value);
                sb.AppendFormat("</{0}>", kv.Key.Value);
            }

            sb.Append("</object>");

            return node;
        }
 protected override TsonNode VisitRootObject(TsonObjectNodeBase node)
 {
     return VisitObject(node);
 }
        protected override TsonNode VisitObject(TsonObjectNodeBase node)
        {
            var e = node.GetEnumerator();
            bool addComma = false;

            sb.Append(indent);
            sb.AppendLine("{");
            Indent();

            while (e.MoveNext())
            {
                var kv = e.Current;

                if (addComma)
                    sb.AppendLine(",");
                else
                    addComma = true;

                sb.Append(indent);
                Visit(kv.Key);

                if (kv.Value.IsObject || kv.Value.IsArray)
                {
                    sb.AppendLine(":");
                }
                else
                {
                    sb.Append(": ");
                }

                Visit(kv.Value);
            }

            sb.AppendLine();
            Outdent();
            sb.Append(indent);
            sb.Append("}");

            return node;
        }
Exemple #6
0
 protected virtual TsonNode VisitRootObject(TsonObjectNodeBase node)
 {
     return node;
 }