Exemplo n.º 1
0
        private void listBoxWeapons_SelectedIndexChanged(object sender, EventArgs e)
        {
            _loaded = false;
            if (JunkShopWorker.Kernel == null)
            {
                return;
            }
            JunkShopWorker.ReadWeapons(listBoxWeapons.SelectedIndex);

            try
            {
                numericUpDownCost.Value     = JunkShopWorker.GetSelectedWeaponsData.Price * 10;
                comboBoxItem1.SelectedIndex = JunkShopWorker.GetSelectedWeaponsData.Item1;
                numericUpDownQua1.Value     = JunkShopWorker.GetSelectedWeaponsData.Quantity1;
                comboBoxItem2.SelectedIndex = JunkShopWorker.GetSelectedWeaponsData.Item2;
                numericUpDownQua2.Value     = JunkShopWorker.GetSelectedWeaponsData.Quantity2;
                comboBoxItem3.SelectedIndex = JunkShopWorker.GetSelectedWeaponsData.Item3;
                numericUpDownQua3.Value     = JunkShopWorker.GetSelectedWeaponsData.Quantity3;
                comboBoxItem4.SelectedIndex = JunkShopWorker.GetSelectedWeaponsData.Item4;
                numericUpDownQua4.Value     = JunkShopWorker.GetSelectedWeaponsData.Quantity4;
            }
            catch (Exception eException)
            {
                MessageBox.Show(eException.ToString());
            }
            _loaded = true;
        }
Exemplo n.º 2
0
        public mainForm()
        {
            InitializeComponent();

            saveToolStripButton.Enabled = false;
            panelObjects.Enabled        = false;
            listBoxWeapons.Enabled      = false;

            #region Event Handlers

            numericUpDownCost.ValueChanged     += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(0, numericUpDownCost.Value);
            comboBoxItem1.SelectedIndexChanged += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(1, comboBoxItem1.SelectedIndex);
            comboBoxItem2.SelectedIndexChanged += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(3, comboBoxItem2.SelectedIndex);
            comboBoxItem3.SelectedIndexChanged += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(5, comboBoxItem3.SelectedIndex);
            comboBoxItem4.SelectedIndexChanged += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(7, comboBoxItem4.SelectedIndex);
            numericUpDownQua1.TextChanged      += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(2, numericUpDownQua1.Text);
            numericUpDownQua2.TextChanged      += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(4, numericUpDownQua2.Text);
            numericUpDownQua3.TextChanged      += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(6, numericUpDownQua3.Text);
            numericUpDownQua4.TextChanged      += (sender, args) => JunkShopWorker.UpdateVariable_Weapons(8, numericUpDownQua4.Text);

            #endregion
        }
