/// <summary> /// Creates the object. If it's syntax highlighted, it's a <see cref="TextBlock"/>, else /// it's just a <see cref="string"/>. See also <see cref="CreateTextBlock()"/> /// </summary> /// <returns></returns> public object CreateObject() { if (simpleHighlighter != null) { return(simpleHighlighter.Create()); } return(output.ToString()); }
/// <summary> /// Creates the object. If it's syntax highlighted, it's a <see cref="TextBlock"/>, else /// it's just a <see cref="string"/>. See also <see cref="CreateTextBlock()"/> /// </summary> /// <param name="useEllipsis">true to add <see cref="TextTrimming.CharacterEllipsis"/> to the <see cref="TextBlock"/></param> /// <param name="filterOutNewLines">true to filter out newline characters</param> /// <returns></returns> public object CreateObject(bool useEllipsis = false, bool filterOutNewLines = true) { if (simpleHighlighter != null) { return(simpleHighlighter.Create(useEllipsis, filterOutNewLines)); } return(ToString(output.ToString(), filterOutNewLines)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { var flags = WriteObjectFlags.None; if (parameter != null) { foreach (var c in (string)parameter) { if (c == 's') { flags |= WriteObjectFlags.ShortInstruction; } } } var gen = new SimpleHighlighter(); BodyUtils.WriteObject(gen.TextOutput, value, flags); var tb = gen.Create(); tb.TextTrimming = TextTrimming.CharacterEllipsis; return(tb); } catch (Exception ex) { Debug.Fail(ex.ToString()); } if (value == null) { return(string.Empty); } return(value.ToString()); }