Ejemplo n.º 1
0
 public static void UnregisterFunctions(Type type)
 {
     MethodInfo[] staticMethods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
     foreach (MethodInfo method in staticMethods)
     {
         if (method.IsDefined(typeof(XMLSkinFunctionAttribute), false))
         {
             XMLSkinFunctionAttribute attrib =
                 (XMLSkinFunctionAttribute)method.GetCustomAttributes(typeof(XMLSkinFunctionAttribute), false)[0];
             string functionName = attrib.FunctionName ?? (method.DeclaringType.Name + "." + method.Name);
             if (_registeredFunctions.ContainsKey(functionName))
             {
                 _registeredFunctions.Remove(functionName);
             }
         }
     }
 }
Ejemplo n.º 2
0
 public static void RegisterFunctions(Type type)
 {
     MethodInfo[] staticMethods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
     foreach (MethodInfo method in staticMethods)
     {
         if (method.IsDefined(typeof(XMLSkinFunctionAttribute), false))
         {
             XMLSkinFunctionAttribute attrib =
                 (XMLSkinFunctionAttribute)method.GetCustomAttributes(typeof(XMLSkinFunctionAttribute), false)[0];
             FunctionDefinition func;
             string             functionName = attrib.FunctionName ?? (method.DeclaringType.Name + "." + method.Name);
             if (!_registeredFunctions.TryGetValue(functionName, out func))
             {
                 func = new FunctionDefinition(functionName);
                 _registeredFunctions.Add(functionName, func);
             }
             func.AddMethod(method);
         }
     }
 }