예제 #1
0
        public IMethod GetMethodT(string funcname, MethodParamList ttypes, MethodParamList types)
        {
            //这个实现还不完全
            //有个别重构下,判定比这个要复杂
            System.Reflection.MethodInfo _method = null;
            var ms = TypeForSystem.GetMethods();

            foreach (var m in ms)
            {
                if (m.Name == funcname && m.IsGenericMethodDefinition)
                {
                    var ts = m.GetGenericArguments();
                    var ps = m.GetParameters();
                    if (ts.Length == ttypes.Count && ps.Length == types.Count)
                    {
                        _method = m;
                        break;
                    }
                }
            }

            // _method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());

            return(new Method_Common_System(this, _method.MakeGenericMethod(ttypes.ToArraySystem())));
        }
예제 #2
0
        public IMethod[] GetMethods(string funcname)
        {
            List <IMethod> methods = new List <IMethod>();

            if (funcname == ".ctor")
            {
                var cons = TypeForSystem.GetConstructors();
                foreach (var c in cons)
                {
                    methods.Add(new Method_Common_System(this, c));
                }
            }
            else
            {
                var __methods = TypeForSystem.GetMethods();
                foreach (var m in __methods)
                {
                    if (m.Name == funcname)
                    {
                        methods.Add(new Method_Common_System(this, m));
                    }
                }
            }

            return(methods.ToArray());
        }
예제 #3
0
        public bool IsInst(object obj)
        {
            if (obj is VBox)
            {
                return(TypeForSystem.IsInstanceOfType((obj as VBox).BoxDefine()));
            }

            return(TypeForSystem.IsInstanceOfType(obj));
        }
예제 #4
0
        public IMethod GetMethod(string funcname, MethodParamList types)
        {
            if (funcname == ".ctor")
            {
                var con = TypeForSystem.GetConstructor(types.ToArraySystem());
                return(new Method_Common_System(this, con));
            }
            var method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());

            return(new Method_Common_System(this, method));
        }
예제 #5
0
        public string[] GetFieldNames()
        {
            var fs = TypeForSystem.GetFields();

            string[] names = new string[fs.Length];
            for (int i = 0; i < fs.Length; i++)
            {
                names[i] = fs[i].Name;
            }
            return(names);
        }
예제 #6
0
        public IMethod[] GetAllMethods()
        {
            List <IMethod> methods = new List <IMethod>();

            {
                var __methods = TypeForSystem.GetMethods();
                foreach (var m in __methods)
                {
                    //if (m.Name == funcname)
                    {
                        methods.Add(new Method_Common_System(this, m));
                    }
                }
            }

            return(methods.ToArray());
        }
예제 #7
0
        public virtual IMethod[] GetMethods(string funcname)
        {
            List <IMethod> methods = new List <IMethod>();

            if (funcname == ".ctor")
            {
                var cons = TypeForSystem.GetConstructors();
                {
                    var __array1       = cons;
                    var __arrayLength1 = __array1.Length;
                    for (int __i1 = 0; __i1 < __arrayLength1; ++__i1)
                    {
                        var c = __array1[__i1];
                        {
                            methods.Add(new Method_Common_System(this, c));
                        }
                    }
                }
            }
            else
            {
                var __methods = TypeForSystem.GetMethods();
                {
                    var __array2       = __methods;
                    var __arrayLength2 = __array2.Length;
                    for (int __i2 = 0; __i2 < __arrayLength2; ++__i2)
                    {
                        var m = __array2[__i2];
                        {
                            if (m.Name == funcname)
                            {
                                methods.Add(new Method_Common_System(this, m));
                            }
                        }
                    }
                }
            }

            return(methods.ToArray());
        }
예제 #8
0
        public virtual IMethod GetMethod(string funcname, MethodParamList types)
        {
            if (funcname == ".ctor")
            {
                var con = TypeForSystem.GetConstructor(types.ToArraySystem());
                return(new Method_Common_System(this, con));
            }
            else if (funcname == "Get" && TypeForSystem == typeof(int[, ]) && types.Count == 2 && types[0].TypeForSystem == typeof(int) && types[1].TypeForSystem == typeof(int))
            {
                return(new Method_Common_System(this, typeof(CustomMethod).GetMethod("GetTwoDimesionArray")));
            }
            var method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());
            var ret    = new Method_Common_System(this, method);

            Func <object, object[], object> fastCall;

            if (FastCalls.TryGetValue(method, out fastCall))
            {
                ret.SetFastCall(fastCall);
            }

            return(ret);
        }
예제 #9
0
        public virtual IMethod GetMethodT(string funcname, MethodParamList ttypes, MethodParamList types)
        {
            if (funcname == "CompareExchange")
            {
                return(new Method_Common_System(this, typeof(CustomMethod).GetMethod("CompareExchange")));
            }

            //这个实现还不完全
            //有个别重构下,判定比这个要复杂
            System.Reflection.MethodInfo _method = null;
            var ms = TypeForSystem.GetMethods();

            {
                var __array4       = ms;
                var __arrayLength4 = __array4.Length;
                for (int __i4 = 0; __i4 < __arrayLength4; ++__i4)
                {
                    var m = __array4[__i4];
                    {
                        if (m.Name == funcname && m.IsGenericMethodDefinition)
                        {
                            var ts = m.GetGenericArguments();
                            var ps = m.GetParameters();
                            if (ts.Length == ttypes.Count && ps.Length == types.Count)
                            {
                                _method = m;
                                break;
                            }
                        }
                    }
                }
            }
            // _method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());

            return(new Method_Common_System(this, _method.MakeGenericMethod(ttypes.ToArraySystem())));
        }
예제 #10
0
        public virtual IMethod[] GetAllMethods()
        {
            List <IMethod> methods = new List <IMethod>();

            {
                var __methods = TypeForSystem.GetMethods();
                {
                    var __array3       = __methods;
                    var __arrayLength3 = __array3.Length;
                    for (int __i3 = 0; __i3 < __arrayLength3; ++__i3)
                    {
                        var m = __array3[__i3];
                        {
                            //if (m.Name == funcname)
                            {
                                methods.Add(new Method_Common_System(this, m));
                            }
                        }
                    }
                }
            }

            return(methods.ToArray());
        }
예제 #11
0
 public bool IsInst(object obj)
 {
     return(TypeForSystem.IsInstanceOfType(obj));
 }
예제 #12
0
 public IField GetField(string name)
 {
     return(new Field_Common_System(env, TypeForSystem.GetField(name)));
 }