private void corruptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!_readOnly)
            {
                long start  = hexBox.SelectionStart;
                long length = hexBox.SelectionLength;

                if (length > 0)
                {
                    using (CorruptSectionForm frm = new CorruptSectionForm())
                    {
                        if (frm.ShowDialog(this) == DialogResult.OK)
                        {
                            ICorruptSection cs = frm.CorruptSectionObject;
                            if (cs != null)
                            {
                                try
                                {
                                    cs.Corrupt(_prov, start, start + length);
                                }
                                catch
                                {
                                }
                            }
                        }
                    }

                    hexBox.Invalidate();
                }
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            bool succes = false;

            if (radioRandom.Checked)
            {
                if (numericMinimum.Value > numericMaximum.Value)
                {
                    MessageBox.Show(this, "Minimum value must be less than or equal to maximum", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    _corrupt_section = new CorruptSectionRandomValue((byte)numericMinimum.Value,
                                                                     (byte)numericMaximum.Value, (CorruptSectionOperation)comboBoxRandomOperation.SelectedItem);
                    succes = true;
                }
            }
            else if (radioFixed.Checked)
            {
                byte[] data = new byte[1];
                data[0]          = (byte)numericFixedValue.Value;
                _corrupt_section = new CorruptSectionFixedValue(data,
                                                                (CorruptSectionOperation)comboBoxFixedOperation.SelectedItem);
                succes = true;
            }
            else if (radioString.Checked)
            {
                byte[] data = Encoding.UTF8.GetBytes(textBoxString.Text);
                _corrupt_section = new CorruptSectionFixedValue(data,
                                                                (CorruptSectionOperation)comboBoxStringOperation.SelectedItem);
                succes = true;
            }

            if (succes)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            bool succes = false;

            if (radioRandom.Checked)
            {
                if (numericMinimum.Value > numericMaximum.Value)
                {
                    MessageBox.Show(this, "Minimum value must be less than or equal to maximum", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    _corrupt_section = new CorruptSectionRandomValue((byte)numericMinimum.Value,
                        (byte)numericMaximum.Value, (CorruptSectionOperation)comboBoxRandomOperation.SelectedItem);
                    succes = true;
                }
            }
            else if (radioFixed.Checked)
            {
                byte[] data = new byte[1];
                data[0] = (byte)numericFixedValue.Value;
                _corrupt_section = new CorruptSectionFixedValue(data,
                    (CorruptSectionOperation)comboBoxFixedOperation.SelectedItem);
                succes = true;
            }
            else if (radioString.Checked)
            {
                byte[] data = Encoding.UTF8.GetBytes(textBoxString.Text);
                _corrupt_section = new CorruptSectionFixedValue(data,
                    (CorruptSectionOperation)comboBoxStringOperation.SelectedItem);
                succes = true;
            }
            
            if(succes)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }