/// <summary> /// 准备上传 /// </summary> /// <param name="filePath"></param> /// <param name="targetId"></param> /// <param name="albumId"></param> public Upload UploadPrepare(string targetId, string albumId, AlbumType albumType, FileType fileType, string target, string filePath) { FileInfo fileInfo = new FileInfo(filePath); string fileName = fileInfo.Name; string lastModified = new FileInfo(filePath).LastWriteTime.ToString(); var identifier = GenerateMD5($"{AccountManager.Instance.Account}{fileName}{filePath}{lastModified}"); Upload uploader; var isUploading = IsUploading(targetId, albumId, identifier); //校验是否在正在上传列表 if (isUploading.Item1) { uploader = isUploading.Item2; } else { UploadManager.AddUploader(new Upload() { UserName = AccountManager.Instance.Account, FileName = fileName, FileSize = (int)fileInfo.Length, FileType = (int)fileType, TargetId = targetId, AlbumId = albumId, AlbumType = (int)albumType, Progress = 0, Identifier = identifier, ChunkNumber = 0, FilePath = filePath, Target = target }); uploader = UploadManager.GetUploader(targetId, albumId, identifier); } return(uploader); }