Ejemplo n.º 1
0
        // 构造 LogicChipItem
        // 除了基本数据外,也包括 DSFID EAS AFI
        public static LogicChipItem FromTagInfo(TagInfo tag_info)
        {
            var chip = LogicChipItem.From(tag_info.Bytes,
                                          (int)tag_info.BlockSize,
                                          tag_info.LockStatus);

            chip.SetSystemValues(
                tag_info.Bytes,
                tag_info.LockStatus,
                (int)tag_info.MaxBlockCount,
                (int)tag_info.BlockSize,
                tag_info.UID,
                tag_info.DSFID,
                tag_info.AFI,
                tag_info.EAS,
                tag_info.AntennaID);
#if NO
            chip.DSFID = tag_info.DSFID;
            chip.AFI   = tag_info.AFI;
            chip.EAS   = tag_info.EAS;

            // 2019/1/25
            chip.SetChanged(false);
#endif
            return(chip);
        }
Ejemplo n.º 2
0
 public ViewModel(LogicChipItem instance,
                  ICustomTypeDescriptor originalDescriptor)
     : base(originalDescriptor)
 {
     _instance           = instance;
     _originalDescriptor = originalDescriptor;
     // PropertyAttributeReplacements = new Dictionary<Type, IList<Attribute>>();
 }
Ejemplo n.º 3
0
        // 根据物理数据构造 (拆包)
        // parameters:
        //      block_map   每个 char 表示一个 block 的锁定状态。'l' 表示锁定, '.' 表示没有锁定
        public static new LogicChipItem From(byte[] data,
                                             int block_size,
                                             string block_map = "")
        {
            LogicChipItem chip = new LogicChipItem();

            chip.Parse(data, block_size, block_map);
            // chip.InitialAllReadonly();
            return(chip);
        }
Ejemplo n.º 4
0
        // 根据物理数据构造 (拆包)
        // Exception:
        //      可能会抛出异常 ArgumentException TagDataException
        // parameters:
        //      block_map   每个 char 表示一个 block 的锁定状态。'l' 表示锁定, '.' 表示没有锁定
        public static new LogicChipItem From(byte[] data,
                                             int block_size,
                                             string block_map = "")
        {
            LogicChipItem chip = new LogicChipItem();

            // Exception:
            //      可能会抛出异常 ArgumentException TagDataException
            chip.Parse(data, block_size, block_map);
            // chip.InitialAllReadonly();
            return(chip);
        }
Ejemplo n.º 5
0
        public void SetContent(LogicChipItem chip)
        {
            _chip = chip;

            if (chip != null)
            {
                // item.PropertyChanged += Item_PropertyChanged;
                propertyGrid1.SelectedObject = chip;
            }
            else
            {
                propertyGrid1.SelectedObject = null;
            }
        }
Ejemplo n.º 6
0
        public LogicChip GetContent()
        {
            ChipItem item = (ChipItem)propertyGrid1.SelectedObject;

            if (_chip == null)
            {
                _chip = new LogicChip();
            }

            if (item != null)
            {
                GetField(item, "PrimaryItemIdentifier");
                GetField(item, "OwnerInstitution");
                GetField(item, "SetInformation");
            }
            return(_chip);
        }
Ejemplo n.º 7
0
        public static TagInfo ToTagInfo(TagInfo existing,
                                        LogicChipItem chip)
        {
            TagInfo new_tag_info = existing.Clone();

            new_tag_info.Bytes = chip.GetBytes(
                (int)(new_tag_info.MaxBlockCount * new_tag_info.BlockSize),
                (int)new_tag_info.BlockSize,
                LogicChip.GetBytesStyle.None,
                out string block_map);
            new_tag_info.LockStatus = block_map;

            // 2019/1/22
            new_tag_info.AFI   = chip.AFI;
            new_tag_info.DSFID = chip.DSFID;
            new_tag_info.EAS   = chip.EAS;

            return(new_tag_info);
        }
Ejemplo n.º 8
0
 public static ViewModel DressUp(LogicChipItem instance)
 {
     return(new ViewModel(instance, TypeDescriptor.GetProvider(instance).GetTypeDescriptor(instance)));
 }