public MarkupExtensionFormatter(IList <string> singleLineTypes) { this.singleLineTypes = singleLineTypes; this.singleLineFormatter = new SingleLineMarkupExtensionFormatter(this); this.multiLineFormatter = new MultiLineMarkupExtensionFormatter(this); }
private IEnumerable <string> FormatValue(Value value) { var type = value.GetType(); if (type == typeof(LiteralValue)) { return(MarkupExtensionFormatterBase.FormatLiteralValue((LiteralValue)value)); } if (type == typeof(MarkupExtension)) { return(this.FormatArguments((MarkupExtension)value)); } throw new ArgumentException($"Unhandled type {type.FullName}", nameof(value)); }
private IEnumerable <string> FormatNamedArgument(NamedArgument namedArgument) { return(MarkupExtensionFormatterBase.Format($"{namedArgument.Name}=", this.FormatValue(namedArgument.Value))); }
public IEnumerable <string> FormatArguments(MarkupExtension markupExtension, bool isNested = false) { return(markupExtension.Arguments.Any() ? MarkupExtensionFormatterBase.Format($"{{{markupExtension.TypeName} ", this.FormatArguments(markupExtension.Arguments, isNested: isNested), "}") : new string[] { $"{{{markupExtension.TypeName}}}" }); }