ARCed.Scintilla.FindReplaceDialog.FindNextR C# (CSharp) Method

FindNextR() private method

private FindNextR ( bool searchUp, Regex &rr ) : Range
searchUp bool
rr Regex
return Range
        private Range FindNextR(bool searchUp, ref Regex rr)
        {
            Range foundRange;

            if (this.rdoRegexR.Checked)
            {
                if (rr == null)
                    rr = new Regex(this.cboFindR.Text, this.GetRegexOptions());

                if (this.chkSearchSelectionR.Checked)
                {
                    if (this._searchRange == null)
                        this._searchRange = this.Scintilla.Selection.Range;

                    if (searchUp)
                        foundRange = this.Scintilla.FindReplace.FindPrevious(rr, this.chkWrapR.Checked, this._searchRange);
                    else
                        foundRange = this.Scintilla.FindReplace.FindNext(rr, this.chkWrapR.Checked, this._searchRange);
                }
                else
                {
                    this._searchRange = null;
                    if (searchUp)
                        foundRange = this.Scintilla.FindReplace.FindPrevious(rr, this.chkWrapR.Checked);
                    else
                        foundRange = this.Scintilla.FindReplace.FindNext(rr, this.chkWrapR.Checked);
                }
            }
            else
            {
                if (this.chkSearchSelectionF.Checked)
                {
                    if (this._searchRange == null)
                        this._searchRange = this.Scintilla.Selection.Range;

                    if (searchUp)
                        foundRange = this.Scintilla.FindReplace.FindPrevious(this.cboFindR.Text, this.chkWrapR.Checked, this.GetSearchFlags(), this._searchRange);
                    else
                        foundRange = this.Scintilla.FindReplace.FindNext(this.cboFindR.Text, this.chkWrapR.Checked, this.GetSearchFlags(), this._searchRange);
                }
                else
                {
                    this._searchRange = null;
                    if (searchUp)
                        foundRange = this.Scintilla.FindReplace.FindPrevious(this.cboFindR.Text, this.chkWrapF.Checked, this.GetSearchFlags());
                    else
                        foundRange = this.Scintilla.FindReplace.FindNext(this.cboFindR.Text, this.chkWrapF.Checked, this.GetSearchFlags());
                }
            }
            return foundRange;
        }