mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
24 lines
No EOL
636 B
C#
24 lines
No EOL
636 B
C#
namespace NAK.BetterContentLoading;
|
|
|
|
public partial class DownloadManager2
|
|
{
|
|
private void StartBandwidthMonitor()
|
|
{
|
|
Task.Run(async () =>
|
|
{
|
|
while (true)
|
|
{
|
|
await Task.Delay(1000);
|
|
Interlocked.Exchange(ref _bytesReadLastSecond, 0);
|
|
Interlocked.Exchange(ref _completedDownloads, 0);
|
|
}
|
|
});
|
|
}
|
|
|
|
private int ComputeUsableBandwidthPerDownload()
|
|
{
|
|
var activeCount = _activeDownloads.Count;
|
|
if (activeCount == 0) return MaxDownloadBandwidth;
|
|
return MaxDownloadBandwidth / activeCount;
|
|
}
|
|
} |