예제 #1
0
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName    = methodInfo.Name;
            jsMethod.JavascriptName = LowercaseFirst(methodInfo.Name);
            jsMethod.Function       = methodInfo.Invoke;

            return(jsMethod);
        }
예제 #2
0
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo, bool camelCaseJavascriptNames)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName    = methodInfo.Name;
            jsMethod.JavascriptName = GetJavascriptName(methodInfo.Name, camelCaseJavascriptNames);
            jsMethod.Function       = methodInfo.Invoke;
            jsMethod.ParameterCount = methodInfo.GetParameters().Length;

            return(jsMethod);
        }
예제 #3
0
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo, bool camelCaseJavascriptNames)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName      = methodInfo.Name;
            jsMethod.JavascriptName   = GetJavascriptName(methodInfo.Name, camelCaseJavascriptNames);
            jsMethod.Function         = methodInfo.Invoke;
            jsMethod.ParameterCount   = methodInfo.GetParameters().Length;
            jsMethod.MethodParameters = methodInfo.GetParameters()
                                        .Select(t => new MethodParameter()
            {
                IsParamArray = t.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0
            }).ToList();


            return(jsMethod);
        }
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo, bool camelCaseJavascriptNames)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName    = methodInfo.Name;
            jsMethod.JavascriptName = GetJavascriptName(methodInfo.Name, camelCaseJavascriptNames);
            jsMethod.Function       = methodInfo.Invoke;
            jsMethod.ParameterCount = methodInfo.GetParameters().Length;
            jsMethod.Parameters     = methodInfo.GetParameters()
                                      .Select(t => new MethodParameter()
            {
                IsParamArray = t.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0
            }).ToList();
            //Pre compute HasParamArray for a very minor performance gain
            jsMethod.HasParamArray = jsMethod.Parameters.LastOrDefault(t => t.IsParamArray) != null;

            return(jsMethod);
        }
예제 #5
0
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo, IJavascriptNameConverter nameConverter)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName    = methodInfo.Name;
            jsMethod.JavascriptName = nameConverter == null ? methodInfo.Name : nameConverter.ConvertToJavascript(methodInfo);
            jsMethod.Function       = methodInfo.Invoke;
            jsMethod.ReturnType     = methodInfo.ReturnType;
            jsMethod.ParameterCount = methodInfo.GetParameters().Length;
            jsMethod.Parameters     = methodInfo.GetParameters()
                                      .Select(t => new MethodParameter()
            {
                IsParamArray = t.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0,
                Type         = t.ParameterType
            }).ToList();
            //Pre compute HasParamArray for a very minor performance gain
            jsMethod.HasParamArray = jsMethod.Parameters.LastOrDefault(t => t.IsParamArray) != null;

            return(jsMethod);
        }
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName = methodInfo.Name;
            jsMethod.JavascriptName = LowercaseFirst(methodInfo.Name);
            jsMethod.Function = methodInfo.Invoke;
            jsMethod.ParameterCount = methodInfo.GetParameters().Length;

            return jsMethod;
        }
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo, bool camelCaseJavascriptNames)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName = methodInfo.Name;
            jsMethod.JavascriptName = GetJavascriptName(methodInfo.Name, camelCaseJavascriptNames);
            jsMethod.Function = methodInfo.Invoke;
            jsMethod.ParameterCount = methodInfo.GetParameters().Length;
            jsMethod.Parameters = methodInfo.GetParameters()
                .Select(t => new MethodParameter()
                {
                    IsParamArray = t.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0
                }).ToList();
            //Pre compute HasParamArray for a very minor performance gain
            jsMethod.HasParamArray = jsMethod.Parameters.LastOrDefault(t => t.IsParamArray) != null;

            return jsMethod;
        }
        private static JavascriptMethod CreateJavaScriptMethod(MethodInfo methodInfo, bool camelCaseJavascriptNames)
        {
            var jsMethod = new JavascriptMethod();

            jsMethod.ManagedName = methodInfo.Name;
            jsMethod.JavascriptName = GetJavascriptName(methodInfo.Name, camelCaseJavascriptNames);
            jsMethod.Function = methodInfo.Invoke;
            jsMethod.ParameterCount = methodInfo.GetParameters().Length;

            return jsMethod;
        }