Skip to content

Commit

Permalink
修正多线程下载时的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
ldqk committed Dec 20, 2019
1 parent 57ee7e9 commit 4c17e0d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Masuit.Tools.Core/Masuit.Tools.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<Version>2.2.7.4</Version>
<Version>2.2.7.5</Version>
<Authors>懒得勤快</Authors>
<Company>masuit.com</Company>
<Description>包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
Expand Down
11 changes: 9 additions & 2 deletions Masuit.Tools.Core/Net/MultiThreadDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void temp_DownloadPartProgressChanged(object sender, EventArgs e)
void UpdateProgress()
{
int pr = (int)(TotalBytesReceived * 1d / Size * 100);
if (TotalProgress != pr)
if (Math.Abs(TotalProgress - pr) > 0.01)
{
TotalProgress = pr;
if (TotalProgressChanged != null)
Expand Down Expand Up @@ -253,7 +253,14 @@ void MergeParts()
}
}

File.Delete(item.FullPath);
try
{
File.Delete(item.FullPath);
}
catch
{
// ignored
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion Masuit.Tools/Net/MultiThreadDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,14 @@ void MergeParts()
}
}

File.Delete(item.FullPath);
try
{
File.Delete(item.FullPath);
}
catch
{
// ignored
}
}
}

Expand Down
Binary file modified Masuit.Tools/Properties/AssemblyInfo.cs
Binary file not shown.

0 comments on commit 4c17e0d

Please sign in to comment.