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));
        }
Exemple #2
0
        public List <ReferenceSegment> Decompile(TextEditor data, ITreeNavigator navigator, DecompileFlags flags)
        {
            var assemblyLoader = (AssemblyLoader)navigator.DataItem;

            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetAssemblyLoader(navigator), b =>
                                                  b.DecompileModuleAndAssemblyAttributes(), flags: flags));
        }
Exemple #3
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));
        }
        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)));
        }
        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)));
        }
        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)));
        }
Exemple #7
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)));
        }
Exemple #8
0
        string IAssemblyBrowserNodeBuilder.GetDecompiledCode(ITreeNavigator navigator)
        {
            IField        field  = (IField)navigator.DataItem;
            StringBuilder result = new StringBuilder();

            result.Append(DomMethodNodeBuilder.GetAttributes(Ambience, field.Attributes));
            result.Append(Ambience.GetString(field, DomTypeNodeBuilder.settings));
            result.Append(";");
            return(result.ToString());
        }
        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)));
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            IProperty property = (IProperty)dataObject;

            label = Ambience.GetString(property, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.ReturnTypesLast);
            if (property.IsPrivate || property.IsInternal)
            {
                label = DomMethodNodeBuilder.FormatPrivate(label);
            }
            icon = ImageService.GetPixbuf(property.StockIcon, Gtk.IconSize.Menu);
        }
Exemple #11
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            IField field = (IField)dataObject;

            label = Ambience.GetString(field, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup);
            if (field.IsPrivate || field.IsInternal)
            {
                label = DomMethodNodeBuilder.FormatPrivate(label);
            }
            icon = ImageService.GetPixbuf(field.StockIcon, Gtk.IconSize.Menu);
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            var type     = (IUnresolvedTypeDefinition)dataObject;
            var resolved = Resolve(treeBuilder, type);

            label = Ambience.GetString(resolved, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.UseNETTypeNames);
            if (type.IsPrivate)
            {
                label = DomMethodNodeBuilder.FormatPrivate(label);
            }
            icon = ImageService.GetPixbuf(type.GetStockIcon(), Gtk.IconSize.Menu);
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            var evt      = (IUnresolvedEvent)dataObject;
            var resolved = Resolve(treeBuilder, evt);

            label = Ambience.GetString(resolved, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.CompletionListFomat);
            if (evt.IsPrivate || evt.IsInternal)
            {
                label = DomMethodNodeBuilder.FormatPrivate(label);
            }
            icon = ImageService.GetPixbuf(evt.GetStockIcon(), Gtk.IconSize.Menu);
        }
Exemple #14
0
        public List <ReferenceSegment> Disassemble(TextEditor data, ITreeNavigator navigator)
        {
            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.Disassemble(data, rd => rd.WriteAssemblyHeader(compilationUnit)));
        }
        string IAssemblyBrowserNodeBuilder.GetDescription(ITreeNavigator navigator)
        {
            IProperty     property = (IProperty)navigator.DataItem;
            StringBuilder result   = new StringBuilder();

            result.Append("<span font_family=\"monospace\">");
            result.Append(Ambience.GetString(property, OutputFlags.AssemblyBrowserDescription));
            result.Append("</span>");
            result.AppendLine();
            DomMethodNodeBuilder.PrintDeclaringType(result, navigator);
            DomTypeNodeBuilder.PrintAssembly(result, navigator);
            return(result.ToString());
        }
        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));
        }
        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)));
        }
        string IAssemblyBrowserNodeBuilder.GetDescription(ITreeNavigator navigator)
        {
            var           evt      = (IUnresolvedEvent)navigator.DataItem;
            var           resolved = Resolve(navigator, evt);
            StringBuilder result   = new StringBuilder();

            result.Append("<span font_family=\"monospace\">");
            result.Append(Ambience.GetString(resolved, OutputFlags.AssemblyBrowserDescription));
            result.Append("</span>");
            result.AppendLine();
            DomMethodNodeBuilder.PrintDeclaringType(result, navigator);
            DomTypeNodeBuilder.PrintAssembly(result, navigator);
            return(result.ToString());
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            var method   = (IUnresolvedMethod)dataObject;
            var dt       = new DefaultResolvedTypeDefinition(GetContext(treeBuilder), method.DeclaringTypeDefinition);
            var resolved = (DefaultResolvedMethod)Resolve(treeBuilder, method, dt);

            label = Ambience.GetString(resolved, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.CompletionListFomat);

            if (method.IsPrivate || method.IsInternal)
            {
                label = DomMethodNodeBuilder.FormatPrivate(label);
            }

            icon = ImageService.GetPixbuf(resolved.GetStockIcon(), Gtk.IconSize.Menu);
        }
