Example #1
0
        internal static string FormatLocation(object location)
        {
            if (location is Uri url)
            {
                if (url.IsAbsoluteUri)
                {
                    if (url.Scheme == "data")
                    {
                        return(string.Format(
                                   "<(data){0}>",
                                   TextUtility.Escape(TextUtility.Truncate(Uri.UnescapeDataString(url.PathAndQuery)))
                                   ));
                    }
                    if (url.Scheme == "file")
                    {
                        return(url.LocalPath);
                    }
                }
                return(url.ToString());
            }

            return(location.ToString());
        }
Example #2
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);
            }