public string Format(DisplayActualOptions options)
            {
                // On recursion, no need to display types
                var  recursionOptions = options & ~DisplayActualOptions.ShowType;
                var  entries          = new StringBuilder();
                bool comma            = false;

                foreach (var e in _entries)
                {
                    if (comma)
                    {
                        entries.Append(", ");
                    }
                    entries.Append(e.property);
                    entries.Append(" = ");
                    entries.Append(e.actual.Format(recursionOptions));
                    comma = true;
                }

                // Show the type if it was requested or if there are no fields within
                string formatString = (entries.Length == 0 || options.ShowType())
                    ? "{0} {{ {1} }}"
                    : "{{ {1} }}";

                return(string.Format(
                           formatString, _schema.SimpleTypeName, entries
                           ));
            }
Beispiel #2
0
            public string Format(DisplayActualOptions options)
            {
                string formatString = options.ShowType() ? "{0} {{ {1} }}" : "{{ {1} }}";

                // On recursion, no need to display types
                var recursionOptions = options & ~DisplayActualOptions.ShowType;

                return(string.Format(
                           formatString,
                           TextUtility.ConvertToSimpleTypeName(_type),
                           string.Join(", ", _values.Select(v => v.Format(recursionOptions)))
                           ));
            }
Beispiel #3
0
            public string Format(DisplayActualOptions options)
            {
                var w = Text;

                if (options.ShowWhitespace())
                {
                    w = TextUtility.ShowWhitespace(w);
                }
                if (options.ShowType())
                {
                    var type = TextUtility.ConvertToSimpleTypeName(Type);
                    w += $" ({type})";
                }
                return(w);
            }
Beispiel #4
0
            public string Format(DisplayActualOptions options)
            {
                var w = _text;

                if (_escape)
                {
                    w = string.Format("\"{0}\"", TextUtility.Escape(w));
                }

                if (options.ShowWhitespace())
                {
                    w = TextUtility.ShowWhitespace(w);
                }
                if (_text.Length == 0)
                {
                    w = "<empty>";
                }

                if (options.ShowType())
                {
                    return(w + " (string)");
                }
                return(w);
            }