示例#1
0
        public TktGcl(Type mtype, CnEnDict wordDict)
        {
            MType     = mtype;
            WordDict  = wordDict;
            classAttr = getTKTAttr(MType);

            if (classAttr.ParentMappingType != null)
            {
                ParentMapping = GclUtil.Load(classAttr.ParentMappingType, wordDict);
            }
            else
            {
                if (MType.BaseType != null)
                {
                    ZClassAttribute attr = getTKTAttr(MType.BaseType);
                    if (attr != null)
                    {
                        ParentMapping = GclUtil.Load(MType.BaseType, wordDict);
                    }
                }
            }
            if (ParentMapping == null)
            {
                ParentMapping = GclUtil.Load(typeof(事物), wordDict);
            }
        }
示例#2
0
        public static ZType CreateZType(Type type)
        {
            ZClassAttribute zAttr = AttributeUtil.GetAttribute <ZClassAttribute>(type);

            if (zAttr != null)
            {
                if (type.IsEnum)
                {
                    return(new ZEnumGenType(type));
                }
                else
                {
                    return(new ZClassGenType(type));
                }
            }
            else
            {
                ZMappingAttribute mAttr = AttributeUtil.GetAttribute <ZMappingAttribute>(type);
                if (mAttr == null)
                {
                    return(null);
                }
                if (type.IsEnum)
                {
                    return(new ZEnumMappingType(type));
                }
                else
                {
                    return(new ZEnumGenType(type));
                }
            }
            //return null;
        }
示例#3
0
        public static IGcl Load(Type type, CnEnDict wordDict)
        {
            ZMappingAttribute mattr = Attribute.GetCustomAttribute(type, typeof(ZMappingAttribute)) as ZMappingAttribute;

            if (mattr != null)
            {
                return(new MappingGcl(type, wordDict));
            }

            ZClassAttribute tcAttr = Attribute.GetCustomAttribute(type, typeof(ZClassAttribute)) as ZClassAttribute;

            if (tcAttr != null)
            {
                return(new TktGcl(type, wordDict));
            }

            ExternalGcl egcl = new ExternalGcl(type, wordDict);

            return(egcl);
        }