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)));
        }
        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)));
        }
Exemple #3
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)));
        }
Exemple #4
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)));
        }
        string IAssemblyBrowserNodeBuilder.GetDisassembly(ITreeNavigator navigator)
        {
            NetAmbience   netAmbience = new NetAmbience();
            IProperty     property    = (IProperty)navigator.DataItem;
            StringBuilder result      = new StringBuilder();

            result.Append(netAmbience.GetString(property, DomTypeNodeBuilder.settings));
            result.AppendLine();
            result.AppendLine();
            DomCecilProperty cecilProperty = property as DomCecilProperty;

            if (property.HasGet)
            {
                result.Append("Getter:"); result.AppendLine();
                result.Append(DomMethodNodeBuilder.Disassemble(cecilProperty.GetMethod as DomCecilMethod, true).Replace("\t", "\t\t"));
            }
            if (property.HasSet)
            {
                result.Append("Setter:"); result.AppendLine();
                result.Append(DomMethodNodeBuilder.Disassemble(cecilProperty.SetMethod as DomCecilMethod, true).Replace("\t", "\t\t"));
            }

            return(result.ToString());
        }
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Disassemble(TextEditorData data, ITreeNavigator navigator)
        {
            var property = (DomCecilProperty)navigator.DataItem;

            return(DomMethodNodeBuilder.Disassemble(data, rd => rd.DisassembleProperty(property.PropertyDefinition)));
        }
Exemple #7
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Disassemble(TextEditorData data, ITreeNavigator navigator)
        {
            var field = (DomCecilField)navigator.DataItem;

            return(DomMethodNodeBuilder.Disassemble(data, rd => rd.DisassembleField(field.FieldDefinition)));
        }
Exemple #8
0
        List <ReferenceSegment> IAssemblyBrowserNodeBuilder.Disassemble(TextEditorData data, ITreeNavigator navigator)
        {
            var evt = (DomCecilEvent)navigator.DataItem;

            return(DomMethodNodeBuilder.Disassemble(data, rd => rd.DisassembleEvent(evt.EventDefinition)));
        }
        void SearchDoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            try {
                string pattern = e.Argument.ToString().ToUpper();
                int    types = 0, curType = 0;
                foreach (DomCecilCompilationUnit unit in this.definitions)
                {
                    types += unit.Types.Count;
                }
                List <IMember> members = new List <IMember> ();
                switch (searchMode)
                {
                case SearchMode.Member:
                    foreach (DomCecilCompilationUnit unit in this.definitions)
                    {
                        foreach (IType type in unit.Types)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            curType++;
                            foreach (IMember member in type.Members)
                            {
                                if (worker.CancellationPending)
                                {
                                    return;
                                }
                                if (member.Name.ToUpper().Contains(pattern))
                                {
                                    members.Add(member);
                                }
                            }
                        }
                    }
                    Gtk.Application.Invoke(delegate {
                        IdeApp.Workbench.StatusBar.SetProgressFraction((double)curType / types);
                        foreach (MonoDevelop.Projects.Dom.IMember member in members)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            memberListStore.AppendValues(ImageService.GetPixbuf(member.StockIcon, Gtk.IconSize.Menu),
                                                         member.Name,
                                                         member.DeclaringType.FullName,
                                                         ((DomCecilCompilationUnit)member.DeclaringType.CompilationUnit).AssemblyDefinition.Name.FullName,
                                                         member);
                        }
                    });
                    break;

                case SearchMode.Disassembler:
                    Gtk.Application.Invoke(delegate {
                        IdeApp.Workbench.StatusBar.BeginProgress(GettextCatalog.GetString("Searching string in disassembled code..."));
                    });
                    foreach (DomCecilCompilationUnit unit in this.definitions)
                    {
                        foreach (IType type in unit.Types)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            curType++;
                            foreach (IMethod method in type.Methods)
                            {
                                if (worker.CancellationPending)
                                {
                                    return;
                                }
                                DomCecilMethod domMethod = method as DomCecilMethod;
                                if (domMethod == null)
                                {
                                    continue;
                                }
                                if (DomMethodNodeBuilder.Disassemble(domMethod, false).ToUpper().Contains(pattern))
                                {
                                    members.Add(method);
                                }
                            }
                        }
                    }
                    Gtk.Application.Invoke(delegate {
                        IdeApp.Workbench.StatusBar.SetProgressFraction((double)curType / types);
                        foreach (MonoDevelop.Projects.Dom.IMember member in members)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            memberListStore.AppendValues(ImageService.GetPixbuf(member.StockIcon, Gtk.IconSize.Menu),
                                                         member.Name,
                                                         member.DeclaringType.FullName,
                                                         ((DomCecilCompilationUnit)member.DeclaringType.CompilationUnit).AssemblyDefinition.Name.FullName,
                                                         member);
                        }
                    });
                    break;

                case SearchMode.Decompiler:
                    foreach (DomCecilCompilationUnit unit in this.definitions)
                    {
                        foreach (IType type in unit.Types)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            curType++;
                            foreach (IMethod method in type.Methods)
                            {
                                if (worker.CancellationPending)
                                {
                                    return;
                                }
                                DomCecilMethod domMethod = method as DomCecilMethod;
                                if (domMethod == null)
                                {
                                    continue;
                                }
                                if (DomMethodNodeBuilder.Decompile(domMethod, false).ToUpper().Contains(pattern))
                                {
                                    members.Add(method);
                                }
                            }
                        }
                    }
                    Gtk.Application.Invoke(delegate {
                        IdeApp.Workbench.StatusBar.SetProgressFraction((double)curType / types);
                        foreach (MonoDevelop.Projects.Dom.IMember member in members)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            memberListStore.AppendValues(ImageService.GetPixbuf(member.StockIcon, Gtk.IconSize.Menu),
                                                         member.Name,
                                                         member.DeclaringType.FullName,
                                                         ((DomCecilCompilationUnit)member.DeclaringType.CompilationUnit).AssemblyDefinition.Name.FullName,
                                                         member);
                        }
                    });
                    break;

                case SearchMode.Type:
                    foreach (DomCecilCompilationUnit unit in this.definitions)
                    {
                        foreach (IType type in unit.Types)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            if (type.FullName.ToUpper().IndexOf(pattern) >= 0)
                            {
                                members.Add(type);
                            }
                        }
                    }
                    Gtk.Application.Invoke(delegate {
                        foreach (IType type in members)
                        {
                            if (worker.CancellationPending)
                            {
                                return;
                            }
                            typeListStore.AppendValues(ImageService.GetPixbuf(type.StockIcon, Gtk.IconSize.Menu),
                                                       type.Name,
                                                       type.Namespace,
                                                       ((DomCecilCompilationUnit)type.CompilationUnit).AssemblyDefinition.Name.FullName,
                                                       type);
                        }
                    });

                    break;
                }
            } finally {
                Gtk.Application.Invoke(delegate {
                    IdeApp.Workbench.StatusBar.EndProgress();
                });
            }
        }
        public List <ReferenceSegment> Disassemble(TextEditorData data, ITreeNavigator navigator)
        {
            var type = (DomCecilType)navigator.DataItem;

            return(DomMethodNodeBuilder.Disassemble(data, rd => rd.DisassembleType(type.TypeDefinition)));
        }