Exemple #1
0
        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();
        }
Exemple #2
0
		UISyntaxHighlighter(bool highlight) {
			if (highlight) {
				this.simpleHighlighter = new SimpleHighlighter();
				this.output = null;
			}
			else {
				this.simpleHighlighter = null;
				this.output = new PlainTextOutput();
			}
		}