Exemplo n.º 1
0
        public static DeviceBitsGroup From(XElement xBits)
        {
            var res          = new DeviceBitsGroup();
            var xName        = xBits.Attribute("name");
            var xDescription = xBits.Element("description");

            res.Name        = xName != null ? xName.Value : "";
            res.Description = DeviceInfoUtils.FormatDescription(xDescription);
            foreach (var xBit in xBits.Elements("deviceBit"))
            {
                res.Bits.Add(DeviceBit.From(xBit));
            }
            return(res);
        }
Exemplo n.º 2
0
        public static DeviceBits Parse(XElement xBits)
        {
            var res = new DeviceBits();

            var xPage     = xBits.Attribute("page");
            var xLocation = xBits.Attribute("location");

            res.PageSize = xPage != null?int.Parse(xPage.Value) : 1;

            res.Location = xLocation != null ? new AvrMemoryType?((AvrMemoryType)Enum.Parse(typeof(AvrMemoryType), xLocation.Value, true)) : null;
            foreach (var xBit in xBits.Elements())
            {
                res.Groups.Add(DeviceBitsGroup.From(xBit));
            }
            return(res);
        }