From ba693b22d4a7574014ad3b71aa426c422af2f3a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:37:22 +0000 Subject: [PATCH 1/3] Initial plan From 835de992a28dd944a30c7881a6226456b37cb74c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:44:17 +0000 Subject: [PATCH 2/3] chore: upgrade monotorrent Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com> --- Ra3.BattleNet.Downloader/Download.cs | 10 +++++----- .../Ra3.BattleNet.Downloader.csproj | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Ra3.BattleNet.Downloader/Download.cs b/Ra3.BattleNet.Downloader/Download.cs index 38de5a9..3246e43 100644 --- a/Ra3.BattleNet.Downloader/Download.cs +++ b/Ra3.BattleNet.Downloader/Download.cs @@ -38,11 +38,11 @@ public static async Task BitTorrentDownload(ViewModel viewModel) var settingsBuilder = new EngineSettingsBuilder { - ListenPort = -1, - DhtPort = -1, AllowPortForwarding = false, CacheDirectory = cacheFolder, + DhtEndPoint = null, }; + settingsBuilder.ListenEndPoints.Clear(); var engine = new ClientEngine(settingsBuilder.ToSettings()); var taskSource = new TaskCompletionSource(); @@ -59,10 +59,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; } diff --git a/Ra3.BattleNet.Downloader/Ra3.BattleNet.Downloader.csproj b/Ra3.BattleNet.Downloader/Ra3.BattleNet.Downloader.csproj index 7db5c78..08766b3 100644 --- a/Ra3.BattleNet.Downloader/Ra3.BattleNet.Downloader.csproj +++ b/Ra3.BattleNet.Downloader/Ra3.BattleNet.Downloader.csproj @@ -36,7 +36,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 9b62de1069e6834ed7f08aa524c814f2b08f2af6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:45:23 +0000 Subject: [PATCH 3/3] chore: address review feedback Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com> --- Ra3.BattleNet.Downloader/Download.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Ra3.BattleNet.Downloader/Download.cs b/Ra3.BattleNet.Downloader/Download.cs index 3246e43..e31667c 100644 --- a/Ra3.BattleNet.Downloader/Download.cs +++ b/Ra3.BattleNet.Downloader/Download.cs @@ -38,6 +38,7 @@ public static async Task BitTorrentDownload(ViewModel viewModel) var settingsBuilder = new EngineSettingsBuilder { + AllowLocalPeerDiscovery = false, AllowPortForwarding = false, CacheDirectory = cacheFolder, DhtEndPoint = null, @@ -59,8 +60,9 @@ public static async Task BitTorrentDownload(ViewModel viewModel) if (!torrentManager.Complete) { var monitor = torrentManager.Monitor; - viewModel.SetDownloadedSize(monitor.DataBytesReceived, torrent.Size); - var progress = (double)monitor.DataBytesReceived / torrent.Size; + var dataBytesReceived = monitor.DataBytesReceived; + viewModel.SetDownloadedSize(dataBytesReceived, torrent.Size); + var progress = (double)dataBytesReceived / torrent.Size; viewModel.SetProgress(progress); viewModel.SetDownloadSpeed(monitor.DownloadRate); return;