public List <ReferenceSegment> Decompile(TextEditorData data, ITreeNavigator navigator, bool publicOnly)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var type = CecilLoader.GetCecilObject((IUnresolvedTypeDefinition)navigator.DataItem);

            if (type == null)
            {
                return(null);
            }
            var types      = DesktopService.GetMimeTypeInheritanceChain(data.Document.MimeType);
            var codePolicy = MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy <MonoDevelop.CSharp.Formatting.CSharpFormattingPolicy> (types);
            var settings   = new DecompilerSettings()
            {
                AnonymousMethods        = true,
                AutomaticEvents         = true,
                AutomaticProperties     = true,
                ForEachStatement        = true,
                LockStatement           = true,
                CSharpFormattingOptions = codePolicy.CreateOptions()

                                          //,
//				HideNonPublicMembers = publicOnly
            };

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), type, builder =>
            {
                builder.AddType(type);
            }, settings));
        }
Пример #2
0
        public List <ReferenceSegment> Decompile(TextEditorData data, ITreeNavigator navigator, bool publicOnly)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var type = CecilLoader.GetCecilObject((IUnresolvedTypeDefinition)navigator.DataItem);

            if (type == null)
            {
                return(null);
            }
            var settings = new DecompilerSettings()
            {
                AnonymousMethods     = true,
                AutomaticEvents      = true,
                AutomaticProperties  = true,
                ForEachStatement     = true,
                LockStatement        = true,
                HideNonPublicMembers = publicOnly
            };

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), type, builder => {
                builder.AddType(type);
            }, settings));
        }
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Decompile(TextEditorData data, ITreeNavigator navigator, bool publicOnly)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var field = CecilLoader.GetCecilObject((IUnresolvedField)navigator.DataItem);

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), field.DeclaringType, b => b.AddField(field)));
        }
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Disassemble(TextEditorData data, ITreeNavigator navigator)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var field = CecilLoader.GetCecilObject((IUnresolvedField)navigator.DataItem);

            return(DomMethodNodeBuilder.Disassemble(data, rd => rd.DisassembleField(field)));
        }
Пример #5
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Disassemble(TextEditor data, ITreeNavigator navigator)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var evt = GetCecilLoader(navigator).GetCecilObject <EventDefinition> ((IUnresolvedEvent)navigator.DataItem);

            return(DomMethodNodeBuilder.Disassemble(data, rd => rd.DisassembleEvent(evt)));
        }
Пример #6
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.GetSummary(TextEditorData data, ITreeNavigator navigator, bool publicOnly)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var property = CecilLoader.GetCecilObject((IUnresolvedProperty)navigator.DataItem);

            return(DomMethodNodeBuilder.GetSummary(data, DomMethodNodeBuilder.GetModule(navigator), property.DeclaringType, b => b.AddProperty(property)));
        }
Пример #7
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Decompile(TextEditor data, ITreeNavigator navigator, DecompileFlags flags)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var evt = GetCecilLoader(navigator).GetCecilObject <EventDefinition>((IUnresolvedEvent)navigator.DataItem);

            if (evt == null)
            {
                return(null);
            }
            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetAssemblyLoader(navigator), b => b.Decompile(evt), flags: flags));
        }
Пример #8
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.GetSummary(TextEditor data, ITreeNavigator navigator, bool publicOnly)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var evt = GetCecilLoader(navigator).GetCecilObject((IUnresolvedEvent)navigator.DataItem);

            if (evt == null)
            {
                return(null);
            }
            return(DomMethodNodeBuilder.GetSummary(data, DomMethodNodeBuilder.GetModule(navigator), evt.DeclaringType, b => b.AddEvent(evt)));
        }
Пример #9
0
        public List <ReferenceSegment> Disassemble(TextEditor data, ITreeNavigator navigator)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var type = CecilLoader.GetCecilObject((IUnresolvedTypeDefinition)navigator.DataItem);

            if (type == null)
            {
                return(null);
            }

            return(DomMethodNodeBuilder.Disassemble(data, rd => rd.DisassembleType(type)));
        }
Пример #10
0
        public List <ReferenceSegment> Decompile(TextEditor data, ITreeNavigator navigator, DecompileFlags flags)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var type = (IUnresolvedTypeDefinition)navigator.DataItem;

            if (type == null)
            {
                return(null);
            }
            var settings = DomMethodNodeBuilder.GetDecompilerSettings(data, flags.PublicOnly);

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetAssemblyLoader(navigator), builder => builder.DecompileType(type.FullTypeName), flags: flags));
        }
Пример #11
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.GetSummary(TextEditor data, ITreeNavigator navigator, bool publicOnly)
        {
            if (DomMethodNodeBuilder.HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var type = CecilLoader.GetCecilObject((IUnresolvedTypeDefinition)navigator.DataItem);

            if (type == null)
            {
                return(null);
            }
            var types      = DesktopService.GetMimeTypeInheritanceChain(data.MimeType);
            var codePolicy = MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy <MonoDevelop.CSharp.Formatting.CSharpFormattingPolicy> (types);
            var settings   = CreateDecompilerSettings(publicOnly, codePolicy);

            return(DomMethodNodeBuilder.GetSummary(data, DomMethodNodeBuilder.GetModule(navigator), type, builder => {
                builder.AddType(type);
            }, settings));
        }