Beispiel #1
0
        public override void WriteToolTip(ISyntaxHighlightOutput output, IMemberRef member, IHasCustomAttribute typeAttributes)
        {
            if (!(member is ITypeDefOrRef) && ILLanguageUtils.Write(SyntaxHighlightOutputToTextOutput.Create(output), member))
            {
                return;
            }

            base.WriteToolTip(output, member, typeAttributes);
        }
        static void ExecuteInternal(MDTableContext context)
        {
            var output  = new NoSyntaxHighlightOutput();
            var output2 = SyntaxHighlightOutputToTextOutput.Create(output);

            context.Node.WriteHeader(output2);
            foreach (var rec in context.Records)
            {
                context.Node.Write(output2, rec);
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                Clipboard.SetText(s);
            }
        }
Beispiel #3
0
 public void WriteName(ISyntaxHighlightOutput output, PropertyDef property, bool?isIndexer)
 {
     FormatPropertyName(SyntaxHighlightOutputToTextOutput.Create(output), property, isIndexer);
 }
Beispiel #4
0
 public void WriteType(ISyntaxHighlightOutput output, ITypeDefOrRef type, bool includeNamespace, ParamDef pd = null)
 {
     TypeToString(SyntaxHighlightOutputToTextOutput.Create(output), type, includeNamespace, pd);
 }
Beispiel #5
0
 public void WriteName(ISyntaxHighlightOutput output, TypeDef type)
 {
     FormatTypeName(SyntaxHighlightOutputToTextOutput.Create(output), type);
 }
Beispiel #6
0
        public static void WriteObject(ISyntaxHighlightOutput output, object obj, WriteObjectFlags flags = WriteObjectFlags.None)
        {
            if (IsNull(obj))
            {
                output.Write("null", TextTokenKind.Keyword);
                return;
            }

            var mr = obj as IMemberRef;

            if (mr != null)
            {
                if (simpleILPrinter.Write(SyntaxHighlightOutputToTextOutput.Create(output), mr))
                {
                    return;
                }
            }

            var local = obj as LocalVM;

            if (local != null)
            {
                output.Write(IdentifierEscaper.Escape(GetLocalName(local.Name, local.Index)), TextTokenKind.Local);
                output.WriteSpace();
                output.WriteLocalParameterIndex(local.Index);
                return;
            }

            var parameter = obj as Parameter;

            if (parameter != null)
            {
                if (parameter.IsHiddenThisParameter)
                {
                    output.Write("this", TextTokenKind.Keyword);
                }
                else
                {
                    output.Write(IdentifierEscaper.Escape(GetParameterName(parameter.Name, parameter.Index)), TextTokenKind.Parameter);
                    output.WriteSpace();
                    output.WriteLocalParameterIndex(parameter.Index);
                }
                return;
            }

            var instr = obj as InstructionVM;

            if (instr != null)
            {
                if ((flags & WriteObjectFlags.ShortInstruction) != 0)
                {
                    output.WriteShort(instr);
                }
                else
                {
                    output.WriteLong(instr);
                }
                return;
            }

            var instrs = obj as IList <InstructionVM>;

            if (instrs != null)
            {
                output.Write(instrs);
                return;
            }

            var methodSig = obj as MethodSig;

            if (methodSig != null)
            {
                simpleILPrinter.Write(SyntaxHighlightOutputToTextOutput.Create(output), methodSig);
                return;
            }

            if (obj is TypeSig)
            {
                simpleILPrinter.Write(SyntaxHighlightOutputToTextOutput.Create(output), obj as TypeSig);
                return;
            }

            if (obj is Code)
            {
                output.Write(((Code)obj).ToOpCode().Name, TextTokenKind.OpCode);
                return;
            }

            // This code gets called by the combobox and it sometimes passes in the empty string.
            // It's never shown in the UI.
            Debug.Assert(string.Empty.Equals(obj), "Shouldn't be here");
            output.Write(obj.ToString(), TextTokenKind.Text);
        }