Esempio n. 1
0
        private void btnSetWarcraftPath_Click(object sender, EventArgs e)
        {
            folderBrowserDialog.ShowNewFolderButton = true;
            DialogResult result = folderBrowserDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                textBoxWarcraftPath.Text = folderBrowserDialog.SelectedPath;
                string location = Properties.Settings.Default.WarcraftLocation = folderBrowserDialog.SelectedPath;
                Properties.Settings.Default.Save();
                w3SuperAdminFormBLL.UpdatePathAndButtonsState(location, lblWarcraftVersion.Name, btnChangePatch.Name, textBoxWarcraftPath.Name, btnGrabRocCDKey.Name, btnGrabTftCDKey.Name,
                                                              textBoxRocKey.Name, textBoxTftKey.Name, btnChangeRocKey.Name, btnChangeTftKey.Name);
                w3SuperAdminFormBLL.AddSubItemToPlay(location, playToolStripMenuItem);
            }
        }
Esempio n. 2
0
        private void SavePatchVersion_Click(object sender, EventArgs e)
        {
            string patchVersion = patchesList.FocusedItem != null ? patchesList.Items[patchesList.FocusedItem.Index].Text : null;

            if (patchVersion == null)
            {
                message = "Add a patch and select it from the list.";
                title   = "Operation failed";

                buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, title, buttons, MessageBoxIcon.Error);
                return;
            }

            DirectoryInfo d = new DirectoryInfo(patchesDir); //Assuming Test is your Folder

            FileInfo[] Files = d.GetFiles("*.zip");          //Getting zip files
            foreach (FileInfo file in Files)
            {
                if (file.Name == patchVersion)
                {
                    using (ZipArchive archive = ZipFile.OpenRead(file.FullName))
                    {
                        foreach (ZipArchiveEntry entry in archive.Entries)
                        {
                            entry.ExtractToFile(Path.Combine(_location, entry.FullName), true);
                        }
                    }
                    Control lblWarcraftVersion = _configurationBLL.GetFormControl(_lblWarcraftVersionName, _mainForm);
                    _configurationBLL.UpdatePathAndButtonsState(_location, _lblWarcraftVersionName);

                    message = "The patch has been applied successfully!";
                    title   = "Operation completed";

                    buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, title, buttons, MessageBoxIcon.Information);
                    break;
                }
            }
        }
Esempio n. 3
0
        private void LoadForm()
        {
            string location = Properties.Settings.Default.WarcraftLocation;

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Blizzard Entertainment\Warcraft III");

            //check if the key exists
            if (key == null)
            {
                this.btnManageSettings.Enabled = false;
            }
            else
            {
                key.Dispose();
            }

            w3SuperAdminFormBLL = new W3SuperAdminFormBLL();
            w3SuperAdminFormBLL.PatchesGroupBox = this.managePatchesGroupBox;
            w3SuperAdminFormBLL.CDKeyGroupBox   = this.manageCDKeysGroupBox;
            w3SuperAdminFormBLL.UpdatePathAndButtonsState(location, lblWarcraftVersion.Name, btnChangePatch.Name,
                                                          textBoxWarcraftPath.Name, btnGrabRocCDKey.Name, btnGrabTftCDKey.Name,
                                                          textBoxRocKey.Name, textBoxTftKey.Name, btnChangeRocKey.Name, btnChangeTftKey.Name);
            w3SuperAdminFormBLL.AddSubItemToPlay(location, this.playToolStripMenuItem);
        }