/// <summary> /// 文件目录初始化 /// </summary> /// <param name="id">目录ID</param> /// <param name="name">目录名称</param> /// <param name="flag">召唤标志</param> /// <param name="startTime">开始时间</param> /// <param name="endTime">结束时间</param> public FileDirectoryCalledPacket(UInt32 id, string name, FileCallFlag flag, CP56Time2a startTime, CP56Time2a endTime) { OperationSign = OperatSign.ReadDirectory; DirectoryID = id; DirectoryName = name; CallFlag = flag; QueryStartingTime = startTime; QueryEndTime = endTime; }
/// <summary> /// 文件数据传输包 /// </summary> /// <param name="sign">读写操作标识</param> /// <param name="id">文件ID</param> /// <param name="num">数据段号</param> /// <param name="fllow">后续标志</param> /// <param name="fileData">包好文件数据的数组</param> /// <param name="offset">数据偏移</param> /// <param name="len">数据长度</param> public FileDataThransmitPacket(OperatSign sign, UInt32 id, UInt32 num, FllowingFlag fllow, byte[] fileData, int offset, int len) { try { OperationSign = sign; FileID = id; FragmentNum = num; Fllow = fllow; FileData = new byte[len]; Array.Copy(fileData, offset, FileData, 0, len); Check = GetCheck(FileData); } catch (Exception ex) { throw ex; } }
/// <summary> /// 数据包转换为属性值 /// </summary> /// <param name="data">数据包</param> /// <param name="offset">便宜</param> /// <param name="len">数据长度</param> public void PacketDataToElement(byte[] data, byte offset, byte len) { OperationSign = (OperatSign)data[offset++]; ResultSign = (FileResultSign)data[offset++]; DirectoryID = ElementTool.CombinationByte(data[offset++], data[offset++], data[offset++], data[offset++]); Fllow = (FllowingFlag)data[offset++]; Count = data[offset++]; if (Count > 0) { for (int i = 0; i < Count; i++) { byte attributeLen = (byte)(data[offset] + 13); var attribute = new FileAttribute(data, offset, attributeLen); FileAttributeList.Add(attribute); offset += attributeLen; } } }
/// <summary> /// 读文件激活 /// </summary> /// <param name="name">文件名</param> public FileReadActivityPacket(string name) { OperationSign = OperatSign.ReadFileActivity; Name = name; }