//public static IZDescType CreateZDescType(Type type) //{ // if (ztypeCache.ContainsKey(type)) // { // return ztypeCache[type]; // } // else // { // IZDescType ztype = CreateZTypeImp(type); // if (ztype != null) // { // if (!sharpCache.ContainsKey(ztype.SharpType)) // sharpCache.Add(ztype.SharpType, ztype); // if (!ztypeCache.ContainsKey(type)) // ztypeCache.Add(type, ztype); // } // return ztype; // } //} private static IZDescType CreateZTypeImp(Type type) { if (AttributeUtil.HasAttribute <ZDimAttribute>(type)) { ZDimType zdim = new ZDimType(type); return(zdim); } else if (AttributeUtil.HasAttribute <ZEnumAttribute>(type)) { ZEnumType zenum = new ZEnumType(type); return(zenum); } else if (AttributeUtil.HasAttribute <ZStaticAttribute>(type)) { ZStaticAttribute zAttr = AttributeUtil.GetAttribute <ZStaticAttribute>(type); Type sharpType = (zAttr.SharpType == null ? type : zAttr.SharpType); ZClassType zclass = new ZClassType(type, sharpType, true); return(zclass); } else if (AttributeUtil.HasAttribute <ZInstanceAttribute>(type)) { ZInstanceAttribute zAttr = AttributeUtil.GetAttribute <ZInstanceAttribute>(type); Type sharpType = (zAttr.SharpType == null ? type : zAttr.SharpType); ZClassType zclass = new ZClassType(type, sharpType, false); return(zclass); } return(null); }
private static ZLType CreateZTypeImp(Type type) { if (AttributeUtil.HasAttribute <ZInstanceAttribute>(type)) { ZInstanceAttribute zAttr = AttributeUtil.GetAttribute <ZInstanceAttribute>(type); Type sharpType = (zAttr.SharpType == null ? type : zAttr.SharpType); ZLClassInfo zclass = new ZLClassInfo(type, sharpType, false); return(zclass); } else if (AttributeUtil.HasAttribute <ZEnumAttribute>(type)) { ZLEnumInfo zenum = new ZLEnumInfo(type); return(zenum); } else if (AttributeUtil.HasAttribute <ZStaticAttribute>(type)) { ZStaticAttribute zAttr = AttributeUtil.GetAttribute <ZStaticAttribute>(type); Type sharpType = (zAttr.SharpType == null ? type : zAttr.SharpType); ZLClassInfo zclass = new ZLClassInfo(type, sharpType, true); return(zclass); } return(null); }