コード例 #1
0
        public override List <BaseItem> LoadChildren()
        {
            var items = new List <BaseItem>();

            Children = new List <RegisterItem>();
            foreach (var reg in Element.Descendants("register"))
            {
                var item = new RegisterItem(reg, this, Owner);
                Children.Add(item);
                items.Add(item);
            }
            return(items);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 public override List<BaseItem> LoadChildren()
 {
     var items = new List<BaseItem>();
     Children = new List<RegisterItem>();
     foreach (var reg in Element.Descendants("register"))
     {
         var item = new RegisterItem(reg, this, Owner);
         Children.Add(item);
         items.Add(item);
     }
     return items;
 }