private void buttoneHomeUpdate_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.GamePath))
            {
                if (Properties.Settings.Default.Backup)
                {
                    ModFunctions.generateBackup(Properties.Settings.Default.GamePath);
                }
                switch (selectedMod)
                {
                case "The Other Roles":
                    TheOtherRoles.TheOtherRoles.updateTheOtherRoles(this, Properties.Settings.Default.GamePath);
                    break;
                }
            }
            else
            {
                DialogResult response = MessageBoxFunctions.openMessageBoxWithResponse("No play path was given. Please enter it under the settings. Would you like to be redirected to the settings?", "Error");

                if (response == DialogResult.Yes)
                {
                    settingsButton.PerformClick();
                }
            }
        }
 private static void OnCloseCommand(object parameter)
 {
     if (MessageBoxFunctions.ShowCloseApplicationMessageBox())
     {
         Application.Current.Shutdown();
     }
 }
        private void settingsButtonQuickSearch_Click(object sender, EventArgs e)
        {
            DialogResult response = MessageBoxFunctions.openMessageBoxWithResponse("This automatic search only works if you've installed Among Us using Steam. If you didn't install the game using Steam, try using the Automated search", "Attention");

            if (response == DialogResult.Yes)
            {
                SystemFunctions.startQuickSearch(this);
            }
        }
        private void settingsButtonAutomated_Click(object sender, EventArgs e)
        {
            DialogResult response = MessageBoxFunctions.openMessageBoxWithResponse("The automatic search can take longer and cause problems with slow systems. Especially if you have more than two hard drives. If you continue your system might slow down.", "Attention");

            if (response == DialogResult.Yes)
            {
                SystemFunctions.startAutomatedSearch(this);
            }
        }
 private void settingsOpenFolder_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.GamePath))
     {
         Process.Start("explorer.exe", Properties.Settings.Default.GamePath);
     }
     else
     {
         MessageBoxFunctions.openMessageBox("No game path was specified. Please add it in the settings.", "Error");
     }
 }
Beispiel #6
0
        public static async void updateTheOtherRoles(dynamic mainWindow, string rootPath)
        {
            mainWindow.buttonHomeUpdate.Enabled = false;
            if (deleteOldFiles(rootPath).Result)
            {
                //Create Mod Folder
                Properties.Settings.Default.ReleaseId = currentReleaseId;
                Properties.Settings.Default.Save();
                string gamePath = Properties.Settings.Default.GamePath;
                Directory.CreateDirectory(gamePath);

                await SystemFunctions.copyFolder(rootPath, gamePath);

                mainWindow.downloadProgress.Visible = true;


                //Download Mod
                string zipPath = Properties.Settings.Default.GamePath + "\\" + releaseName + ".zip";
                await ModFunctions.downloadNewVersion(downloadUrl, zipPath, mainWindow);

                ZipFile.ExtractToDirectory(zipPath, Properties.Settings.Default.GamePath);

                if (!Directory.Exists(Properties.Settings.Default.GamePath + "\\BepInex\\config"))
                {
                    Directory.CreateDirectory(Properties.Settings.Default.GamePath + "\\BepInex\\config");
                }
                if (configControll)
                {
                    var _tmpCheck = false;
                    do
                    {
                        if (File.Exists(Properties.Settings.Default.GamePath + "\\me.eisbison.theotherroles.cfg"))
                        {
                            File.Copy(Properties.Settings.Default.GamePath + "\\me.eisbison.theotherroles.cfg", Properties.Settings.Default.GamePath + "\\BepInex\\config\\me.eisbison.theotherroles.cfg", true);
                            _tmpCheck = true;
                            Logger.Log("File copy successed (z329)", null);
                        }
                        else
                        {
                            Logger.Log("Waiting for copy (z333)", null);
                            Thread.Sleep(100);
                        }
                    } while (!_tmpCheck);
                }

                mainWindow.buttonHomeInstall.Visible = false;
                mainWindow.buttonHomeUpdate.Visible  = false;
                mainWindow.buttonHomeStart.Visible   = true;
                mainWindow.downloadProgress.Visible  = false;

                if (File.Exists(rootPath + "\\me.eisbison.theotherroles.cfg"))
                {
                    File.Delete(rootPath + "\\me.eisbison.theotherroles.cfg");
                }
                if (File.Exists(Properties.Settings.Default.GamePath + "\\me.eisbison.theotherroles.cfg"))
                {
                    File.Delete(Properties.Settings.Default.GamePath + "\\me.eisbison.theotherroles.cfg");
                }
                if (File.Exists(Properties.Settings.Default.GamePath + "\\" + releaseName + ".zip"))
                {
                    File.Delete(Properties.Settings.Default.GamePath + "\\" + releaseName + ".zip");
                }

                mainWindow.buttonHomeInstall.Enabled = true;
                mainWindow.buttonHomeUpdate.Enabled  = true;

                DialogResult messageBoxResponse = MessageBoxFunctions.openMessageBoxWithResponse("The mod has been successfully updated. Would you like to start the game now?", "Update finished");

                if (messageBoxResponse == DialogResult.Yes)
                {
                    startTheOtherRoles(mainWindow);
                }
            }
        }