Exemple #1
0
 public void UnDefine(string token)
 {
     if (NonSubstitutionTokens.Contains(token))
     {
         NonSubstitutionTokens.Remove(token);
     }
     else
     {
         if (SubstitutionTokens.ContainsKey(token))
         {
             SubstitutionTokens.Remove(token);
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Adds a token to the define collection.  If the token exists it gets redefined.
        /// </summary>
        /// <param name="token">the define token</param>
        /// <param name="substitutionText">the substitution text</param>
        public void Define(string token, string substitutionText)
        {
            substitutionText = (substitutionText == null) ? string.Empty : substitutionText;

            /*if the collections already contains the same key we remove it and replace it with
             * the new key value pair...which means that we actually redefining
             */
            UnDefine(token);

            substitutionText = substitutionText.Trim();

            if (substitutionText.Length == 0)
            {
                NonSubstitutionTokens.Add(token);
            }
            else
            {
                SubstitutionTokens.Add(token, substitutionText);
            }
        }
Exemple #3
0
 /// <summary>
 /// Evaluates if a token is defined or not
 /// </summary>
 /// <param name="token">token to be checked whether it is defined or not</param>
 /// <returns>true if defined, false if not</returns>
 public bool IsDefined(string token)
 {
     return(NonSubstitutionTokens.Contains(token) || SubstitutionTokens.ContainsKey(token));
 }
Exemple #4
0
 /// <summary>
 /// Clears any defines being handled
 /// </summary>
 public void Clear()
 {
     NonSubstitutionTokens.Clear();
     SubstitutionTokens.Clear();
 }