private void processExistsTimer_Tick(object sender, EventArgs e) { RLProcessMonitor.LookForProcess(); //if dll is injected and our process becomes null, reset UI state if (RLProcessMonitor.RocketLeagueProcess == null && isDllInjected) { injectButton.Enabled = true; dllInjectionVerified = false; isDllInjected = false; injectStatusLabel.Text = "Not Injected"; } //save path if it's not saved already if (RLProcessMonitor.RocketLeagueProcess != null && string.IsNullOrEmpty((Properties.Settings.Default.GamePath))) { string path = RLProcessMonitor.RocketLeagueProcess.MainModule.FileName.Replace("\\", "\\\\"); Properties.Settings.Default.GamePath = path.Remove(path.Length - 16); //setup cooked and workshop paths SetupPaths(); RefreshWorkshopMaps(); } }
private void MainForm_Load(object sender, EventArgs e) { //ensure our CurrentDirectory is our executing assembly location //this will correct errors caused by shorcuts and whatnot Environment.CurrentDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); //set title var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version; this.Text += $" {assemblyVersion.Major}.{assemblyVersion.Minor}"; //check if we're already running and close if we are var mutex = new Mutex(true, "RocketLauncher", out var mutexCreated); if (!mutexCreated) { logger.WriteLine("Mutex already created. Shutting down. (An instance of Rocket Launcher is already running)"); mutex.Close(); Application.Exit(); return; } //create logger and start new log logger = new LogFile("RL.log"); logger.Clear(); logger.WriteLine($"Initializing {this.Text}"); //verify installation bool installationCorrect = true; if (!File.Exists("Injector.dll")) { installationCorrect = false; } //yell at the user for doing things wrong if (!installationCorrect) { MessageBox.Show( "One or more required program files are missing. Please fully extract Rocket Launcher and try again.", "Invalid Installation", MessageBoxButtons.OK, MessageBoxIcon.Error); //log details before exiting logger.WriteLine("Oh no! The Injector doesn't exist. Lets see some details that will help us diagnose how this happened"); logger.WriteLine($"The executing assembly is located in the directory {new DirectoryInfo(Assembly.GetExecutingAssembly().Location).Name}"); logger.WriteLine($"This directory contains {Directory.GetFiles(Environment.CurrentDirectory, "*.*", SearchOption.TopDirectoryOnly).Length - 1} other files"); logger.WriteLine("Well, we can't function without the injector, so that's all folks!"); Application.Exit(); return; } //startup actions LoadSettings(); RLProcessMonitor.LookForProcess(); //do a game running check CheckForUpdate(); //check for an update initialized = true; }
private void MainForm_Load(object sender, EventArgs e) { //set title var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version; this.Text += $" {assemblyVersion.Major}.{assemblyVersion.Minor}"; //verify installation bool installationCorrect = true; if (!File.Exists("Injector.dll")) { installationCorrect = false; } //yell at the user for doing things wrong if (!installationCorrect) { MessageBox.Show( "One or more required program files are missing. Please fully extract Rocket Launcher and try again.", "Invalid Installation", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); return; } //check if we're already running and close if we are var mutex = new Mutex(true, "RocketLauncher", out var mutexCreated); if (!mutexCreated) { mutex.Close(); Application.Exit(); return; } //create logger logger = new LogFile("RL.log"); logger.Clear(); logger.WriteLine($"Initializing {this.Text}"); //startup actions LoadSettings(); RLProcessMonitor.LookForProcess(); //do a game running check CheckForUpdate(); //check for an update autoLoadModsTimer.Enabled = Properties.Settings.Default.AutoLoadMods; //Start auto load timer }