CollapseLauncher / Collapse

An Advanced Launcher for miHoYo/HoYoverse Games
MIT License
1.4k stars 64 forks source link

File Downloader Submodule Major Refactor (Hi3Helper.Http) #563

Closed neon-nyan closed 2 months ago

neon-nyan commented 3 months ago

Main Goal

As per title, this PR contains some huge changes to our own File Downloader Submodule implementation that we use for Collapse called: Hi3Helper.Http. The changes brings some new features to improve the reliability of the downloading process for certain parts, like Game Installation/Update, Game Repair, Cache Updates and Internal APIs. The changes that worth to mention are including:

However, this PR requires some changes in some parts, including:

PR Status :

Templates

Changelog Prefixes ``` **[New]** **[Imp]** **[Fix]** **[Loc]** **[Doc]** ```
github-actions[bot] commented 3 months ago

Qodana for .NET

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked ☁️ View the detailed Qodana report

Detected 102 dependencies # Third-party software list This page lists the third-party software dependencies used in CollapseLauncher | Dependency | Version | Licenses | |--------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Clowd.Squirrel](https://github.com/clowd/Clowd.Squirrel) | 2.11.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.Common](https://github.com/CommunityToolkit/dotnet) | 8.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.Mvvm](https://github.com/CommunityToolkit/dotnet) | 8.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Animations](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Behaviors](https://www.nuget.org/packages/CommunityToolkit.WinUI.Behaviors) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Controls.ImageCropper](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Controls.Primitives](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Controls.SettingsControls](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Controls.Sizers](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Converters](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Extensions](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Helpers](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Media](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [CommunityToolkit.WinUI.Triggers](https://github.com/CommunityToolkit/Windows) | 8.1.240821 | [MIT](http://opensource.org/licenses/mit-license.php) | | [GitInfo](https://clarius.org/GitInfo) | 3.3.5 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Google.Protobuf.Tools](https://github.com/protocolbuffers/protobuf) | 3.28.0 | PROTOBUF | | [Google.Protobuf](https://github.com/protocolbuffers/protobuf) | 3.28.0 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) | | [H.GeneratedIcons.System.Drawing](https://github.com/HavenDV/H.NotifyIcon) | 2.1.3 | [MIT](http://opensource.org/licenses/mit-license.php) | | [H.NotifyIcon.WinUI](https://github.com/HavenDV/H.NotifyIcon) | 2.1.3 | [MIT](http://opensource.org/licenses/mit-license.php) | | [H.NotifyIcon](https://github.com/HavenDV/H.NotifyIcon) | 2.1.3 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Hi3Helper.ZstdNet](https://github.com/CollapseLauncher/Hi3Helper.ZstdNet) | 1.6.2 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) | | [HtmlAgilityPack](http://html-agility-pack.net/) | 1.11.65 | [MIT](http://opensource.org/licenses/mit-license.php) | | [ImageEx](https://www.nuget.org/packages/ImageEx) | 2.1.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Markdig.Signed](https://github.com/lunet-io/markdig) | 0.37.0 | [BSD-2-Clause](http://www.opensource.org/licenses/BSD-2-Clause) | | [Microsoft.CSharp](https://github.com/dotnet/corefx) | 4.7.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Microsoft.Graphics.Win2D](http://go.microsoft.com/fwlink/?LinkID=519078) | 1.2.0 | [MS-ASP-NET-WEB-OPTIMIZATION](https://www.microsoft.com/web/webpi/eula/weboptimization_1_eula_enu.htm) | | [Microsoft.NET.ILLink.Tasks](https://dot.net/) | 8.0.5 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Microsoft.NETCore.Platforms](https://www.nuget.org/packages/Microsoft.NETCore.Platforms) | 8.0.0-preview.7.23375.6 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Microsoft.NETCore.Targets](https://www.nuget.org/packages/Microsoft.NETCore.Targets) | 6.0.0-preview.4.21253.7 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Microsoft.Web.WebView2](https://aka.ms/webview) | 1.0.2651.64 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause)
BSD-MYLEX | | [Microsoft.Win32.Registry](https://github.com/dotnet/runtime) | 5.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Microsoft.Win32.SystemEvents](https://dot.net/) | 8.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Microsoft.Windows.CsWinRT](https://github.com/microsoft/cswinrt) | 2.1.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Microsoft.Windows.SDK.BuildTools](https://aka.ms/WinSDKProjectURL) | 10.0.26100.1 | PROPRIETARY-LICENSE | | [Microsoft.WindowsAppSDK](https://github.com/microsoft/windowsappsdk) | 1.6.240821007-preview2 | [MIT](http://opensource.org/licenses/mit-license.php)
[MS-DXSDK-D3DX-9.29.952.3](https://www.nuget.org/packages/Microsoft.DXSDK.D3DX/9.29.952.3/License) | | [Microsoft.Xaml.Behaviors.WinUI.Managed](http://go.microsoft.com/fwlink/?LinkID=651678) | 2.0.9 | [MIT](http://opensource.org/licenses/mit-license.php) | | [PhotoSauce.MagicScaler](https://photosauce.net/) | 0.14.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [PhotoSauce.NativeCodecs.Libwebp](https://photosauce.net/) | 1.3.2-preview3 | [MIT](http://opensource.org/licenses/mit-license.php) | | [Roman-Numerals](https://github.com/picrap/RomanNumerals) | 2.0.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [SharpCompress](https://github.com/adamhathcock/sharpcompress) | 0.37.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [SharpHDiffPatch.Core](https://github.com/CollapseLauncher/SharpHDiffPatch.Core) | 2.2.7 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Collections.Concurrent](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Collections](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Diagnostics.Debug](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Diagnostics.DiagnosticSource](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Diagnostics.EventLog](https://dot.net/) | 8.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Diagnostics.Tracing](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Drawing.Common](https://github.com/dotnet/winforms) | 8.0.8 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Globalization.Calendars](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Globalization.Extensions](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Globalization](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.IO.FileSystem.Primitives](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.IO.FileSystem](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.IO.Hashing](https://dot.net/) | 8.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.IO](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Linq](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Net.Http](https://dot.net/) | 4.3.4 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Net.Primitives](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Reflection.Primitives](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Reflection](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Resources.ResourceManager](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Runtime.Extensions](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Runtime.Handles](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Runtime.InteropServices](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Runtime.Numerics](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Runtime](https://dot.net/) | 4.3.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.AccessControl](https://dot.net/) | 6.0.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.Algorithms](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.Cng](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.Csp](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.Encoding](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.Primitives](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.ProtectedData](https://dot.net/) | 8.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Cryptography.X509Certificates](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Security.Principal.Windows](https://github.com/dotnet/runtime) | 5.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Text.Encoding.CodePages](https://dot.net/) | 8.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Text.Encoding](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Text.Encodings.Web](https://dot.net/) | 8.0.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Text.Json](https://dot.net/) | 8.0.4 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Text.RegularExpressions](https://dot.net/) | 4.3.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Threading.Tasks.Extensions](https://dot.net/) | 4.5.4 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Threading.Tasks](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [System.Threading](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [TaskScheduler](https://github.com/dahall/taskscheduler) | 2.11.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [ThisAssembly.Constants](https://clarius.org/ThisAssembly) | 1.4.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [ZstdSharp.Port](https://github.com/oleg-st/ZstdSharp) | 0.8.1 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.native.System.Net.Http](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.native.System.Security.Cryptography.Apple](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.native.System](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple](https://dot.net/) | 4.3.0 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) | | [runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl](https://dot.net/) | 4.3.2 | [MIT](http://opensource.org/licenses/mit-license.php) |
Contact Qodana team Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) - Or via our issue tracker: https://jb.gg/qodana-issue - Or share your feedback: https://jb.gg/qodana-discussions
neon-nyan commented 2 months ago

Overall, PR looks OK and works as intended (tested locally). We could cleanup the magic numbers that we use in the code, such as for specifying max thread count and such by declaring them as variables in the function but functionally it works as intended (mostly for debugging later, to make it easier). That being said, the following UI issue is encountered for Cache Repair in Hi3 GLB region. I don't have the other regions installed so cannot verify if it is region agnostic:

image

Furthermore, please make sure to fix the i18n issues before merging. Aside from that, great work!

The issue with counts has a relation with the fetching mechanism to be enumerating the assets on-the-air rather than getting all the list of the assets and placed it into List<T>. Since it's using IEnumerable<T> to enumerate the assets OTA, getting the total count is not possible because technically IEnumerable<T> doesn't have a Count property.

zakidze commented 2 months ago

can you show some pictures on how to set the limit , also is it released yet on stable version????

and also please

i want to example duriang the day i donwlaod at 100kb /sec at night i donwlaod at 1mb/sec like can planify when speed get limited and when not

if this is not added