static void LoadGameDll(string BasePath) { BasePath = Path.Combine(BasePath, "Game.dll"); Assembly GameAssembly = Reflect.LoadAssembly(BasePath); Type[] GameImplementations = Reflect.GetAllImplementationsOf(GameAssembly, typeof(LibTechGame)).ToArray(); if (GameImplementations.Length == 0) { GConsole.WriteLine("No game implementations found in " + BasePath); Environment.Exit(0); } else if (GameImplementations.Length > 1) { GConsole.WriteLine("Too many game implementations in " + BasePath); Environment.Exit(0); } AppDomain.CurrentDomain.AssemblyResolve += (S, E) => TryLoadAssembly(E.Name, BasePath); Importers.RegisterAll(GameAssembly); Game = (LibTechGame)Activator.CreateInstance(GameImplementations[0]); Game.Load(); }