/// <summary> /// 通过附加特性获取所有的附加类型 /// </summary> /// <param name="inputType">输入的类型</param> private void AutoGetAttributeTypes(Type inputType) { try { Attribute oneAttribute = inputType.GetCustomAttribute(typeof(ClassSerializeTypeAttribute)); if (null == oneAttribute) { return; } ClassSerializeTypeAttribute useClassSeriializeAttribute = oneAttribute as ClassSerializeTypeAttribute; if (null == useClassSeriializeAttribute) { return; } Type[] useTypes = useClassSeriializeAttribute.ThisTypes; if (null == useTypes) { return; } string tempString; foreach (var oneType in useTypes) { if (null == oneType) { continue; } //调整目前缓存 AssemblyUtility.GetAllInnerTypes(oneType, ref m_lstType, ref m_dicType); } } catch (Exception) { ; } }
/// <summary> /// 获得自身Type列表 /// </summary> /// <param name="input"></param> internal UseBinder(Type input) { if (null != input) { if (!m_hashSetType.Contains(input)) { //根据特性放入依赖类 AutoGetAttributeTypes(input); //根据特性设置转换器 AutoSetTransformer(input); //hash表存入 m_hashSetType.Add(input); } //加载输入所有涉及的Type AssemblyUtility.GetAllInnerTypes(input, ref m_lstType, ref m_dicType); } }