Esempio n. 1
0
        public ResourceDescription(XElement Element)
        {
            this.Path = Element.Attribute("path").Value;
            if (Element.Attribute("unit") != null)
            {
                this.Unit = Element.Attribute("unit").Value;
            }
            if (Element.Attribute("description") != null)
            {
                this.Description = Element.Attribute("description").Value;
            }

            XElement TypeDesc = Element.Element(LWTSD.Namespace + "type");

            this.SimpleType = SimplifiedTypeMethods.LoadFromString(
                TypeDesc.Attribute("base").Value);
            this.Restrictions = new Restriction(TypeDesc);

            XElement Supports = Element.Element(LWTSD.Namespace + "supports");

            if (Supports.Attribute("read") != null)
            {
                SupportsRead = XmlConvert.ToBoolean(Supports.Attribute("read").Value);
            }
            if (Supports.Attribute("write") != null)
            {
                SupportsWrite = XmlConvert.ToBoolean(Supports.Attribute("write").Value);
            }
            foreach (XElement It in Supports.Elements())
            {
                if (It.Name.LocalName != "filter")
                {
                    continue;
                }
                this.SupportedFilters.Add(It.Attribute("name").Value);
            }
        }