C
Cairn
I have some .net code I am using which I also which to use on a compact
device.
The code looks in the given dir and then loads all instances of the given
interface. I have attempted to convert the code to complei and run on a
device to to no luck. please does anyone have to ideas on what to change.
Dictionary<short, IPlugin> pluginlist;
void load (string filename)
{
Assembly plugin_assembly = null;
//Load the assembly to memory so we don't lock up the file
byte[] assemblyFileData = System.IO.File.ReadAllBytes(filename);
//Load the assembly
try
{
plugin_assembly = Assembly.Load(assemblyFileData);
}
catch
{
errorMsg = "Compiled Assembly (" + filename + ") is not a valid
Assembly File to be Loaded.";
}
if (plugin_assembly != null)
{
string typeName = typeof(IPlugin).ToString();
//Go through the types we need to find our clientinterface
foreach (Type t in plugin_assembly.GetTypes())
{
//Try getting the interface from the current type
if (t.GetInterface(typeName, true) != null)
{
IPlugin ish = (IPlugin)Activator.CreateInstance(t);
luginlist.Add(ish.Plugin_id, ish);
}
}
}
device.
The code looks in the given dir and then loads all instances of the given
interface. I have attempted to convert the code to complei and run on a
device to to no luck. please does anyone have to ideas on what to change.
Dictionary<short, IPlugin> pluginlist;
void load (string filename)
{
Assembly plugin_assembly = null;
//Load the assembly to memory so we don't lock up the file
byte[] assemblyFileData = System.IO.File.ReadAllBytes(filename);
//Load the assembly
try
{
plugin_assembly = Assembly.Load(assemblyFileData);
}
catch
{
errorMsg = "Compiled Assembly (" + filename + ") is not a valid
Assembly File to be Loaded.";
}
if (plugin_assembly != null)
{
string typeName = typeof(IPlugin).ToString();
//Go through the types we need to find our clientinterface
foreach (Type t in plugin_assembly.GetTypes())
{
//Try getting the interface from the current type
if (t.GetInterface(typeName, true) != null)
{
IPlugin ish = (IPlugin)Activator.CreateInstance(t);
luginlist.Add(ish.Plugin_id, ish);
}
}
}