Пример #1
0
 public bitFieldView(ref fieldView mparent, string name, byte data, byte bitOffset)
 {
     parent = mparent;
     string tmp;
     if (bitOffset == 0xff)
     {
          tmp = data.ToString() + "........";
     }
     else
     {
         tmp = " ";
         for (var i = 0; i < bitOffset; i++)
             tmp += ".";
         tmp += data.ToString();
         for (var i = 0; i < 7 - bitOffset; i++)
             tmp += ".";
     }
     Text = tmp + "   " + name + "    ("+ ((data == 1) ? "Set" : "Reset")+")";
 }
Пример #2
0
 void paintNodes()
 {
     foreach (var i in offsetDict.OrderBy(p => p.Value))
         if (lengthDict.ContainsKey(i.Key))
             if (dataDict.ContainsKey(i.Key))
             {
                 var field = new fieldView(i.Key, dataDict[i.Key], i.Value, lengthDict[i.Key]);
                 Nodes.Add(field);
                 if (bitFieldList.ContainsKey(i.Key))
                 {
                     foreach (var j in bitFieldList[i.Key])
                         field.Nodes.Add(new bitFieldView(ref field, j.Value.fieldName, j.Value.data, j.Value.bitOffset));
                 }
                 field.BackColor = this.BackColor;
             }
             else
                 Nodes.Add(new fieldView(i.Key, i.Value, lengthDict[i.Key]));
 }