using Edge.Core.Parser.BinaryParser.Attributes; using System.Collections.Generic; namespace PetroChinaOnlineWatchPlugin.MessageEntity.Incoming { public class IfsfMessageDataIn { [Format(1, EncodingType.BIN, -9890)] public byte DataIdentifier { get; set; } [Format(1, EncodingType.BIN, -9880)] public int DataLength { get; set; } [EnumerableFormat("%cascade", -9870)] public List Data { get; set; } public override string ToString() { return $"{DataIdentifier} {DataLength}"; } } public class AnswerWriteUnsolicitedMessageIn : MessageBase { [Format(2, EncodingType.BIN, -9930)] public int MessageLength { get; set; } [Format(1, EncodingType.BIN, -9920)] public int DatabaseAddressLength { get; set; } [EnumerableFormat("DatabaseAddressLength", -9910)] public List DatabaseAddress { get; set; } public int DataListLength { get { return MessageLength - 1 - DatabaseAddress.Count; } } [EnumerableFormat("DataListLength", -9900)] public List DataList { get; set; } public override string ToString() { string dbAddress = string.Empty; foreach (byte ad in DatabaseAddress) { dbAddress += " " + ad.ToString(); } string dtList = string.Empty; foreach (var dt in DataList) { dtList += " " + dt.ToString(); } return $"{MessageLength} {DatabaseAddressLength} {dbAddress} {dtList}"; } } }