コード例 #1
0
        /// <summary>
        /// Find next match
        /// </summary>
        private void FindNext()
        {
            if (_findBuffer.Length == 0)
            {
                Find();
                return;
            }

            // show cancel dialog
            _formFindCancel = new HexFindCancelForm();
            _formFindCancel.SetHexBox(hexBox);
            _formFindCancel.Closed += FormFindCancel_Closed;
            _formFindCancel.Show();

            // block activation of main form
            //Activated += new EventHandler(FocusToFormFindCancel);

            // start find process
            long res = hexBox.Find(_findBuffer, hexBox.SelectionStart + hexBox.SelectionLength);

            _formFindCancel.Dispose();

            // unblock activation of main form
            //Activated -= new EventHandler(FocusToFormFindCancel);

            if (res == -1)             // -1 = no match
            {
                MessageBox.Show(@"End of data reached", string.Empty,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (res == -2)             // -2 = find was aborted
            {
                return;
            }
            else             // something was found
            {
                if (!hexBox.Focused)
                {
                    hexBox.Focus();
                }
            }

            ManageAbility();
        }
コード例 #2
0
ファイル: HexEditorControl.cs プロジェクト: camilohe/Reflexil
		/// <summary>
		/// Find next match
		/// </summary>
		private void FindNext()
		{
			if (_findBuffer.Length == 0)
			{
				Find();
				return;
			}

			// show cancel dialog
			_formFindCancel = new HexFindCancelForm();
			_formFindCancel.SetHexBox(hexBox);
			_formFindCancel.Closed += FormFindCancel_Closed;
			_formFindCancel.Show();

			// block activation of main form
			//Activated += new EventHandler(FocusToFormFindCancel);

			// start find process
			long res = hexBox.Find(_findBuffer, hexBox.SelectionStart + hexBox.SelectionLength);

			_formFindCancel.Dispose();

			// unblock activation of main form
			//Activated -= new EventHandler(FocusToFormFindCancel);

			if (res == -1) // -1 = no match
			{
				MessageBox.Show(@"End of data reached", string.Empty,
					MessageBoxButtons.OK, MessageBoxIcon.Information);
			}
			else if (res == -2) // -2 = find was aborted
			{
				return;
			}
			else // something was found
			{
				if (!hexBox.Focused)
					hexBox.Focus();
			}

			ManageAbility();
		}