diff --git a/BattleNetPrefill.Integration.Test/GlobalUsings.cs b/BattleNetPrefill.Integration.Test/GlobalUsings.cs index a2eb588b..18861e57 100644 --- a/BattleNetPrefill.Integration.Test/GlobalUsings.cs +++ b/BattleNetPrefill.Integration.Test/GlobalUsings.cs @@ -6,7 +6,6 @@ global using BattleNetPrefill.Parsers; global using BattleNetPrefill.Structs; global using BattleNetPrefill.Utils.Debug; -global using BattleNetPrefill.Utils.Debug.Models; global using BattleNetPrefill.Web; global using ByteSizeLib; global using NUnit.Framework; diff --git a/BattleNetPrefill.Test/DebugUtilTests/RequestUtilsTests.cs b/BattleNetPrefill.Test/DebugUtilTests/RequestUtilsTests.cs index 3b4a1341..c48e9663 100644 --- a/BattleNetPrefill.Test/DebugUtilTests/RequestUtilsTests.cs +++ b/BattleNetPrefill.Test/DebugUtilTests/RequestUtilsTests.cs @@ -1,3 +1,5 @@ +using BattleNetPrefill.Utils; + namespace BattleNetPrefill.Test.DebugUtilTests { [TestFixture] diff --git a/BattleNetPrefill.Test/Properties/GlobalUsings.cs b/BattleNetPrefill.Test/Properties/GlobalUsings.cs index e764bd2b..e8e200d2 100644 --- a/BattleNetPrefill.Test/Properties/GlobalUsings.cs +++ b/BattleNetPrefill.Test/Properties/GlobalUsings.cs @@ -1,12 +1,9 @@ // Global using directives -global using System; global using System.Collections.Generic; global using System.Linq; global using BattleNetPrefill.Extensions; global using BattleNetPrefill.Structs; global using BattleNetPrefill.Structs.Enums; global using BattleNetPrefill.Utils.Debug; -global using BattleNetPrefill.Utils.Debug.Models; -global using Benchmarks; global using NUnit.Framework; \ No newline at end of file diff --git a/BattleNetPrefill/Handlers/ArchiveIndexHandler.cs b/BattleNetPrefill/Handlers/ArchiveIndexHandler.cs index b48830b7..5957aa59 100644 --- a/BattleNetPrefill/Handlers/ArchiveIndexHandler.cs +++ b/BattleNetPrefill/Handlers/ArchiveIndexHandler.cs @@ -67,7 +67,7 @@ public async Task BuildArchiveIndexesAsync(CDNConfigFile cdnConfig, StatusContex int sliceAmount = (int)Math.Ceiling((double)cdnConfig.archives.Length / maxTasks); - // TODO rewrite this + // TODO rewrite this, difficult to understand for (int i = 0; i < maxTasks; i++) { var lowerLimit = (i * sliceAmount); diff --git a/BattleNetPrefill/Properties/GlobalUsings.cs b/BattleNetPrefill/Properties/GlobalUsings.cs index 97f7ffe7..38c85c58 100644 --- a/BattleNetPrefill/Properties/GlobalUsings.cs +++ b/BattleNetPrefill/Properties/GlobalUsings.cs @@ -6,7 +6,6 @@ global using BattleNetPrefill.Structs.Enums; global using BattleNetPrefill.Utils; global using BattleNetPrefill.Utils.Debug; -global using BattleNetPrefill.Utils.Debug.Models; global using BattleNetPrefill.Web; global using ByteSizeLib; global using CliFx; diff --git a/BattleNetPrefill/Structs/MD5Hash.cs b/BattleNetPrefill/Structs/MD5Hash.cs index 3638e2b8..57fa5776 100644 --- a/BattleNetPrefill/Structs/MD5Hash.cs +++ b/BattleNetPrefill/Structs/MD5Hash.cs @@ -4,9 +4,6 @@ namespace BattleNetPrefill.Structs { public readonly struct MD5Hash : IEquatable { - //TODO figure out what to do here, and re-enable this warning -#pragma warning disable SYSLIB1038 - /// /// This is actually the "higher" part of the hash. Left most chunk of data. /// @@ -15,7 +12,6 @@ namespace BattleNetPrefill.Structs [JsonInclude] public readonly ulong highPart; -#pragma warning restore SYSLIB1038 [JsonConstructor] public MD5Hash(ulong lowPart, ulong highPart) diff --git a/BattleNetPrefill/Utils/Debug/Models/Request.cs b/BattleNetPrefill/Structs/Request.cs similarity index 92% rename from BattleNetPrefill/Utils/Debug/Models/Request.cs rename to BattleNetPrefill/Structs/Request.cs index e9f27582..a77ef07b 100644 --- a/BattleNetPrefill/Utils/Debug/Models/Request.cs +++ b/BattleNetPrefill/Structs/Request.cs @@ -1,6 +1,5 @@ -namespace BattleNetPrefill.Utils.Debug.Models +namespace BattleNetPrefill.Structs { - //TODO probably shouldn't be in debug namespace /// /// Model that represents a request that could be made to a CDN. /// @@ -11,8 +10,7 @@ public Request() } - public Request(string productRootUri, RootFolder rootFolder, MD5Hash cdnKey, long? startBytes = null, long? endBytes = null, - bool writeToDevNull = false, bool isIndex = false) + public Request(string productRootUri, RootFolder rootFolder, MD5Hash cdnKey, long? startBytes = null, long? endBytes = null, bool isIndex = false) { ProductRootUri = productRootUri; RootFolder = rootFolder; @@ -47,7 +45,7 @@ public Request(string productRootUri, RootFolder rootFolder, MD5Hash cdnKey, lon public long UpperByteRange { get; set; } // Bytes are an inclusive range. Ex bytes 0->9 == 10 bytes - public long TotalBytes => (UpperByteRange - LowerByteRange) + 1; + public long TotalBytes => UpperByteRange - LowerByteRange + 1; /// /// Request path, without a host name. Agnostic towards host name, since we will combine with it later if needed to make a real request. @@ -76,7 +74,7 @@ public override string ToString() return $"{Uri} - -"; } - var size = ByteSize.FromBytes((double)TotalBytes); + var size = ByteSize.FromBytes(TotalBytes); return $"{Uri} {LowerByteRange}-{UpperByteRange} {size}"; } diff --git a/BattleNetPrefill/Utils/Debug/Models/ComparisonResult.cs b/BattleNetPrefill/Utils/Debug/ComparisonResult.cs similarity index 98% rename from BattleNetPrefill/Utils/Debug/Models/ComparisonResult.cs rename to BattleNetPrefill/Utils/Debug/ComparisonResult.cs index 02fc1609..32b77f5e 100644 --- a/BattleNetPrefill/Utils/Debug/Models/ComparisonResult.cs +++ b/BattleNetPrefill/Utils/Debug/ComparisonResult.cs @@ -1,4 +1,4 @@ -namespace BattleNetPrefill.Utils.Debug.Models +namespace BattleNetPrefill.Utils.Debug { public class ComparisonResult { diff --git a/BattleNetPrefill/Utils/DirectorySearch.cs b/BattleNetPrefill/Utils/Debug/DirectorySearch.cs similarity index 94% rename from BattleNetPrefill/Utils/DirectorySearch.cs rename to BattleNetPrefill/Utils/Debug/DirectorySearch.cs index 8561ad9c..4d5d85d7 100644 --- a/BattleNetPrefill/Utils/DirectorySearch.cs +++ b/BattleNetPrefill/Utils/Debug/DirectorySearch.cs @@ -1,4 +1,4 @@ -namespace BattleNetPrefill.Utils +namespace BattleNetPrefill.Utils.Debug { public static class DirectorySearch { diff --git a/BattleNetPrefill/Utils/Debug/RequestUtils.cs b/BattleNetPrefill/Utils/RequestUtils.cs similarity index 96% rename from BattleNetPrefill/Utils/Debug/RequestUtils.cs rename to BattleNetPrefill/Utils/RequestUtils.cs index 14619238..627aec58 100644 --- a/BattleNetPrefill/Utils/Debug/RequestUtils.cs +++ b/BattleNetPrefill/Utils/RequestUtils.cs @@ -1,6 +1,5 @@ -namespace BattleNetPrefill.Utils.Debug +namespace BattleNetPrefill.Utils { - //TODO should this be in debug? public static class RequestUtils { /// diff --git a/BattleNetPrefill/Web/CdnRequestManager.cs b/BattleNetPrefill/Web/CdnRequestManager.cs index 144441ee..e4c80ed2 100644 --- a/BattleNetPrefill/Web/CdnRequestManager.cs +++ b/BattleNetPrefill/Web/CdnRequestManager.cs @@ -69,7 +69,7 @@ public async Task InitializeAsync(TactProduct currentProduct) public void QueueRequest(RootFolder rootPath, in MD5Hash hash, in long? startBytes = null, in long? endBytes = null, bool isIndex = false) { - var request = new Request(_productBasePath, rootPath, hash, startBytes, endBytes, writeToDevNull: true, isIndex); + var request = new Request(_productBasePath, rootPath, hash, startBytes, endBytes, isIndex); _queuedRequests.Add(request); } @@ -191,7 +191,7 @@ async Task DownloadRequestWrapper(Request request, CancellationToken _) public async Task GetRequestAsBytesAsync(RootFolder rootPath, MD5Hash hash, bool isIndex = false, bool writeToDevNull = false, long? startBytes = null, long? endBytes = null) { - Request request = new Request(_productBasePath, rootPath, hash, startBytes, endBytes, writeToDevNull, isIndex); + Request request = new Request(_productBasePath, rootPath, hash, startBytes, endBytes, isIndex); return await AppConfig.RetryPolicy.ExecuteAsync(async () => { return await GetRequestAsBytesAsync(request);