Esempio n. 1
0
        public static IMetadataInfo GetOrCreate(Assembly assembly)
        {
            lock (assemblyCatalogInfoToMetadataInfoMap)
            {
                MetadataInfo result;

                var assemblyCatalogInfo = Discovery.GetAssemblyCatalogInfoFromFile(assembly.Location);
                if (!assemblyCatalogInfoToMetadataInfoMap.TryGetValue(assemblyCatalogInfo, out result))
                {
                    result = new MetadataInfo(assemblyCatalogInfo, assembly);
                    assemblyCatalogInfoToMetadataInfoMap.Add(assemblyCatalogInfo, result);
                }

                return(result);
            }
        }
Esempio n. 2
0
        public static IMetadataInfo GetOrCreateByAssemblyFullName(string assemblyFullName)
        {
            if (Discovery.IsKnownNonMefAssembly(assemblyFullName))
            {
                return(null);
            }

            lock (assemblyCatalogInfoToMetadataInfoMap)
            {
                MetadataInfo result;

                var assemblyCatalogInfo = Discovery.GetAssemblyCatalogInfoFromAssemblyName(assemblyFullName);
                if (!assemblyCatalogInfoToMetadataInfoMap.TryGetValue(assemblyCatalogInfo, out result))
                {
                    result = new MetadataInfo(assemblyCatalogInfo);
                    assemblyCatalogInfoToMetadataInfoMap.Add(assemblyCatalogInfo, result);
                }

                return(result);
            }
        }
Esempio n. 3
0
        public static IMetadataInfo GetOrCreate(string assemblyFilePath)
        {
            lock (assemblyCatalogInfoToMetadataInfoMap)
            {
                MetadataInfo result;

                AssemblyResolver.AddPath(Path.GetFullPath(Path.GetDirectoryName(assemblyFilePath)));

                var assemblyCatalogInfo = Discovery.GetAssemblyCatalogInfoFromFile(assemblyFilePath);
                if (assemblyCatalogInfo == null)
                {
                    throw new FileNotFoundException(
                              string.Format("Could not resolve assembly {0} likely because the file wasn't found on disk.", assemblyFilePath));
                }

                if (!assemblyCatalogInfoToMetadataInfoMap.TryGetValue(assemblyCatalogInfo, out result))
                {
                    result = new MetadataInfo(assemblyCatalogInfo);
                    assemblyCatalogInfoToMetadataInfoMap.Add(assemblyCatalogInfo, result);
                }

                return(result);
            }
        }
Esempio n. 4
0
        public static IMetadataInfo GetOrCreate(Assembly assembly)
        {
            lock (assemblyCatalogInfoToMetadataInfoMap)
            {
                MetadataInfo result;

                var assemblyCatalogInfo = Discovery.GetAssemblyCatalogInfoFromFile(assembly.Location);
                if (!assemblyCatalogInfoToMetadataInfoMap.TryGetValue(assemblyCatalogInfo, out result))
                {
                    result = new MetadataInfo(assemblyCatalogInfo, assembly);
                    assemblyCatalogInfoToMetadataInfoMap.Add(assemblyCatalogInfo, result);
                }

                return result;
            }
        }
Esempio n. 5
0
        public static IMetadataInfo GetOrCreateByAssemblyFullName(string assemblyFullName)
        {
            if (Discovery.IsKnownNonMefAssembly(assemblyFullName))
            {
                return null;
            }

            lock (assemblyCatalogInfoToMetadataInfoMap)
            {
                MetadataInfo result;

                var assemblyCatalogInfo = Discovery.GetAssemblyCatalogInfoFromAssemblyName(assemblyFullName);
                if (!assemblyCatalogInfoToMetadataInfoMap.TryGetValue(assemblyCatalogInfo, out result))
                {
                    result = new MetadataInfo(assemblyCatalogInfo);
                    assemblyCatalogInfoToMetadataInfoMap.Add(assemblyCatalogInfo, result);
                }

                return result;
            }
        }
Esempio n. 6
0
        public static IMetadataInfo GetOrCreate(string assemblyFilePath)
        {
            lock (assemblyCatalogInfoToMetadataInfoMap)
            {
                MetadataInfo result;

                AssemblyResolver.AddPath(Path.GetFullPath(Path.GetDirectoryName(assemblyFilePath)));

                var assemblyCatalogInfo = Discovery.GetAssemblyCatalogInfoFromFile(assemblyFilePath);
                if (assemblyCatalogInfo == null)
                {
                    throw new FileNotFoundException(
                        string.Format("Could not resolve assembly {0} likely because the file wasn't found on disk.", assemblyFilePath));
                }

                if (!assemblyCatalogInfoToMetadataInfoMap.TryGetValue(assemblyCatalogInfo, out result))
                {
                    result = new MetadataInfo(assemblyCatalogInfo);
                    assemblyCatalogInfoToMetadataInfoMap.Add(assemblyCatalogInfo, result);
                }

                return result;
            }
        }
Esempio n. 7
0
        public static MetadataTypeCatalog Create(string assemblyFilePath, ICompositionElement definitionOrigin)
        {
            var metadataInfo = MetadataInfo.GetOrCreate(assemblyFilePath);

            return(new MetadataTypeCatalog(metadataInfo, definitionOrigin));
        }
Esempio n. 8
0
 public static IMetadataInfo GetOrCreateMetadataInfoByAssemblyFullName(string assemblyFullName)
 {
     return(MetadataInfo.GetOrCreateByAssemblyFullName(assemblyFullName));
 }
Esempio n. 9
0
 public static IMetadataInfo GetOrCreateMetadataInfo(Assembly assembly)
 {
     return(MetadataInfo.GetOrCreate(assembly));
 }