public RegisterItem(XElement reg, RegisterGroupItem parent, RegViewModel owner) { Element = reg; ParentItem = Parent = parent; Owner = owner; Name = reg.Attribute("name").Value; Description = reg.Element("description").Value; ItemPath = Path.Combine(parent.ItemPath, Name); Icon = EmbSysRegView.Properties.Resources.unselected_register; try { var val = (reg.Attribute("resetvalue") != null) ? reg.Attribute("resetvalue").Value.Trim() : ""; if (val.IndexOf('x') > 0) { val = val.Substring(val.IndexOf('x') + 1); } Reset = Convert.ToUInt32((val.Length > 0) ? val : "0x00", 16); Access = reg.Attribute("access").Value; val = reg.Attribute("address").Value.Trim(); if (val.IndexOf('x') > 0) { val = val.Substring(val.IndexOf('x') + 1); } Address = Convert.ToUInt32(val, 16); } catch (Exception ex) { Description = "PARSE ERROR: " + ex.Message; } }
public GroupItem(XElement group, RegViewModel owner) { Element = group; Owner = owner; Name = group.Attribute("name").Value; Description = group.Attribute("description").Value; ItemPath = Name; }
public GroupItem(XElement group, RegViewModel owner) { Element = group; Owner = owner; Name = group.Attribute("name").Value; Description = group.Attribute("description").Value; ItemPath = Name; }
public RegisterGroupItem(XElement regGroup, GroupItem parent, RegViewModel owner) { Element = regGroup; ParentItem = Parent = parent; Owner = owner; Name = regGroup.Attribute("name").Value; Description = regGroup.Attribute("description").Value; ItemPath = Path.Combine(parent.ItemPath, Name); }
public FieldItem(XElement reg, RegisterItem parent, RegViewModel owner) { Element = reg; ParentItem = Parent = parent; Owner = owner; Name = reg.Attribute("name").Value; BitOffset = int.Parse(reg.Attribute("bitoffset").Value); BitLength = int.Parse(reg.Attribute("bitlength").Value); var attr = reg.Attribute("description"); var elem = reg.Element("description"); if (attr != null) { Description = attr.Value; } else if (elem != null) { Description = elem.Value; } else { Description = ""; } if (BitLength > 1) { Name = String.Format("{0} (bits {1}-{2})", Name, BitOffset, BitOffset + BitLength - 1); } else { Name = String.Format("{0} (bit {1})", Name, BitOffset); } ItemPath = Path.Combine(parent.ItemPath, Name); Icon = EmbSysRegView.Properties.Resources.unselected_field; foreach (var interp in Element.Descendants("interpretation")) { var key = uint.Parse(interp.Attribute("key").Value); var text = interp.Attribute("text").Value.Trim(); interpretations.Add(key, text); } }
public RegisterGroupItem(XElement regGroup, GroupItem parent, RegViewModel owner) { Element = regGroup; ParentItem = Parent = parent; Owner = owner; Name = regGroup.Attribute("name").Value; Description = regGroup.Attribute("description").Value; ItemPath = Path.Combine(parent.ItemPath, Name); }
public FieldItem(XElement reg, RegisterItem parent, RegViewModel owner) { Element = reg; ParentItem = Parent = parent; Owner = owner; Name = reg.Attribute("name").Value; BitOffset = int.Parse(reg.Attribute("bitoffset").Value); BitLength = int.Parse(reg.Attribute("bitlength").Value); var attr = reg.Attribute("description"); var elem = reg.Element("description"); if (attr != null) Description = attr.Value; else if (elem != null) Description = elem.Value; else Description = ""; if (BitLength > 1) Name = String.Format("{0} (bits {1}-{2})", Name, BitOffset, BitOffset + BitLength - 1); else Name = String.Format("{0} (bit {1})", Name, BitOffset); ItemPath = Path.Combine(parent.ItemPath, Name); Icon = EmbSysRegView.Properties.Resources.unselected_field; foreach (var interp in Element.Descendants("interpretation")) { var key = Convert.ToUInt32(interp.Attribute("key").Value, 16); var text = interp.Attribute("text").Value.Trim(); interpretations[key] = text; } }
public RegisterItem(XElement reg, RegisterGroupItem parent, RegViewModel owner) { Element = reg; ParentItem = Parent = parent; Owner = owner; Name = reg.Attribute("name").Value; Description = reg.Element("description").Value; ItemPath = Path.Combine(parent.ItemPath, Name); Icon = EmbSysRegView.Properties.Resources.unselected_register; try { var val = (reg.Attribute("resetvalue") != null) ? reg.Attribute("resetvalue").Value.Trim() : ""; if (val.IndexOf('x') > 0) val = val.Substring(val.IndexOf('x') + 1); Reset = Convert.ToUInt32((val.Length > 0) ? val : "0x00", 16); Access = reg.Attribute("access").Value; val = reg.Attribute("address").Value.Trim(); if (val.IndexOf('x') > 0) val = val.Substring(val.IndexOf('x') + 1); Address = Convert.ToUInt32(val, 16); } catch (Exception ex) { Description = "PARSE ERROR: " + ex.Message; } }