/// <summary> /// 更新文件信息实体 /// </summary> /// <param name="sendFileInfo">发送文件集合</param> /// <param name="fileInfoEntity">新对象</param> public static void updateFileInfo(SendFileInfo sendFileInfo, FileInfoEntity fileInfoEntity) { for (int i = 0; i < sendFileInfo.fileList.Count; i++) { FileInfoEntity entity = sendFileInfo.fileList[i]; if (fileInfoEntity.hashcode.Equals(entity.hashcode)) { sendFileInfo.fileList[i] = fileInfoEntity; break; } } }
/// <summary> /// 移除文件信息实体 /// </summary> /// <param name="sendFileInfo">发送文件集合</param> /// <param name="hashcode">哈希值</param> public static void removeFileInfo(SendFileInfo sendFileInfo, string hashcode) { for (int i = 0; i < sendFileInfo.fileList.Count; i++) { FileInfoEntity entity = sendFileInfo.fileList[i]; if (hashcode.Equals(entity.hashcode)) { sendFileInfo.fileList.RemoveAt(i); break; } } }
/// <summary> /// 获取文件信息实体 /// </summary> /// <param name="sendFileInfo">发送文件集合</param> /// <param name="hashcode">哈希值</param> /// <returns></returns> public static FileInfoEntity getFileInfo(SendFileInfo sendFileInfo, string hashcode) { for (int i = 0; i < sendFileInfo.fileList.Count; i++) { FileInfoEntity entity = sendFileInfo.fileList[i]; if (hashcode.Equals(entity.hashcode)) { return(entity); } } return(null); }