Exemplo n.º 1
0
        private RawUsingItem CreateUsingItem([NotNull] ItemType itemType, [NotNull] TypeReference typeReference, [NotNull] string memberName, [CanBeNull, ItemNotNull] string[] markers, [CanBeNull] ItemTail customSections, WorkingGraph readingGraph)
        {
            string namespaceName, className, assemblyName, assemblyVersion, assemblyCulture;

            GetTypeInfo(typeReference, out namespaceName, out className, out assemblyName, out assemblyVersion, out assemblyCulture);
            return(RawUsingItem.New(_rawUsingItemsCache, itemType, namespaceName, className, assemblyName, assemblyVersion, assemblyCulture, memberName, markers, customSections, readingGraph));
        }
Exemplo n.º 2
0
        protected override IEnumerable <RawUsingItem> ReadUsingItems(int depth, WorkingGraph readingGraph)
        {
            Log.WriteInfo("Reading " + FullFileName);
            AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(FullFileName);

            try {
                assembly.MainModule.ReadSymbols();
            } catch (Exception ex) {
                Log.WriteWarning(
                    $"Loading symbols for assembly {FullFileName} failed - maybe .PDB file is missing. ({ex.Message})", FullFileName, 0);
            }

            ItemTail customSections = GetCustomSections(readingGraph, assembly.CustomAttributes, null);

            foreach (TypeDefinition type in assembly.MainModule.Types)
            {
                if (type.Name == "<Module>")
                {
                    continue;
                }

                foreach (var usingItem in AnalyzeType(type, customSections, readingGraph))
                {
                    yield return(usingItem);
                }
            }

            AssemblyNameDefinition currentAssembly = assembly.Name;

            yield return(RawUsingItem.New(_rawUsingItemsCache, DOTNETASSEMBLY,
                                          namespaceName: "", className: "", assemblyName: currentAssembly.Name,
                                          assemblyVersion: currentAssembly.Version.ToString(), assemblyCulture: currentAssembly.Culture,
                                          memberName: "", markers: null, tail: null, readingGraph: readingGraph));
        }
Exemplo n.º 3
0
        private RawUsingItem GetClassItem(TypeReference typeReference, ItemTail customSections, WorkingGraph readingGraph)
        {
            string namespaceName, className, assemblyName, assemblyVersion, assemblyCulture;

            GetTypeInfo(typeReference, out namespaceName, out className, out assemblyName, out assemblyVersion, out assemblyCulture);

            return(RawUsingItem.New(_rawUsingItemsCache, DotNetAssemblyDependencyReaderFactory.DOTNETTYPE,
                                    namespaceName, className, assemblyName, assemblyVersion, assemblyCulture, memberName: "",
                                    markers: null, tail: customSections, readingGraph: readingGraph));
        }