Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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;
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        /// <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));
            }
        }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
 private void AddMethod(CustomErasureMethod method)
 {
     ListViewItem item = customMethod.Items.Add(method.Name);
        item.SubItems.Add(method.Passes.Length.ToString(CultureInfo.CurrentCulture));
        item.Tag = method;
 }
Esempio n. 8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="method">The erasure method definition for the custom method.</param>
 public EraseCustom(CustomErasureMethod method)
 {
     this.method = method;
 }
Esempio n. 9
0
 public EraseCustom(CustomErasureMethod method)
 {
     this.method = method;
 }