Src/Black.Beard.ComponentModel/ComponentModel/TypeDiscovery.cs
/// <summary>
///     Load in memory all the assemblies from the specified with directory.
/// </summary>
/// <returns></returns>
Load in memory all the assemblies from the specified with directory.
Load in memory all the assemblies from the specified with directory .
public int LoadAssembliesFrom(string dir)
        {
            int result = 0;
            var directory = new DirectoryInfo(dir);
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            try
            {
                var files = directory.GetFiles("*.dll").Where(c => FilterFilename(c));
                foreach (var file in files)
                    if (!IsLoadedByFile(file.FullName))
                    {
                        Assembly ass = null;
                        try
                        {
                            ass = AssemblyLoad(file.FullName);
                            result += ass.ExportedTypes.Count();
                        }
                        catch (Exception e)
                        {
                            OnRegisterException(e);
                            Trace.TraceError(e.ToString());
                        }
                    }
            }
            finally
            {
                AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
            }
            return result;
        }
public int LoadAssembliesFrom ( string dir ) { int result = 0 ; var directory = new DirectoryInfo ( dir ) ; AppDomain . CurrentDomain . AssemblyResolve += CurrentDomain_AssemblyResolve ; try { var files = directory . GetFiles ( " " ) . Where ( c => FilterFilename ( c ) ) ; foreach ( var file in files ) if ( ! IsLoadedByFile ( file . FullName ) ) { Assembly ass = null ; try { ass = AssemblyLoad ( file . FullName ) ; result += ass . ExportedTypes . Count ( ) ; } catch ( Exception e ) { OnRegisterException ( e ) ; Trace . TraceError ( e . ToString ( ) ) ; } } } finally { AppDomain . CurrentDomain . AssemblyResolve -= CurrentDomain_AssemblyResolve ; } return result ; }
Load in memory all the assemblies from the specified with directory.
Load in memory all the assemblies from the specified with directory .
None
dir
string