private void btnFind_Click(object sender, EventArgs e)
 {
     if (tbSearchText.Text != string.Empty)
     {
         SearchText   = tbSearchText.Text;
         MatchCase    = cbMatchCase.Checked;
         FindPrevious = cbFindPrev.Checked;
         FindNext?.Invoke(this, e);
     }
     else
     {
         System.Media.SystemSounds.Beep.Play();
     }
 }
示例#2
0
        private static IEnumerable <T> EnumFilter <T, U>(FindFirst find_first, FindNext find_next,
                                                         FindClose find_close, GetNextOffset <U> get_next, CreateObject <T, U> create) where U : struct
        {
            using (var buffer = new SafeStructureInOutBuffer <U>(128 * 1024, true))
            {
                NtStatus          no_more_hresult = Win32Error.ERROR_NO_MORE_ITEMS.ToHresult();
                NtResult <IntPtr> handle          = new NtResult <IntPtr>(no_more_hresult, IntPtr.Zero);
                var list = new List <T>();
                try
                {
                    handle = find_first(buffer);
                    var status = handle.Status;
                    while (status != no_more_hresult)
                    {
                        if (status != NtStatus.STATUS_SUCCESS)
                        {
                            throw new NtException(status);
                        }

                        var next_buffer = buffer;
                        do
                        {
                            list.Add(create(next_buffer));
                            int offset = get_next(next_buffer);
                            if (offset == 0)
                            {
                                break;
                            }
                            next_buffer = next_buffer.GetStructAtOffset <U>(offset);
                        }while (true);

                        status = find_next(handle.Result, buffer);
                    }
                }
                finally
                {
                    if (handle.IsSuccess)
                    {
                        find_close(handle.Result);
                    }
                }
                return(list.AsReadOnly());
            }
        }
示例#3
0
        public void Replace()
        {
            IEditor ce = GetCurrentEditor();

            if (ce == null)
            {
                return;
            }

            // if currently selected text matches -> replace; anyways, find the next match
            Regex  r = GetRegEx();
            string s = ce.Text.Substring(ce.SelectionStart, ce.SelectionLength);             // CE.SelectedText;
            Match  m = r.Match(s);

            if (m.Success && m.Index == 0 && m.Length == s.Length)
            {
                ce.Replace(ce.SelectionStart, ce.SelectionLength, ReplacementText);
                //CE.SelectedText = ReplacementText;
            }

            FindNext?.Invoke(this, false);
        }
示例#4
0
        public MainViewModel(Repository repository, IParser parser, KeywordExtractor keywordExtractor, State state)
        {
            _repository       = repository;
            _parser           = parser;
            _keywordExtractor = keywordExtractor;
            _state            = state;

            SaveCommand        = new RelayCommand(_ => Save());
            SyncCommand        = new RelayCommand(_ => Sync());
            NextDayCommand     = new RelayCommand(_ => NextDay());
            PreviousDayCommand = new RelayCommand(_ => PreviousDay());
            InsertCommand      = new RelayCommand(_ => Insert());

            _timer = new Timer(1000)
            {
                Enabled = false
            };
            _timer.Elapsed += Timer_Elapsed;

            _text = _repository.Load();
            _todo = _repository.LoadToDo();

            Find                        = new Find(state);
            FindNext                    = new FindNext(state);
            FindPrevious                = new FindPrevious(state);
            Goto                        = new Goto(state);
            ShowContextMenu             = new ShowContextMenu(state);
            FormatSelectionBase64Decode = new FormatSelectionBase64Decode(state);
            FormatSelectionBase64Encode = new FormatSelectionBase64Encode(state);
            FormatSelectionDecodeUrl    = new FormatSelectionDecodeUrl(state);
            FormatSelectionEncodeUrl    = new FormatSelectionEncodeUrl(state);
            FormatSelectionToLower      = new FormatSelectionToLower(state);
            FormatSelectionToUpper      = new FormatSelectionToUpper(state);
            SpellCheck                  = new SpellCheck(state);

            EnsureDateLine();
        }
示例#5
0
        private void uiNextButton_Click(object sender, EventArgs e)
        {
            string search = uiFindTextTextBox.Text;

            FindNext?.Invoke(this, new TextEventArgs(search));
        }
 private void btnFindNext_Click(object sender, RoutedEventArgs e)
 {
     PopulateComboBox("Find");
     FindNext?.Invoke(this, e);
 }
示例#7
0
 public void FindPrevious()
 {
     FindNext?.Invoke(this, true);
 }
示例#8
0
 protected virtual void OnFindNext(FindEventArgs e)
 {
     FindNext?.Invoke(this, e);
 }