コード例 #1
0
ファイル: RegexProcessor.cs プロジェクト: schifflee/Replacer
        public RelatedMatch RelatedMatch(string text, int startIndex, TextLengthChanger owner = null)
        {
            var sw    = Stopwatch.StartNew();
            var match = _regex.Match(text, startIndex);

            Interlocked.Add(ref PerfomanceCounter, sw.ElapsedTicks);
            return(new RelatedMatch(match, owner));
        }
コード例 #2
0
 public RelatedMatch(Match match, TextLengthChanger owner = null)
 {
     StartIndex = match.Index;
     Length     = match.Length;
     Success    = match.Success;
     Groups     = match.Groups;
     if (owner != null)
     {
         SetOwner(owner);
     }
 }
コード例 #3
0
ファイル: RegexProcessor.cs プロジェクト: schifflee/Replacer
        public List <RelatedMatch> RelatedMatches(string text, TextLengthChanger owner = null)
        {
            var result = new List <RelatedMatch>();
            var m      = RelatedMatch(text, 0, owner);

            while (m.Success)
            {
                result.Add(m);
                m = RelatedMatch(text, m.StartIndex + m.Length, owner);
            }
            if (result.Count == 0)
            {
                result.Add(m);
            }
            return(result);
        }
コード例 #4
0
ファイル: RelatedLocation.cs プロジェクト: Dem0n13/Replacer
 public void SetOwner(TextLengthChanger owner)
 {
     _totalLegthCorrection = owner.TotalLegthCorrection;
 }
コード例 #5
0
 public void SetOwner(TextLengthChanger owner)
 {
     _totalLegthCorrection = owner.TotalLegthCorrection;
 }