private void txtProfileAddress_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { try { Match match = Regex.Match(txtProfileAddress.Text, @"([a-zA-Z0-9]{51,})"); if (match.Success) { string label = ""; if (User.InputBox("Apertus", "Enter label to import key.", ref label) == DialogResult.OK) { CoinRPC a = new CoinRPC(new Uri(GetURL(Main.coinIP[Main.CoinType]) + ":" + Main.coinPort[Main.CoinType]), new NetworkCredential(Main.coinUser[Main.CoinType], Main.coinPassword[Main.CoinType])); var result = a.ImportPrivateKey(txtProfileAddress.Text, "~~~~" + label, true); cmbProfileAddress.Items.Add(label); txtProfileAddress.Text = ""; txtProfileAddress.Visible = false; cmbProfileAddress.Visible = true; cmbProfileAddress.SelectedItem = label; } } else { CoinRPC a = new CoinRPC(new Uri(GetURL(Main.coinIP[Main.CoinType]) + ":" + Main.coinPort[Main.CoinType]), new NetworkCredential(Main.coinUser[Main.CoinType], Main.coinPassword[Main.CoinType])); string label; if (txtProfileAddress.Text.LastIndexOf('~') > 0) { label = txtProfileAddress.Text; } else { label = "~~~~" + txtProfileAddress.Text; } label = a.GetNewAddress(label); cmbProfileAddress.Items.Add(txtProfileAddress.Text); txtProfileAddress.Visible = false; cmbProfileAddress.Visible = true; cmbProfileAddress.SelectedItem = txtProfileAddress.Text; txtProfileAddress.Text = ""; StreamWriter writeTrustList = new StreamWriter("trust.txt", true); writeTrustList.WriteLine(label); writeTrustList.Close(); var mainForm = Application.OpenForms.OfType <Main>().Single(); mainForm.RefreshHashCache(); } } catch { } } if (e.KeyValue == 27) { txtProfileAddress.Text = ""; txtProfileAddress.Visible = false; cmbProfileAddress.Visible = true; } }
private void txtTipAddress_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { try { Match match = Regex.Match(txtTipAddress.Text, @"([a-zA-Z0-9]{51,})"); if (match.Success) { string label = ""; if (User.InputBox("Apertus", "Enter label to import key.", ref label) == DialogResult.OK) { CoinRPC a = new CoinRPC(new Uri(GetURL(Main.coinIP[Main.CoinType]) + ":" + Main.coinPort[Main.CoinType]), new NetworkCredential(Main.coinUser[Main.CoinType], Main.coinPassword[Main.CoinType])); var result = a.ImportPrivateKey(txtTipAddress.Text, "~~~~~" + label, true); cmbTipAddress.Items.Add(label); txtTipAddress.Text = ""; txtTipAddress.Visible = false; cmbTipAddress.Visible = true; cmbTipAddress.SelectedItem = label; } } else { CoinRPC a = new CoinRPC(new Uri(GetURL(Main.coinIP[Main.CoinType]) + ":" + Main.coinPort[Main.CoinType]), new NetworkCredential(Main.coinUser[Main.CoinType], Main.coinPassword[Main.CoinType])); string label; if (txtTipAddress.Text.LastIndexOf('~') > 0) { label = txtTipAddress.Text; } else { label = "~~~~~" + txtTipAddress.Text; } label = a.GetNewAddress(label); cmbTipAddress.Items.Add(txtTipAddress.Text); txtTipAddress.Visible = false; cmbTipAddress.Visible = true; cmbTipAddress.SelectedItem = txtTipAddress.Text; txtTipAddress.Text = ""; } } catch { } } if (e.KeyValue == 27) { txtTipAddress.Text = ""; txtTipAddress.Visible = false; cmbTipAddress.Visible = true; } }