コード例 #1
0
ファイル: MainForm.cs プロジェクト: CheAle14/bot-chess
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            lblFolderFeedback.Text      = originalF;
            lblFolderFeedback.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
            var browser = new FolderBrowserDialog();

            browser.Description         = "Select install folder";
            browser.ShowNewFolderButton = true;
            //browser.SelectedPath = @"C:\Program Files (x86)\";
            var r = browser.ShowDialog();

            if (r == DialogResult.OK)
            {
                if (InstallProcess.isValidLocation(browser.SelectedPath))
                {
                    txtLocation.Text = browser.SelectedPath;
                }
                else
                {
                    lblFolderFeedback.Text      = "Folder path is not valid (must be empty)";
                    lblFolderFeedback.ForeColor = Color.Red;
                }
            }
            else
            {
                txtLocation.Text = "";
            }
            cbTerms.Enabled = !string.IsNullOrWhiteSpace(txtLocation.Text);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: CheAle14/bot-chess
 private void cbTerms_CheckedChanged(object sender, EventArgs e)
 {
     if (!promptWarnings)
     {
         return;
     }
     if (cbTerms.Checked && !InstallProcess.isValidLocation(txtLocation.Text))
     {
         MessageBox.Show("Set install location first.");
         cbTerms.Checked = false;
         return;
     }
     if (cbTerms.Checked)
     {
         var result = MessageBox.Show("By agreeing to the Terms and Conditions, you agree to the use of this Chess Client.\r\n" +
                                      "The Client uses a number of anti-cheating mechanisms, such as scanning active programs.\r\n" +
                                      "These mechanisms may infringe on your privacy.\r\n" +
                                      "If you have any concerns, close any private information before running the Client, or do not use it at all.\r\n" +
                                      "Any collected information is viewable only by the Chief Justice unless released in accordance to the Terms.", "Warning!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         if (result != DialogResult.OK)
         {
             cbTerms.Checked = false;
         }
     }
     btnInstall.Enabled = cbTerms.Checked;
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: CheAle14/bot-chess
 private void btnInstall_Click(object sender, EventArgs e)
 {
     if (btnInstall.Text.StartsWith("Un"))
     {
         btnInstall.Enabled = false;
         uninstall();
     }
     else
     {
         if (!InstallProcess.isValidLocation(txtLocation.Text))
         {
             return;
         }
         btnInstall.Enabled = false;
         INSTALL            = new InstallProcess(txtLocation.Text, setUpdate, (y, z) =>
         {
             this.Invoke(new Action(() =>
             {
                 lblBytes.Text = z;
                 pbBar.Value   = y;
             }));
         });
         var latest = INSTALL.getLatestVersion();
         INSTALL.install(new ClientVersion(latest));
     }
 }
コード例 #4
0
ファイル: UpdateForm.cs プロジェクト: CheAle14/bot-chess
        void threadDoStuff()
        {
            var fullPath = (string)reg.GetValue("");

            installPath = fullPath.Replace("ChessInstaller.exe", "").Replace("ChessClient.exe", "").Replace("ChessInstall.exe", "");
            var    version   = new ClientVersion((string)reg.GetValue("Version"));
            var    installer = new InstallProcess(installPath, update, percentage);
            var    latest    = new ClientVersion(installer.getLatestVersion());
            string delta     = "";
            int    compare   = version.CompareTo(latest);

            if (compare == 0)
            {
                delta = "Up to date";
            }
            else if (compare < 0)
            {
                delta = "Outdated";
            }
            else
            {
                delta = "Newer";
            }
            update($"Current: {version}\r\nLatest: {latest}\r\n{delta}");
            Thread.Sleep(1500);
            if (compare < 0)
            { // remove everything
                update("Updating...");
                Thread.Sleep(250);
                installer.unInstall();
                Thread.Sleep(250);
                if (!Directory.Exists(installPath))
                {
                    Directory.CreateDirectory(installPath);
                }
                Thread.Sleep(250);
                installer.install(latest);
                installer.Complete += Installer_Complete;
            }
            else
            {
                update("Hacking NASA and the NSA...");
                Thread.Sleep(2500);
                while (isEnteringManualVersion && manualVersion == null)
                {
                    update("Waiting manual version...");
                    Thread.Sleep(500);
                }
                if (manualVersion != null)
                {
                    update("Getting manual version: " + manualVersion.ToString());
                    Thread.Sleep(250);
                    installer.unInstall();
                    Thread.Sleep(250);
                    if (!Directory.Exists(installPath))
                    {
                        Directory.CreateDirectory(installPath);
                    }
                    Thread.Sleep(250);
                    installer.install(manualVersion);
                    installer.Complete += Installer_Complete;
                }
                else
                {
                    update($"Running latest ({latest}) no update needed");
                    Installer_Complete(installer, null);
                }
            }
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: CheAle14/bot-chess
 void uninstall()
 {
     INSTALL = new InstallProcess(txtLocation.Text, setUpdate, null);
     INSTALL.unInstall();
 }