/// <summary> /// Retrieves the location of Reloaded's launcher. /// </summary> private static string GetLauncherLocation() { // Launcher is Squirrel Installed. if (File.Exists(LoaderPaths.ReloadedLauncherLocation)) { return(LoaderPaths.ReloadedLauncherLocation); } else { // Not squirrel installed, user must specify themselves. var shimSettings = ReloadedShimSettings.GetShim(); // Check if file previously specified by user. if (!String.IsNullOrEmpty(shimSettings.LauncherLocation)) { if (File.Exists(shimSettings.LauncherLocation)) { return(shimSettings.LauncherLocation); } } // Get file location from user. OpenFileDialog openFileDialog = new OpenFileDialog(); MessageBox.Show("Reloaded-Launcher not found at default location; please specify the location manually."); openFileDialog.Title = "Select Reloaded-Launcher.exe location"; openFileDialog.Multiselect = false; // Keep opening dialog until not OK while (openFileDialog.ShowDialog() != DialogResult.OK) { } string fileName = openFileDialog.FileName; shimSettings.LauncherLocation = openFileDialog.FileName; shimSettings.SaveShim(); openFileDialog.Dispose(); return(fileName); } }
static void Main() { #if DEBUG Debugger.Launch(); #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); RetrieveConfigs(); // Read shim settings. var shimSettings = ReloadedShimSettings.GetShim(); // If there are multiple games, let the user select one. if (GameConfigurations.Count > 1) { // Auto-load game if default set, else ask user. if (!String.IsNullOrEmpty(shimSettings.LoadByDefault)) { Functions.LaunchGame(shimSettings.LoadByDefault); } else { Application.Run(new GameSelector(GameConfigurations, shimSettings)); } } if (GameConfigurations.Count < 1) { MessageBox.Show("No game profiles found pointing to either the current directory or any of the subfolders.\n" + "Please ensure you have your game profiles correctly set up.\n" + "Refer to the readme pages on Github for more information."); Environment.Exit(0); } // Single game, launch it. Functions.LaunchGame(Path.GetDirectoryName(GameConfigurations[0].ConfigLocation)); }