Beispiel #1
0
        public TKTProcDesc SearchProc(TKTProcDesc procDesc)
        {
            var methodArray = MType.GetMethods( );

            foreach (var method in methodArray)
            {
                CodeAttribute procAttr = Attribute.GetCustomAttribute(method, typeof(CodeAttribute)) as CodeAttribute;
                if (procAttr == null)
                {
                    ExMethodInfo exMethod     = GclUtil.CreatExMethodInfo(method, this.ForType);
                    TKTProcDesc  typeProcDesc = ProcDescHelper.CreateProcDesc(exMethod);
                    if (typeProcDesc.Eq(procDesc))
                    {
                        return(typeProcDesc);
                    }
                }
                else
                {
                    ProcDescCodeParser parser = new ProcDescCodeParser();
                    parser.InitType(ForType, method);
                    TKTProcDesc typeProcDesc = parser.Parser(WordDict, procAttr.Code);
                    if (typeProcDesc.Eq(procDesc))
                    {
                        ExMethodInfo exMethod = GclUtil.CreatExMethodInfo(method, this.ForType);
                        typeProcDesc.ExMethod = exMethod;
                        return(typeProcDesc);
                    }
                }
            }
            if (ParentMapping != null)
            {
                return(ParentMapping.SearchProc(procDesc));
            }
            return(null);
        }
Beispiel #2
0
        public override TKTProcDesc[] GetProces()
        {
            List <TKTProcDesc> list = new List <TKTProcDesc>();
            var methodArray         = this.SharpType.GetMethods();

            foreach (var method in methodArray)
            {
                if (!ReflectionUtil.IsDeclare(SharpType, method))
                {
                    continue;
                }
                /* 编译器生成的类肯定有标注 */
                ZCodeAttribute     procAttr = AttributeUtil.GetAttribute <ZCodeAttribute>(method);
                ProcDescCodeParser parser   = new ProcDescCodeParser();
                parser.InitType(SharpType, method);
                TKTProcDesc  typeProcDesc = parser.Parser(procAttr.Code);
                ExMethodInfo exMethod     = ZTypeUtil.CreatExMethodInfo(method, this.SharpType);
                typeProcDesc.ExMethod = exMethod;
                list.Add(typeProcDesc);
            }
            if (ParentMapping != null)
            {
                TKTProcDesc[] epi = ParentMapping.GetProces();
                foreach (var pitem in epi)
                {
                    pitem.ExMethod.IsSelf = false;
                }
                list.AddRange(epi);
            }
            return(list.ToArray());
        }
Beispiel #3
0
        public override TKTProcDesc SearchProc(TKTProcDesc procDesc)
        {
            var methodArray = this.SharpType.GetMethods( );

            foreach (var method in methodArray)
            {
                if (!ReflectionUtil.IsDeclare(SharpType, method))
                {
                    continue;
                }
                /* 编译器生成的类肯定有标注 */
                ZCodeAttribute procAttr = AttributeUtil.GetAttribute <ZCodeAttribute>(method);// Attribute.GetCustomAttribute(method, typeof(ZCodeAttribute)) as ZCodeAttribute;
                //if (procAttr == null)
                //{
                //    ExMethodInfo exMethod = ZTypeHelper.CreatExMethodInfo(method, this.SharpType);
                //    TKTProcDesc typeProcDesc = ProcDescHelper.CreateProcDesc(exMethod);
                //    if (typeProcDesc.Eq(procDesc))
                //    {
                //        return typeProcDesc;
                //    }
                //}
                //else
                //{
                ProcDescCodeParser parser = new ProcDescCodeParser();
                parser.InitType(SharpType, method);
                TKTProcDesc typeProcDesc = parser.Parser(procAttr.Code);
                if (typeProcDesc.Eq(procDesc))
                {
                    ExMethodInfo exMethod = ZTypeUtil.CreatExMethodInfo(method, this.SharpType);
                    typeProcDesc.ExMethod = exMethod;
                    return(typeProcDesc);
                }
                //}
            }
            if (ParentMapping != null)
            {
                return(ParentMapping.SearchProc(procDesc));
            }
            return(null);
        }
Beispiel #4
0
        public TKTProcDesc SearchProc(TKTProcDesc procDesc)
        {
            var methodArray = MType.GetMethods(/*BindingFlags.DeclaredOnly*/);

            foreach (var method in methodArray)
            {
                if (ReflectionUtil.IsDeclare(MType, method))
                {
                    MappingCodeAttribute procAttr = Attribute.GetCustomAttribute(method, typeof(MappingCodeAttribute)) as MappingCodeAttribute;
                    if (procAttr == null)
                    {
                        TKTProcDesc typeProcDesc = ProcDescHelper.CreateProcDesc(method);
                        if (typeProcDesc.Eq(procDesc))
                        {
                            return(typeProcDesc);
                        }
                    }
                    else
                    {
                        ProcDescCodeParser parser     = new ProcDescCodeParser();
                        ParameterInfo[]    paramArray = method.GetParameters();
                        foreach (var param in paramArray)
                        {
                            parser.AddType(param.ParameterType);
                        }
                        TKTProcDesc typeProcDesc = parser.Parser(WordDict, procAttr.Code);
                        if (typeProcDesc.Eq(procDesc))
                        {
                            typeProcDesc.Method = method;
                            return(typeProcDesc);
                        }
                    }
                }
            }
            return(null);
        }