Beispiel #1
0
 private void RemoteLoad()
 {
     UpdateStatus("Loading latest releases...");
     remote.PopulateReleases();
     installer = new InstallerLogic(remote.releases, path.installPath);
     installer.StatusUpdate += Installer_StatusUpdate;
     this.Invoke((MethodInvoker)(() => { ShowReleases(); }));
 }
 private void RemoteLoad()
 {
     UpdateStatus("Loading game versions...");
     remote.GetGameVersions();
     for (int i = 0; i < remote.gameVersions.Length; i++)
     {
         GameVersion gv = remote.gameVersions[i];
         this.Invoke((MethodInvoker)(() => { comboBox_gameVersions.Items.Add(gv.value); }));
     }
     this.Invoke((MethodInvoker)(() => { comboBox_gameVersions.SelectedIndex = 0; }));
     UpdateStatus("Loading releases...");
     remote.PopulateReleases();
     installer = new InstallerLogic(remote.releases, path.installPath);
     installer.StatusUpdate += Installer_StatusUpdate;
     this.Invoke((MethodInvoker)(() => { ShowReleases(); }));
 }
Beispiel #3
0
        static void RunOptions(Options opts)
        {
            var installer = new InstallerLogic();

            try
            {
                Environment.ExitCode = 1;

                var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));

                if (!installer.BuildPublish(opts.ProjectPath, tempPath))
                {
                    return;
                }

                var zipFileName = Path.Combine(tempPath, $"{opts.AdapterId}");

                if (!installer.Compress(tempPath, zipFileName))
                {
                    return;
                }

                var projectFileName = Path.GetFileName(opts.ProjectPath);
                var entryAssembly   = $"{projectFileName.Remove(projectFileName.LastIndexOf('.'))}.dll";

                if (!installer.PushToCloud(zipFileName, opts.AdapterId, entryAssembly, opts.AccessKeyId, opts.SecretAccessKey, opts.ServiceUrl, opts.BucketName))
                {
                    return;
                }

                if (!installer.Cleanup(tempPath))
                {
                    return;
                }

                Environment.ExitCode = 0;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     installer = new InstallerLogic();
     initConnections();
 }
Beispiel #5
0
        private void RemoteLoad()
        {
            UpdateStatus("Loading game versions...");
            remote.GetGameVersions();

            string installedVersion      = GetInstalledGameVersion();
            int    installedVersionIndex = -1;
            string allVersionsString     = "";
            string latestVersion         = remote.gameVersions[0].value;

            for (int i = 0; i < remote.gameVersions.Length; i++)
            {
                GameVersion gv = remote.gameVersions[i];
                this.Invoke((MethodInvoker)(() => { comboBox_gameVersions.Items.Add(gv.value); }));

                allVersionsString = string.Concat(allVersionsString, (i > 0 ? ", " : "") + gv.value);
                if (gv.value.Equals(installedVersion))
                {
                    installedVersionIndex = i;
                }
            }

            // Check if a new version has been added to BeatMods
            if (Properties.Settings.Default.VersionsList != allVersionsString)
            {
                string infoMessage =
                    "A new version of Beat Saber has been added to Beat Mods!\n" +
                    latestVersion + "\n\n" +
                    "This version has been selected automatically.\n" +
                    "You can change it in the settings tab!";

                // If this is a fresh install, don't show version message
                if (Properties.Settings.Default.VersionsList != "")
                {
                    MessageBox.Show(infoMessage, "Beat Saber v" + latestVersion, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                Properties.Settings.Default.VersionsList = allVersionsString;
                Properties.Settings.Default.Save();
            }


            // Show error message if installed version isn't found
            if (installedVersionIndex == -1 && installedVersion != null)
            {
                string versionErrorMessage =
                    "You appear to have Beat Saber version " + installedVersion + " installed,\n" +
                    "but it is not supported by Beat Mods!\n\n" +
                    "Beat Mods only supports the following versions:\n" +
                    allVersionsString +
                    "\n\n" +
                    "Install mods at your own risk!";
                MessageBox.Show(versionErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Set the comboBox to the installed version
            this.Invoke((MethodInvoker)(() => {
                comboBox_gameVersions.SelectedIndex = 0;
            }));

            UpdateStatus("Loading releases...");
            remote.PopulateReleases();
            installer = new InstallerLogic(remote.releases, path.installPath);
            installer.StatusUpdate += Installer_StatusUpdate;
            this.Invoke((MethodInvoker)(() => { ShowReleases(); }));
        }