예제 #1
0
        private void StartGame()
        {
            var gateStatus = false;

            try
            {
                gateStatus = _game.GetGateStatus();
            }
            catch
            {
                // ignored
            }

            if (!gateStatus)
            {
                MessageBox.Show(
                    "Square Enix seems to be running maintenance work right now or the login server is unreachable. The game shouldn't be launched.", "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);

                return;
            }

            try
            {
                _game.Login(LoginUsername.Text, LoginPassword.Password, OtpTextBox.Text);
                StartAddons();

                Environment.Exit(0);
            }
            catch (Exception exc)
            {
                Util.ShowError("Logging in failed, check your login information or try again.\n\n" + exc, "Login failed");
            }
        }
        private void StartGame()
        {
            if (!XIVGame.GetGateStatus())
            {
                MessageBox.Show(
                    "Square Enix seems to be running maintenance work right now. The game shouldn't be launched.", "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);

                return;
            }

            try
            {
                XIVGame.Login(LoginUsername.Text, LoginPassword.Password, OtpTextBox.Text);
                Environment.Exit(0);
            }
            catch (Exception exc)
            {
                Util.ShowError("Logging in failed, check your login information or try again.\n\n" + exc, "Login failed");
            }
        }
예제 #3
0
        private async void StartGame(string otp)
        {
            Serilog.Log.Information("StartGame() called");
            try
            {
                var gateStatus = false;
                try
                {
                    gateStatus = await Task.Run(() => _game.GetGateStatus());
                }
                catch
                {
                    // ignored
                }

                if (!gateStatus)
                {
                    Serilog.Log.Information("GateStatus is false.");
                    MessageBox.Show(
                        "Square Enix seems to be running maintenance work right now or the login server is unreachable. The game shouldn't be launched.", "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    _isLoggingIn = false;

                    return;
                }

                var gameProcess = _game.Login(LoginUsername.Text, LoginPassword.Password, otp, Settings.UniqueIdCacheEnabled);

                if (gameProcess == null)
                {
                    Serilog.Log.Error("GameProcess was null...");
                    return;
                }

                try
                {
                    await Task.Run(() => StartAddons(gameProcess));
                }
                catch (Exception exc)
                {
                    new ErrorWindow(exc, "This could be caused by your antivirus, please check its logs and add any needed exclusions.", "Addons").ShowDialog();
                    _isLoggingIn = false;
                }

                try
                {
                    if (Settings.IsInGameAddonEnabled())
                    {
                        await Task.Run(() =>
                        {
                            new HooksAddon().Run(gameProcess);
                        });
                    }
                }
                catch (Exception exc)
                {
                    new ErrorWindow(exc, "This could be caused by your antivirus, please check its logs and add any needed exclusions.", "Hooks").ShowDialog();
                    _isLoggingIn = false;
                }

                Environment.Exit(0);
            }
            catch (Exception exc)
            {
                new ErrorWindow(exc, "Please also check your login information or try again.", "Login").ShowDialog();
                _isLoggingIn = false;
            }
        }
        private async void StartGame()
        {
            try
            {
                var gateStatus = false;
                try
                {
                    gateStatus = await Task.Run(() => _game.GetGateStatus());
                }
                catch
                {
                    // ignored
                }

                if (!gateStatus)
                {
                    MessageBox.Show(
                        "Square Enix seems to be running maintenance work right now or the login server is unreachable. The game shouldn't be launched.", "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    _isLoggingIn = false;

                    return;
                }

                //LoadingMessageCancelButton.Visibility = Visibility.Hidden;
                //LoadingMessageTextBlock.Text = "Logging in...";

                //DialogHost.OpenDialogCommand.Execute(null, MaintenanceQueueDialogHost);

                var gameProcess = _game.Login(LoginUsername.Text, LoginPassword.Password, OtpTextBox.Text, Settings.UniqueIdCacheEnabled);

                if (gameProcess == null)
                {
                    return;
                }

                try
                {
                    await Task.Run(() => StartAddons(gameProcess));
                }
                catch (Exception exc)
                {
                    new ErrorWindow(exc, "This could be caused by your antivirus, please check its logs and add any needed exclusions.", "Addons").ShowDialog();
                    _isLoggingIn = false;
                }

                try
                {
                    if (Settings.IsInGameAddonEnabled())
                    {
                        await Task.Run(() =>
                        {
                            new HooksAddon().Run(gameProcess);
                        });
                    }
                }
                catch (Exception exc)
                {
                    new ErrorWindow(exc, "This could be caused by your antivirus, please check its logs and add any needed exclusions.", "Hooks").ShowDialog();
                    _isLoggingIn = false;
                }

                Environment.Exit(0);
            }
            catch (Exception exc)
            {
                new ErrorWindow(exc, "Additionally, please check your login information or try again.", "Login").ShowDialog();
                _isLoggingIn = false;
            }
        }