Ejemplo n.º 1
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 == true && !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();
            }
        }