示例#1
0
        private ManagedFormAttribute(String name, String synonym, ManagedFormAttributeType type, ManagedFormAttribute[] children)
        {
            m_Type = type;
            Name   = name;
            Title  = synonym;

            if (children != null)
            {
                m_ChildItems = new MDObjectsCollection <ManagedFormAttribute>();

                foreach (var child in children)
                {
                    m_ChildItems.Add(child);
                }
            }
        }
示例#2
0
        public MDTable(SerializedList tableDescription)
        {
            m_RawContent = tableDescription;
            var StringsBlock = ((SerializedList)tableDescription).DrillDown(4);

            ReadStringsBlock(StringsBlock);

            m_Attributes = new MDObjectsCollection <MDAttribute>();

            if (tableDescription.Items.Count > 2)
            {
                var AttributeList = (SerializedList)tableDescription.Items[2];

                FillAttributeCollection(AttributeList);
            }
        }
示例#3
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]));
            }
        }
示例#4
0
        private void LoadElements(SerializedList elementsList, MDObjectsCollection <ManagedFormElement> itemsPrototype, int idIndex, string uuid = null)
        {
            int itemCount = Int32.Parse(elementsList.Items[idIndex - 1].ToString());

            int iterationCount = itemCount * 2;

            for (int i = 0; i < iterationCount; ++i)
            {
                int index = idIndex + i;
                if (index >= elementsList.Items.Count)
                {
                    break;
                }

                SerializedItem item = elementsList.Items[index];

                if (item.GetType() == typeof(SerializedItem))
                {
                    uuid = item.ToString();
                }
                else
                {
                    int            offset;
                    SerializedList lst = (SerializedList)item;
                    if (lst.Items[4].ToString() == "0")
                    {
                        offset = 0;
                    }
                    else
                    {
                        offset = 1;
                    }

                    String ElementName;
                    String ElementSubtype;

                    if (uuid == "143c00f7-a42d-4cd7-9189-88e4467dc768" || uuid == "a9f3b1ac-f51b-431e-b102-55a69acdecad")
                    {
                        ElementName    = lst.Items[6].ToString();
                        ElementSubtype = (uuid == "a9f3b1ac-f51b-431e-b102-55a69acdecad") ? lst.Items[5].ToString() : lst.Items[7].ToString();
                    }
                    else
                    {
                        ElementName    = lst.Items[6 + offset].ToString();
                        ElementSubtype = lst.Items[5 + offset].ToString();
                    }

                    var ElementClass = ManagedFormElementType.ParseTypeID(uuid);

                    MDObjectsCollection <ManagedFormElement> ChildrenPrototype = null;

                    if (lst.Items.Count > 22 && (ElementClass == FormElementClass.Group || ElementClass == FormElementClass.Grid))
                    {
                        System.Text.RegularExpressions.Regex RegExp = new System.Text.RegularExpressions.Regex(@"\w{8}-\w{4}-\w{4}-\w{4}-\w{12}");

                        for (int j = 22; j < lst.Items.Count; ++j)
                        {
                            String content = lst.Items[j].ToString();
                            if (content.Length == 36 && content != "00000000-0000-0000-0000-000000000000" && RegExp.IsMatch(content))
                            {
                                // load children

                                ChildrenPrototype = new MDObjectsCollection <ManagedFormElement>();

                                LoadElements(lst, ChildrenPrototype, j);
                                break;
                            }
                        }
                    }

                    ManagedFormElement element;
                    var ElementType = new ManagedFormElementType(ElementClass, Int32.Parse(ElementSubtype));
                    if (ChildrenPrototype == null)
                    {
                        element = new ManagedFormElement(ElementName, ElementName, ElementType);
                    }
                    else
                    {
                        ManagedFormElements Children = new ManagedFormElements(ChildrenPrototype);
                        element = new ManagedFormElement(ElementName, ElementName, ElementType, Children);
                    }

                    itemsPrototype.Add(element);
                }
            }
        }
示例#5
0
 public ManagedFormElements(MDObjectsCollection <ManagedFormElement> items)
 {
     m_Items         = items;
     m_InitPerformed = true;
 }