Пример #1
0
 public static object ToDnSpyColor(DbgTextColor color)
 {
     if (!toDnSpyColor.TryGetValue(color, out var dnspyColor))
     {
         Debug.Fail($"Couldn't convert color '{color}'");
         dnspyColor = TextColor.Error.Box();
     }
     return(dnspyColor);
 }
Пример #2
0
 /// <summary>
 /// Writes text
 /// </summary>
 /// <param name="color">Color</param>
 /// <param name="text">Text</param>
 public void Write(DbgTextColor color, string?text)
 {
     if (text is null)
     {
         return;
     }
     colors.Add(new SpanData <object>(new Span(sb.Length, text.Length), ColorConverter.ToDnSpyColor(color)));
     sb.Append(text);
 }
Пример #3
0
 static DbgTextColor GetColor(DmdMethodInfo method, DbgTextColor staticValue, DbgTextColor instanceValue)
 {
     if ((object)method == null)
     {
         return(instanceValue);
     }
     if (method.IsStatic)
     {
         return(staticValue);
     }
     return(instanceValue);
 }
        void WriteArgumentAndText(IDbgTextWriter output, DbgTextColor defaultColor, string formatString, Action callback)
        {
            const string pattern = "{0}";
            var          index   = formatString.IndexOf(pattern);

            if (index < 0)
            {
                output.Write(DbgTextColor.Error, "???");
            }
            else
            {
                if (index != 0)
                {
                    output.Write(defaultColor, formatString.Substring(0, index));
                }
                callback();
                if (index + pattern.Length != formatString.Length)
                {
                    output.Write(defaultColor, formatString.Substring(index + pattern.Length));
                }
            }
        }
 void OutputWrite(string s, DbgTextColor color) => output.Write(color, s);
 void WriteIdentifier(string id, DbgTextColor color) => OutputWrite(VisualBasicTypeFormatter.GetFormattedIdentifier(id), color);
Пример #7
0
 void WriteIdentifier(string?id, DbgTextColor color) => OutputWrite(GetFormattedIdentifier(id), color);
Пример #8
0
 void WriteIdentifier(string id, DbgTextColor color) => OutputWrite(CSharpTypeFormatter.GetFormattedIdentifier(id), color);
 void WriteArgumentAndText(IDbgTextWriter output, DbgTextColor defaultColor, DbgTextColor valueColor, string formatString, string formatValue) =>
 WriteArgumentAndText(output, defaultColor, formatString, () => output.Write(valueColor, formatValue ?? string.Empty));
 void WriteArgumentAndText(IDbgTextWriter output, DbgTextColor valueColor, string formatString, string formatValue) =>
 WriteArgumentAndText(output, DbgTextColor.Comment, valueColor, formatString, formatValue);
Пример #11
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="color">Color</param>
 /// <param name="text">Text</param>
 public DbgDotNetTextPart(DbgTextColor color, string text)
 {
     Color = color;
     Text  = text ?? throw new ArgumentNullException(nameof(text));
 }