private void EnsureLoaded()
{
if (Loaded) return;
lock (loadlock)
{
if (!Loaded)
{
loadedAssemblies.Clear();
if (!String.IsNullOrEmpty(DomainPath))
{
var paths = DomainPath.Split(';');
var filters = FileFilter.Split('|');
foreach (var path in paths)
{
try
{
loadedAssemblies.AddRange(
filters.SelectMany(s => Directory.GetFiles(path, s)).Select(Assembly.LoadFrom));
Loaded = true;
}
// Files should always exists but don't blow up here if they don't
catch (FileNotFoundException)
{
}
// File was found but could not be loaded
catch (FileLoadException)
{
}
// Dlls that contain native code are not loaded, but do not invalidate the Directory
catch (BadImageFormatException)
{
}
// Dlls that have missing Managed dependencies are not loaded, but do not invalidate the Directory
catch (ReflectionTypeLoadException)
{
}
}
}
}
}
}