Game Development Reference
In-Depth Information
parameters.ReferencedAssemblies.Add(“System.XML.dll”);
parameters.ReferencedAssemblies.Add(“Accessibility.dll”);
parameters.ReferencedAssemblies.Add(“Microsoft.Vsa.dll”);
if (references != null)
{
foreach (string reference in references)
{
if (!parameters.ReferencedAssemblies.Contains(reference))
{
parameters.ReferencedAssemblies.Add(reference);
}
}
}
CompilerResults results
= codeProvider.CompileAssemblyFromFile(parameters,
fileNames.ToArray());
compileErrors = results.Errors;
if (compileErrors.Count > 0)
{
throw new Exception(“Error(s) occurred while “ +
“compiling source file(s).”);
}
return results.CompiledAssembly;
}
}
}
Note
One restriction on the code compilation system presented in this chapter is that each source code
file must be a fully functional module. Plugins cannot be spread over multiple files in the plugins
directory, because each file will be compiled as a standalone plugin.
Enforcing a Security Policy
A common concern when making an application plugin-aware is how code security
can be handled. Malicious plugins can do a lot of damage to the application or
even the operating system itself. This is even more of a concern when allowing
 
Search Nedrilad ::




Custom Search