Esempio n. 1
0
        private void LaunchApplicationAndExit(string applicationToLaunch)
        {
            // Acquire arguments
            _commandLineArguments.TryGetValue(Constants.ParameterArguments, out var arguments);
            if (arguments == null)
            {
                arguments = "";
            }

            applicationToLaunch = Path.GetFullPath(applicationToLaunch);
            var application = ApplicationConfig.GetAllApplications(IoC.Get <LoaderConfig>().ApplicationConfigDirectory).FirstOrDefault(x => Path.GetFullPath(x.Config.AppLocation) == applicationToLaunch);

            if (application != null)
            {
                arguments = $"{arguments} {application.Config.AppArguments}";
            }

            // Show warning for Wine users.
            if (Shared.Environment.IsWine)
            {
                // Set up UI Resources, since they're needed for the dialog.
                SetupResources();
                if (CompatibilityDialogs.WineShowLaunchDialog())
                {
                    StartGame(applicationToLaunch, arguments);
                }
            }
            else
            {
                StartGame(applicationToLaunch, arguments);
            }
        }
Esempio n. 2
0
    private static void LaunchApplicationAndExit(string applicationToLaunch)
    {
        // Acquire arguments
        var loaderConfig = IoC.Get <LoaderConfig>();

        loaderConfig.UpdatePaths(Paths.CurrentProgramFolder, Resources.ErrorLoaderNotFound.Get());
        IConfig <LoaderConfig> .ToPath(loaderConfig, Paths.LoaderConfigPath);

        _commandLineArguments.TryGetValue(Constants.ParameterArguments, out var arguments);
        arguments ??= "";
        applicationToLaunch = Path.GetFullPath(applicationToLaunch);

        var application = ApplicationConfig.GetAllApplications(loaderConfig.GetApplicationConfigDirectory()).FirstOrDefault(x => ApplicationConfig.GetAbsoluteAppLocation(x) == applicationToLaunch);

        if (application != null)
        {
            arguments = $"{arguments} {application.Config.AppArguments}";
        }

        // Show warning for Wine users.
        if (Shared.Environment.IsWine)
        {
            // Set up UI Resources, since they're needed for the dialog.
            if (CompatibilityDialogs.WineShowLaunchDialog())
            {
                StartGame(applicationToLaunch, arguments);
            }
        }
        else
        {
            StartGame(applicationToLaunch, arguments);
        }
    }
Esempio n. 3
0
        private async void LaunchApplication_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                ViewModel.ApplicationTuple.Save();
                ViewModel.CheckModCompatibility();
                await Setup.CheckForMissingModDependenciesAsync();

                var appConfig = ViewModel.ApplicationTuple.Config;
                var launcher  = ApplicationLauncher.FromApplicationConfig(appConfig);

                if (!Environment.IsWine || (Environment.IsWine && CompatibilityDialogs.WineShowLaunchDialog()))
                {
                    launcher.Start();
                }
            }
        }