I'm building a board game with the possibility of adding custom user bot. Bot behaviors and decisions are define according to an interface :
public interface IBotPlayer
{
.....
void Init();
PlayResult Play(TableState tableState) ;
.....
}
Other users can implement that interface in an external assembly that I load dynamically in my main application.
Assembly assembly = Assembly.LoadFile("externalLib.dll");
foreach (var botPlayerType in assembly.GetTypes().Where(t => t.IsClass && t.IsAssignableFrom(typeof(IBotPlayer)))
{
..........
// Execution on a new thread th
// Now I wanna run it in some kind of sandbox with very limited right, no disk access, no network, ...
IBotPlayer botPlayer = Activator.CreateInstance<IBotPlayer>(botPlayerType);
botPlayer.Init() ;
........
}
- As if
IBotPlayer
implementation should only be algorithmic, is it possible to restrict the executing thread with only the use of collections for e.g? **If yes how ?