Exemplo n.º 1
0
        private void PrintJson(IPrintContext context)
        {
            context.Indent();
            context.Write('{');
            context.WriteLine();

            using (context.IncreaseDepth())
            {
                for (var index = 0; index < properties.Length; index++)
                {
                    context.Indent();

                    properties[index].Print(context);

                    if (index < properties.Length - 1)
                    {
                        context.Write(',');
                    }

                    context.WriteLine();
                }
            }

            context.Indent();
            context.Write('}');
        }
Exemplo n.º 2
0
        private void PrintJson(IPrintContext context)
        {
            context.Indent();
            context.Write('[');
            context.WriteLine();

            using (context.IncreaseDepth())
            {
                for (var index = 0; index < elements.Count; index++)
                {
                    context.Indent();

                    elements[index].Print(context);

                    if (index < elements.Count - 1)
                    {
                        context.Write(',');
                    }

                    context.WriteLine();
                }
            }

            context.Indent();
            context.Write(']');
        }
Exemplo n.º 3
0
        private void PrintYaml(IPrintContext context)
        {
            for (var index = 0; index < properties.Length; index++)
            {
                context.Indent();

                properties[index].Print(context);

                if (index < properties.Length - 1)
                {
                    context.WriteLine();
                }
            }
        }
Exemplo n.º 4
0
        private void PrintYaml(IPrintContext context)
        {
            for (var index = 0; index < elements.Count; index++)
            {
                context.Indent();
                context.Write("- ");

                var element = elements[index];
                if (element is ObjectToken || element is SequenceToken)
                {
                    context.WriteLine();
                }

                using (context.IncreaseDepth())
                    element.Print(context);

                if (index < elements.Count - 1)
                {
                    context.WriteLine();
                }
            }
        }