private void Login(object sender, EventArgs e)
        {
            if (!XIVGame.GetGateStatus())
            {
                MessageBox.Show(
                    "Square Enix seems to be running maintenance work right now. The game shouldn't be launched.");

                return;
            }

            if (saveCheckBox.Checked)
            {
                Settings.Instance.SavedID = IDTextBox.Text;
                Settings.Instance.SavedPW = PWTextBox.Text;
                if (autoLoginCheckBox.Checked)
                {
                    DialogResult result = MessageBox.Show("This option will log you in automatically with the credentials you entered.\nTo reset it again, launch this application as administrator once.\n\nDo you really want to enable it?", "Enabling Autologin", MessageBoxButtons.YesNo);

                    if (result == System.Windows.Forms.DialogResult.No)
                    {
                        autoLoginCheckBox.Checked = false;
                    }
                    else
                    {
                        Settings.Instance.AutoLogin = true;
                    }
                }
                else
                {
                    Settings.Instance.AutoLogin = false;
                }
                Settings.Instance.Save();
            }
            else
            {
                Settings.Instance.SavedID = "";
                Settings.Instance.SavedPW = "";
                Settings.Instance.Save();
            }

            StatusLabel.Text = "Logging in...";
            try
            {
                XIVGame.LaunchGame(XIVGame.GetRealSid(IDTextBox.Text, PWTextBox.Text, OTPTextBox.Text), SettingsHelper.GetLanguage(), SettingsHelper.IsDX11(), SettingsHelper.UseSteam(), SettingsHelper.GetExpansionLevel());
                Environment.Exit(0);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Logging in failed, check your login information or try again.\n\n" + exc, "Login failed", MessageBoxButtons.OK);
                StatusLabel.Text = "";
                return;
            }
        }
示例#2
0
        public MainForm()
        {
            InitializeComponent();

            if (Properties.Settings.Default.savedid != "")
            {
                IDTextBox.Text       = Properties.Settings.Default.savedid;
                PWTextBox.Text       = Properties.Settings.Default.savedpw;
                saveCheckBox.Checked = true;
            }

            if (Properties.Settings.Default.setupcomplete != true)
            {
                InitialSetup();
            }

            if (Properties.Settings.Default.autologin && !Settings.IsAdministrator())
            {
                try
                {
                    this.Enabled = false;

                    if (!XIVGame.GetGateStatus())
                    {
                        this.Enabled = true;
                        MessageBox.Show(
                            "Square Enix seems to be running maintenance work right now. The game shouldn't be launched.");

                        Properties.Settings.Default["autologin"] = false;
                        Properties.Settings.Default.Save();
                    }
                    else
                    {
                        XIVGame.LaunchGame(XIVGame.GetRealSid(IDTextBox.Text, PWTextBox.Text, OTPTextBox.Text), Settings.GetLanguage(), Settings.IsDX11(), Settings.GetExpansionLevel());
                        Environment.Exit(0);
                    }
                }
                catch (Exception e)
                {
                    this.Enabled = true;
                    MessageBox.Show("Logging in failed, check your login information or try again.\n\n" + e, "Login failed", MessageBoxButtons.OK);
                }
            }
            else
            {
                Properties.Settings.Default["autologin"] = false;
                Properties.Settings.Default.Save();
            }
        }
        public MainForm()
        {
            InitializeComponent();

            if (Settings.Instance.SavedID != "")
            {
                IDTextBox.Text       = Settings.Instance.SavedID;
                PWTextBox.Text       = Settings.Instance.SavedPW;
                saveCheckBox.Checked = true;
            }

            if (Settings.Instance.SetupComplete != true)
            {
                InitialSetup();
            }

            if (Settings.Instance.AutoLogin == true && !SettingsHelper.IsAdministrator())
            {
                try
                {
                    this.Enabled = false;

                    if (!XIVGame.GetGateStatus())
                    {
                        this.Enabled = true;
                        MessageBox.Show(
                            "Square Enix seems to be running maintenance work right now. The game shouldn't be launched.");

                        Settings.Instance.AutoLogin = false;
                        Settings.Instance.Save();
                    }
                    else
                    {
                        XIVGame.LaunchGame(XIVGame.GetRealSid(IDTextBox.Text, PWTextBox.Text, OTPTextBox.Text), SettingsHelper.GetLanguage(), SettingsHelper.IsDX11(), SettingsHelper.UseSteam(), SettingsHelper.GetExpansionLevel());
                        Environment.Exit(0);
                    }
                }
                catch (Exception e)
                {
                    this.Enabled = true;
                    MessageBox.Show("Logging in failed, check your login information or try again.\n\n" + e, "Login failed", MessageBoxButtons.OK);
                }
            }
            else
            {
                Settings.Instance.AutoLogin = false;
                Settings.Instance.Save();
            }
        }