Beispiel #1
0
        /// <summary>
        ///     The process.
        /// </summary>
        /// <param name="text">
        ///     The text.
        /// </param>
        public void Process(ref string text)
        {
            if (text.IsNotSet())
            {
                return;
            }

            // sort the rules according to rank...
            if (this._needSort)
            {
                lock (this._rulesLock)
                {
                    this._rulesList.Sort();
                    this._needSort = false;
                }
            }

            // make the replacementCollection for this instance...
            var mainCollection = new ReplaceBlocksCollection();

            // get as local list...
            var localRulesList = new List <IReplaceRule>();

            lock (this._rulesLock)
            {
                localRulesList.AddRange(this._rulesList);
            }

            // apply all rules...
            foreach (IReplaceRule rule in localRulesList)
            {
                rule.Replace(ref text, mainCollection);
            }

            // reconstruct the html
            mainCollection.Reconstruct(ref text);
        }
    /// <summary>
    /// The process.
    /// </summary>
    /// <param name="text">
    /// The text.
    /// </param>
    public void Process(ref string text)
    {
      if (text.IsNotSet())
      {
        return;
      }

      // sort the rules according to rank...
      if (this._needSort)
      {
        lock (this._rulesLock)
        {
          this._rulesList.Sort();
          this._needSort = false;
        }
      }

      // make the replacementCollection for this instance...
      var mainCollection = new ReplaceBlocksCollection();

      // get as local list...
      var localRulesList = new List<IReplaceRule>();

      lock (this._rulesLock)
      {
        localRulesList.AddRange(this._rulesList);
      }

      // apply all rules...
      foreach (IReplaceRule rule in localRulesList)
      {
        rule.Replace(ref text, mainCollection);
      }

      // reconstruct the html
      mainCollection.Reconstruct(ref text);
    }