int SaveNewChip(out string strError) { strError = ""; #if OLD_CODE RfidChannel channel = StartRfidChannel( Program.MainForm.RfidCenterUrl, out strError); if (channel == null) { strError = "StartRfidChannel() error"; return(-1); } #endif try { TagInfo new_tag_info = LogicChipItem.ToTagInfo( _tagExisting.TagInfo, this.chipEditor_editing.LogicChipItem); #if OLD_CODE NormalResult result = channel.Object.WriteTagInfo( _tagExisting.ReaderName, _tagExisting.TagInfo, new_tag_info); #else NormalResult result = RfidManager.WriteTagInfo( _tagExisting.ReaderName, _tagExisting.TagInfo, new_tag_info); TagList.ClearTagTable(_tagExisting.UID); #endif if (result.Value == -1) { strError = result.ErrorInfo; return(-1); } return(0); } catch (Exception ex) { strError = "SaveNewChip() 出现异常: " + ex.Message; return(-1); } finally { #if OLD_CODE EndRfidChannel(channel); #endif } }
int SaveNewChip(out string strError) { strError = ""; RfidChannel channel = StartRfidChannel( Program.MainForm.RfidCenterUrl, out strError); if (channel == null) { strError = "StartRfidChannel() error"; return(-1); } try { #if NO TagInfo new_tag_info = _tagExisting.TagInfo.Clone(); new_tag_info.Bytes = this.chipEditor_editing.LogicChipItem.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; #endif TagInfo new_tag_info = LogicChipItem.ToTagInfo( _tagExisting.TagInfo, this.chipEditor_editing.LogicChipItem); NormalResult result = channel.Object.WriteTagInfo( _tagExisting.ReaderName, _tagExisting.TagInfo, new_tag_info); if (result.Value == -1) { strError = result.ErrorInfo; return(-1); } return(0); } catch (Exception ex) { strError = "SaveNewChip() 出现异常: " + ex.Message; return(-1); } finally { EndRfidChannel(channel); } }
int SaveNewChip(out string strError) { strError = ""; RfidChannel channel = StartRfidChannel( Program.MainForm.RfidCenterUrl, out strError); if (channel == null) { strError = "StartRfidChannel() error"; return(-1); } try { TagInfo new_tag_info = LogicChipItem.ToTagInfo( _tagExisting.TagInfo, this.chipEditor_editing.LogicChipItem); NormalResult result = channel.Object.WriteTagInfo( _tagExisting.ReaderName, _tagExisting.TagInfo, new_tag_info); if (result.Value == -1) { strError = result.ErrorInfo; return(-1); } return(0); } catch (Exception ex) { strError = "SaveNewChip() 出现异常: " + ex.Message; return(-1); } finally { EndRfidChannel(channel); } }
int SaveNewChip(out string strError) { strError = ""; #if OLD_CODE RfidChannel channel = StartRfidChannel( Program.MainForm.RfidCenterUrl, out strError); if (channel == null) { strError = "StartRfidChannel() error"; return(-1); } #endif try { #if NO TagInfo new_tag_info = _tagExisting.TagInfo.Clone(); new_tag_info.Bytes = this.chipEditor_editing.LogicChipItem.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; #endif Debug.Assert(_tagExisting != null, ""); Debug.WriteLine("333 " + (_tagExisting.TagInfo != null ? "!=null" : "==null")); Debug.Assert(_tagExisting.TagInfo != null, ""); TagInfo new_tag_info = LogicChipItem.ToTagInfo( _tagExisting.TagInfo, this.chipEditor_editing.LogicChipItem); #if OLD_CODE NormalResult result = channel.Object.WriteTagInfo( _tagExisting.ReaderName, _tagExisting.TagInfo, new_tag_info); #else Debug.Assert(_tagExisting != null, ""); Debug.WriteLine("111 " + (_tagExisting.TagInfo != null ? "!=null" : "==null")); Debug.Assert(_tagExisting.TagInfo != null, ""); // 2019/9/30 Debug.Assert(_tagExisting.AntennaID == _tagExisting.TagInfo.AntennaID, $"2 _tagExisting.AntennaID({_tagExisting.AntennaID}) 应该 == _tagExisting.TagInfo.AntennaID({_tagExisting.TagInfo.AntennaID})"); NormalResult result = RfidManager.WriteTagInfo( _tagExisting.ReaderName, _tagExisting.TagInfo, new_tag_info); TagList.ClearTagTable(_tagExisting.UID); #endif if (result.Value == -1) { strError = result.ErrorInfo; return(-1); } return(0); } catch (Exception ex) { strError = "SaveNewChip() 出现异常: " + ex.Message; return(-1); } finally { #if OLD_CODE EndRfidChannel(channel); #endif } }