示例#1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            versionLabel.Text = string.Format("{0} (built {1})",
                                              versionNumber,
                                              Assembly.GetExecutingAssembly().GetLinkerTime()
                                              .ToString("MMM dd, yyyy (hh:mm tt)", CultureInfo.InvariantCulture));

            this.BeginInvoke((MethodInvoker)async delegate {
                InitialOpen();

                if (_archive.IndexOf(dummyVfsPath) != -1)
                {
                    _archive.CloseReader();
                    if (File.Exists(backupArchivePath))
                    {
                        var dr = MessageBox.Show("Your shaders were already patched. "
                                                 + "Want to restore the originals? You'll be able to re-patch with different settings afterwards.",
                                                 "ffxvDitherPatch",
                                                 MessageBoxButtons.YesNo);
                        if (dr != DialogResult.Yes)
                        {
                            Application.Exit();
                        }
                        // not redundant - Application.Exit() does not stop control flow here
                        else
                        {
                            File.Delete(archivePath);
                            File.Move(backupArchivePath, archivePath);
                            InitialOpen();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Your shaders were already patched and no backup was found. "
                                        + "Please restore the original \"" + archivePath + "\" (e.g. with Steam's Verify Integrity feature).");
                        Application.Exit();
                    }
                }

                progressBar.Maximum = _archive.Count();
                statusLabel.Text    = "Loading archive into memory";
                await _archive.LoadAsync(new Progress <int>(UpdateProgressBar));
                _archive.CloseReader();

                _patcher = new Patcher(_archive);
                processButton.Enabled = true;
                statusLabel.Text      = "Waiting for input";
            });
        }