private void buttonFieldEdit_Click(object sender, EventArgs e) { ListView.SelectedListViewItemCollection lvsicSel = listView2.SelectedItems; FormField tag = (FormField)lvsicSel[0].Tag; KeeFoxFieldForm kfff = null; if (tag != null) { kfff = new KeeFoxFieldForm(tag); } else if (lvsicSel[0].SubItems[1].Text == "{PASSWORD}") { kfff = new KeeFoxFieldForm(lvsicSel[0].SubItems[0].Text, "{PASSWORD}", lvsicSel[0].SubItems[2].Text, FormFieldType.FFTpassword, int.Parse(lvsicSel[0].SubItems[4].Text)); } else if (lvsicSel[0].SubItems[1].Text == "{USERNAME}") { kfff = new KeeFoxFieldForm(lvsicSel[0].SubItems[0].Text, "{USERNAME}", lvsicSel[0].SubItems[2].Text, FormFieldType.FFTusername, int.Parse(lvsicSel[0].SubItems[4].Text)); } else { throw new Exception("Corrupt Entry found!"); } if (kfff.ShowDialog() == DialogResult.OK) { // Update the display name. defaulting to whatever user entered as the name unless they were editing one of the standard fields //Really? Why fix the name to this random string?!! string displayName = kfff.Name; if (kfff.Value == "{PASSWORD}") { displayName = "KeePass password"; } else if (kfff.Value == "{USERNAME}") { displayName = "KeePass username"; } string displayValue = kfff.Value; if (kfff.Type == FormFieldType.FFTpassword) { displayValue = "********"; if (kfff.Value == "{PASSWORD}") { displayValue = "KeePass password"; } } string type = Utilities.FormFieldTypeToDisplay(kfff.Type, false); int page = kfff.Page; ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, displayValue, kfff.Id, type, page.ToString() }); lvi.Tag = new FormField(kfff.Name, displayName, kfff.Value, kfff.Type, kfff.Id, page); RemoveFieldListItem(lvsicSel[0]); AddFieldListItem(lvi); UpdateFieldStrings(); } }
private void buttonFieldEdit_Click(object sender, EventArgs e) { ListView.SelectedListViewItemCollection lvsicSel = listView2.SelectedItems; List <string> all = new List <string>(); for (int i = 0; i < listView2.Items.Count; ++i) { all.Add(listView2.Items[i].Text); } List <string> others = all.GetRange(0, all.Count); others.Remove(lvsicSel[0].Text); FormFieldType fft = Utilities.FormFieldTypeFromDisplay(lvsicSel[0].SubItems[3].Text); string existingValue = ""; if (lvsicSel[0].SubItems[1].Text == "KeePass password" || lvsicSel[0].SubItems[1].Text == "KeePass username") { existingValue = lvsicSel[0].SubItems[1].Text; } else { existingValue = _strings.Get("KPRPC Form field " + lvsicSel[0].SubItems[0].Text + " value").ReadString(); } KeeFoxFieldForm kfff = new KeeFoxFieldForm(lvsicSel[0].SubItems[0].Text, existingValue, lvsicSel[0].SubItems[2].Text, fft, int.Parse(lvsicSel[0].SubItems[4].Text), others); if (kfff.ShowDialog() == DialogResult.OK) { // remove the old field data fields.Remove(lvsicSel[0].Text); RemoveFieldListItem(lvsicSel[0]); string displayName = kfff.Name; if (kfff.Value == "KeePass password" || kfff.Value == "KeePass username") { displayName = kfff.Value; } string type = Utilities.FormFieldTypeToDisplay(kfff.Type, false); int page = kfff.Page; ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, kfff.Type == FormFieldType.FFTpassword ? "********" : kfff.Value, kfff.Id, type, page.ToString() }); AddFieldListItem(lvi); fields.Add(kfff.Name, new FormField(kfff.Name, displayName, kfff.Value, kfff.Type, kfff.Id, page)); UpdateFieldStrings(); } }
private void buttonFieldAdd_Click(object sender, EventArgs e) { KeeFoxFieldForm kfff = new KeeFoxFieldForm(null, null, null, FormFieldType.FFTtext, 1); if (kfff.ShowDialog() == DialogResult.OK) { FormField ff = new FormField(kfff.Name, kfff.Name, kfff.Value, kfff.Type, kfff.Id, kfff.Page); string type = Utilities.FormFieldTypeToDisplay(kfff.Type, false); int page = kfff.Page; // We know any new passwords are not the main Entry password // Also know that the display name can be same as main name ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, kfff.Type == FormFieldType.FFTpassword ? "********" : kfff.Value, kfff.Id, type, page.ToString() }); lvi.Tag = ff; AddFieldListItem(lvi); UpdateFieldStrings(); } }
private void buttonFieldAdd_Click(object sender, EventArgs e) { List <string> all = new List <string>(); for (int i = 0; i < listView2.Items.Count; ++i) { all.Add(listView2.Items[i].Text); } KeeFoxFieldForm kfff = new KeeFoxFieldForm(null, null, null, FormFieldType.FFTtext, 1, all); if (kfff.ShowDialog() == DialogResult.OK) { fields.Add(kfff.Name, new FormField(kfff.Name, kfff.Name, kfff.Value, kfff.Type, kfff.Id, kfff.Page)); string type = Utilities.FormFieldTypeToDisplay(kfff.Type, false); int page = kfff.Page; // We know any new passwords are not the main Entry password ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, kfff.Type == FormFieldType.FFTpassword ? "********" : kfff.Value, kfff.Id, type, page.ToString() }); AddFieldListItem(lvi); //////if (kfff.Type != FormFieldType.FFTusername //UpdateEntryStrings(false, false); //ResizeColumnHeaders(); //if (kfff.Match && !kfff.RegEx) //{ // listNormalURLs.Add(kfff.URL); // ListViewItem lvi = new ListViewItem(new string[] { kfurlf.URL, "Normal", "Match" }); // AddURLListItem(lvi); //} UpdateFieldStrings(); //fiel } }
private void buttonFieldAdd_Click(object sender, EventArgs e) { List<string> all = new List<string>(); for (int i = 0; i < listView2.Items.Count; ++i) all.Add(listView2.Items[i].Text); KeeFoxFieldForm kfff = new KeeFoxFieldForm(null, null, null, FormFieldType.FFTtext, 1, all); if (kfff.ShowDialog() == DialogResult.OK) { fields.Add(kfff.Name,new FormField(kfff.Name, kfff.Name, kfff.Value, kfff.Type, kfff.Id, kfff.Page)); string type = Utilities.FormFieldTypeToDisplay(kfff.Type,false); int page = kfff.Page; // We know any new passwords are not the main Entry password ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, kfff.Type == FormFieldType.FFTpassword ? "********" : kfff.Value, kfff.Id, type, page.ToString() }); AddFieldListItem(lvi); //////if (kfff.Type != FormFieldType.FFTusername //UpdateEntryStrings(false, false); //ResizeColumnHeaders(); //if (kfff.Match && !kfff.RegEx) //{ // listNormalURLs.Add(kfff.URL); // ListViewItem lvi = new ListViewItem(new string[] { kfurlf.URL, "Normal", "Match" }); // AddURLListItem(lvi); //} UpdateFieldStrings(); //fiel } }
private void buttonFieldEdit_Click(object sender, EventArgs e) { ListView.SelectedListViewItemCollection lvsicSel = listView2.SelectedItems; List<string> all = new List<string>(); for (int i = 0; i < listView2.Items.Count; ++i) all.Add(listView2.Items[i].Text); List<string> others = all.GetRange(0, all.Count); others.Remove(lvsicSel[0].Text); FormFieldType fft = Utilities.FormFieldTypeFromDisplay(lvsicSel[0].SubItems[3].Text); string existingValue = ""; if (lvsicSel[0].SubItems[1].Text == "KeePass password" || lvsicSel[0].SubItems[1].Text == "KeePass username") existingValue = lvsicSel[0].SubItems[1].Text; else existingValue = _strings.Get("KPRPC Form field " + lvsicSel[0].SubItems[0].Text + " value").ReadString(); KeeFoxFieldForm kfff = new KeeFoxFieldForm(lvsicSel[0].SubItems[0].Text, existingValue, lvsicSel[0].SubItems[2].Text, fft, int.Parse(lvsicSel[0].SubItems[4].Text), others); if (kfff.ShowDialog() == DialogResult.OK) { // remove the old field data fields.Remove(lvsicSel[0].Text); RemoveFieldListItem(lvsicSel[0]); string displayName = kfff.Name; if (kfff.Value == "KeePass password" || kfff.Value == "KeePass username") displayName = kfff.Value; string type = Utilities.FormFieldTypeToDisplay(kfff.Type, false); int page = kfff.Page; ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, kfff.Type == FormFieldType.FFTpassword ? "********" : kfff.Value, kfff.Id, type, page.ToString() }); AddFieldListItem(lvi); fields.Add(kfff.Name, new FormField(kfff.Name, displayName, kfff.Value, kfff.Type, kfff.Id, page)); UpdateFieldStrings(); } }
private void buttonFieldAdd_Click(object sender, EventArgs e) { KeeFoxFieldForm kfff = new KeeFoxFieldForm(null, null, null, FormFieldType.FFTtext, 1); if (kfff.ShowDialog() == DialogResult.OK) { FormField ff = new FormField(kfff.Name, kfff.Name, kfff.Value, kfff.Type, kfff.Id, kfff.Page); string type = Utilities.FormFieldTypeToDisplay(kfff.Type,false); int page = kfff.Page; // We know any new passwords are not the main Entry password // Also know that the display name can be same as main name ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, kfff.Type == FormFieldType.FFTpassword ? "********" : kfff.Value, kfff.Id, type, page.ToString() }); lvi.Tag = ff; AddFieldListItem(lvi); UpdateFieldStrings(); } }
private void buttonFieldEdit_Click(object sender, EventArgs e) { ListView.SelectedListViewItemCollection lvsicSel = listView2.SelectedItems; FormField tag = (FormField)lvsicSel[0].Tag; KeeFoxFieldForm kfff = null; if (tag != null) kfff = new KeeFoxFieldForm(tag); else if (lvsicSel[0].SubItems[1].Text == "{PASSWORD}") kfff = new KeeFoxFieldForm(lvsicSel[0].SubItems[0].Text, "{PASSWORD}", lvsicSel[0].SubItems[2].Text, FormFieldType.FFTpassword, int.Parse(lvsicSel[0].SubItems[4].Text)); else if (lvsicSel[0].SubItems[1].Text == "{USERNAME}") kfff = new KeeFoxFieldForm(lvsicSel[0].SubItems[0].Text, "{USERNAME}", lvsicSel[0].SubItems[2].Text, FormFieldType.FFTusername, int.Parse(lvsicSel[0].SubItems[4].Text)); else throw new Exception("Corrupt Entry found!"); if (kfff.ShowDialog() == DialogResult.OK) { // Update the display name. defaulting to whatever user entered as the name unless they were editing one of the standard fields //Really? Why fix the name to this random string?!! string displayName = kfff.Name; if (kfff.Value == "{PASSWORD}") displayName = "KeePass password"; else if (kfff.Value == "{USERNAME}") displayName = "KeePass username"; string displayValue = kfff.Value; if (kfff.Type == FormFieldType.FFTpassword) { displayValue = "********"; if (kfff.Value == "{PASSWORD}") displayValue = "KeePass password"; } string type = Utilities.FormFieldTypeToDisplay(kfff.Type, false); int page = kfff.Page; ListViewItem lvi = new ListViewItem(new string[] { kfff.Name, displayValue, kfff.Id, type, page.ToString() }); lvi.Tag = new FormField(kfff.Name, displayName, kfff.Value, kfff.Type, kfff.Id, page); RemoveFieldListItem(lvsicSel[0]); AddFieldListItem(lvi); UpdateFieldStrings(); } }