Skip to content

Commit

Permalink
更新包
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbbaixue committed Nov 20, 2024
1 parent 97380ed commit 516f35f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions Ra3.BattleNet.Downloader/Download.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Threading;

namespace Ra3.BattleNet.Downloader;
Expand Down Expand Up @@ -38,11 +40,13 @@ public static async Task BitTorrentDownload(ViewModel viewModel)

var settingsBuilder = new EngineSettingsBuilder
{
ListenPort = -1,
DhtPort = -1,
AllowPortForwarding = false,
CacheDirectory = cacheFolder,
DhtEndPoint = null
};

settingsBuilder.ListenEndPoints.Add(IPAddress.Loopback.ToString(), new IPEndPoint(IPAddress.Loopback, 0));

var engine = new ClientEngine(settingsBuilder.ToSettings());

var taskSource = new TaskCompletionSource<string>();
Expand All @@ -59,10 +63,10 @@ public static async Task BitTorrentDownload(ViewModel viewModel)
if (!torrentManager.Complete)
{
var monitor = torrentManager.Monitor;
viewModel.SetDownloadedSize(monitor.DataBytesDownloaded, torrent.Size);
var progress = (double)monitor.DataBytesDownloaded / torrent.Size;
viewModel.SetDownloadedSize(monitor.DataBytesReceived, torrent.Size);
var progress = (double)monitor.DataBytesReceived / torrent.Size;
viewModel.SetProgress(progress);
viewModel.SetDownloadSpeed(monitor.DownloadSpeed);
viewModel.SetDownloadSpeed(monitor.DownloadRate);
return;
}
Expand Down
8 changes: 4 additions & 4 deletions Ra3.BattleNet.Downloader/Ra3.BattleNet.Downloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<ItemGroup>
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Fody" Version="6.8.0">
<PackageReference Include="Fody" Version="6.9.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MonoTorrent" Version="2.0.7" />
<PackageReference Include="MonoTorrent" Version="3.0.2" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

</Project>

0 comments on commit 516f35f

Please sign in to comment.