Exemplo n.º 1
0
        /// <summary>Adds a CSS function to the global set.
        /// This is generally done automatically, but you can also add one manually if you wish.</summary>
        /// <param name="cssFunction">The function to add.</param>
        /// <returns>True if adding it was successful.</returns>
        public static bool Add(CssFunction cssFunction)
        {
            string[] names = cssFunction.GetNames();

            if (names == null || names.Length == 0)
            {
                return(false);
            }

            for (int i = 0; i < names.Length; i++)
            {
                // Grab the name:
                string name = names[i].ToLower();

                // Is it the first? If so, set the name:
                if (i == 0)
                {
                    cssFunction.Name = name;
                }

                // Add it to functions:
                Functions[name] = cssFunction;
            }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>Attempts to find the named function, returning the global function if it's found.</summary>
        /// <param name="name">The function to look for.</param>
        /// <returns>The global CssFunction if the function was found; Null otherwise.</returns>
        public static CssFunction Get(string name)
        {
            CssFunction globalFunction = null;

            Functions.TryGetValue(name, out globalFunction);
            return(globalFunction);
        }
		/// <summary>Adds a CSS function to the global set.
		/// This is generally done automatically, but you can also add one manually if you wish.</summary>
		/// <param name="cssFunction">The function to add.</param>
		/// <returns>True if adding it was successful.</returns>
		public static bool Add(CssFunction cssFunction){
			
			string[] names=cssFunction.GetNames();
			
			if(names==null||names.Length==0){
				return false;
			}
			
			for(int i=0;i<names.Length;i++){
				
				// Grab the name:
				string name=names[i].ToLower();
				
				// Is it the first? If so, set the name:
				if(i==0){
					cssFunction.Name=name;
				}
				
				// Add it to functions:
				Functions[name]=cssFunction;
				
			}
			
			return true;
		}