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); }
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); }