protected bool result(bool success) { State.PatternDepth--; if (success) { if (startIndex > -1 && stopIndex > -1 && Replacement != null) { if (multiScan) { Replacement = Replacement.Clone(); } State.SaveWorkingInput(); var slicer = new Slicer(State.WorkingInput); var length = stopIndex - startIndex; var text = slicer[startIndex, length]; State.WorkingInput = text; Regions.SetPatternPositionData(startIndex, length); if (Replacement.Immediate) { var replacementText = Replacement.Text; if (replacementText != null) { slicer[startIndex, length] = replacementText; State.RestoreWorkingInput(); State.WorkingInput = slicer.ToString(); } else { State.RestoreWorkingInput(); } } else { State.Replacements.Add(startIndex, length, Replacement); State.RestoreWorkingInput(); } } if (!SubPattern) { State.Replacements.Replace(); } } return(success); }
public IBrush Clone() { return(new ReplaceBrushBrush(Block, Replacement.Clone())); }