Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (expansionBox.Enabled == true)
            {
                if (!File.Exists(executableBox.Text))
                {
                    MessageBox.Show(Translator.GetText("ExecutableNotFound"));
                    DialogResult          = System.Windows.Forms.DialogResult.None;
                    AdvancedCheck.Checked = true;
                    return;
                }
                var games = new List <string>();
                foreach (ListViewItem item in expansionBox.CheckedItems)
                {
                    games.Add(item.Name);
                }
                if (locationBox.Enabled == true)
                {
target:
                    try {
                        var directory = new DirectoryInfo(locationBox.Text);
                        if (directory.Exists)
                        {
                            var result = MessageBox.Show(Translator.GetText("DirectoryAlreadyExists"), "Any Game Starter 3", MessageBoxButtons.AbortRetryIgnore);
                            if (result == System.Windows.Forms.DialogResult.Retry)
                            {
                                goto target;
                            }
                            if (result == System.Windows.Forms.DialogResult.Abort)
                            {
                                DialogResult = System.Windows.Forms.DialogResult.None;
                                return;
                            }
                        }
                        else
                        {
                            directory.Create();
                        }
                    }
                    catch (Exception ex) {
                        MessageBox.Show(ex.Message);
                        DialogResult = System.Windows.Forms.DialogResult.None;
                        return;
                    }
                }
                Profile = new StarterProfile(executableBox.Text, locationBox.Text, games, nameBox.Text, languageBox.Text);
                Profile.Save();
                Hide();
            }
            else
            {
                GameUtils.Locale = languageBox.Text;
                Hide();
            }
        }