IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
CShell.AssemblyLoader Class Reference

Static Helper classes to manage the assemblies. The instance is subscribed to the workpsace events and the AssemblyReferences to load it's modules to the container. More...

+ Inheritance diagram for CShell.AssemblyLoader:
+ Collaboration diagram for CShell.AssemblyLoader:

Public Member Functions

 AssemblyLoader (CompositionContainer container, IEventAggregator eventAggregator)
 
void Handle (WorkspaceOpeningEventArgs message)
 
void Handle (WorkspaceClosingEventArgs message)
 
 AssemblyLoader (CompositionContainer container, IEventAggregator eventAggregator)
 
void Handle (WorkspaceOpeningEventArgs message)
 
void Handle (WorkspaceClosingEventArgs message)
 

Static Public Member Functions

static string GetAssemblyName (string fullName)
 
static string[] GetAssemblySearchFiles (IEnumerable< AssemblyReference > references)
 
static string[] GetAssemblySearchPaths (IEnumerable< AssemblyReference > references)
 
static Assembly LoadAssembly (AssemblyReference reference)
 
static AssemblyName[] GetGacAssemblyNames ()
 
static Assembly[] GetGacAssemblies ()
 Gets the assemblies in the GAC, the assemblies are loaded reflection only. More...
 
static string GetGacAssemblyPath (AssemblyName assemblyName)
 
static string GetAssemblyName (string fullName)
 
static string[] GetAssemblySearchFiles (IEnumerable< AssemblyReference > references)
 
static string[] GetAssemblySearchPaths (IEnumerable< AssemblyReference > references)
 
static Assembly LoadAssembly (AssemblyReference reference)
 
static AssemblyName[] GetGacAssemblyNames ()
 
static Assembly[] GetGacAssemblies ()
 Gets the assemblies in the GAC, the assemblies are loaded reflection only. More...
 
static string GetGacAssemblyPath (AssemblyName assemblyName)
 

Private Member Functions

void AssembliesOnCollectionChanged (object sender, NotifyCollectionChangedEventArgs args)
 
void AssemblyAdded (AssemblyReference assemblyReference)
 
void AssemblyRemoved (AssemblyReference assemblyReference)
 
void AssembliesOnCollectionChanged (object sender, NotifyCollectionChangedEventArgs args)
 
void AssemblyAdded (AssemblyReference assemblyReference)
 
void AssemblyRemoved (AssemblyReference assemblyReference)
 

Private Attributes

readonly CompositionContainer container
 
readonly AggregateCatalog catalog
 
readonly ILog log = LogManager.GetLog(typeof (AssemblyLoader))
 
readonly List< IModuleloadedModules = new List<IModule>()
 
readonly List< AssemblyReferenceloadedAssemblies = new List<AssemblyReference>()
 

Static Private Attributes

static readonly Lazy
< AssemblyName[]> 
gacAssembyNames = new Lazy<AssemblyName[]>(() => Util.GlobalAssemblyCache.GetAssemblyList().ToArray(), true)
 
static readonly Lazy< Assembly[]> gacAssemblies
 

Detailed Description

Static Helper classes to manage the assemblies. The instance is subscribed to the workpsace events and the AssemblyReferences to load it's modules to the container.

Constructor & Destructor Documentation

CShell.AssemblyLoader.AssemblyLoader ( CompositionContainer  container,
IEventAggregator  eventAggregator 
)
inline
CShell.AssemblyLoader.AssemblyLoader ( CompositionContainer  container,
IEventAggregator  eventAggregator 
)
inline

Member Function Documentation

void CShell.AssemblyLoader.AssembliesOnCollectionChanged ( object  sender,
NotifyCollectionChangedEventArgs  args 
)
inlineprivate
void CShell.AssemblyLoader.AssemblyRemoved ( AssemblyReference  assemblyReference)
inlineprivate
static string CShell.AssemblyLoader.GetAssemblyName ( string  fullName)
inlinestatic
static string [] CShell.AssemblyLoader.GetAssemblySearchFiles ( IEnumerable< AssemblyReference references)
inlinestatic
static string [] CShell.AssemblyLoader.GetAssemblySearchPaths ( IEnumerable< AssemblyReference references)
inlinestatic
static Assembly CShell.AssemblyLoader.LoadAssembly ( AssemblyReference  reference)
inlinestatic
static AssemblyName [] CShell.AssemblyLoader.GetGacAssemblyNames ( )
inlinestatic
static Assembly [] CShell.AssemblyLoader.GetGacAssemblies ( )
inlinestatic

Gets the assemblies in the GAC, the assemblies are loaded reflection only.

Returns
static string CShell.AssemblyLoader.GetGacAssemblyPath ( AssemblyName  assemblyName)
inlinestatic
void CShell.AssemblyLoader.AssembliesOnCollectionChanged ( object  sender,
NotifyCollectionChangedEventArgs  args 
)
inlineprivate
void CShell.AssemblyLoader.AssemblyRemoved ( AssemblyReference  assemblyReference)
inlineprivate
static string CShell.AssemblyLoader.GetAssemblyName ( string  fullName)
inlinestatic
static string [] CShell.AssemblyLoader.GetAssemblySearchFiles ( IEnumerable< AssemblyReference references)
inlinestatic
static string [] CShell.AssemblyLoader.GetAssemblySearchPaths ( IEnumerable< AssemblyReference references)
inlinestatic
static Assembly CShell.AssemblyLoader.LoadAssembly ( AssemblyReference  reference)
inlinestatic
static AssemblyName [] CShell.AssemblyLoader.GetGacAssemblyNames ( )
inlinestatic
static Assembly [] CShell.AssemblyLoader.GetGacAssemblies ( )
inlinestatic

Gets the assemblies in the GAC, the assemblies are loaded reflection only.

Returns
static string CShell.AssemblyLoader.GetGacAssemblyPath ( AssemblyName  assemblyName)
inlinestatic

Member Data Documentation

readonly CompositionContainer CShell.AssemblyLoader.container
private
readonly AggregateCatalog CShell.AssemblyLoader.catalog
private
readonly ILog CShell.AssemblyLoader.log = LogManager.GetLog(typeof (AssemblyLoader))
private
readonly List< IModule > CShell.AssemblyLoader.loadedModules = new List<IModule>()
private
readonly List< AssemblyReference > CShell.AssemblyLoader.loadedAssemblies = new List<AssemblyReference>()
private
static readonly Lazy< AssemblyName[]> CShell.AssemblyLoader.gacAssembyNames = new Lazy<AssemblyName[]>(() => Util.GlobalAssemblyCache.GetAssemblyList().ToArray(), true)
staticprivate
static readonly Lazy< Assembly[]> CShell.AssemblyLoader.gacAssemblies
staticprivate
Initial value:
= new Lazy<Assembly[]>(() =>
{
var assemblies = new List<Assembly>();
var errorCount = 0;
foreach (var assemblyName in gacAssembyNames.Value)
{
try
{
var assembly = Assembly.ReflectionOnlyLoad(assemblyName.FullName);
assemblies.Add(assembly);
}
catch (Exception ex)
{
errorCount++;
Debug.Print("Could not load GAC assembly '{0}': {1}",assemblyName.FullName, ex);
}
}
Debug.Print("GAC error count: "+errorCount);
return assemblies.ToArray();
}, true)

The documentation for this class was generated from the following file: