예제 #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);
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: szymski/Rayman2Lib
        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);
            }
        }