コード例 #1
0
        object Create(IToolTipProviderContext context, GenericParam gp)
        {
            var provider = context.Create();

            provider.SetImage(gp);

            context.Language.WriteToolTip(provider.Output, gp, null);

            provider.CreateNewOutput();
            try {
                var docProvider = XmlDocLoader.LoadDocumentation(gp.Module);
                if (docProvider != null)
                {
                    if (!provider.Output.WriteXmlDocGeneric(GetDocumentation(docProvider, gp.Owner), gp.Name) && gp.Owner is TypeDef)
                    {
                        // If there's no doc available, use the parent class' documentation if this
                        // is a generic type parameter (and not a generic method parameter).
                        var owner = ((TypeDef)gp.Owner).DeclaringType;
                        while (owner != null)
                        {
                            if (provider.Output.WriteXmlDocGeneric(GetDocumentation(docProvider, owner), gp.Name))
                            {
                                break;
                            }
                            owner = owner.DeclaringType;
                        }
                    }
                }
            }
            catch (XmlException) {
            }

            return(provider.Create());
        }
コード例 #2
0
        object Create(IToolTipProviderContext context, NamespaceReference nsRef)
        {
            var provider = context.Create();

            provider.SetImage(nsRef);
            context.Language.WriteNamespaceToolTip(provider.Output, nsRef.Namespace);
            return(provider.Create());
        }
コード例 #3
0
        public object Create(IToolTipProviderContext context, object @ref)
        {
            var bref = @ref as BamlToolTipReference;

            if (bref != null)
            {
                var provider = context.Create();
                provider.Output.Write(BoxedTextColor.Text, bref.String);
                return(provider.Create());
            }

            return(null);
        }
コード例 #4
0
        public object Create(IToolTipProviderContext context, object @ref)
        {
            // This reference is added to the "decompiled" code by ModuleChildNode.Decompile()
            var sref = @ref as StringInfoReference;

            if (sref != null)
            {
                var provider = context.Create();
                provider.Output.Write(BoxedTextColor.String, sref.Message);
                return(provider.Create());
            }

            return(null);
        }
コード例 #5
0
        object Create(IToolTipProviderContext context, IVariable v, string name)
        {
            var provider = context.Create();

            provider.SetImage(v);

            if (v == null)
            {
                if (name == null)
                {
                    return(null);
                }
                provider.Output.Write(BoxedTextColor.Text, string.Format("(local variable) {0}", name));
                return(provider.Create());
            }

            context.Language.WriteToolTip(provider.Output, v, name);

            provider.CreateNewOutput();
            if (v is Parameter)
            {
                var method = ((Parameter)v).Method;
                try {
                    var docProvider = XmlDocLoader.LoadDocumentation(method.Module);
                    if (docProvider != null)
                    {
                        if (!provider.Output.WriteXmlDocParameter(GetDocumentation(docProvider, method), v.Name))
                        {
                            var owner = method.DeclaringType;
                            while (owner != null)
                            {
                                if (provider.Output.WriteXmlDocParameter(GetDocumentation(docProvider, owner), v.Name))
                                {
                                    break;
                                }
                                owner = owner.DeclaringType;
                            }
                        }
                    }
                }
                catch (XmlException) {
                }
            }

            return(provider.Create());
        }
コード例 #6
0
        object Create(IToolTipProviderContext context, OpCode opCode)
        {
            var provider = context.Create();

            var    s         = ILLanguageHelper.GetOpCodeDocumentation(opCode);
            string opCodeHex = opCode.Size > 1 ? string.Format("0x{0:X4}", opCode.Value) : string.Format("0x{0:X2}", opCode.Value);

            provider.Output.Write(BoxedTextColor.OpCode, opCode.Name);
            provider.Output.WriteSpace();
            provider.Output.Write(BoxedTextColor.Punctuation, "(");
            provider.Output.Write(BoxedTextColor.Number, opCodeHex);
            provider.Output.Write(BoxedTextColor.Punctuation, ")");
            if (s != null)
            {
                provider.Output.Write(BoxedTextColor.Text, " - ");
                provider.Output.Write(BoxedTextColor.Text, s);
            }

            return(provider.Create());
        }
コード例 #7
0
        object Create(IToolTipProviderContext context, IMemberRef @ref)
        {
            var provider = context.Create();

            var resolvedRef = Resolve(@ref) ?? @ref;

            provider.SetImage(resolvedRef);
            context.Language.WriteToolTip(provider.Output, @ref, null);
            provider.CreateNewOutput();
            try {
                if (resolvedRef is IMemberDef)
                {
                    var docProvider = XmlDocLoader.LoadDocumentation(resolvedRef.Module);
                    if (docProvider != null)
                    {
                        provider.Output.WriteXmlDoc(GetDocumentation(docProvider, resolvedRef));
                    }
                }
            }
            catch (XmlException) {
            }

            return(provider.Create());
        }