public Assembly LoadAssembly(IAssembly asm)
        {
            var project = asm.GetProject();

            if (project != null)
            {
                return(LoadAssembly(project));
            }
            if (asm.IsGacAssembly())
            {
                return(LoadAssembly(new AssemblyName(asm.FullAssemblyName), false));
            }
            return(LoadAssembly(asm.GetRuntimeAssemblyLocation()));
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieves the model instance for the given assembly.
        /// May return null if there is no model for the specified assembly.
        /// </summary>
        public static IAssemblyModel GetModel(this IAssembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            IProject project = assembly.GetProject();

            if (project != null)
            {
                return(project.AssemblyModel);
            }

            try {
                return(SD.AssemblyParserService.GetAssemblyModel(assembly.GetReferenceAssemblyLocation()));
            } catch (Exception) {
                // TODO: use the exact exception types that GetAssemblyModel() throws (+document them)
                // silently ignore errors when loading the assembly
                return(null);
            }
        }
 public Assembly LoadAssembly(IAssembly asm)
 {
     var project = asm.GetProject();
     if (project != null)
         return LoadAssembly(project);
     if (asm.IsGacAssembly())
         return LoadAssembly(new AssemblyName(asm.FullAssemblyName), false);
     return LoadAssembly(asm.GetRuntimeAssemblyLocation());
 }