Exemplo n.º 1
0
        private void goToByteToolStripMenuItem_Click(Object sender, EventArgs e)
        {
            var dialog = new GoToByteForm();

            dialog.ShowDialog(this);

            var positionText = dialog.Output;

            if (string.IsNullOrEmpty(positionText))
            {
                return;
            }

            int newPos;

            if (int.TryParse(positionText, out newPos))
            {
                hexView1.SelectedPosition = newPos;
            }
            else if (int.TryParse(positionText.Replace("0x", ""), NumberStyles.HexNumber, new NumberFormatInfo(), out newPos))
            {
                hexView1.SelectedPosition = newPos;
            }
            else
            {
                MessageBox.Show("Invalid value!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                goToByteToolStripMenuItem_Click(sender, e);
            }
        }
Exemplo n.º 2
0
        private void goToByteToolStripMenuItem_Click(Object sender, EventArgs e)
        {
            var dialog = new GoToByteForm();
            dialog.ShowDialog(this);

            var positionText = dialog.Output;
            if (string.IsNullOrEmpty(positionText))
                return;

            int newPos;

            if (int.TryParse(positionText, out newPos))
                hexView1.SelectedPosition = newPos;
            else if (int.TryParse(positionText.Replace("0x", ""), NumberStyles.HexNumber, new NumberFormatInfo(), out newPos))
                hexView1.SelectedPosition = newPos;
            else
            {
                MessageBox.Show("Invalid value!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                goToByteToolStripMenuItem_Click(sender, e);
            }
        }