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)));
        }
Пример #4
0
        public List <ReferenceSegment> Decompile(TextEditorData data, ITreeNavigator navigator)
        {
            DomCecilMethod method = navigator.DataItem as DomCecilMethod;

            if (method == null)
            {
                return(null);
            }
            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), ((DomCecilType)method.DeclaringType).TypeDefinition, b => b.AddMethod(method.MethodDefinition)));
        }
Пример #5
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)));
        }
Пример #6
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)));
        }
        public List <ReferenceSegment> Decompile(TextEditorData data, ITreeNavigator navigator, bool publicOnly)
        {
            var method = (IUnresolvedMethod)navigator.DataItem;

            if (HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var cecilMethod = CecilLoader.GetCecilObject(method);

            if (cecilMethod == null)
            {
                return(null);
            }
            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), cecilMethod.DeclaringType, b => b.AddMethod(cecilMethod)));
        }
Пример #8
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.GetSummary(TextEditor data, ITreeNavigator navigator, bool publicOnly)
        {
            var assembly        = ((AssemblyLoader)navigator.DataItem).UnresolvedAssembly;
            var compilationUnit = Widget.CecilLoader.GetCecilObject(assembly);

            if (compilationUnit == null)
            {
                LoggingService.LogError("Can't get cecil object for assembly:" + assembly);
                return(new List <ReferenceSegment> ());
            }
            return(DomMethodNodeBuilder.GetSummary(data, DomMethodNodeBuilder.GetModule(navigator), null, b => {
                if (b != null)
                {
                    b.AddAssembly(compilationUnit, true);
                }
            }));
        }
Пример #9
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));
        }
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Decompile(TextEditorData data, ITreeNavigator navigator)
        {
            var property = (DomCecilProperty)navigator.DataItem;

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), ((DomCecilType)property.DeclaringType).TypeDefinition, b => b.AddProperty(property.PropertyDefinition)));
        }
Пример #11
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Decompile(TextEditorData data, ITreeNavigator navigator)
        {
            var field = (DomCecilField)navigator.DataItem;

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), ((DomCecilType)field.DeclaringType).TypeDefinition, b => b.AddField(field.FieldDefinition)));
        }
Пример #12
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Decompile(TextEditorData data, ITreeNavigator navigator)
        {
            var evt = (DomCecilEvent)navigator.DataItem;

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), ((DomCecilType)evt.DeclaringType).TypeDefinition, b => b.AddEvent(evt.EventDefinition)));
        }
Пример #13
0
        public List <ReferenceSegment> Disassemble(TextEditorData data, ITreeNavigator navigator)
        {
            var compilationUnit = Widget.CecilLoader.GetCecilObject(((AssemblyLoader)navigator.DataItem).UnresolvedAssembly);

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), null, b => b.AddAssembly(compilationUnit, true)));
        }
Пример #14
0
        public List <ReferenceSegment> Disassemble(TextEditorData data, ITreeNavigator navigator)
        {
            DomCecilCompilationUnit compilationUnit = (DomCecilCompilationUnit)navigator.DataItem;

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), null, b => b.AddAssembly(compilationUnit.AssemblyDefinition, true)));
        }
Пример #15
0
        public List <ReferenceSegment> Decompile(TextEditorData data, ITreeNavigator navigator)
        {
            var type = (DomCecilType)navigator.DataItem;

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetModule(navigator), type.TypeDefinition, b => b.AddType(type.TypeDefinition)));
        }