/// <summary> /// The main entry point for the application. /// </summary> /// <param name="args"></param> public static void Main(string[] args) { // Find Assemblies Manually if necessary (Deprecate app.config) AppDomain.CurrentDomain.AssemblyResolve += AssemblyFinder.CurrentDomain_AssemblyResolve; /* - Initialization - */ DoSquirrelStuff(); // Initialize the console. ConsoleFunctions.Initialize(); // Print startup information. Banner.PrintBanner(); // Get Controller Order Controllers.PrintControllerOrder(); // Unlock DLLs, Removes Zone Information which may prevent DLL injection if DLL was downloaded from e.g. Internet Explorer DllUnlocker.UnblockDlls(); // Setup Server LoaderServer.SetupServer(); // Setup libReloaded Debug Bindings SetuplibReloadedBindings(); /* - Option Parsing, Linking - */ // Parse Arguments ParseArguments(args); // Start game InjectByMethod(args); /* - Load and enter main close polling loop - */ // Add to exited event _gameProcess.GetProcessFromReloadedProcess().EnableRaisingEvents = true; _gameProcess.GetProcessFromReloadedProcess().Exited += (sender, eventArgs) => ProcessSelfReattach(args); // Load modifications for the current game. ModLoader.LoadMods(_gameConfig, _gameProcess); // Stay alive in the background AppDomain.CurrentDomain.ProcessExit += Shutdown; Console.CancelKeyPress += Shutdown; // Sleep infinitely as much as it is necessary. while (true) { Console.ReadLine(); } }