public SGIP_Field(SGIP_CommandHead CommandHead, PropertyInfo ProInfo, SGIP_PropertyAttribute ProAttribute) { m_CommandHead = CommandHead; m_ProInfo = ProInfo; m_ProAttribute = ProAttribute; Build(); }
private List <SGIP_Field> GetFields(bool bHeader) { PropertyInfo[] Fields = new PropertyInfo[255]; SGIP_PropertyAttribute[] FieldAttributes = new SGIP_PropertyAttribute[255]; int nCount = 0; foreach (PropertyInfo Field in this.GetType().GetProperties()) { bool bFound = false; SGIP_PropertyAttribute FieldAttr = null; foreach (Attribute attr in Field.GetCustomAttributes(false)) { if (attr.GetType() == typeof(SGIP_PropertyAttribute)) { FieldAttr = attr as SGIP_PropertyAttribute; bFound = true; break; } } if (bFound && FieldAttr.IsHeader == bHeader) { Fields[FieldAttr.Order] = Field; FieldAttributes[FieldAttr.Order] = FieldAttr; nCount++; } } List <SGIP_Field> FieldList = new List <SGIP_Field>(); for (int nIndex = 0; nIndex < nCount; nIndex++) { if (Fields[nIndex] == null || FieldAttributes[nIndex] == null) { FieldList.Clear(); return(null); } FieldList.Add(new SGIP_Field(this, Fields[nIndex], FieldAttributes[nIndex])); } return(FieldList); }
private List<SGIP_Field> GetFields(bool bHeader) { PropertyInfo[] Fields = new PropertyInfo[255]; SGIP_PropertyAttribute[] FieldAttributes = new SGIP_PropertyAttribute[255]; int nCount = 0; foreach (PropertyInfo Field in this.GetType().GetProperties()) { bool bFound = false; SGIP_PropertyAttribute FieldAttr = null; foreach (Attribute attr in Field.GetCustomAttributes(false)) { if (attr.GetType() == typeof(SGIP_PropertyAttribute)) { FieldAttr = attr as SGIP_PropertyAttribute; bFound = true; break; } } if (bFound && FieldAttr.IsHeader == bHeader) { Fields[FieldAttr.Order] = Field; FieldAttributes[FieldAttr.Order] = FieldAttr; nCount++; } } List<SGIP_Field> FieldList = new List<SGIP_Field>(); for (int nIndex = 0; nIndex < nCount; nIndex++) { if (Fields[nIndex] == null || FieldAttributes[nIndex] == null) { FieldList.Clear(); return null; } FieldList.Add(new SGIP_Field(this, Fields[nIndex], FieldAttributes[nIndex])); } return FieldList; }
public SGIP_Field(SGIP_CommandHead CommandHead, PropertyInfo ProInfo, SGIP_PropertyAttribute ProAttribute) { m_CommandHead = CommandHead; m_ProInfo = ProInfo; m_ProAttribute = ProAttribute; Build(); }