ConvertToXlMethodInfos() public static method

public static ConvertToXlMethodInfos ( List methods, List targets, List methodAttributes, List argumentAttributes ) : List
methods List
targets List
methodAttributes List
argumentAttributes List
return List
示例#1
0
        public static void RegisterRtdWrapper(string progId, object rtdWrapperOptions, object functionAttribute, List <object> argumentAttributes)
        {
            if (_rtdWrapperHelpers == null)
            {
                _rtdWrapperHelpers = new List <RtdWrapperHelper>();
            }

            var helper = new RtdWrapperHelper(progId, rtdWrapperOptions);

            _rtdWrapperHelpers.Add(helper);

            // var del = Delegate.CreateDelegate(typeof(RtdWrapperHelper.RtdWrapperDelegate, helper, "RtdWrapperHelper");

            // TODO: Need to check that we are not marked as IsTreadSafe (for now)

            var rtdWrapperMethod = RtdWrapperHelper.GetRtdWrapperMethod();
            var xlMethods        = XlMethodInfo.ConvertToXlMethodInfos(
                new List <MethodInfo> {
                rtdWrapperMethod
            },
                new List <object> {
                helper
            },
                null,
                new List <object> {
                functionAttribute
            },
                new List <List <object> > {
                argumentAttributes
            });

            RegisterXlMethods(xlMethods);
        }
示例#2
0
        static void Register(List <MethodInfo> methods, List <object> targets, List <object> methodAttributes, List <List <object> > argumentAttributes)
        {
            Debug.Assert(targets == null || targets.Count == methods.Count);

            List <XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(methods, targets, methodAttributes, argumentAttributes);

            xlMethods.ForEach(RegisterXlMethod);
        }
示例#3
0
        static void Register(List <MethodInfo> methods, List <object> targets, List <object> methodAttributes, List <List <object> > argumentAttributes)
        {
            Debug.Assert(targets == null || targets.Count == methods.Count);

            List <XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(methods, targets, methodAttributes, argumentAttributes);

            xlMethods.ForEach(RegisterXlMethod);
            // Increment the registration version (safe to call a few times)
            registrationInfoVersion += 1.0;
        }
示例#4
0
        static void Register(List <MethodInfo> methods, List <object> targets, List <object> methodAttributes, List <List <object> > argumentAttributes)
        {
            Debug.Assert(targets == null || targets.Count == methods.Count);
            Logger.Registration.Verbose("Registering {0} methods", methods.Count);
            List <XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(methods, targets, methodAttributes, argumentAttributes);

            // Sort by name in reverse order before registering - this is inspired by the article http://www.benf.org/excel/regcost/
            // Makes a small but measurable difference in the Excel registration calls
            xlMethods.Sort(delegate(XlMethodInfo mi1, XlMethodInfo mi2) { return(-string.CompareOrdinal(mi1.Name.ToLower(), mi2.Name.ToLower())); });
            xlMethods.ForEach(RegisterXlMethod);
            // Increment the registration version (safe to call a few times)
            registrationInfoVersion += 1.0;
        }
示例#5
0
        public static void RegisterDelegatesWithAttributes(List <Delegate> delegates, List <object> methodAttributes, List <List <object> > argumentAttributes)
        {
            // I'm missing LINQ ...
            List <MethodInfo> methods = new List <MethodInfo>();
            List <object>     targets = new List <object>();

            for (int i = 0; i < delegates.Count; i++)
            {
                Delegate del = delegates[i];
                // Using del.Method and del.Target from here is a problem
                // - then we have to deal with the open/closed situation very carefully.
                // We'll pass and invoke the actual delegate, which means the method signature is correct.
                // Overhead should be negligible.
                methods.Add(del.GetType().GetMethod("Invoke"));
                targets.Add(del);
            }
            List <XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(methods, targets, null, methodAttributes, argumentAttributes);

            RegisterXlMethods(xlMethods);
        }
示例#6
0
        public static void RegisterLambdaExpressionsWithAttributes(List <LambdaExpression> lambdaExpressions, List <object> methodAttributes, List <List <object> > argumentAttributes)
        {
            List <XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(null, null, lambdaExpressions, methodAttributes, argumentAttributes);

            RegisterXlMethods(xlMethods);
        }
示例#7
0
        public static void RegisterMethodsWithAttributes(List <MethodInfo> methods, List <object> methodAttributes, List <List <object> > argumentAttributes)
        {
            List <XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(methods, null, null, methodAttributes, argumentAttributes);

            RegisterXlMethods(xlMethods);
        }
示例#8
0
        public static void RegisterMethods(List <MethodInfo> methods)
        {
            List <XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(methods);

            xlMethods.ForEach(RegisterXlMethod);
        }