public TransponderAddCommand(TransponderInfo info) { if (info == null || info.TxNumber == 0 || info.ImportantPackets?.Count < 12) { throw new ArgumentException("Missing transponder registration info"); } this.info = info; }
public void HandleStringResponse(string resp) { if (String.IsNullOrEmpty(resp)) { return; } if (resp.StartsWith("INFO ")) { string[] s = resp.Substring(5).Split(' '); Int32 txCandidate = 0; if (Int32.TryParse(s[0].Trim(), out txCandidate)) { bool important = false; String nick = String.Empty; if (s.Length > 1) { nick = s[1].Trim(); } if (s.Length > 2) { important = s[2].Trim() == "*"; } TransponderInfo newEntry = new TransponderInfo(txCandidate, important); newEntry.NickName = nick; this.entries.Add(newEntry); } } if (resp.StartsWith("SUCCESS List complete")) { this.finished = true; } if (resp.StartsWith("ERROR")) { this.finished = true; errorCause = resp.Substring(6).Trim(); if (String.IsNullOrEmpty(errorCause)) { errorCause = "Generic error"; } } }