Beispiel #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try {
                Debug.WriteLine("[MainForm] Creating new MinecraftLauncher instance");
                mcLauncher = new MinecraftLauncher();
                Debug.WriteLine("[MainForm] Populating comboMinecraftVersion");
                comboMinecraftVersion.Items.AddRange(mcLauncher.GetMinecraftVersions());
                comboMinecraftVersion.SelectedIndex = 0;

                Debug.WriteLine("[MainForm] Checking for authentication data");
                if (Properties.Settings.Default.MinecraftUsername == "") {
                    Debug.WriteLine("[MainForm] Creating new AuthDetailForm.");
                    AuthDetailForm authForm = new AuthDetailForm();
                    Debug.WriteLine("[MainForm] Showing AuthDetailForm.");
                    authForm.ShowDialog();
                    Debug.WriteLine("[MainForm] Disposing of created AuthDetailForm.");
                    authForm.Dispose();
                }

                Debug.WriteLine("[MainForm] Attempting to authenticate with minecraft.net");
                AuthData = new MinecraftAuthentication(Properties.Settings.Default.MinecraftUsername, Properties.Settings.Default.MinecraftPassword);
                if (AuthData.DoAuthentication() != MinecraftAuthentication.AuthenticationStatus.Success) {
                    MessageBox.Show("There was an error logging you into minecraft.net. Please check your login details.");
                }
                menuOptionsItemAuthDetails.Text = "Authenticated as " + AuthData.MinecraftUsername;
            }
            catch (MinecraftLauncher.JavaNotFoundException) {
                Debug.WriteLine("[MainForm] JavaNotFoundException encountered, closing app.");
                Application.Exit();
            }
            catch (Exception ex) {
                Debug.WriteLine("[MainForm] Exception encountered: " + ex.Message);
                Debug.Indent();
                Debug.WriteLine(ex.StackTrace);
                Debug.Unindent();
                MessageBox.Show("Oops, something went wrong and launcher² has to close.\n\nIf you would like to help us fix what caused this crash, please send the log file located at the path below to [email protected] :\n" + launcher2.Program.logPath, "launcher²", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Beispiel #2
0
        private void menuOptionsItemChangeAuthDetails_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("[MainForm] Creating new AuthDetailForm.");
            AuthDetailForm authForm = new AuthDetailForm();
            Debug.WriteLine("[MainForm] Showing AuthDetailForm.");
            authForm.ShowDialog();
            Debug.WriteLine("[MainForm] Disposing of created AuthDetailForm.");
            authForm.Dispose();

            Debug.WriteLine("[MainForm] Attempting to authenticate with minecraft.net");
            AuthData.MinecraftUsername = Properties.Settings.Default.MinecraftUsername;
            AuthData.MinecraftPassword = Properties.Settings.Default.MinecraftPassword;
            if (AuthData.DoAuthentication() != MinecraftAuthentication.AuthenticationStatus.Success) {
                MessageBox.Show("There was an error logging you into minecraft.net. Please check your login details.");
            }
            menuOptionsItemAuthDetails.Text = "Authenticated as " + AuthData.MinecraftUsername;
        }