예제 #1
0
        public void Install()
        {
            Log.Clear();
            Log.WriteLine("Installing...");
            Block();

            ShowStatus();

            CurrentTask = Task.Run(() => {
                try {
                    Application.AsyncInvoke(() => VersionDisplay.SetIndex(0));

                    foreach (var version in ComponentList.SelectedVersions)
                    {
                        var ver = version.Version;

                        using (var build = Downloader.Download(ver)) {
                            var installable = new Installer.InstallableComponent(version.Component, ver, build);

                            if (!Options.ForceBackupOption)
                            {
                                Installer.Restore();
                            }
                            Installer.Backup(Options.ForceBackupOption);

                            if (!Options.SkipVersionChecksOption)
                            {
                                installable.ValidateGungeonVersion(Autodetector.GetVersionIn(ExeSelector.Path));
                            }

                            Installer.InstallComponent(installable, leave_mmdlls: Options.LeavePatchDLLsOption);
                        }

                        Application.AsyncInvoke(() => VersionDisplay.IncreaseIndex());
                    }
                } catch (Exception e) {
                    _PostInstall(e);
                    return;
                }

                _PostInstall();
            });
        }