public static void LoadScript(Game game, string path) { Assembly assembly = null; switch (Path.GetExtension(path)) { case ".exe": case ".dll": assembly = LoadAssembly(path); break; case ".cs": assembly = CompileScript(path, cSharpCodeProvider); break; case ".vb": assembly = CompileScript(path, vBCodeProvider); break; } if (assembly != null) { foreach (IScript script in FindInterfaces <IScript>(assembly)) { loadedScripts.Add(script); script.Start(game); } foreach (ICommand cmd in FindInterfaces <ICommand>(assembly)) { Commands.RegisterCommand(cmd); } foreach (IActionItem actionItem in FindInterfaces <IActionItem>(assembly)) { ActionItems.RegisterAction(actionItem); } } }