示例#1
0
        private void ThreadFunc()
        {
            try
            {
                Stopwatch sw = Stopwatch.StartNew();

                // search based on \n for newline
                Matches = _Regex.Matches(Regex.Replace(Input, "\r\n", "\n"));

                System.Collections.Generic.List <Match> UnneededList = new System.Collections.Generic.List <Match>();
                // force matches to actually run
                foreach (Match m in Matches)
                {
                    UnneededList.Add(m);
                }

                if (Replace != null)
                {
                    Result = _Regex.Replace(Input, Replace);
                }

                ExecutionTime = sw.ElapsedMilliseconds;
            }
            catch (Exception ex)
            {
                Error = ex;
            }
            finally
            {
                if (Error == null || !(Error is ThreadAbortException))
                {
                    Parent.Invoke(new RegexRunnerFinishedDelegate(Parent.RegexRunnerFinished), this);
                }
            }
        }
示例#2
0
        private void ThreadFunc()
        {
            try
            {
                Matches = _Regex.Matches(Input);

                foreach (Match m in Matches)
                {
                }  // force matches to actually run

                if (!string.IsNullOrEmpty(Replace))
                {
                    Result = _Regex.Replace(Input, Replace);
                }
            }
            catch (Exception ex)
            {
                Error = ex;
            }
            finally
            {
                if (Error == null || !(Error is ThreadAbortException))
                {
                    Parent.Invoke(new RegexRunnerFinishedDelegate(Parent.RegexRunnerFinished), this);
                }
            }
        }
示例#3
0
        private void ThreadFunc()
        {
            try
            {
                Stopwatch sw = Stopwatch.StartNew();

                Matches = _Regex.Matches(Input);

                foreach (Match m in Matches)
                {
                }  // force matches to actually run

                if (!string.IsNullOrEmpty(Replace))
                {
                    Result = _Regex.Replace(Input, Replace);
                }

                ExecutionTime = sw.ElapsedMilliseconds;
            }
            catch (Exception ex)
            {
                Error = ex;
            }
            finally
            {
                if (Error == null || !(Error is ThreadAbortException))
                {
                    Parent.Invoke(new RegexRunnerFinishedDelegate(Parent.RegexRunnerFinished), this);
                }
            }
        }