示例#1
0
        public static SubGroupEntity ImportFromXmlNode(GroupEntity parent, XmlNode node)
        {
            if (node.Name.ToUpper() != "SUBTAGGROUP")
            {
                return(null);
            }

            SubGroupEntity sgroup = new SubGroupEntity(parent)
            {
                Prefix = XMLHelper.GetAttributeStringValue(node, "Prefix", "00"),
            };

            XmlNode child = node.FirstChild;

            while (child != null)
            {
                TagEntity tag = TagEntity.ImportFromXmlNode(sgroup, child);
                if (tag != null)
                {
                    sgroup.Tags.Add(tag);
                }

                child = child.NextSibling;
            }

            return(sgroup);
        }
示例#2
0
        public static GroupEntity ImportFromXmlNode(
            DeviceEntity parent,
            XmlNode node)
        {
            GroupEntity rlt = null;

            if (node.Name.ToUpper() != "TAGGROUP")
            {
                return(rlt);
            }

            rlt = new GroupEntity(parent)
            {
                Name = XMLHelper.GetAttributeStringValue(node, "Name", "Unknown"),
            };

            XmlNode child = node.FirstChild;

            while (child != null)
            {
                switch (child.Name.ToUpper())
                {
                case "TAG":
                    TagEntity tag =
                        TagEntity.ImportFromXmlNode(rlt, child);
                    if (tag != null)
                    {
                        rlt.Tags.Add(tag);
                    }
                    break;

                case "SUBTAGGROUP":
                    SubGroupEntity sgroup =
                        SubGroupEntity.ImportFromXmlNode(rlt, child);
                    if (sgroup != null)
                    {
                        rlt.SubGroups.Add(sgroup);
                    }
                    break;
                }

                child = child.NextSibling;
            }

            return(rlt);
        }