using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; namespace Rdh.SocketServer.Client.Models { public class RequestSupplyDrugProtocol : EleMedKitProtocol { public RequestSupplyDrugProtocol() { this.Command = EleMedKitCommand.RequestSupplyList; this.MinLines = base.MinLines + 3; } public UserInfoProtocol? UserInfo { get; set; } public List? ListBarcode { get; set; } public string LineEnd { get => EleMedKitProtocolFlags.LineSpiltor; } public override string GetContent() { return base.GetContent() + UserInfo?.ToString() + AddList(ListBarcode) + AddLineContent(LineEnd) + AddLineContent(CountFlag); } public override bool ParseContent(string[] lines) { if (!base.ParseContent(lines) || lines.Length < MinLines) { return false; } if (!lines[lines.Length - 2].Contains(LineEnd)) { return false; } UserInfo = new UserInfoProtocol(); if (!UserInfo.ParseContent(lines[2])) { return false; } ListBarcode = new List(); for (int i = 3; i < lines.Length - 2; i++) { string barcode = EleMedKitProtocolHelper.GetLineContent(lines[i]); if (barcode.Length > 0) { ListBarcode.Add(barcode); } } return ListBarcode.Count > 0; } } }