예제 #1
0
 /// <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;
         }
     }
 }
예제 #2
0
 /// <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;
         }
     }
 }
예제 #3
0
        /// <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);
        }