public void Execute(JsonFormatterStrategyContext context)
        {
            if (!context.IsProcessingDoubleQuoteInitiatedString && !context.WasLastCharacterABackSlash)
                context.IsProcessingSingleQuoteInitiatedString = !context.IsProcessingSingleQuoteInitiatedString;

            context.AppendCurrentChar();
        }
 public void Execute(JsonFormatterStrategyContext context)
 {
     if (context.IsProcessingString)
     {
         context.AppendCurrentChar();
     }
 }
Exemplo n.º 3
0
 public void Execute(JsonFormatterStrategyContext context)
 {
     if (context.IsProcessingString)
     {
         context.AppendCurrentChar();
     }
 }
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (!context.IsProcessingSingleQuoteInitiatedString && !context.WasLastCharacterABackSlash)
            {
                context.IsProcessingDoubleQuoteInitiatedString = !context.IsProcessingDoubleQuoteInitiatedString;
            }

            context.AppendCurrentChar();
        }
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            PeformNonStringPrint(context);
        }
Exemplo n.º 6
0
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            PeformNonStringPrint(context);
        }
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            context.CloseCurrentScope();
            context.BuildContextIndents();
            context.AppendCurrentChar();
        }
Exemplo n.º 8
0
        public void Execute(JsonFormatterStrategyContext context)
        {
            context.AppendCurrentChar();

            if (context.IsProcessingString)
            {
                return;
            }

            context.BuildContextIndents();
            context.IsProcessingVariableAssignment = false;
        }
Exemplo n.º 9
0
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            context.CloseCurrentScope();
            context.BuildContextIndents();
            context.AppendCurrentChar();
        }
        public void Execute(JsonFormatterStrategyContext context)
        {
            context.AppendCurrentChar();

            if (context.IsProcessingString)
            {
                return;
            }

            context.BuildContextIndents();
            context.IsProcessingVariableAssignment = false;
        }
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            context.IsProcessingVariableAssignment = true;
            context.AppendCurrentChar();
            context.AppendSpace();
        }
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            context.IsProcessingVariableAssignment = true;
            context.AppendCurrentChar();
            context.AppendSpace();
        }
        /// <summary>
        /// Returns a 'pretty printed' version of the specified JSON string, formatted for human
        /// consumption.
        /// </summary>
        /// <param name="json">A valid JSON string.</param>
        /// <returns>A 'pretty printed' version of the specified JSON string.</returns>
        public static string Format(string json)
        {
            if (json == null)
            {
                throw new ArgumentNullException("json should not be null.");
            }

            var context   = new JsonFormatterStrategyContext();
            var formatter = new JsonFormatterInternal(context);

            return(formatter.Format(json));
        }
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            context.AppendCurrentChar();
            context.EnterObjectScope();

            if (!IsBeginningOfNewLineAndIndentionLevel(context)) return;

            context.BuildContextIndents();
        }
Exemplo n.º 15
0
        public void Execute(JsonFormatterStrategyContext context)
        {
            if (context.IsProcessingString)
            {
                context.AppendCurrentChar();
                return;
            }

            context.AppendCurrentChar();
            context.EnterObjectScope();

            if (!IsBeginningOfNewLineAndIndentionLevel(context))
            {
                return;
            }

            context.BuildContextIndents();
        }
 public void Execute(JsonFormatterStrategyContext context)
 {
     context.AppendCurrentChar();
 }
Exemplo n.º 17
0
 private static void PeformNonStringPrint(JsonFormatterStrategyContext context)
 {
     context.CloseCurrentScope();
     context.BuildContextIndents();
     context.AppendCurrentChar();
 }
 private static void PeformNonStringPrint(JsonFormatterStrategyContext context)
 {
     context.CloseCurrentScope();
     context.BuildContextIndents();
     context.AppendCurrentChar();
 }
 private static bool IsBeginningOfNewLineAndIndentionLevel(JsonFormatterStrategyContext context)
 {
     return context.IsProcessingVariableAssignment || (!context.IsStart && !context.IsInArrayScope);
 }
Exemplo n.º 20
0
 private static bool IsBeginningOfNewLineAndIndentionLevel(JsonFormatterStrategyContext context)
 {
     return(context.IsProcessingVariableAssignment || (!context.IsStart && !context.IsInArrayScope));
 }
 public void Execute(JsonFormatterStrategyContext context)
 {
     context.AppendCurrentChar();
 }