private void buttonSave_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(CommandLineOptions.getcommand(textBoxExtraArgs.Text, "-pw"))) { if (MessageBox.Show("SuperPutty save the password in Sessions.xml file in plain text.\nUse a password in 'Extra PuTTY Arguments' is very insecure.\nFor a secure connection use SSH authentication with Pageant. \nSelect yes, if you want save the password", "Are you sure that you want to save the password?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Cancel) { return; } } Session.SessionName = textBoxSessionName.Text.Trim(); Session.PuttySession = comboBoxPuttyProfile.Text.Trim(); Session.Host = textBoxHostname.Text.Trim(); Session.ExtraArgs = textBoxExtraArgs.Text.Trim(); Session.Port = int.Parse(textBoxPort.Text.Trim()); Session.Username = textBoxUsername.Text.Trim(); Session.SessionId = SessionData.CombineSessionIds(SessionData.GetSessionParentId(Session.SessionId), Session.SessionName); Session.ImageKey = buttonImageSelect.ImageKey; Session.SPSLFileName = textBoxSPSLScriptFile.Text.Trim(); Session.RemotePath = textBoxRemotePathSesion.Text.Trim(); Session.LocalPath = textBoxLocalPathSesion.Text.Trim(); for (int i = 0; i < groupBox1.Controls.Count; i++) { RadioButton rb = (RadioButton)groupBox1.Controls[i]; if (rb.Checked) { Session.Proto = (ConnectionProtocol)rb.Tag; } } DialogResult = DialogResult.OK; }
private void sessionDetailPropertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { SessionData Session = sessionDetailPropertyGrid.SelectedObject as SessionData; if (Session != null) { String HostPropertyName = "Host"; String PuttySessionPropertyName = "PuttySession"; if (e.ChangedItem.PropertyDescriptor.Name == HostPropertyName || e.ChangedItem.PropertyDescriptor.Name == PuttySessionPropertyName) { if (String.IsNullOrEmpty(Session.PuttySession) && String.IsNullOrEmpty(Session.Host)) { if (e.ChangedItem.PropertyDescriptor.Name == HostPropertyName) { MessageBox.Show("A host name must be specified if a Putty Session Profile is not selected"); Session.Host = (String)e.OldValue; } else { MessageBox.Show("A Putty Session Profile must be selected if a Host Name is not provided"); Session.PuttySession = (String)e.OldValue; } sessionDetailPropertyGrid.Refresh(); } } String ExtraArgsPropertyName = "ExtraArgs"; if (e.ChangedItem.PropertyDescriptor.Name == ExtraArgsPropertyName) { if (!String.IsNullOrEmpty(CommandLineOptions.getcommand(Session.ExtraArgs, "-pw"))) { if (MessageBox.Show("SuperPutty save the password in Sessions.xml file in plain text.\nUse a password in 'Extra PuTTY Arguments' is very insecure.\nFor a secure connection use SSH authentication with Pageant. \nSelect yes, if you want save the password", "Are you sure that you want to save the password?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Cancel) { Session.ExtraArgs = (String)e.OldValue; return; } } sessionDetailPropertyGrid.Refresh(); } Session.SessionId = SessionData.CombineSessionIds(SessionData.GetSessionParentId(Session.SessionId), Session.SessionName); } SuperPuTTY.SaveSessions(); }
private void buttonSave_Click(object sender, EventArgs e) { int val = 0; if (!String.IsNullOrEmpty(CommandLineOptions.getcommand(textBoxExtraArgs.Text, "-pw"))) { if (MessageBox.Show("SuperPutty saves the extra arguments Sessions.xml file in plain text.\nUse of -pw password in 'Extra Arguments' is very insecure.\nFor a secure connection use SSH authentication with Pageant. \nSelect yes, if you want save the password", "Are you sure that you want to save the password?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Cancel) { return; } } Session.SessionName = textBoxSessionName.Text.Trim(); Session.PuttySession = comboBoxPuttyProfile.Text.Trim(); Session.Host = textBoxHostname.Text.Trim(); Session.ExtraArgs = textBoxExtraArgs.Text.Trim(); if (!Int32.TryParse(this.textBoxPort.Text, out val)) { Session.Port = 0; } else { Session.Port = int.Parse(textBoxPort.Text.Trim()); } Session.Username = textBoxUsername.Text.Trim(); Session.SessionId = SessionData.CombineSessionIds(SessionData.GetSessionParentId(Session.SessionId), Session.SessionName); Session.ImageKey = buttonImageSelect.ImageKey; Session.SPSLFileName = textBoxSPSLScriptFile.Text.Trim(); Session.RemotePath = textBoxRemotePathSesion.Text.Trim(); Session.LocalPath = textBoxLocalPathSesion.Text.Trim(); if (this.protoTypesMap.ContainsKey(comboBoxProto.SelectedItem)) { Session.Proto = (ConnectionProtocol)this.protoTypesMap[comboBoxProto.SelectedItem]; } DialogResult = DialogResult.OK; }
private void buttonSave_Click(object sender, EventArgs e) { Session.SessionName = textBoxSessionName.Text.Trim(); Session.PuttySession = comboBoxPuttyProfile.Text.Trim(); Session.Host = textBoxHostname.Text.Trim(); Session.ExtraArgs = textBoxExtraArgs.Text.Trim(); Session.Port = int.Parse(textBoxPort.Text.Trim()); Session.Username = textBoxUsername.Text.Trim(); Session.SessionId = SessionData.CombineSessionIds(SessionData.GetSessionParentId(Session.SessionId), Session.SessionName); Session.ImageKey = buttonImageSelect.ImageKey; for (int i = 0; i < groupBox1.Controls.Count; i++) { RadioButton rb = (RadioButton)groupBox1.Controls[i]; if (rb.Checked) { Session.Proto = (ConnectionProtocol)rb.Tag; } } DialogResult = DialogResult.OK; }