예제 #1
0
        private static AssemblyReferenceInfo GetAssemblyReferenceInfo(
            IDictionary <string, AssemblyReferenceInfo> assemblies,
            AssemblyName assemblyName,
            AppDomain appDomainWithBindingRedirects,
            VisualizerOptions options,
            string fileName = "")
        {
            if (options.SkipSystem && AssemblyInformationProvider.IsSystemAssembly(assemblyName))
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(options.ReferencedStartsWith) &&
                !assemblyName.FullName.StartsWith(options.ReferencedStartsWith, StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            var assemblyFullName = appDomainWithBindingRedirects != null
                ? appDomainWithBindingRedirects.ApplyPolicy(assemblyName.FullName)
                : assemblyName.FullName;

            if (assemblies.TryGetValue(assemblyFullName, out AssemblyReferenceInfo assemblyReferenceInfo))
            {
                return(assemblyReferenceInfo);
            }

            assemblyReferenceInfo = new AssemblyReferenceInfo(assemblyName, new AssemblyName(assemblyFullName), fileName);
            assemblies.Add(assemblyFullName, assemblyReferenceInfo);
            return(assemblyReferenceInfo);
        }
예제 #2
0
        private AssemblyReferenceInfo GetAssemblyReferenceInfo(IDictionary <string, AssemblyReferenceInfo> assemblies, AssemblyName assemblyName)
        {
            if (SkipSystem && AssemblyInformationProvider.IsSystemAssembly(assemblyName))
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(ReferencedStartsWith) && !assemblyName.FullName.StartsWith(ReferencedStartsWith, StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            var assemblyFullName = AppDomainWithBindingRedirects != null?AppDomainWithBindingRedirects.ApplyPolicy(assemblyName.FullName) : assemblyName.FullName;

            AssemblyReferenceInfo assemblyReferenceInfo;

            if (assemblies.TryGetValue(assemblyFullName, out assemblyReferenceInfo))
            {
                return(assemblyReferenceInfo);
            }

            assemblyReferenceInfo = new AssemblyReferenceInfo(assemblyName, new AssemblyName(assemblyFullName));
            assemblies.Add(assemblyFullName, assemblyReferenceInfo);
            return(assemblyReferenceInfo);
        }