Exemplo n.º 3
0
        private async void openToolStripButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title    = "Open FF8 mwepon.bin";
            openFileDialog.Filter   = "FF8 mwepon|*.bin";
            openFileDialog.FileName = "mwepon.bin";

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            {
                try
                {
                    using (var fileStream = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read))
                    {
                        using (var BR = new BinaryReader(fileStream))
                        {
                            JunkShopWorker.ReadJunkShop(BR.ReadBytes((int)fileStream.Length));
                        }
                    }
                    _existingFilename = openFileDialog.FileName;
                }
                catch (Exception)
                {
                    MessageBox.Show
                        (String.Format("I cannot open the file {0}, maybe it's locked by another software?", Path.GetFileName(openFileDialog.FileName)), "Error Opening File",
                        MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);

                    _openSaveException = true;
                }
            }

            if (!_openSaveException)
            {
                panelObjects.Enabled   = true;
                listBoxWeapons.Enabled = true;

                JunkShopWorker.CheckKernel = File.ReadAllBytes(_existingFilename);

                this.KeyUp += new KeyEventHandler(mainForm_KeyUp);
                this.numericUpDownCost.ValueChanged     += new EventHandler(mainForm_Objects);
                this.numericUpDownQua1.TextChanged      += new EventHandler(mainForm_Objects);
                this.numericUpDownQua2.TextChanged      += new EventHandler(mainForm_Objects);
                this.numericUpDownQua3.TextChanged      += new EventHandler(mainForm_Objects);
                this.numericUpDownQua4.TextChanged      += new EventHandler(mainForm_Objects);
                this.comboBoxItem1.SelectedIndexChanged += new EventHandler(mainForm_Objects);
                this.comboBoxItem2.SelectedIndexChanged += new EventHandler(mainForm_Objects);
                this.comboBoxItem3.SelectedIndexChanged += new EventHandler(mainForm_Objects);
                this.comboBoxItem4.SelectedIndexChanged += new EventHandler(mainForm_Objects);

                listBoxWeapons.SelectedIndex = 0;
                listBoxWeapons.Items[listBoxWeapons.SelectedIndex] = listBoxWeapons.SelectedItem; //used to refresh, useful if opening files more than once

                string language = comboBoxLang.GetItemText(comboBoxLang.SelectedItem);
                switch (language)
                {
                case "English":
                    toolStripStatusLabelStatus.Text      = Path.GetFileName(_existingFilename) + " loaded successfully";
                    toolStripStatusLabelFile.Text        = Path.GetFileName(_existingFilename) + " loaded";
                    statusStrip1.BackColor               = Color.FromArgb(255, 0, 150, 200);
                    toolStripStatusLabelStatus.BackColor = Color.FromArgb(255, 0, 150, 200);
                    await Task.Delay(4000);

                    statusStrip1.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.Text      = "Ready";
                    break;

                case "French":
                    toolStripStatusLabelStatus.Text      = Path.GetFileName(_existingFilename) + " chargé avec succès";
                    toolStripStatusLabelFile.Text        = Path.GetFileName(_existingFilename) + " chargé";
                    statusStrip1.BackColor               = Color.FromArgb(255, 0, 150, 200);
                    toolStripStatusLabelStatus.BackColor = Color.FromArgb(255, 0, 150, 200);
                    await Task.Delay(4000);

                    statusStrip1.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.Text      = "Prêt";
                    break;

                case "German":
                    toolStripStatusLabelStatus.Text      = Path.GetFileName(_existingFilename) + " erfolgreich geladen";
                    toolStripStatusLabelFile.Text        = Path.GetFileName(_existingFilename) + " geladen";
                    statusStrip1.BackColor               = Color.FromArgb(255, 0, 150, 200);
                    toolStripStatusLabelStatus.BackColor = Color.FromArgb(255, 0, 150, 200);
                    await Task.Delay(4000);

                    statusStrip1.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.Text      = "Bereit";
                    break;

                case "Italian":
                    toolStripStatusLabelStatus.Text      = Path.GetFileName(_existingFilename) + " caricato con successo";
                    toolStripStatusLabelFile.Text        = Path.GetFileName(_existingFilename) + " caricato";
                    statusStrip1.BackColor               = Color.FromArgb(255, 0, 150, 200);
                    toolStripStatusLabelStatus.BackColor = Color.FromArgb(255, 0, 150, 200);
                    await Task.Delay(4000);

                    statusStrip1.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.Text      = "Pronto";
                    break;

                case "Spanish":
                    toolStripStatusLabelStatus.Text      = Path.GetFileName(_existingFilename) + " cargado correctamente";
                    toolStripStatusLabelFile.Text        = Path.GetFileName(_existingFilename) + " cargado";
                    statusStrip1.BackColor               = Color.FromArgb(255, 0, 150, 200);
                    toolStripStatusLabelStatus.BackColor = Color.FromArgb(255, 0, 150, 200);
                    await Task.Delay(4000);

                    statusStrip1.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.BackColor = Color.Gray;
                    toolStripStatusLabelStatus.Text      = "Listo";
                    break;
                }
            }
            _openSaveException = false;
        }