/// <summary> /// Updates the UI which represents the given custom erasure method. /// </summary> /// <param name="item">The method to update.</param> private static void UpdateMethod(ListViewItem item) { CustomErasureMethod method = (CustomErasureMethod)item.Tag; item.Text = method.Name; item.SubItems[1].Text = method.Passes.Length.ToString(CultureInfo.CurrentCulture); }
/// <summary> /// Adds the given method to the custom methods list. /// </summary> /// <param name="method">The method to add.</param> private void AddMethod(CustomErasureMethod method) { ListViewItem item = customMethod.Items.Add(method.Name); item.SubItems.Add(method.Passes.Length.ToString(CultureInfo.CurrentCulture)); item.Tag = method; }
private void customMethod_ItemActivate(object sender, EventArgs e) { //Create the dialog CustomMethodEditorForm editorForm = new CustomMethodEditorForm(); ListViewItem item = customMethod.SelectedItems[0]; editorForm.Method = (CustomErasureMethod)item.Tag; if (editorForm.ShowDialog() == DialogResult.OK) { //Remove the old definition of the erasure method CustomErasureMethod method = editorForm.Method; if (customMethods.ContainsKey(method.Guid) && removeCustomMethods.IndexOf(method.Guid) == -1) { removeCustomMethods.Add(method.Guid); } //Add the new definition foreach (CustomErasureMethod addMethod in addCustomMethods) { if (addMethod.Guid == method.Guid) { addCustomMethods.Remove(addMethod); break; } } addCustomMethods.Add(method); item.Tag = method; UpdateMethod(item); } }
private void customMethodAdd_Click(object sender, EventArgs e) { CustomMethodEditorForm form = new CustomMethodEditorForm(); if (form.ShowDialog() == DialogResult.OK) { CustomErasureMethod method = form.Method; addCustomMethods.Add(method); AddMethod(method); } }
/// <summary> /// Registers all defined custom methods with the method manager. /// </summary> internal static void RegisterAll() { if (DefaultPlugin.Settings.EraseCustom == null) { return; } Dictionary <Guid, CustomErasureMethod> methods = DefaultPlugin.Settings.EraseCustom; foreach (Guid guid in methods.Keys) { CustomErasureMethod method = methods[guid]; Host.Instance.ErasureMethods.Add(new EraseCustom(method)); } }
private void deleteMethodToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in customMethod.SelectedItems) { CustomErasureMethod method = (CustomErasureMethod)item.Tag; if (addCustomMethods.IndexOf(method) >= 0) { addCustomMethods.Remove(method); } else { removeCustomMethods.Add(method.Guid); } customMethod.Items.Remove(item); } }
private void AddMethod(CustomErasureMethod method) { ListViewItem item = customMethod.Items.Add(method.Name); item.SubItems.Add(method.Passes.Length.ToString(CultureInfo.CurrentCulture)); item.Tag = method; }
/// <summary> /// Constructor. /// </summary> /// <param name="method">The erasure method definition for the custom method.</param> public EraseCustom(CustomErasureMethod method) { this.method = method; }
public EraseCustom(CustomErasureMethod method) { this.method = method; }