コード例 #1
0
ファイル: StringTokenizer.cs プロジェクト: radtek/BootFX
            internal string EvaluatePlaceholder(Match match)
            {
                if (match == null)
                {
                    throw new ArgumentNullException("match");
                }

                // replace...
                string propertyName = match.Groups["name"].Value;

                // get...
                if (!(string.IsNullOrEmpty(propertyName)))
                {
                    // mbr - 2010-08-25 - added an event...
                    string value = (string)this.Evaluator.Evaluate(propertyName, this.Flags | EvaluateFlags.ConvertResultToString);

                    // if...
                    if (this.Tokenizer.SanitizeValue != null)
                    {
                        SanitizeValueEventArgs e = new SanitizeValueEventArgs(value);
                        this.Tokenizer.OnSanitizeValue(e);

                        // reset...
                        value = e.Value;
                    }

                    // return....
                    return(value);
                }
                else
                {
                    return(string.Format("(Null property: {0}, {1})", match.Index, match.Length));
                }
            }
コード例 #2
0
ファイル: StringTokenizer.cs プロジェクト: radtek/BootFX
 /// <summary>
 /// Raises the <c>SanitizeValue</c> event.
 /// </summary>
 protected virtual void OnSanitizeValue(SanitizeValueEventArgs e)
 {
     // raise...
     if (SanitizeValue != null)
     {
         SanitizeValue(this, e);
     }
 }