示例#1
0
        public static ManagedFormAttribute CreateFromList(SerializedList attrLst)
        {
            String Name = attrLst.Items[3].ToString();
            String Syn  = null;

            if (attrLst.Items[4].Items[1].ToString() == "0")
            {
                Syn = Name;
            }
            else
            {
                Syn = attrLst.Items[4].Items[2].Items[1].ToString();
            }

            bool isBasic = attrLst.Items[10].ToString() == "1";

            var pattern = (SerializedList)attrLst.Items[5];

            ManagedFormAttributeType type = new ManagedFormAttributeType();

            type.TypeDescription = V8TypeDescription.ReadFromList(pattern);

            ManagedFormAttribute attr;

            int childCount = Int32.Parse(attrLst.Items[13].ToString());

            if (childCount > 0)
            {
                int baseIndex = 14;

                ManagedFormAttribute[] children = new ManagedFormAttribute[childCount];

                for (int i = 0; i < childCount; i++)
                {
                    SerializedList innerAttr = (SerializedList)attrLst.Items[baseIndex + i];

                    children[i] = CreateChildFromList(innerAttr);
                }

                attr = new ManagedFormAttribute(Name, Syn, type, children);
            }
            else
            {
                attr = new ManagedFormAttribute(Name, Syn, type);
            }

            attr.IsBasic = isBasic;

            return(attr);
        }
示例#2
0
        private void LoadAttributes(SerializedList attrSection)
        {
            int count = Int32.Parse(attrSection.Items[1].ToString());

            if (count > 0)
            {
                m_Attributes = new MDObjectsCollection <ManagedFormAttribute>();
            }
            else
            {
                return;
            }

            for (int i = 0; i < count; i++)
            {
                m_Attributes.Add(ManagedFormAttribute.CreateFromList((SerializedList)attrSection.Items[i + 2]));
            }
        }