public static IoObject slotLoadAssembly(IoObject target, IoObject locals, IoObject message)
{
IoCLR self = target as IoCLR;
IoMessage m = message as IoMessage;
IoSeq assemblyName = m.localsSymbolArgAt(locals, 0);
IoCLRAssembly asm = self.loadedAssemblies[assemblyName.value] as IoCLRAssembly;
if (asm != null)
{
return(asm);
}
asm = IoCLRAssembly.createObject(target.state);
asm.assembly = Assembly.LoadWithPartialName(assemblyName.value);
if (asm.assembly == null)
{
return(self);
}
self.loadedAssemblies[assemblyName.value] = asm;
asm.assemblyTypes = asm.assembly.GetTypes();
asm.assemblyNamespaces = new Hashtable();
foreach (Type t in asm.assemblyTypes)
{
string theNameSpace = t.FullName.LastIndexOf(".") == -1 ? "-" : t.FullName.Substring(0, t.FullName.LastIndexOf("."));
string theClass = t.FullName.LastIndexOf(".") == -1 ? t.FullName : t.FullName.Substring(t.FullName.LastIndexOf(".") + 1);
if (theClass.Equals("Form"))
{
int i = 0;
}
if (asm.assemblyNamespaces.ContainsKey(theNameSpace))
{
Hashtable a = asm.assemblyNamespaces[theNameSpace] as Hashtable;
a[theClass] = t;
}
else
{
Hashtable classes = new Hashtable();
classes[theClass] = t;
asm.assemblyNamespaces[theNameSpace] = classes;
}
}
return(asm);
}