Esempio n. 1
0
        private void LoadPuttyKey()
        {
            if (!GitCommandHelpers.Plink())
            {
                return;
            }

            if (File.Exists(AppSettings.Pageant))
            {
                var files = new HashSet <string>(new PathEqualityComparer());
                foreach (var remote in GetSelectedRemotes())
                {
                    var sshKeyFile = Module.GetPuttyKeyFileForRemote(remote);
                    if (!string.IsNullOrEmpty(sshKeyFile))
                    {
                        files.Add(sshKeyFile);
                    }
                }

                foreach (var sshKeyFile in files)
                {
                    if (File.Exists(sshKeyFile))
                    {
                        VsrModule.StartPageantWithKey(sshKeyFile);
                    }
                }
            }
            else
            {
                MessageBoxes.PAgentNotFound(this);
            }

            return;

            IEnumerable <string> GetSelectedRemotes()
            {
                if (PullFromUrl.Checked)
                {
                    yield break;
                }

                if (IsPullAll())
                {
                    foreach (var remote in (IEnumerable <ConfigFileRemote>)_NO_TRANSLATE_Remotes.DataSource)
                    {
                        if (!string.IsNullOrWhiteSpace(remote.Name) && remote.Name != AllRemotes)
                        {
                            yield return(remote.Name);
                        }
                    }
                }
                else if (!string.IsNullOrWhiteSpace(_NO_TRANSLATE_Remotes.Text))
                {
                    yield return(_NO_TRANSLATE_Remotes.Text);
                }
            }
        }
        /// <summary>
        /// Tries to load the given key. Returns whether successful.
        /// </summary>
        public static bool LoadKey(IWin32Window parent, string path)
        {
            if (!File.Exists(AppSettings.Pageant))
            {
                MessageBoxes.PAgentNotFound(parent);
                return(false);
            }

            VsrModule.StartPageantWithKey(path);
            return(true);
        }
Esempio n. 3
0
 private void LoadSshKeyClick(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(PuttySshKey.Text))
     {
         MessageBox.Show(this, _errorNoKeyEntered.Text, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         VsrModule.StartPageantWithKey(PuttySshKey.Text);
     }
 }