Game Development Reference
In-Depth Information
{
byte[] assemblyData = new byte[stream.Length];
if (stream.Read(assemblyData,
0,
(int)stream.Length) < 1)
{
return false;
}
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = “Plugins”;
setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
setup.ShadowCopyFiles = “true”;
setup.ShadowCopyDirectories = pluginDirectory.FullName;
appDomain = AppDomain.CreateDomain(“PluginDomain” +
plugin.Name.Replace(“.dll”, “”).Replace(“.”, “”), null, setup);
EnforceSecurityPolicy();
proxy = appDomain.CreateInstanceAndUnwrap(“Plugin.Manager”,
“Plugin.Manager.PluginProxy”) as PluginProxy;
if (plugin.Extension.EndsWith(“cs”) ||
plugin.Extension.EndsWith(“js”) ||
plugin.Extension.EndsWith(“vb”))
{
if (!proxy.CompileAssembly(appDomain, plugin.FullName))
{
return false;
}
}
else if (!proxy.LoadAssembly(appDomain, assemblyData))
{
return false;
}
name = plugin.Name;
return true;
}
Search Nedrilad ::




Custom Search