Exemple #20
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)));
        }
Exemple #21
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var type = (IUnresolvedTypeDefinition)dataObject;

            try {
                var resolved = Resolve(treeBuilder, type);
                nodeInfo.Label = Ambience.GetString(resolved, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.UseNETTypeNames);
            } catch (Exception) {
                nodeInfo.Label = type.Name;
            }
            if (type.IsPrivate)
            {
                nodeInfo.Label = DomMethodNodeBuilder.FormatPrivate(nodeInfo.Label);
            }
            nodeInfo.Icon = Context.GetIcon(type.GetStockIcon());
        }
        public List <ReferenceSegment> Decompile(TextEditor data, ITreeNavigator navigator, DecompileFlags flags)
        {
            var method = (IUnresolvedMethod)navigator.DataItem;

            if (HandleSourceCodeEntity(navigator, data))
            {
                return(null);
            }
            var cecilMethod = GetCecilLoader(navigator).GetCecilObject <MethodDefinition> (method);

            if (cecilMethod == null)
            {
                return(null);
            }
            return(DomMethodNodeBuilder.Decompile(data, DomMethodNodeBuilder.GetAssemblyLoader(navigator), b => b.Decompile(cecilMethod), flags: flags));
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var property = (IUnresolvedProperty)dataObject;

            try {
                var resolved = Resolve(treeBuilder, property);
                nodeInfo.Label = Ambience.GetString(resolved, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.CompletionListFomat);
            } catch (Exception) {
                nodeInfo.Label = property.Name;
            }
            if (property.IsPrivate || property.IsInternal)
            {
                nodeInfo.Label = DomMethodNodeBuilder.FormatPrivate(nodeInfo.Label);
            }
            nodeInfo.Icon = Context.GetIcon(property.GetStockIcon());
        }
        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)));
        }
Exemple #25
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var type = (IUnresolvedTypeDefinition)dataObject;

            try {
                var resolved = Resolve(treeBuilder, type);
                nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText(Ambience.ConvertType(resolved));
            } catch (Exception) {
                nodeInfo.Label = type.Name;
            }
            if (type.IsPrivate)
            {
                nodeInfo.Label = DomMethodNodeBuilder.FormatPrivate(nodeInfo.Label);
            }
            nodeInfo.Icon = Context.GetIcon(type.GetStockIcon());
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            var property = (IUnresolvedProperty)dataObject;

            try {
                var resolved = Resolve(treeBuilder, property);
                label = Ambience.GetString(resolved, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.CompletionListFomat);
            } catch (Exception) {
                label = property.Name;
            }
            if (property.IsPrivate || property.IsInternal)
            {
                label = DomMethodNodeBuilder.FormatPrivate(label);
            }
            icon = ImageService.GetPixbuf(property.GetStockIcon(), Gtk.IconSize.Menu);
        }
        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));
        }
Exemple #28
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var evt = (IUnresolvedEvent)dataObject;

            try {
                var resolved = Resolve(treeBuilder, evt);
                nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText(Ambience.ConvertSymbol(resolved));
            } catch (Exception) {
                nodeInfo.Label = evt.Name;
            }
            if (evt.IsPrivate || evt.IsInternal)
            {
                nodeInfo.Label = DomMethodNodeBuilder.FormatPrivate(nodeInfo.Label);
            }
            nodeInfo.Icon = Context.GetIcon(evt.GetStockIcon());
        }
Exemple #29
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);
                }
            }));
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var method   = (IUnresolvedMethod)dataObject;
            var dt       = new DefaultResolvedTypeDefinition(GetContext(treeBuilder), method.DeclaringTypeDefinition);
            var resolved = (DefaultResolvedMethod)Resolve(treeBuilder, method, dt);

            try {
                nodeInfo.Label = Ambience.GetString(resolved, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup | OutputFlags.CompletionListFomat);
            } catch (Exception) {
                nodeInfo.Label = method.Name;
            }

            if (method.IsPrivate || method.IsInternal)
            {
                nodeInfo.Label = DomMethodNodeBuilder.FormatPrivate(nodeInfo.Label);
            }

            nodeInfo.Icon = Context.GetIcon(resolved.GetStockIcon());
        }