コード例 #1
0
ファイル: FormDiffMissing.cs プロジェクト: Celebrate/GitForce
        /// <summary>
        /// User clicked on a Install KDiff3 button to download and install KDiff3
        /// (Windows only)
        ///
        /// *** This button was removed ***
        /// I left this code in place should it be needed.
        /// The button was downloading this specific executable and installing it.
        /// However, github does not provide easy file access. There are ways around
        /// it and perhaps it is worth redoing it. One day.
        ///
        /// </summary>
        private void BtInstallClick(object sender, EventArgs e)
        {
            string installerFile = Path.GetTempFileName(); // Junk name so we can safely call 'Delete'

            try
            {
                FormDownload formDownload = new FormDownload("Download KDiff3",
                                                             @"https://sourceforge.net/projects/kdiff3/files/kdiff3/0.9.98",
                                                             @">(?<file>\S+.exe)", "/download/");

                // If the download succeeded, run the installer file
                if (formDownload.ShowDialog() == DialogResult.OK)
                {
                    // Run the installer application that we just downloaded and wait for it to finish
                    installerFile = formDownload.TargetFile;
                    Process procInstaller = Process.Start(installerFile);
                    procInstaller.WaitForExit();

                    if (procInstaller.ExitCode == 0)
                    {
                        DialogResult = DialogResult.OK;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                // Make sure we don't leave temporary files around
                File.Delete(installerFile);
            }
        }
コード例 #2
0
ファイル: FormDiffMissing.cs プロジェクト: runt18/GitForce
        /// <summary>
        /// User clicked on a Install KDiff3 button to download and install KDiff3
        /// (Windows only)
        ///
        /// *** This button was removed ***
        /// I left this code in place should it be needed.
        /// The button was downloading this specific executable and installing it.
        /// However, github does not provide easy file access. There are ways around
        /// it and perhaps it is worth redoing it. One day.
        ///
        /// </summary>
        private void BtInstallClick(object sender, EventArgs e)
        {
            string installerFile = Path.GetTempFileName(); // Junk name so we can safely call 'Delete'
            try
            {
                FormDownload formDownload = new FormDownload("Download KDiff3",
                    @"https://sourceforge.net/projects/kdiff3/files/kdiff3/0.9.98",
                    @">(?<file>\S+.exe)", "/download/");

                // If the download succeeded, run the installer file
                if (formDownload.ShowDialog() == DialogResult.OK)
                {
                    // Run the installer application that we just downloaded and wait for it to finish
                    installerFile = formDownload.TargetFile;
                    Process procInstaller = Process.Start(installerFile);
                    procInstaller.WaitForExit();

                    if(procInstaller.ExitCode==0)
                        DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                // Make sure we don't leave temporary files around
                File.Delete(installerFile);
            }
        }
コード例 #3
0
ファイル: FormPathToGit.cs プロジェクト: splintor/GitForce
        /// <summary>
        /// User clicked on the Install button.. We need to find the latest msysgit build,
        /// download it and run it
        /// </summary>
        private void BtInstallClick(object sender, EventArgs e)
        {
            string installerFile = Path.GetTempFileName(); // Junk name so we can safely call 'Delete'
            try
            {
                FormDownload msysgit = new FormDownload("Download msysgit",
                    @"http://code.google.com/p/msysgit/downloads/list?q=full+installer+official+git",
                    @"//(?<file>\S+.exe)", false);

                // If the download succeeded, run the installer file
                if(msysgit.ShowDialog()==DialogResult.OK)
                {
                    installerFile = msysgit.TargetFile;
                    ExecResult ret = Exec.Run(installerFile, String.Empty);
                    if(ret.retcode==0)
                    {
                        // Check if the git executable is at the expected location now
                        if (File.Exists(gitPath))
                            PathToGit = textBoxPath.Text = gitPath;
                    }
                    DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                // Make sure we don't leave temporary files around
                File.Delete(installerFile);
            }
        }
コード例 #4
0
        /// <summary>
        /// User clicked on the Install button.. We need to find the latest msysgit build,
        /// download it and run it
        /// </summary>
        private void BtInstallClick(object sender, EventArgs e)
        {
            string installerFile = Path.GetTempFileName(); // Junk name so we can safely call 'Delete'

            try
            {
                // msysgit is hosted at https://github.com/msysgit/msysgit/releases
                // and the files can be downloaded at the subfolder 'download':

                FormDownload msysgit = new FormDownload("Download msysgit",
                                                        @"https://github.com/msysgit/msysgit/releases",
                                                        @"(?<file>Git-[1-2]+.[0-9]+.[0-9]+-\S+.exe)", "/download/");

                // If the download succeeded, run the installer file
                if (msysgit.ShowDialog() == DialogResult.OK)
                {
                    installerFile = msysgit.TargetFile;
                    ExecResult ret = Exec.Run(installerFile, String.Empty);
                    if (ret.retcode == 0)
                    {
                        // Check if the git executable is at the expected location now
                        if (File.Exists(gitPath))
                        {
                            PathToGit = textBoxPath.Text = gitPath;
                        }
                    }
                    DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                // Make sure we don't leave temporary files around
                File.Delete(installerFile);
            }
        }
コード例 #5
0
ファイル: FormPathToGit.cs プロジェクト: runt18/GitForce
        /// <summary>
        /// User clicked on the Install button.. We need to find the latest msysgit build,
        /// download it and run it
        /// </summary>
        private void BtInstallClick(object sender, EventArgs e)
        {
            string installerFile = Path.GetTempFileName(); // Junk name so we can safely call 'Delete'
            try
            {
                // msysgit is hosted at https://github.com/msysgit/msysgit/releases
                // and the files can be downloaded at the subfolder 'download':

                FormDownload msysgit = new FormDownload("Download msysgit",
                    @"https://github.com/msysgit/msysgit/releases",
                    @"(?<file>Git-[1-2]+.[0-9]+.[0-9]+-\S+.exe)", "/download/");

                // If the download succeeded, run the installer file
                if(msysgit.ShowDialog()==DialogResult.OK)
                {
                    installerFile = msysgit.TargetFile;
                    ExecResult ret = Exec.Run(installerFile, String.Empty);
                    if(ret.retcode==0)
                    {
                        // Check if the git executable is at the expected location now
                        if (File.Exists(gitPath))
                            PathToGit = textBoxPath.Text = gitPath;
                    }
                    DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                // Make sure we don't leave temporary files around
                File.Delete(installerFile);
            }
        }