Esempio n. 1
0
        private void ResetBtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(BaseBox.Text))
            {
                if (!BaseBox.Items.Contains(BaseBox.Text))
                {
                    BaseBox.Items.Add(BaseBox.Text);
                }
            }

            if (!string.IsNullOrEmpty(CompareBox.Text))
            {
                if (!BaseBox.Items.Contains(BaseBox.Text))
                {
                    BaseBox.Items.Add(CompareBox.Text);
                }
            }

            BaseBox.SelectedText = "";
            CompareBox.Clear();
            DifferenceBox.Clear();
            HexBox.Clear();
            HexEscapedBox.Clear();
            ByteArrayBox.Clear();
            MaskBox.Clear();

            StatusLbl.Text      = "Awaiting input...";
            StatusLbl.ForeColor = BlueColor;
            FirstScan           = true;
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the control associated with this module property
        /// </summary>
        public Control GetControl()
        {
            Control control;
            long    max = (long)Math.Pow(2, Length);

            switch (ControlType)
            {
            case PropertyType.BOOL: control = new CheckBox()
            {
                    Size = new Size(20, 20),
            }; break;

            case PropertyType.TEXT: control = new TextBox()
            {
                    Size      = new Size(100, 20),
                    MaxLength = Length >> 3,
            }; break;

            case PropertyType.HEXT: control = new HexBox()
            {
                    Size = new Size(200, 50),
                    VScrollBarVisible = true
            }; break;

            case PropertyType.HEXU: control = new NumericUpDown()
            {
                    Size        = new Size(32 + Length, 20),
                    Minimum     = 0,
                    Maximum     = max,
                    Hexadecimal = true,
            }; break;

            case PropertyType.NUMU: control = new NumericUpDown()
            {
                    Size        = new Size(40 + Length, 20),
                    Minimum     = 0,
                    Maximum     = max,
                    Hexadecimal = false,
            }; break;

            case PropertyType.NUMS: control = new NumericUpDown()
            {
                    Size        = new Size(40 + Length, 20),
                    Minimum     = (max / 2) * -1,
                    Maximum     = (max / 2),
                    Hexadecimal = false,
            }; break;

            case PropertyType.LIST:
                if (FileName == null)
                {
                    control = new ByteBox()
                    {
                    }
                }
                ;
                else
                {
                    control = new ByteArrayBox()
                    {
                        AutoSize = true
                    };
                    ((ByteArrayBox)control).Load(FileName);
                } break;

            case PropertyType.POIN:
                if (FileName == null)
                {
                    control = new PointerBox()
                    {
                    }
                }
                ;
                else
                {
                    control = new PointerArrayBox()
                    {
                        AutoSize = true
                    };
                    ((PointerArrayBox)control).Load(FileName);
                } break;

            default: return(null);
            }
            control.Anchor = AnchorStyles.Left;
            return(control);
        }