コード例 #1
0
        /// <summary>
        /// 尝试秒传文件,文件大小必须大于256K
        /// </summary>
        /// <param name="FilePath">文件路径</param>
        /// <param name="FileName">文件名称</param>
        /// <param name="UploadPath">上传路径</param>
        /// <returns>是否成功</returns>
        public static bool RapidUpload(string FilePath, string FileName, string UploadPath)
        {
            FileInfo info = new FileInfo(FilePath);

            if (info.Length < (256 * 1024))
            {
                return(false);
            }
            if (!SliceFile(FilePath, FileName))
            {
                return(false);
            }
            var MD5      = HashTool.HashFile(FilePath);
            var SliceMD5 = HashTool.HashFile($"{Program.config.TempPath}\\{FileName},Tmp");
            var CRC32    = HashTool.GetFileCRC32(FilePath);

            return(RapidUpload(MD5, SliceMD5, CRC32, info.Length, UploadPath));
        }