Пример #1
0
 private void BtnLaunch_Clicked(object sender, EventArgs e)
 {
     try
     {
         config.FreelancerPath = textInput.Text;
         config.IntroMovies    = !skipMovies.Active;
         config.MuteMusic      = muteMusic.Active;
         config.VSync          = vsync.Active;
         config.BufferWidth    = int.Parse(resWidthBox.Text);
         config.BufferHeight   = int.Parse(resHeightBox.Text);
         config.Validate();
         Program.Launch = true;
         Visible        = false;
         ShowInTaskbar  = false;
     }
     catch (InvalidFreelancerDirectory)
     {
         MessageDialog.ShowError(this, "Not a valid freelancer directory");
         return;
     }
     catch (Exception ex)
     {
         MessageDialog.ShowError(this, "Invalid configuration");
         return;
     }
 }
        void LaunchClicked()
        {
            try
            {
                config.FreelancerPath = freelancerFolder.GetText();
                config.IntroMovies    = !skipIntroMovies;
                config.MasterVolume   = masterVolume;
                config.MusicVolume    = musicVolume;
                config.SfxVolume      = sfxVolume;
                config.VSync          = vsync;
                config.BufferWidth    = resolutionX;
                config.BufferHeight   = resolutionY;
                config.Validate();
            }
            catch (InvalidFreelancerDirectory)
            {
                ImGui.OpenPopup("Error");
                openError = true;
                errorText = "Invalid Freelancer Directory";
                return;
            }
            catch (Exception)
            {
                ImGui.OpenPopup("Error");
                openError = true;
                errorText = "Invalid Configuration";
                return;
            }
            config.Save();
            var p = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location);

            Process.Start(Path.Combine(p, "lancer"));
            Exit();
        }