public void loadFlare() { this.CenterToScreen(); this.TopMost = true; updateStatus("Loading..."); Timer countDown = new Timer(); byte count = 4; countDown.Tick += (object s, EventArgs a) => { count--; this.Refresh(); updateStatus("Launching in " + count); this.Refresh(); if (count == 0) { count = 4; //MessageBox.Show(BootMethods.getLatestVersion()); updateStatus("Checking for Minecraft..."); if (!BootMethods.isMinecraftRunning()) { updateStatus("Launching Minecraft..."); BootMethods.launchMinecraft(); return; } updateStatus("Checking for Flare..."); if (BootMethods.isFlareFresh()) { updateStatus("First time? <3"); BootMethods.flareFiles.Create(); } if (BootMethods.getLatestSavedVersion() == "None") { downloadHLFlare(); } else { if (BootMethods.getLatestVersion() != BootMethods.getLatestSavedVersion()) { downloadHLFlare(); } } if (!BootMethods.launchFlare()) { MessageBox.Show("Flare failed to launch. Please try again later."); } SetForegroundWindow(BootMethods.flare.MainWindowHandle); Application.Exit(); countDown.Stop(); } }; countDown.Interval = 1000; countDown.Start(); }
public static void downloadHLFlare() { updateStatus("Downloading Flare..."); string latest = BootMethods.getLatestVersion(); if (!BootMethods.downloadFlare(latest)) { updateStatus("Failed to download Flare!"); return; } BootMethods.saveVersion(latest); }