using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ShengJu_CUT100_DES.MessageEntity.Outgoing { public class WriteAppFileRequest : MessageBase { /// /// /// /// 1-4 /// 0-3 /// 16 bytes key /// 32 bytes data public WriteAppFileRequest(byte fileId, byte blockAddress, byte[] writeKey, byte[] data) { if (fileId < 1 || fileId > 4) throw new ArgumentOutOfRangeException("fileId must be range from(include) 1 to 4"); if (blockAddress > 3) throw new ArgumentOutOfRangeException("blockAddress must be range from(include) 0 to 3"); if (writeKey.Length != 16) throw new ArgumentException("writeKey must has its length to 16"); if (data.Length != 32) throw new ArgumentException("data must has its length to 32"); base.命令代码 = CommandType.DesFireEV1操作命令_写数据_高级命令; base.RawDataAndCheck = new byte[] { fileId }.Concat(new byte[] { blockAddress }).Concat(writeKey).Concat(data).ToList(); } } }