public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
		{
			var compilationUnit = (AssemblyLoader)dataObject;
			
			var references = new AssemblyReferenceFolder (compilationUnit.Assembly);
			if (references.AssemblyReferences.Any () || references.ModuleReferences.Any ())
				builder.AddChild (references);
			
			var resources = new AssemblyResourceFolder (compilationUnit.Assembly);
			if (resources.Resources.Any ())
				builder.AddChild (resources);
			
			var namespaces = new Dictionary<string, Namespace> ();
			bool publicOnly = builder.Options ["PublicApiOnly"];
			
			foreach (var type in compilationUnit.UnresolvedAssembly.TopLevelTypeDefinitions) {
				string namespaceName = string.IsNullOrEmpty (type.Namespace) ? "-" : type.Namespace;
				if (!namespaces.ContainsKey (namespaceName))
					namespaces [namespaceName] = new Namespace (namespaceName);
				
				var ns = namespaces [namespaceName];
				ns.Types.Add (type);
			}
			
			foreach (var ns in namespaces.Values) {
				builder.AddChild (ns);
			}
		}
		public override void BuildChildNodes (ITreeBuilder treeBuilder, object dataObject)
		{
			var compilationUnit = (AssemblyLoader)dataObject;
			if (compilationUnit.Assembly == null)
				return;
			var references = new AssemblyReferenceFolder (compilationUnit.Assembly);
			if (references.AssemblyReferences.Any () || references.ModuleReferences.Any ())
				treeBuilder.AddChild (references);
			
			var resources = new AssemblyResourceFolder (compilationUnit.Assembly);
			if (resources.Resources.Any ())
				treeBuilder.AddChild (resources);
			
			var namespaces = new Dictionary<string, Namespace> ();
			bool publicOnly = Widget.PublicApiOnly;
			
			foreach (var type in compilationUnit.UnresolvedAssembly.TopLevelTypeDefinitions) {
				string namespaceName = string.IsNullOrEmpty (type.Namespace) ? "-" : type.Namespace;
				if (!namespaces.ContainsKey (namespaceName))
					namespaces [namespaceName] = new Namespace (namespaceName);
				
				var ns = namespaces [namespaceName];
				ns.Types.Add (type);
			}

			treeBuilder.AddChildren (namespaces.Values.Where (ns => !publicOnly || ns.Types.Any (t => t.IsPublic)));
		}
Пример #3
0
        public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
        {
            var compilationUnit = (AssemblyLoader)dataObject;

            if (compilationUnit.Error != null)
            {
                treeBuilder.AddChild(compilationUnit.Error);
                return;
            }
            if (compilationUnit.Assembly == null)
            {
                return;
            }
            var references = new AssemblyReferenceFolder(compilationUnit.Assembly);

            if (references.AssemblyReferences.Any() || references.ModuleReferences.Any())
            {
                treeBuilder.AddChild(references);
            }

            var resources = new AssemblyResourceFolder(compilationUnit.Assembly);

            if (resources.Resources.Any())
            {
                treeBuilder.AddChild(resources);
            }

            var  namespaces = new Dictionary <string, NamespaceData> ();
            bool publicOnly = Widget.PublicApiOnly;

            foreach (var type in compilationUnit.DecompilerTypeSystem.MainModule.TypeDefinitions)
            {
                string namespaceName = string.IsNullOrEmpty(type.Namespace) ? "" : type.Namespace;
                if (!namespaces.ContainsKey(namespaceName))
                {
                    namespaces [namespaceName] = new NamespaceData(namespaceName);
                }

                var ns = namespaces [namespaceName];
                ns.Types.Add((type.IsPublic(), type));
            }

            treeBuilder.AddChildren(namespaces.Where(ns => ns.Key != "" && (!publicOnly || ns.Value.Types.Any(t => t.isPublic))).Select(n => n.Value));
            if (namespaces.ContainsKey(""))
            {
                foreach (var child in namespaces[""].Types)
                {
                    if (((INamedElement)child.typeObject).Name == "<Module>")
                    {
                        continue;
                    }
                    treeBuilder.AddChild(child);
                }
            }
        }
Пример #4
0
        public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
        {
            var compilationUnit = (AssemblyLoader)dataObject;

            if (compilationUnit.Assembly == null)
            {
                return;
            }
            var references = new AssemblyReferenceFolder(compilationUnit.Assembly);

            if (references.AssemblyReferences.Any() || references.ModuleReferences.Any())
            {
                treeBuilder.AddChild(references);
            }

            var resources = new AssemblyResourceFolder(compilationUnit.Assembly);

            if (resources.Resources.Any())
            {
                treeBuilder.AddChild(resources);
            }

            var  namespaces = new Dictionary <string, Namespace> ();
            bool publicOnly = Widget.PublicApiOnly;

            foreach (var type in compilationUnit.UnresolvedAssembly.TopLevelTypeDefinitions)
            {
                string namespaceName = string.IsNullOrEmpty(type.Namespace) ? "-" : type.Namespace;
                if (!namespaces.ContainsKey(namespaceName))
                {
                    namespaces [namespaceName] = new Namespace(namespaceName);
                }

                var ns = namespaces [namespaceName];
                ns.Types.Add(type);
            }

            foreach (var ns in namespaces.Values)
            {
                if (publicOnly && !ns.Types.Any(t => t.IsPublic))
                {
                    continue;
                }
                treeBuilder.AddChild(ns);
            }
        }
Пример #5
0
        public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
        {
            var assemblyLoader = (AssemblyLoader)dataObject;

            if (assemblyLoader.Error != null)
            {
                treeBuilder.AddChild(assemblyLoader.Error);
                return;
            }
            if (assemblyLoader.Assembly == null)
            {
                return;
            }
            var references = new AssemblyReferenceFolder(assemblyLoader.Assembly);

            if (references.AssemblyReferences.Any() || references.ModuleReferences.Any())
            {
                treeBuilder.AddChild(references);
            }

            var resources = new AssemblyResourceFolder(assemblyLoader.Assembly);

            if (resources.Resources.Any())
            {
                treeBuilder.AddChild(resources);
            }

            var mainModule = assemblyLoader.DecompilerTypeSystem.MainModule;
            var rootData   = new NamespaceData(mainModule.RootNamespace);

            if (rootData.Types.Length > 0)
            {
                treeBuilder.AddChild(rootData);
            }

            var allNamespaces = new List <NamespaceData> (32);

            CollectNamespaces(allNamespaces, mainModule.RootNamespace.ChildNamespaces);
            treeBuilder.AddChildren(allNamespaces);
        }