コード例 #1
0
        /// <summary>
        /// Callback that handles process printing to stderr.
        /// Prints the stderr to a log window.
        /// </summary>
        private void PStderr(String message)
        {
            // Remove CSI [ or ESC [ + single character sequence
            if (message.StartsWith("\u001b["))
            {
                message = message.Remove(0, 3);
            }

            // This is a workaround for Linux Mono:
            // On Windows, when we clone a remote repo, we receive each status line as a separate message
            // On Linux, it is all clumped together without any newlines (or 0A), so we inject them
            if (ClassUtils.IsMono())
            {
                // A bit of a hack since we simply hard-code recognized types of messages. Oh, well...
                message = message.Replace("remote:", Environment.NewLine + "remote:");
                message = message.Replace("Receiving", Environment.NewLine + "Receiving");
                message = message.Replace("Resolving", Environment.NewLine + "Resolving");
            }
            textStdout.AppendText(ClassUtils.ToPlainAscii(message) + Environment.NewLine, Color.Red);

            // Keep the newly added text visible
            textStdout.SelectionStart = textStdout.TextLength;
            textStdout.ScrollToCaret();

            // This hack recognizes a common problem where the host RSA key was not added to the list
            // of known hosts. Help the user by telling him that and (on Windows) offering to open the
            // Manage Keys dialog.
            if (message.Contains("key fingerprint is"))
            {
                // On Linux / Mono, we don't have a Manage SSH dialog
                if (ClassUtils.IsMono())
                {
                    MessageBox.Show(@"The remote server RSA key was not added to the list of known hosts.", @"Host Key error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    DialogResult response = MessageBox.Show(@"The remote server RSA key was not added to the list of known hosts." + Environment.NewLine +
                                                            @"Would you like to open the Manage SSH Keys dialog to add the host in the Remote Keys tab?", @"Host Key error",
                                                            MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (response == DialogResult.Yes)
                    {
                        FormSSH formSsh = new FormSSH();
                        formSsh.ShowDialog();
                    }
                }
            }

            // This hack recognizes a common HTTPS authentication error message
            if (message.Contains(@"fatal: Authentication failed for 'https:"))
            {
                MessageBox.Show(@"The remote server refused to authenticate you." + Environment.NewLine +
                                @"You need to set your full HTTPS credentials (user name and password) to access this repo.",
                                @"HTTPS Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            // Append the stderr stream message to a log window
            App.PrintLogMessage("stderr: " + message, MessageType.Error);
        }
コード例 #2
0
        /// <summary>
        /// Manage SSH keys
        /// </summary>
        private void BtSshClick(object sender, EventArgs e)
        {
            FormSSH formSsh = new FormSSH();

            // Add one of the URLs from our input into the text box of a URL to add
            if (_fetchUrl.Type == ClassUrl.UrlType.Ssh)
            {
                formSsh.AddHost(textUrlFetch.Text.Trim());
            }
            else
            if (_pushUrl.Type == ClassUrl.UrlType.Ssh)
            {
                formSsh.AddHost(textUrlPush.Text.Trim());
            }

            // Show the dialog. A previous call to AddHost will set the "Remote Keys" tab as current,
            // with one of the host strings (URLs) added into the input text box, ready to click on Add Host.
            formSsh.ShowDialog();
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: orf53975/GitForce
        /// <summary>
        /// Manage SSH Keys
        /// </summary>
        private void MenuMainManageKeysClick(object sender, EventArgs e)
        {
            FormSSH formSsh = new FormSSH();

            formSsh.ShowDialog();
        }
コード例 #4
0
        /// <summary>
        /// Manage SSH keys
        /// </summary>
        private void BtSshClick(object sender, EventArgs e)
        {
            FormSSH formSsh = new FormSSH();

            // Add one of the URLs from our input into the text box of a URL to add
            if (_fetchUrl.Type == ClassUrl.UrlType.Ssh)
                formSsh.AddHost(textUrlFetch.Text.Trim());
            else
                if (_pushUrl.Type == ClassUrl.UrlType.Ssh)
                    formSsh.AddHost(textUrlPush.Text.Trim());

            // Show the dialog. A previous call to AddHost will set the "Remote Keys" tab as current,
            // with one of the host strings (URLs) added into the input text box, ready to click on Add Host.
            formSsh.ShowDialog();
        }
コード例 #5
0
ファイル: FormMain.cs プロジェクト: gdevic/GitForce
 /// <summary>
 /// Manage SSH Keys
 /// </summary>
 private void MenuMainManageKeysClick(object sender, EventArgs e)
 {
     FormSSH formSsh = new FormSSH();
     formSsh.ShowDialog();
 }
コード例 #6
0
ファイル: FormGitRun.cs プロジェクト: runt18/GitForce
        /// <summary>
        /// Callback that handles process printing to stderr.
        /// Prints the stderr to a log window.
        /// </summary>
        private void PStderr(String message)
        {
            // This is a workaround for Linux Mono:
            // On Windows, when we clone a remote repo, we receive each status line as a separate message
            // On Linux, it is all clumped together without any newlines (or 0A), so we inject them
            if (ClassUtils.IsMono())
            {
                // A bit of a hack since we simply hard-code recognized types of messages. Oh, well...
                message = message.Replace("remote:", Environment.NewLine + "remote:");
                message = message.Replace("Receiving", Environment.NewLine + "Receiving");
                message = message.Replace("Resolving", Environment.NewLine + "Resolving");
            }
            textStdout.AppendText(ClassUtils.ToPlainAscii(message) + Environment.NewLine, Color.Red);

            // Keep the newly added text visible
            textStdout.SelectionStart = textStdout.TextLength;
            textStdout.ScrollToCaret();

            // This hack recognizes a common problem where the host RSA key was not added to the list
            // of known hosts. Help the user by telling him that and (on Windows) offering to open the
            // Manage Keys dialog.
            if (message.Contains("key fingerprint is"))
            {
                // On Linux / Mono, we don't have a Manage SSH dialog
                if (ClassUtils.IsMono())
                {
                    MessageBox.Show(@"The remote server RSA key was not added to the list of known hosts.", @"Host Key error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    DialogResult response = MessageBox.Show(@"The remote server RSA key was not added to the list of known hosts." + Environment.NewLine + @"Would you like to open the Manage SSH Keys dialog to add the host in the Remote Keys tab?", @"Host Key error", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (response == DialogResult.Yes)
                    {
                        FormSSH formSsh = new FormSSH();
                        formSsh.ShowDialog();
                    }
                }
            }

            // Append the stderr stream message to a log window
            App.PrintLogMessage("stderr: " + message, MessageType.Error);
        }