private Assembly GetRequiredAssembly(string classType, AbstractMachineState state)
{
AMAssemblyCache cache = (AMAssemblyCache)state.AssemblyCache;
string assemblyFile = "";
// if it exists in the global assembly cache, then get it from there...
foreach (string ns in cache.Namespaces)
{
string fullName = ns + "." + classType;
if (cache.LocalAssemblyCache.Contains(fullName))
{
assemblyFile = (string)cache.LocalAssemblyCache[fullName];
return Assembly.LoadWithPartialName(assemblyFile);
}
}
foreach (string loadedAssembly in cache.AssemblyFiles)
{
Assembly a = Assembly.LoadFrom(loadedAssembly);
Type[] types = a.GetTypes();
Type type = null;
foreach (Type t in types)
{
if (t.Name == classType)
{
type = t;
break;
}
}
fullTypeName = type.FullName;
return a;
}
return null;
}