Example #1
0
        public static void Add(Delegate function, String name)
        {
            JassTypeAttribute attribute;

            var prototype = "(";

            foreach (var parameter in function.Method.GetParameters())
            {
                attribute  = (JassTypeAttribute)parameter.ParameterType.GetCustomAttributes(typeof(JassTypeAttribute), true).Single();
                prototype += attribute.TypeString;
            }
            prototype += ")";

            if (function.Method.ReturnType == typeof(void))
            {
                prototype += "V";
            }
            else
            {
                attribute  = (JassTypeAttribute)function.Method.ReturnType.GetCustomAttributes(typeof(JassTypeAttribute), true).Single();
                prototype += attribute.TypeString;
            }

            InternalNatives.Add(function, name, prototype);
        }
Example #2
0
 public static void Add(Delegate function)
 {
     InternalNatives.Add(function, function.Method.Name);
 }
Example #3
0
 public static void Add(Delegate function, String name, String prototype)
 {
     InternalNatives.Add(new NativeDeclaration(function, name, prototype));
 }