12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ShengJu_CUT100_DES.MessageEntity.Outgoing
- {
- public class WriteAppFileRequest : MessageBase
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="fileId">1-4</param>
- /// <param name="blockAddress">0-3</param>
- /// <param name="writeKey">16 bytes key</param>
- /// <param name="data">32 bytes data</param>
- 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();
- }
- }
- }
|