public void SetUp() { string filePath = FileInjectHelper.GetDestinationFilePath(this.viewPath); Directory.CreateDirectory(Path.GetDirectoryName(filePath)); Stream destination = new FileStream(filePath, FileMode.Create, FileAccess.Write); var assembly = ServerOperationsFeather.Pages().GetTestUtilitiesAssembly(); Stream source = assembly.GetManifestResourceStream(FileResource); FileInjectHelper.CopyStream(source, destination); source.Close(); destination.Close(); var fields = new FormFieldType[] { FormFieldType.ParagraphTextField, FormFieldType.SubmitButton }; var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName); Guid pageId = ServerOperations.Pages().CreatePage(PageName); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId, FeatherGlobals.FormName, "Body"); }
public static object GetChildFieldValue(this IWebElement webElement, FormFieldType fieldType) { object result; switch (fieldType) { case FormFieldType.Input: var input = webElement.FindElement(By.CssSelector("input")); result = input.GetFieldValue(fieldType); break; case FormFieldType.TextArea: var textarea = webElement.FindElement(By.CssSelector("textarea")); result = textarea.GetFieldValue(fieldType); break; case FormFieldType.Select: var select = webElement.FindElement(By.CssSelector("select")); result = select.GetFieldValue(fieldType); break; case FormFieldType.Checkbox: var checkbox = webElement.FindElement(By.CssSelector("input")); result = checkbox.GetFieldValue(fieldType); break; default: result = webElement.GetFieldValue(fieldType); break; } return(result); }
public static string FormFieldTypeToDisplay(FormFieldType fft, bool titleCase) { string type = "Text"; if (fft == FormFieldType.FFTpassword) { type = "Password"; } else if (fft == FormFieldType.FFTselect) { type = "Select"; } else if (fft == FormFieldType.FFTradio) { type = "Radio"; } else if (fft == FormFieldType.FFTtext) { type = "Text"; } else if (fft == FormFieldType.FFTusername) { type = "Username"; } else if (fft == FormFieldType.FFTcheckbox) { type = "Checkbox"; } if (!titleCase) { return(type.ToLower()); } return(type); }
public FormField(IntPtr obj) { objPtr = obj; List <FormFieldOption> csOptions = new List <FormFieldOption>(); int nOptionsSize = 0; IntPtr nOptions = VidyoFormFieldGetoptionsArrayNative(VidyoFormFieldGetoptionsNative(objPtr), ref nOptionsSize); int nOptionsIndex = 0; while (nOptionsIndex < nOptionsSize) { FormFieldOption csToptions = new FormFieldOption(Marshal.ReadIntPtr(nOptions + (nOptionsIndex * Marshal.SizeOf(nOptions)))); csOptions.Add(csToptions); nOptionsIndex++; } cols = VidyoFormFieldGetcolsNative(objPtr); maxlength = VidyoFormFieldGetmaxlengthNative(objPtr); multiple = VidyoFormFieldGetmultipleNative(objPtr); name = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoFormFieldGetnameNative(objPtr)); options = csOptions; rows = VidyoFormFieldGetrowsNative(objPtr); size = VidyoFormFieldGetsizeNative(objPtr); type = VidyoFormFieldGettypeNative(objPtr); value = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoFormFieldGetvalueNative(objPtr)); wrap = VidyoFormFieldGetwrapNative(objPtr); VidyoFormFieldFreeoptionsArrayNative(nOptions, nOptionsSize); }
public static FormFieldType FormFieldTypeFromDisplay(string type) { type = type.ToLower(); FormFieldType fft = FormFieldType.FFTusername; if (type == "password") { fft = FormFieldType.FFTpassword; } else if (type == "select") { fft = FormFieldType.FFTselect; } else if (type == "radio") { fft = FormFieldType.FFTradio; } else if (type == "text") { fft = FormFieldType.FFTtext; } else if (type == "username") { fft = FormFieldType.FFTusername; } else if (type == "checkbox") { fft = FormFieldType.FFTcheckbox; } return(fft); }
public FormFieldType GetByID(int _formFieldTypeId) { FormFieldTypeDAC _formFieldTypeComponent = new FormFieldTypeDAC(); IDataReader reader = _formFieldTypeComponent.GetByIDFormFieldType(_formFieldTypeId); FormFieldType _formFieldType = null; while (reader.Read()) { _formFieldType = new FormFieldType(); if (reader["FormFieldTypeId"] != DBNull.Value) { _formFieldType.FormFieldTypeId = Convert.ToInt32(reader["FormFieldTypeId"]); } if (reader["Name"] != DBNull.Value) { _formFieldType.Name = Convert.ToString(reader["Name"]); } if (reader["Template"] != DBNull.Value) { _formFieldType.Template = Convert.ToString(reader["Template"]); } _formFieldType.NewRecord = false; } reader.Close(); return(_formFieldType); }
public List <FormFieldType> GetAll() { FormFieldTypeDAC _formFieldTypeComponent = new FormFieldTypeDAC(); IDataReader reader = _formFieldTypeComponent.GetAllFormFieldType().CreateDataReader(); List <FormFieldType> _formFieldTypeList = new List <FormFieldType>(); while (reader.Read()) { if (_formFieldTypeList == null) { _formFieldTypeList = new List <FormFieldType>(); } FormFieldType _formFieldType = new FormFieldType(); if (reader["FormFieldTypeId"] != DBNull.Value) { _formFieldType.FormFieldTypeId = Convert.ToInt32(reader["FormFieldTypeId"]); } if (reader["Name"] != DBNull.Value) { _formFieldType.Name = Convert.ToString(reader["Name"]); } if (reader["Template"] != DBNull.Value) { _formFieldType.Template = Convert.ToString(reader["Template"]); } _formFieldType.NewRecord = false; _formFieldTypeList.Add(_formFieldType); } reader.Close(); return(_formFieldTypeList); }
public static object GetFieldValue(this IWebElement webElement, FormFieldType fieldType) { object result; switch (fieldType) { case FormFieldType.Input: result = webElement.GetAttribute("value"); break; case FormFieldType.TextArea: result = webElement.Text; break; case FormFieldType.Select: result = new SelectElement(webElement).SelectedOption.Text; break; case FormFieldType.Checkbox: result = webElement.Selected; break; default: result = webElement.Text; break; } return(result); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Length <= 0) { MessageBox.Show(this, "Please specify a name"); this.DialogResult = DialogResult.None; return; } if (textBox2.Text.Length <= 0) { MessageBox.Show(this, "Please specify a value"); this.DialogResult = DialogResult.None; return; } if (textBox2.Enabled && (textBox2.Text == "KeePass username" || textBox2.Text == "KeePass password")) { MessageBox.Show(this, "Please change the value of this form field - it is currently set to a value that KeeFox needs to reserve for internal use. Sorry, please report this on the support forums if you are inconvienced by this choice of reserved phrase."); this.DialogResult = DialogResult.None; return; } if (OtherKeys.Contains(textBox1.Text)) { MessageBox.Show(this, "A rule for '" + textBox1.Text + "' has already been added."); this.DialogResult = DialogResult.None; return; } Name = textBox1.Text; Value = textBox2.Text; Id = textBox3.Text; Page = int.Parse(textBox4.Text); if (comboBox1.Text == "Password") { Type = FormFieldType.FFTpassword; } else if (comboBox1.Text == "Select") { Type = FormFieldType.FFTselect; } else if (comboBox1.Text == "Radio") { Type = FormFieldType.FFTradio; } else if (comboBox1.Text == "Text") { Type = FormFieldType.FFTtext; } else if (comboBox1.Text == "Username") { Type = FormFieldType.FFTusername; } else if (comboBox1.Text == "Checkbox") { Type = FormFieldType.FFTcheckbox; } }
public FormField(string fieldName, FormFieldType fieldType) { FieldName = fieldName; HtmlFieldName = fieldName; CSharpFieldName = fieldName; FieldType = fieldType; IsRequired = true; }
public PropertyBuilder( string name) { Name = name; Order = short.MaxValue; Required = !IsNullable(name); Type = FormFieldType.Text; }
public static IEnumerable <SelectListItem> GetFormFieldTypes(int?formFieldType = null) { FormFieldType type = formFieldType.HasValue ? (FormFieldType)formFieldType : FormFieldType.None; var temp = FormFieldTypeNames.Select(x => new SelectListItem() { Value = ((int)x.Key).ToString(), Text = x.Value, Selected = formFieldType.HasValue && x.Key == type }); return(temp); }
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(); } }
public FormField(string name, string displayName, string value, FormFieldType @type, string id, int page) { Name = name; DisplayName = displayName; Value = value; @Type = @type; Id = id; Page = page; }
public FormField(string name, string displayName, string value, FormFieldType @type, string id, int page, PlaceholderHandling placeholderHandling) { Name = name; DisplayName = displayName; Value = value; @Type = @type; Id = id; Page = page; PlaceholderHandling = placeholderHandling; }
public void SetUp() { var fields = new FormFieldType[] { FormFieldType.SubmitButton }; var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName); var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName); ServerOperations.Pages().CreatePage(PageName, templateId); var pageId = ServerOperations.Pages().GetPageId(PageName); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); }
public KeeFoxFieldForm(string name, string value, string id, FormFieldType type, int page, List<string> otherKeys) { InitializeComponent(); Icon = global::KeePassRPC.Properties.Resources.keefox; OtherKeys = otherKeys; if (string.IsNullOrEmpty(name)) this.Text = "Add a form field"; else this.Text = "Edit a form field"; if (value == "KeePass username") { textBox2.Enabled = false; comboBox1.Text = "Username"; comboBox1.Enabled = false; label6.Visible = true; } else if (value == "KeePass password") { textBox2.Enabled = false; comboBox1.Text = "Password"; comboBox1.Enabled = false; label7.Visible = true; } else { if (type == FormFieldType.FFTpassword) comboBox1.Text = "Password"; else if (type == FormFieldType.FFTselect) comboBox1.Text = "Select"; else if (type == FormFieldType.FFTradio) comboBox1.Text = "Radio"; else if (type == FormFieldType.FFTtext) comboBox1.Text = "Text"; else if (type == FormFieldType.FFTusername) comboBox1.Text = "Username"; else if (type == FormFieldType.FFTcheckbox) comboBox1.Text = "Checkbox"; } textBox1.Text = Name = name; textBox2.Text = Value = value; textBox3.Text = Id = id; Page = page; textBox4.Text = Page.ToString(); }
public void SetUp() { var fields = new FormFieldType[] { FormFieldType.CheckboxesField, FormFieldType.SubmitButton }; var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName); var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName); ServerOperations.Pages().CreatePage(PageName, templateId); var pageId = ServerOperations.Pages().GetPageId(PageName); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageId, "Test content", "Contentplaceholder1"); }
public void SetUp() { var fields = new FormFieldType[] { FormFieldType.TextField, FormFieldType.MultipleChoiceField, FormFieldType.DropdownListField, FormFieldType.ParagraphTextField, FormFieldType.CheckboxesField, FormFieldType.PageBreak, FormFieldType.TextField }; var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName); var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName); ServerOperations.Pages().CreatePage(PageName, templateId); var pageId = ServerOperations.Pages().GetPageId(PageName); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); }
public KeeFieldForm(string name, string value, string id, FormFieldType type, int page, PlaceholderHandling phh) { InitializeComponent(); Icon = global::KeePassRPC.Properties.Resources.KPRPCico; if (string.IsNullOrEmpty(name)) { this.Text = "Add a form field"; } else { this.Text = "Edit a form field"; } if (value == "{USERNAME}") { textBox2.Text = Value = value; comboBox1.Text = "Username"; comboBox1.Enabled = false; label6.Visible = true; } else if (value == "{PASSWORD}") { textBox2.Text = Value = value; comboBox1.Text = "Password"; comboBox1.Enabled = false; label7.Visible = true; } else { if (type == FormFieldType.FFTpassword) { comboBox1.Text = "Password"; } else if (type == FormFieldType.FFTselect) { comboBox1.Text = "Select"; } else if (type == FormFieldType.FFTradio) { comboBox1.Text = "Radio"; } else if (type == FormFieldType.FFTtext) { comboBox1.Text = "Text"; } else if (type == FormFieldType.FFTusername) { comboBox1.Text = "Username"; } else if (type == FormFieldType.FFTcheckbox) { comboBox1.Text = "Checkbox"; } if (type == FormFieldType.FFTcheckbox) { checkBox1.Visible = true; Value = value; checkBox1.Checked = Value == "KEEFOX_CHECKED_FLAG_TRUE" ? true : false; } else { textBox2.Text = Value = value; textBox2.Visible = true; label2.Visible = true; } } textBox1.Text = Name = name; textBox3.Text = Id = id; Page = page; textBox4.Text = Page.ToString(); switch (phh) { case PlaceholderHandling.Default: radioButton1.Checked = true; break; case PlaceholderHandling.Enabled: radioButton2.Checked = true; break; case PlaceholderHandling.Disabled: radioButton3.Checked = true; break; } comboBox1.SelectedIndexChanged += new System.EventHandler(comboBox1_SelectedIndexChanged); }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Visible && textBox2.Text.Length <= 0) { MessageBox.Show(this, "Please specify a value"); this.DialogResult = DialogResult.None; return; } if (textBox2.Visible && (textBox2.Text == "{USERNAME}" || textBox2.Text == "{PASSWORD}")) { MessageBox.Show(this, "Please change the value of this form field - it is currently set to a value that Kee needs to reserve for internal use. Sorry, please report this on the support forums if you are inconvenienced by this choice of reserved phrase."); this.DialogResult = DialogResult.None; return; } Name = textBox1.Text; Id = textBox3.Text; if (!int.TryParse(textBox4.Text, out Page)) { Page = 1; } if (comboBox1.Text == "Password") { Type = FormFieldType.FFTpassword; } else if (comboBox1.Text == "Select") { Type = FormFieldType.FFTselect; } else if (comboBox1.Text == "Radio") { Type = FormFieldType.FFTradio; } else if (comboBox1.Text == "Text") { Type = FormFieldType.FFTtext; } else if (comboBox1.Text == "Username") { Type = FormFieldType.FFTusername; } else if (comboBox1.Text == "Checkbox") { Type = FormFieldType.FFTcheckbox; } if (comboBox1.Text == "Checkbox") { Value = checkBox1.Checked ? "KEEFOX_CHECKED_FLAG_TRUE" : "KEEFOX_CHECKED_FLAG_FALSE"; } else { Value = textBox2.Text; } if (radioButton1.Checked) { PlaceholderHandling = PlaceholderHandling.Default; } if (radioButton2.Checked) { PlaceholderHandling = PlaceholderHandling.Enabled; } if (radioButton3.Checked) { PlaceholderHandling = PlaceholderHandling.Disabled; } }
public KeeFoxFieldForm(string name, string value, string id, FormFieldType type, int page) { InitializeComponent(); Icon = global::KeePassRPC.Properties.Resources.keefox; if (string.IsNullOrEmpty(name)) { this.Text = "Add a form field"; } else { this.Text = "Edit a form field"; } if (value == "{USERNAME}") { textBox2.Enabled = false; comboBox1.Text = "Username"; comboBox1.Enabled = false; label6.Visible = true; } else if (value == "{PASSWORD}") { textBox2.Enabled = false; comboBox1.Text = "Password"; comboBox1.Enabled = false; label7.Visible = true; } else { if (type == FormFieldType.FFTpassword) { comboBox1.Text = "Password"; } else if (type == FormFieldType.FFTselect) { comboBox1.Text = "Select"; } else if (type == FormFieldType.FFTradio) { comboBox1.Text = "Radio"; } else if (type == FormFieldType.FFTtext) { comboBox1.Text = "Text"; } else if (type == FormFieldType.FFTusername) { comboBox1.Text = "Username"; } else if (type == FormFieldType.FFTcheckbox) { comboBox1.Text = "Checkbox"; } } textBox1.Text = Name = name; textBox2.Text = Value = value; textBox3.Text = Id = id; Page = page; textBox4.Text = Page.ToString(); }
public static string FormFieldTypeToDisplay(FormFieldType fft, bool titleCase) { string type = "Text"; if (fft == FormFieldType.FFTpassword) type = "Password"; else if (fft == FormFieldType.FFTselect) type = "Select"; else if (fft == FormFieldType.FFTradio) type = "Radio"; else if (fft == FormFieldType.FFTtext) type = "Text"; else if (fft == FormFieldType.FFTusername) type = "Username"; else if (fft == FormFieldType.FFTcheckbox) type = "Checkbox"; if (!titleCase) return type.ToLower(); return type; }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Length <= 0) { MessageBox.Show(this, "Please specify a name"); this.DialogResult = DialogResult.None; return; } if (textBox2.Text.Length <= 0) { MessageBox.Show(this, "Please specify a value"); this.DialogResult = DialogResult.None; return; } if (textBox2.Enabled && (textBox2.Text == "KeePass username" || textBox2.Text == "KeePass password")) { MessageBox.Show(this, "Please change the value of this form field - it is currently set to a value that KeeFox needs to reserve for internal use. Sorry, please report this on the support forums if you are inconvienced by this choice of reserved phrase."); this.DialogResult = DialogResult.None; return; } if (OtherKeys.Contains(textBox1.Text)) { MessageBox.Show(this, "A rule for '" + textBox1.Text + "' has already been added."); this.DialogResult = DialogResult.None; return; } Name = textBox1.Text; Value = textBox2.Text; Id = textBox3.Text; Page = int.Parse(textBox4.Text); if (comboBox1.Text == "Password") Type = FormFieldType.FFTpassword; else if (comboBox1.Text == "Select") Type = FormFieldType.FFTselect; else if (comboBox1.Text == "Radio") Type = FormFieldType.FFTradio; else if (comboBox1.Text == "Text") Type = FormFieldType.FFTtext; else if (comboBox1.Text == "Username") Type = FormFieldType.FFTusername; else if (comboBox1.Text == "Checkbox") Type = FormFieldType.FFTcheckbox; }
public HTMLForm(HTMLNode node) { Param param; this.d = 20; this.a = HTMLTree.FieldType(node); if (this.a == FormFieldType.Form) { param = node.Param.ByName("action"); } else { param = node.Param.ByName("value"); } if (param != null) { this.b = param.Value; } else { this.b = ""; } param = node.Param.ByName("name"); if (param != null) { this.c = param.Value; } else { this.c = ""; } if (this.a == FormFieldType.TextArea) { param = node.Param.ByName("row"); if (param != null) { this.e = HTMLTree.FontSizeFromHTML(param.Value); } else { this.e = 2; } param = node.Param.ByName("col"); if (param != null) { this.d = HTMLTree.FontSizeFromHTML(param.Value); } } if ((this.a == FormFieldType.Text) || (this.a == FormFieldType.Password)) { param = node.Param.ByName("size"); if (param != null) { this.d = HTMLTree.FontSizeFromHTML(param.Value); } } if (((this.a == FormFieldType.Text) || (this.a == FormFieldType.Password)) || (this.a == FormFieldType.Select)) { int num = node.Css.Css.IndexOf("width", CssType.ForAll, ""); if (num != -1) { this.f = HTMLTree.FontSizeFromHTML(node.Css.Css[num].Value); } else { this.f = this.d * 15; } } }
internal TypeAttribute(FormFieldType type) { Type = type; }
private void KeeFoxEntryUserControl_Load(object sender, EventArgs e) { bool kfNeverAutoFill = false; bool kfAlwaysAutoFill = false; bool kfNeverAutoSubmit = false; bool kfAlwaysAutoSubmit = false; this.checkBoxHideFromKeeFox.CheckedChanged += new System.EventHandler(this.checkBoxHideFromKeeFox_CheckedChanged); this.checkBoxBlockHostnameOnly.CheckedChanged += new System.EventHandler(this.checkBoxBlockHostnameOnly_CheckedChanged); foreach (ListViewItem existingLi in _advancedListView.Items) { if (existingLi.Text == "Hide from KeeFox" || existingLi.Text == "Hide from KPRPC") { removeAdvancedString("Hide from KeeFox"); checkBoxHideFromKeeFox.Checked = true; } else if (existingLi.Text == "KPRPC Block hostname-only match") { checkBoxBlockHostnameOnly.Checked = true; } else if (existingLi.Text == "KeeFox Never Auto Fill" || existingLi.Text == "KPRPC Never Auto Fill") { kfNeverAutoFill = true; } else if (existingLi.Text == "KeeFox Always Auto Fill" || existingLi.Text == "KPRPC Always Auto Fill") { kfAlwaysAutoFill = true; } else if (existingLi.Text == "KeeFox Never Auto Submit" || existingLi.Text == "KPRPC Never Auto Submit") { kfNeverAutoSubmit = true; } else if (existingLi.Text == "KeeFox Always Auto Submit" || existingLi.Text == "KPRPC Always Auto Submit") { kfAlwaysAutoSubmit = true; } else if ((existingLi.Text.StartsWith("Form field ") || existingLi.Text.StartsWith("KPRPC Form field ")) && existingLi.Text.EndsWith("type")) { string name = null; // extract name if (existingLi.Text.StartsWith("Form field ")) { name = existingLi.Text.Substring(11, existingLi.Text.Length - 16); } else if (existingLi.Text.StartsWith("KPRPC Form field ")) { name = existingLi.Text.Substring(17, existingLi.Text.Length - 22); } string displayName = name; string type = existingLi.SubItems[1].Text; FormFieldType fft = Utilities.FormFieldTypeFromDisplay(type); string value = null; string id = null; int page = 1; // Grrrrr... can't find any way to request specific list item! //TODO2: cache a better data structure than .NET provides to speed up handling of many form fields foreach (ListViewItem internalLi in _advancedListView.Items) { if (internalLi.Text == "KPRPC Form field " + name + " value") { value = internalLi.SubItems[1].Text; } if (value == null && internalLi.Text == "Form field " + name + " value") { value = internalLi.SubItems[1].Text; } if (internalLi.Text == "KPRPC Form field " + name + " id") { id = internalLi.SubItems[1].Text; } if (id == null && internalLi.Text == "Form field " + name + " id") { id = internalLi.SubItems[1].Text; } if (internalLi.Text == "KPRPC Form field " + name + " page") { page = int.Parse(internalLi.SubItems[1].Text); } if (internalLi.Text == "Form field " + name + " page") { page = int.Parse(internalLi.SubItems[1].Text); } } // if value not found it's probably a standard KeePass data field if (value == null && fft == FormFieldType.FFTusername) { displayName = "KeePass username"; } else if (value == null && fft == FormFieldType.FFTpassword) { displayName = "KeePass password"; } fields.Add(name, new FormField(name, displayName, value, fft, id, page)); } else if (existingLi.Text == "KeeFox Priority" || existingLi.Text == "KPRPC Priority") { if (existingLi.Text == "KeeFox Priority") { changeAdvancedString("KPRPC Priority", existingLi.SubItems[1].Text, false); removeAdvancedString("KeeFox Priority"); } textBoxKeeFoxPriority.Text = existingLi.SubItems[1].Text; } else if (existingLi.Text == "KPRPC Alternative URLs" || existingLi.Text == "Alternative URLs") { foreach (string url in existingLi.SubItems[1].Text.Split(' ')) { listNormalURLs.Add(url); } if (existingLi.Text == "Alternative URLs") { changeAdvancedString("KPRPC Alternative URLs", existingLi.SubItems[1].Text, false); removeAdvancedString("Alternative URLs"); } } else if (existingLi.Text == "KPRPC Blocked URLs") { foreach (string url in existingLi.SubItems[1].Text.Split(' ')) { listNormalBlockedURLs.Add(url); } } else if (existingLi.Text == "KPRPC URL Regex match") { foreach (string url in existingLi.SubItems[1].Text.Split(' ')) { listRegExURLs.Add(url); } } else if (existingLi.Text == "KPRPC URL Regex block") { foreach (string url in existingLi.SubItems[1].Text.Split(' ')) { listRegExBlockedURLs.Add(url); } } else if (existingLi.Text == "Form HTTP realm" || existingLi.Text == "KPRPC HTTP realm" || existingLi.Text == "KPRPC form HTTP realm") { if (existingLi.Text == "Form HTTP realm") { changeAdvancedString("KPRPC HTTP realm", existingLi.SubItems[1].Text, false); removeAdvancedString("Form HTTP realm"); } if (existingLi.Text == "KPRPC form HTTP realm") { changeAdvancedString("KPRPC HTTP realm", existingLi.SubItems[1].Text, false); removeAdvancedString("KPRPC form HTTP realm"); } textBoxKeeFoxRealm.Text = existingLi.SubItems[1].Text; } } // find password... how? have to look through all fields again for ones with no value? likewise for username though could use FFTPusername type for that... bool standardPasswordFound = false; bool standardUsernameFound = false; foreach (FormField f in fields.Values) { string type = Utilities.FormFieldTypeToDisplay(f.Type, false); string value = f.Value; if (f.DisplayName == "KeePass username") { standardUsernameFound = true; value = f.DisplayName; } if (f.DisplayName == "KeePass password") { standardPasswordFound = true; value = f.DisplayName; } ListViewItem lvi = new ListViewItem(new string[] { f.Name, value, f.Id, type, f.Page.ToString() }); AddFieldListItem(lvi); } // if we didn't find specific details about the username and // password, we'll pre-populate the standard KeePass ones so // users can easily change thigns like page number and ID // we don't add them to the list of actual fields though - just the display list. if (!standardPasswordFound) { ListViewItem lvi = new ListViewItem(new string[] { "UNSPECIFIED password", "KeePass password", "UNSPECIFIED password id", "password", "1" }); AddFieldListItem(lvi); } if (!standardUsernameFound) { ListViewItem lvi = new ListViewItem(new string[] { "UNSPECIFIED username", "KeePass username", "UNSPECIFIED username id", "username", "1" }); AddFieldListItem(lvi); } ReadURLStrings(); comboBoxAutoSubmit.Text = "Use KeeFox setting"; comboBoxAutoFill.Text = "Use KeeFox setting"; // doesn't make sense for some of these values to co-exist so we'll tidy up while working out what we should default the GUI options to. // There are also implicit behaviours based on single option choices so we'll make them explicit now so that the GUI accurately reflects the // strings stored in the advanced tab if (kfNeverAutoFill) { currentBehaviour = EntryBehaviour.NeverAutoFillNeverAutoSubmit; } else if (kfAlwaysAutoSubmit) { currentBehaviour = EntryBehaviour.AlwaysAutoFillAlwaysAutoSubmit; } else if (kfAlwaysAutoFill && kfNeverAutoSubmit) { currentBehaviour = EntryBehaviour.AlwaysAutoFillNeverAutoSubmit; } else if (kfNeverAutoSubmit) { currentBehaviour = EntryBehaviour.NeverAutoSubmit; } else if (kfAlwaysAutoFill) { currentBehaviour = EntryBehaviour.AlwaysAutoFill; } else { currentBehaviour = EntryBehaviour.Default; } changeBehaviourState(currentBehaviour); this.comboBoxAutoSubmit.SelectedIndexChanged += new System.EventHandler(this.comboBoxAutoSubmit_SelectedIndexChanged); this.comboBoxAutoFill.SelectedIndexChanged += new System.EventHandler(this.comboBoxAutoFill_SelectedIndexChanged); this.textBoxKeeFoxPriority.TextChanged += new System.EventHandler(this.textBoxKeeFoxPriority_TextChanged); string realmTooltip = "Set this to the realm (what the \"site says\") in the HTTP authentication popup dialog box for a more accurate match"; toolTipRealm.SetToolTip(this.textBoxKeeFoxRealm, realmTooltip); toolTipRealm.SetToolTip(this.labelRealm, realmTooltip); }
public FormFieldAttribute(string fieldName, FormFieldType type) { Field = fieldName; Type = type; }
protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity <FormFieldTypeRuleType>() .HasKey(pt => new { pt.FormFieldTypeId, pt.FormValidationRuleTypeId }); modelBuilder.Entity <FormFieldTypeRuleType>() .HasOne(pt => pt.FormFieldType) .WithMany(p => p.FormFieldTypeRuleType) .HasForeignKey(pt => pt.FormFieldTypeId); modelBuilder.Entity <FormFieldTypeRuleType>() .HasOne(pt => pt.FormValidationRuleType) .WithMany(t => t.FormFieldTypeRuleType) .HasForeignKey(pt => pt.FormValidationRuleTypeId); foreach (FieldType fieldType in (FieldType[])Enum.GetValues(typeof(FieldType))) { var Type = new FormFieldType { FormFieldTypeId = (int)fieldType, Name = fieldType.ToString() }; //field types that have multiple options if (fieldType == FieldType.DropDown || fieldType == FieldType.RadioButton || fieldType == FieldType.CheckBox) { Type.MultipleOptions = true; } modelBuilder.Entity <FormFieldType>().HasData(Type); } foreach (RuleType ruleType in (RuleType[])Enum.GetValues(typeof(RuleType))) { modelBuilder.Entity <FormFieldValidationRuleType>().HasData(new FormFieldValidationRuleType { FormFieldValidationRuleTypeId = (int)ruleType, Name = ruleType.ToString() }); } //String validation types modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.String, FormValidationRuleTypeId = (int)RuleType.Required }); modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.String, FormValidationRuleTypeId = (int)RuleType.Minimum_Length }); modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.String, FormValidationRuleTypeId = (int)RuleType.Maxmimum_Length }); //Number validation types modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.Number, FormValidationRuleTypeId = (int)RuleType.Required }); modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.Number, FormValidationRuleTypeId = (int)RuleType.Minimum_Value }); modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.Number, FormValidationRuleTypeId = (int)RuleType.Maxmimum__Value }); //Date validation types modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.Date, FormValidationRuleTypeId = (int)RuleType.Required }); modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.Date, FormValidationRuleTypeId = (int)RuleType.Minimum_Date }); modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.Date, FormValidationRuleTypeId = (int)RuleType.Maxmimum_Date }); //Radio button validation types modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.RadioButton, FormValidationRuleTypeId = (int)RuleType.Required }); //Drop down validation types modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.DropDown, FormValidationRuleTypeId = (int)RuleType.Required }); //Checkbox validation types modelBuilder.Entity <FormFieldTypeRuleType>().HasData(new FormFieldTypeRuleType { FormFieldTypeId = (int)FieldType.CheckBox, FormValidationRuleTypeId = (int)RuleType.Required }); }
/// <summary> /// Creates a new FFData by reading the data from the given stream.<br/> /// The position must already be set. /// </summary> /// <param name="dataStream"></param> public FormFieldData(byte[] bytes) { int pos = 0; this.version = System.BitConverter.ToUInt32(bytes, pos); if (this.version == 0xFFFFFFFF) { pos += 4; int bits = (int)System.BitConverter.ToUInt16(bytes, pos); this.iType = (FormFieldType)Utils.BitmaskToInt(bits, 0x3); this.iRes = (UInt16)Utils.BitmaskToInt(bits, 0x7C); this.fOwnHelp = Utils.BitmaskToBool(bits, 0x80); this.fOwnStat = Utils.BitmaskToBool(bits, 0x100); this.fProt = Utils.BitmaskToBool(bits, 0x200); this.iSize = (byte)Utils.BitmaskToInt(bits, 0x400); this.iTypeTxt = (TextboxType)Utils.BitmaskToInt(bits, 0x3800); this.fRecalc = Utils.BitmaskToBool(bits, 0x4000); this.fHasListBox = Utils.BitmaskToBool(bits, 0x8000); pos += 2; this.cch = System.BitConverter.ToUInt16(bytes, pos); pos += 2; this.hps = System.BitConverter.ToUInt16(bytes, pos); pos += 2; //read the name this.xstzName = Utils.ReadXstz(bytes, pos); pos += (this.xstzName.Length * 2) + 2 + 2; //read text def if (this.iType == FormFieldType.iTypeText) { this.xstzTextDef = Utils.ReadXstz(bytes, pos); pos += (this.xstzTextDef.Length * 2) + 2 + 2; } //definition if (this.iType == FormFieldType.iTypeChck || this.iType == FormFieldType.iTypeDrop) { this.wDef = System.BitConverter.ToUInt16(bytes, pos); pos += 2; } //read the text format this.xstzTextFormat = Utils.ReadXstz(bytes, pos); pos += (this.xstzTextFormat.Length * 2) + 2 + 2; //read the help test this.xstzHelpText = Utils.ReadXstz(bytes, pos); pos += (this.xstzHelpText.Length * 2) + 2 + 2; //read the status this.xstzStatText = Utils.ReadXstz(bytes, pos); pos += (this.xstzStatText.Length * 2) + 2 + 2; //read the entry macro this.xstzEntryMcr = Utils.ReadXstz(bytes, pos); pos += (this.xstzEntryMcr.Length * 2) + 2 + 2; //read the exit macro this.xstzExitMcr = Utils.ReadXstz(bytes, pos); pos += (this.xstzExitMcr.Length * 2) + 2 + 2; } }
/// <summary> /// Create form field data. /// </summary> /// <param name="type">Field type.</param> /// <param name="id">Field unique id.</param> /// <param name="label">Optional label.</param> public FormFieldData(FormFieldType type, string id, string label = null) { Type = type; FieldId = id; FieldLabel = label; }
/// <summary> /// Default constructor. /// </summary> /// <param name="fieldType">Type of field.<see cref="FormFieldType"/></param> public FormFieldAttribute( FormFieldType fieldType) { FormFieldType = fieldType; }
internal void method_31(FormFieldType A_0) { this.formFieldType_0 = A_0; }
public static string GetFieldCodeByType(FormFieldType formFieldType) { switch (formFieldType) { case FormFieldType.TextBoxControl: return FormFieldTypeCode.TEXTBOX; case FormFieldType.LabelControl: return FormFieldTypeCode.LABEL; case FormFieldType.DatePickerControl: return FormFieldTypeCode.DATEPICKER; case FormFieldType.DateTimePickerControl: return FormFieldTypeCode.DATETIMEPICKER; case FormFieldType.SqlSelector: return FormFieldTypeCode.SQLSELECTOR; case FormFieldType.ListLookUp: return FormFieldTypeCode.LISTLOOKUP; case FormFieldType.PageListLookUp: return FormFieldTypeCode.PAGELISTLOOKUP; case FormFieldType.YesNoSelector: return FormFieldTypeCode.YESNOSELECTOR; case FormFieldType.FileUpload: return FormFieldTypeCode.FILEUPLOAD; case FormFieldType.MultiFileUpload: return FormFieldTypeCode.MULTIFILEUPLOAD; case FormFieldType.YearSelector: return FormFieldTypeCode.YEARSELECTOR; case FormFieldType.CaptchaControl: return FormFieldTypeCode.CAPTCHA; case FormFieldType.GuidGenerator: return FormFieldTypeCode.GUIDGENERATOR; case FormFieldType.FckEditor: return FormFieldTypeCode.FCKEDITOR; case FormFieldType.ImageSelector: return FormFieldTypeCode.IMAGESELECTOR; case FormFieldType.SqlListLookUp: return FormFieldTypeCode.SQLLISTLOOKUP; case FormFieldType.ContentTypeLookUp: return FormFieldTypeCode.CONTENTTYPELOOKUP; case FormFieldType.ParameterGetter: return FormFieldTypeCode.PARAMETERGETTER; case FormFieldType.UserProfileGetter: return FormFieldTypeCode.USERPROFILEGETTER; case FormFieldType.CustomFormControl: return "uc"; default: return FormFieldTypeCode.UNKNOWN; } }