private void button4_Click(object sender, EventArgs e) { //send SendMailForm SMF = new SendMailForm(pass, "", ""); SMF.ShowDialog(); }
private void listBox1_DoubleClick(object sender, EventArgs e) { //create cryptomail ContactClass CC = (ContactClass)listBox1.Items[listBox1.SelectedIndex]; SendMailForm SMF = new SendMailForm(pass, CC.Mail.Trim(), ""); SMF.ShowDialog(); }
private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (listBox1.SelectedIndex == -1) { return; } if (e.ClickedItem == contextMenuStrip1.Items[0]) { //edit ContactClass CC = (ContactClass)listBox1.Items[listBox1.SelectedIndex]; String contact = Microsoft.VisualBasic.Interaction.InputBox("Input Contact", "Contact", CC.Mail, this.Location.X + 100, this.Location.Y + 100); if (contact.Trim() == "") { return; } DataTable tbl = new DataTable(); SQLLiteconnect sql = new SQLLiteconnect("db.db3"); sql.SQLTransact("UPDATE MyContacts SET name='" + DesClass.Encrypt(contact.ToLower().Trim(), pass) + "' where name='" + DesClass.Encrypt(CC.Mail.ToLower().Trim(), pass) + "'"); } if (e.ClickedItem == contextMenuStrip1.Items[1]) { //del if (MessageBox.Show("Delete the selected contact?", "Delete contact", MessageBoxButtons.YesNo) == DialogResult.Yes) { ContactClass CC = (ContactClass)listBox1.Items[listBox1.SelectedIndex]; DataTable tbl = new DataTable(); SQLLiteconnect sql = new SQLLiteconnect("db.db3"); sql.SQLTransact("Delete from MyContacts where name='" + DesClass.Encrypt(CC.Mail.ToLower().Trim(), pass) + "'"); } } if (e.ClickedItem == contextMenuStrip1.Items[4]) { //sync ContactClass CC = (ContactClass)listBox1.Items[listBox1.SelectedIndex]; String result = DesClass.Decode(ServerAPIClass.ReadPubKey(DesClass.Encode(CC.Mail.ToLower().Trim()))); if (result.Trim() == "") { MessageBox.Show("ERROR"); } else { String pubkey = "<RSAKeyValue><Modulus>" + result + "</Exponent></RSAKeyValue>"; //MessageBox.Show(pubkey); DataTable tbl = new DataTable(); SQLLiteconnect sql = new SQLLiteconnect("db.db3"); sql.SQLTransact("UPDATE MyContacts SET publickey='" + DesClass.Encrypt(pubkey, pass) + "' where name='" + DesClass.Encrypt(CC.Mail.ToLower().Trim(), pass) + "'"); MessageBox.Show("OK"); } } if (e.ClickedItem == contextMenuStrip1.Items[2]) { //create cryptomail ContactClass CC = (ContactClass)listBox1.Items[listBox1.SelectedIndex]; SendMailForm SMF = new SendMailForm(pass, CC.Mail.Trim(), ""); SMF.ShowDialog(); } if (e.ClickedItem == contextMenuStrip1.Items[3]) { //show publickey ContactClass CC = (ContactClass)listBox1.Items[listBox1.SelectedIndex]; if (CC.Publickey.Trim() == "") { MessageBox.Show("No publickey"); } else { MessageBox.Show("<RSAKeyValue><Modulus>" + CC.Publickey.Trim() + "</Exponent></RSAKeyValue>"); } } ListContact(); }
private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (listBox1.SelectedIndex == -1) { return; } if (e.ClickedItem == contextMenuStrip1.Items[0])//read body mail { //answer if (listBox1.SelectedIndex == -1) { return; } DataTable tbl = new DataTable(); SQLLiteconnect sql = new SQLLiteconnect("db.db3"); tbl = sql.SelectTable("select privkey from MyTable"); if (tbl.Rows[0][0].ToString().Trim().Length > 0) { privKey = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass); } int k = 0; MailObjClass MO = (MailObjClass)listBox1.Items[listBox1.SelectedIndex]; richTextBox1.Clear(); richTextBox1.Text += "From: " + MO.Mailfrom + "\r\n"; richTextBox1.Text += "Date: " + MO.Datesend + "\r\n"; richTextBox1.Text += "\r\n"; t = true; sb = new StringBuilder(); ReadCryptoMail(Convert.ToInt32(MO.Nummail)); String bodymail2 = ""; String bodymail = sb.ToString(); //richTextBox2.Text = sb.ToString(); while (bodymail.IndexOf("=") > 0) { k = bodymail.IndexOf("=="); if (k <= 0) { k = bodymail.IndexOf("="); if (k > 0) { bodymail2 = bodymail.Substring(0, k + 1); bodymail = bodymail.Remove(0, k + 1); if (bodymail2.Length > 3) { // MessageBox.Show(Parts[i]); String part = bodymail2.Replace(".", ""); if (part.IndexOf("3D") == 0) { part = part.Remove(0, 2); } richTextBox1.Text += DesClass.RSADec(part, privKey); } } } else { bodymail2 = bodymail.Substring(0, k + 2); bodymail = bodymail.Remove(0, k + 2); if (bodymail2.Length > 3) { // MessageBox.Show(Parts[i]); String part = bodymail2.Replace(".", ""); if (part.IndexOf("3D") == 0) { part = part.Remove(0, 2); } richTextBox1.Text += DesClass.RSADec(part, privKey); } } } //----------------bodymail; SendMailForm SMF = new SendMailForm(pass, MO.Mailfrom, MO.Datesend + "\r\n" + richTextBox1.Text); SMF.ShowDialog(); } }
private void button4_Click(object sender, EventArgs e) { //send SendMailForm SMF = new SendMailForm(pass,"",""); SMF.ShowDialog(); }