示例#1
0
        private void setupConstructed(Type objectClass)
        {
            int count = 0;

            PropertyInfo[] srcFields = null;
            if (typeMeta != null && typeMeta is ASN1SequenceMetadata && ((ASN1SequenceMetadata)typeMeta).IsSet)
            {
                SortedList <int, PropertyInfo> fieldOrder = CoderUtils.getSetOrder(objectClass);
                srcFields = new PropertyInfo[fieldOrder.Count];
                fieldOrder.Values.CopyTo(srcFields, 0);
                count = srcFields.Length;
            }
            else
            {
                srcFields = objectClass.GetProperties(); //objectClass.getDeclaredFields();
                foreach (PropertyInfo field in srcFields)
                {
                    if (!field.PropertyType.Equals(typeof(IASN1PreparedElementData)))
                    {
                        count++;
                    }
                }
            }

            properties         = new PropertyInfo[count];
            propertiesMetadata = new ASN1PreparedElementData[count];
            int idx = 0;

            foreach (PropertyInfo field in srcFields)
            {
                if (!field.PropertyType.Equals(typeof(IASN1PreparedElementData)))
                {
                    properties[idx]         = field;
                    propertiesMetadata[idx] = new ASN1PreparedElementData(objectClass, field);

                    if (properties[idx].Name.Equals("Value"))
                    {
                        setValueField(field, propertiesMetadata[idx]);
                    }
                    idx++;
                }
            }
        }