From 3b57b28be65cacfa189ed9ba68350cf39896f782 Mon Sep 17 00:00:00 2001 From: Kemal Setya Adhi Date: Sun, 25 Aug 2024 21:01:54 +0700 Subject: [PATCH] Adding settings for the new Hi3Helper.Http --- .../Classes/Extension/NumberExtensions.cs | 15 + .../Classes/Interfaces/Class/ProgressBase.cs | 55 ++-- .../RegionManagement/FallbackCDNUtil.cs | 4 +- .../XAMLs/MainApp/Pages/SettingsPage.xaml | 256 +++++++++++++++++- .../XAMLs/MainApp/Pages/SettingsPage.xaml.cs | 92 +++++++ .../XAMLs/MainApp/ValueConverters.cs | 72 ++++- .../Classes/Shared/Region/LauncherConfig.cs | 55 +++- Hi3Helper.Core/Lang/Locale/LangMisc.cs | 6 +- .../Lang/Locale/LangSettingsPage.cs | 35 +++ Hi3Helper.Core/Lang/en_US.json | 43 ++- 10 files changed, 590 insertions(+), 43 deletions(-) create mode 100644 CollapseLauncher/Classes/Extension/NumberExtensions.cs diff --git a/CollapseLauncher/Classes/Extension/NumberExtensions.cs b/CollapseLauncher/Classes/Extension/NumberExtensions.cs new file mode 100644 index 000000000..66256384d --- /dev/null +++ b/CollapseLauncher/Classes/Extension/NumberExtensions.cs @@ -0,0 +1,15 @@ +using Hi3Helper.Shared.Region; +using System; +using System.Runtime.CompilerServices; + +namespace CollapseLauncher.Extension +{ + internal static class NumberExtensions + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static double ClampLimitedSpeedNumber(this double speed) + => LauncherConfig.DownloadSpeedLimitCached > 0 ? + Math.Min(LauncherConfig.DownloadSpeedLimitCached, speed) : + speed; + } +} diff --git a/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs b/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs index 53a339611..281af07f5 100644 --- a/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs +++ b/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs @@ -84,7 +84,7 @@ protected virtual async void _httpClient_FetchAssetProgress(int size, DownloadPr { if (await CheckIfNeedRefreshStopwatch()) { - double speed = downloadProgress.BytesDownloaded / _stopwatch.Elapsed.TotalSeconds; + double speed = (downloadProgress.BytesDownloaded / _stopwatch.Elapsed.TotalSeconds).ClampLimitedSpeedNumber(); TimeSpan timeLeftSpan = ((downloadProgress.BytesTotal - downloadProgress.BytesDownloaded) / speed).ToTimeSpanNormalized(); double percentage = ConverterTool.GetPercentageNumber(downloadProgress.BytesDownloaded, downloadProgress.BytesTotal, 2); @@ -144,13 +144,13 @@ protected virtual async void _httpClient_RepairAssetProgress(int size, DownloadP Interlocked.Add(ref _progressAllSizeCurrent, size); if (await CheckIfNeedRefreshStopwatch()) { - double speed = _progressAllSizeCurrent / _downloadSpeedRefreshStopwatch.Elapsed.TotalSeconds; + double speed = (_progressAllSizeCurrent / _stopwatch.Elapsed.TotalSeconds).ClampLimitedSpeedNumber(); TimeSpan timeLeftSpan = ((_progressAllSizeCurrent - _progressAllSizeTotal) / speed).ToTimeSpanNormalized(); - double percentage = ConverterTool.GetPercentageNumber(_progressAllSizeCurrent, _progressAllSizeTotal, 2); + double percentagePerFile = ConverterTool.GetPercentageNumber(downloadProgress.BytesDownloaded, downloadProgress.BytesTotal, 2); lock (_progress!) { - _progress.ProgressPerFilePercentage = percentage; + _progress.ProgressPerFilePercentage = percentagePerFile; _progress.ProgressPerFileSizeCurrent = downloadProgress.BytesDownloaded; _progress.ProgressPerFileSizeTotal = downloadProgress.BytesTotal; _progress.ProgressAllSizeCurrent = _progressAllSizeCurrent; @@ -258,7 +258,7 @@ protected virtual async void _httpClient_UpdateAssetProgress(int size, DownloadP if (await CheckIfNeedRefreshStopwatch()) { double speed = _progressAllSizeCurrent / _stopwatch.Elapsed.TotalSeconds; - TimeSpan timeLeftSpan = ((_progressAllSizeTotal - _progressAllSizeCurrent) / speed).ToTimeSpanNormalized(); + TimeSpan timeLeftSpan = ((_progressAllSizeTotal - _progressAllSizeCurrent) / speed.ClampLimitedSpeedNumber()).ToTimeSpanNormalized(); double percentage = ConverterTool.GetPercentageNumber(_progressAllSizeCurrent, _progressAllSizeTotal, 2); // Update current progress percentages and speed @@ -952,40 +952,25 @@ protected bool SummarizeStatusAndProgress(List assetIndex, string msgIfFound } protected virtual bool IsArrayMatch(ReadOnlySpan source, ReadOnlySpan target) => source.SequenceEqual(target); - + +#nullable enable protected virtual async Task RunDownloadTask(long assetSize, string assetPath, string assetURL, - DownloadClient downloadClient, DownloadProgressDelegate downloadProgress, CancellationToken token, bool isOverwrite = true) + DownloadClient downloadClient, DownloadProgressDelegate downloadProgress, CancellationToken token, bool isOverwrite = true, + EventHandler? downloadSpeedLimitChanged = null) { // Always do multi-session download with the new DownloadClient regardless of any sizes (if applicable) - if (assetSize < 10 << 10) - { - using FileStream fileStream = File.Open( - EnsureCreationOfDirectory(assetPath), - isOverwrite ? - FileMode.Create : - FileMode.OpenOrCreate, - FileAccess.ReadWrite, - FileShare.ReadWrite); - - await downloadClient.DownloadAsync( - assetURL, - fileStream, - !isOverwrite, - progressDelegateAsync: downloadProgress, - cancelToken: token - ); - } - else - { - await downloadClient.DownloadAsync( - assetURL, - EnsureCreationOfDirectory(assetPath), - isOverwrite, - progressDelegateAsync: downloadProgress, - cancelToken: token - ); - } + await downloadClient.DownloadAsync( + assetURL, + EnsureCreationOfDirectory(assetPath), + isOverwrite, + sessionChunkSize: LauncherConfig.DownloadChunkSize, + progressDelegateAsync: downloadProgress, + cancelToken: token, + downloadSpeedLimitEvent: downloadSpeedLimitChanged, + initialDownloadSpeed: LauncherConfig.DownloadSpeedLimitCached + ); } +#nullable restore protected virtual async Task RunDownloadTask(long assetSize, string assetPath, string assetURL, Http _httpClient, CancellationToken token) { diff --git a/CollapseLauncher/Classes/RegionManagement/FallbackCDNUtil.cs b/CollapseLauncher/Classes/RegionManagement/FallbackCDNUtil.cs index 7c474d1f9..8bff6178f 100644 --- a/CollapseLauncher/Classes/RegionManagement/FallbackCDNUtil.cs +++ b/CollapseLauncher/Classes/RegionManagement/FallbackCDNUtil.cs @@ -389,7 +389,7 @@ private static async ValueTask TryGetCDNContent(CDNURLProperty cdnProp, Do if (!urlStatus.Item1) return false; // Continue to get the content and return true if successful - await downloadClient.DownloadAsync(urlStatus.Item2, outputStream, false, HttpInstance_DownloadProgressAdapter, null, null, token); + await downloadClient.DownloadAsync(urlStatus.Item2, outputStream, false, HttpInstance_DownloadProgressAdapter, null, null, cancelToken:token); return true; } // Handle the error and log it. If fails, then log it and return false @@ -415,7 +415,7 @@ private static async ValueTask TryGetCDNContent(CDNURLProperty cdnProp, Do { // If the CDN marked to not supporting the partial download, then use single thread mode download. using FileStream stream = File.Create(outputPath); - await downloadClient.DownloadAsync(urlStatus.Item2, stream, false, HttpInstance_DownloadProgressAdapter, null, null, token); + await downloadClient.DownloadAsync(urlStatus.Item2, stream, false, HttpInstance_DownloadProgressAdapter, null, null, cancelToken:token); return true; } await downloadClient.DownloadAsync(urlStatus.Item2, outputPath, true, progressDelegateAsync: HttpInstance_DownloadProgressAdapter, maxConnectionSessions: parallelThread, cancelToken: token); diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml b/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml index da8c6ef45..493bc6bf1 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml +++ b/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml @@ -9,6 +9,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:CollapseLauncher.Extension" xmlns:helper="using:Hi3Helper" + xmlns:helperData="using:Hi3Helper.Data" xmlns:innerConfig="using:Hi3Helper.Shared.Region" xmlns:localWindowSize="using:CollapseLauncher.WindowSize" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -20,6 +21,9 @@ + + + @@ -563,6 +567,246 @@ Minimum="10" SpinButtonPlacementMode="Compact" Value="{x:Bind HttpClientTimeout, Mode=TwoWay}" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -712,7 +965,8 @@ SpinButtonPlacementMode="Compact" Value="{x:Bind CurrentAppThreadExtractValue, Mode=TwoWay}" /> - diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs b/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs index 9a3b91f7c..f2cb25bc9 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs @@ -40,6 +40,7 @@ using MediaType = CollapseLauncher.Helper.Background.BackgroundMediaUtility.MediaType; using TaskSched = Microsoft.Win32.TaskScheduler.Task; using Task = System.Threading.Tasks.Task; +using Windows.Storage.Search; // ReSharper disable CheckNamespace // ReSharper disable PossibleNullReferenceException @@ -1265,7 +1266,98 @@ private string? HttpProxyPassword SetAndSaveConfigValue("HttpProxyPassword", protectedString, true); } } + + private bool IsBurstDownloadModeEnabled + { + get => LauncherConfig.IsBurstDownloadModeEnabled; + set => LauncherConfig.IsBurstDownloadModeEnabled = value; + } + + private bool IsUseDownloadSpeedLimiter + { + get + { + bool value = LauncherConfig.IsUseDownloadSpeedLimiter; + NetworkDownloadSpeedLimitGrid.Opacity = value ? 1 : 0.45; + if (value) + NetworkBurstDownloadModeToggle.IsOn = false; + NetworkBurstDownloadModeToggle.IsEnabled = !value; + return value; + } + set + { + NetworkDownloadSpeedLimitGrid.Opacity = value ? 1 : 0.45; + if (value) + NetworkBurstDownloadModeToggle.IsOn = false; + NetworkBurstDownloadModeToggle.IsEnabled = !value; + LauncherConfig.IsUseDownloadSpeedLimiter = value; + } + } + + private bool IsUsePreallocatedDownloader + { + get + { + bool value = LauncherConfig.IsUsePreallocatedDownloader; + NetworkDownloadChunkSizeGrid.Opacity = value ? 1 : 0.45; + OldDownloadChunksMergingToggle.IsEnabled = !value; + + if (!value) + { + NetworkDownloadSpeedLimitToggle.IsOn = value; + NetworkBurstDownloadModeToggle.IsOn = value; + } + NetworkDownloadSpeedLimitToggle.IsEnabled = value; + NetworkBurstDownloadModeToggle.IsEnabled = value; + return value; + } + set + { + NetworkDownloadChunkSizeGrid.Opacity = value ? 1 : 0.45; + OldDownloadChunksMergingToggle.IsEnabled = !value; + + if (!value) + { + NetworkDownloadSpeedLimitToggle.IsOn = value; + NetworkBurstDownloadModeToggle.IsOn = value; + } + NetworkDownloadSpeedLimitToggle.IsEnabled = value; + NetworkBurstDownloadModeToggle.IsEnabled = value; + LauncherConfig.IsUsePreallocatedDownloader = value; + } + } + + private double DownloadSpeedLimit + { + get + { + double val = LauncherConfig.DownloadSpeedLimit; + double valDividedM = val / (1 << 20); + return valDividedM; + } + set + { + long valBfromM = (long)(value * (1 << 20)); + + LauncherConfig.DownloadSpeedLimit = Math.Max(valBfromM, 0); + } + } + private double DownloadChunkSize + { + get + { + double val = LauncherConfig.DownloadChunkSize; + double valDividedM = val / (1 << 20); + return valDividedM; + } + set + { + int valBfromM = (int)(value * (1 << 20)); + + LauncherConfig.DownloadChunkSize = Math.Max(valBfromM, 0); + } + } #nullable restore #endregion diff --git a/CollapseLauncher/XAMLs/MainApp/ValueConverters.cs b/CollapseLauncher/XAMLs/MainApp/ValueConverters.cs index a8a0810d5..cc9f56a95 100644 --- a/CollapseLauncher/XAMLs/MainApp/ValueConverters.cs +++ b/CollapseLauncher/XAMLs/MainApp/ValueConverters.cs @@ -1,7 +1,9 @@ -using Hi3Helper.Data; +using Hi3Helper; +using Hi3Helper.Data; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Data; using System; +using Windows.Globalization.NumberFormatting; namespace CollapseLauncher.Pages { @@ -56,4 +58,72 @@ public class FileSizeToStringLiteralConverter : IValueConverter public object Convert(object value, Type targetType, object parameter, string input) => ConverterTool.SummarizeSizeSimple((long)value); public object ConvertBack(object value, Type targetType, object parameter, string input) => new NotImplementedException(); } + + public class DownloadSpeedLimitToStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is double asDouble) + { + long valBfromM = (long)(asDouble * (1 << 20)); + return valBfromM > 0 ? + string.Format(Locale.Lang._Misc.IsBytesMoreThanBytes, valBfromM, string.Format(Locale.Lang._Misc.SpeedPerSec, ConverterTool.SummarizeSizeSimple(valBfromM))) : + string.Format(Locale.Lang._Misc.IsBytesUnlimited); + } + return Locale.Lang._Misc.IsBytesNotANumber; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } + + public class DownloadChunkSizeToStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is double asDouble) + { + int valBfromM = (int)(asDouble * (1 << 20)); + return valBfromM > 0 ? + string.Format(Locale.Lang._Misc.IsBytesMoreThanBytes, valBfromM, ConverterTool.SummarizeSizeSimple(valBfromM)) : + string.Format(Locale.Lang._Misc.IsBytesUnlimited); + } + return Locale.Lang._Misc.IsBytesNotANumber; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } + + public class BooleanToOpacityDimmConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is bool asBoolean) + return asBoolean ? 1 : 0.45; + + return 0.45; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } + + public class DoubleFormatter : INumberFormatter2, INumberParser + { + private const string Format = "{0:F5}"; + public string FormatDouble(double value) => string.Format(Format, value); + public double? ParseDouble(string text) => double.TryParse(text, out var dbl) ? dbl : null; + + public string FormatInt(long value) => throw new NotSupportedException(); + public string FormatUInt(ulong value) => throw new NotSupportedException(); + public long? ParseInt(string text) => throw new NotSupportedException(); + public ulong? ParseUInt(string text) => throw new NotSupportedException(); + } } diff --git a/Hi3Helper.Core/Classes/Shared/Region/LauncherConfig.cs b/Hi3Helper.Core/Classes/Shared/Region/LauncherConfig.cs index 45c6846dd..e599385f6 100644 --- a/Hi3Helper.Core/Classes/Shared/Region/LauncherConfig.cs +++ b/Hi3Helper.Core/Classes/Shared/Region/LauncherConfig.cs @@ -1,4 +1,5 @@ using Hi3Helper.Data; +using Hi3Helper.Http; using Hi3Helper.Screen; using Hi3Helper.Shared.ClassStruct; using System; @@ -76,6 +77,10 @@ public static void InitAppPreset() // Assign boolean if IsConfigFileExist and IsUserHasPermission. IsFirstInstall = !(IsConfigFileExist && IsUserHasPermission); + + // Initialize the DownloadClient speed at start. + // ignored + _ = DownloadSpeedLimit; } public static bool IsConfigKeyExist(string key) => appIni.Profile![SectionName!]!.ContainsKey(key!); @@ -300,6 +305,50 @@ public static bool IsBurstDownloadModeEnabled set => SetAndSaveConfigValue("IsBurstDownloadModeEnabled", value); } + public static bool IsUsePreallocatedDownloader + { + get => GetAppConfigValue("IsUsePreallocatedDownloader").ToBoolNullable() ?? true; + set => SetAndSaveConfigValue("IsUsePreallocatedDownloader", value); + } + + public static bool IsUseDownloadSpeedLimiter + { + get => GetAppConfigValue("IsUseDownloadSpeedLimiter").ToBoolNullable() ?? true; + set + { + SetAndSaveConfigValue("IsUseDownloadSpeedLimiter", value); + + _ = DownloadSpeedLimit; + } + } + + public static long DownloadSpeedLimit + { + get => DownloadSpeedLimitCached = GetAppConfigValue("DownloadSpeedLimit").ToLong(); + set => SetAndSaveConfigValue("DownloadSpeedLimit", DownloadSpeedLimitCached = value); + } + + public static int DownloadChunkSize + { + get => GetAppConfigValue("DownloadChunkSize").ToInt(); + set => SetAndSaveConfigValue("DownloadChunkSize", value); + } + + private static long _downloadSpeedLimitCached = 0; // Default: 0 == Unlimited + public static long DownloadSpeedLimitCached + { + get => _downloadSpeedLimitCached; + set + { + _downloadSpeedLimitCached = IsUseDownloadSpeedLimiter ? value : 0; + DownloadSpeedLimitChanged?.Invoke(null, _downloadSpeedLimitCached); + } + } + +#nullable enable + public static event EventHandler? DownloadSpeedLimitChanged; +#nullable restore + private static bool? _cachedIsInstantRegionChange = null; public static bool IsInstantRegionChange { @@ -381,7 +430,11 @@ public static Guid GetGuid(int sessionNum) { "IsAllowHttpRedirections", true }, { "IsAllowHttpCookies", false }, { "IsAllowUntrustedCert", false }, - { "IsBurstDownloadModeEnabled", false }, + { "IsUseDownloadSpeedLimiter", false }, + { "IsUsePreallocatedDownloader", true }, + { "IsBurstDownloadModeEnabled", true }, + { "DownloadSpeedLimit", 0 }, + { "DownloadChunkSize", 4 << 20 }, { "HttpProxyUrl", string.Empty }, { "HttpProxyUsername", string.Empty }, { "HttpProxyPassword", string.Empty }, diff --git a/Hi3Helper.Core/Lang/Locale/LangMisc.cs b/Hi3Helper.Core/Lang/Locale/LangMisc.cs index ddc785ff9..5f78d227b 100644 --- a/Hi3Helper.Core/Lang/Locale/LangMisc.cs +++ b/Hi3Helper.Core/Lang/Locale/LangMisc.cs @@ -127,7 +127,11 @@ public sealed class LangMisc public string IAcceptAgreement { get; set; } = LangFallback?._Misc.IAcceptAgreement; public string IDoNotAcceptAgreement { get; set; } = LangFallback?._Misc.IDoNotAcceptAgreement; - public string ImageCropperTitle { get; set; } = LangFallback?._Misc.ImageCropperTitle; + public string ImageCropperTitle { get; set; } = LangFallback?._Misc.ImageCropperTitle; + + public string IsBytesMoreThanBytes { get; set; } = LangFallback?._Misc.IsBytesMoreThanBytes; + public string IsBytesUnlimited { get; set; } = LangFallback?._Misc.IsBytesUnlimited; + public string IsBytesNotANumber { get; set; } = LangFallback?._Misc.IsBytesNotANumber; } } #endregion diff --git a/Hi3Helper.Core/Lang/Locale/LangSettingsPage.cs b/Hi3Helper.Core/Lang/Locale/LangSettingsPage.cs index b8a6a0721..3d323e86b 100644 --- a/Hi3Helper.Core/Lang/Locale/LangSettingsPage.cs +++ b/Hi3Helper.Core/Lang/Locale/LangSettingsPage.cs @@ -48,6 +48,8 @@ public sealed class LangSettingsPage public string AppThreads_Attention4 { get; set; } = LangFallback?._SettingsPage.AppThreads_Attention4; public string AppThreads_Attention5 { get; set; } = LangFallback?._SettingsPage.AppThreads_Attention5; public string AppThreads_Attention6 { get; set; } = LangFallback?._SettingsPage.AppThreads_Attention6; + public string AppThreads_AttentionTop1 { get; set; } = LangFallback?._SettingsPage.AppThreads_AttentionTop1; + public string AppThreads_AttentionTop2 { get; set; } = LangFallback?._SettingsPage.AppThreads_AttentionTop2; public string DiscordRPC { get; set; } = LangFallback?._SettingsPage.DiscordRPC; public string DiscordRPC_Toggle { get; set; } = LangFallback?._SettingsPage.DiscordRPC_Toggle; public string DiscordRPC_GameStatusToggle { get; set; } = LangFallback?._SettingsPage.DiscordRPC_GameStatusToggle; @@ -153,6 +155,39 @@ public sealed class LangSettingsPage public string NetworkSettings_ProxyTest_ButtonChecking { get; set; } = LangFallback?._SettingsPage.NetworkSettings_ProxyTest_ButtonChecking; public string NetworkSettings_ProxyTest_ButtonSuccess { get; set; } = LangFallback?._SettingsPage.NetworkSettings_ProxyTest_ButtonSuccess; public string NetworkSettings_ProxyTest_ButtonFailed { get; set; } = LangFallback?._SettingsPage.NetworkSettings_ProxyTest_ButtonFailed; + + public string FileDownloadSettings_Title { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_Title; + public string FileDownloadSettings_SpeedLimit_Title { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_SpeedLimit_Title; + public string FileDownloadSettings_SpeedLimit_NumBox { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_SpeedLimit_NumBox; + public string FileDownloadSettings_SpeedLimitHelp1 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_SpeedLimitHelp1; + public string FileDownloadSettings_SpeedLimitHelp2 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_SpeedLimitHelp2; + public string FileDownloadSettings_SpeedLimitHelp3 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_SpeedLimitHelp3; + public string FileDownloadSettings_SpeedLimitHelp4 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_SpeedLimitHelp4; + public string FileDownloadSettings_SpeedLimitHelp5 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_SpeedLimitHelp5; + + public string FileDownloadSettings_NewPreallocChunk_Title { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunk_Title; + public string FileDownloadSettings_NewPreallocChunk_Subtitle { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunk_Subtitle; + public string FileDownloadSettings_NewPreallocChunk_NumBox { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunk_NumBox; + public string FileDownloadSettings_NewPreallocChunkHelp1 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp1; + public string FileDownloadSettings_NewPreallocChunkHelp2 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp2; + public string FileDownloadSettings_NewPreallocChunkHelp3 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp3; + public string FileDownloadSettings_NewPreallocChunkHelp4 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp4; + public string FileDownloadSettings_NewPreallocChunkHelp5 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp5; + public string FileDownloadSettings_NewPreallocChunkHelp6 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp6; + public string FileDownloadSettings_NewPreallocChunkHelp7 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp7; + public string FileDownloadSettings_NewPreallocChunkHelp8 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp8; + public string FileDownloadSettings_NewPreallocChunkHelp9 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp9; + public string FileDownloadSettings_NewPreallocChunkHelp10 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_NewPreallocChunkHelp10; + + public string FileDownloadSettings_BurstDownload_Title { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownload_Title; + public string FileDownloadSettings_BurstDownload_Subtitle { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownload_Subtitle; + public string FileDownloadSettings_BurstDownloadHelp1 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownloadHelp1; + public string FileDownloadSettings_BurstDownloadHelp2 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownloadHelp2; + public string FileDownloadSettings_BurstDownloadHelp3 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownloadHelp3; + public string FileDownloadSettings_BurstDownloadHelp4 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownloadHelp4; + public string FileDownloadSettings_BurstDownloadHelp5 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownloadHelp5; + public string FileDownloadSettings_BurstDownloadHelp6 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownloadHelp6; + public string FileDownloadSettings_BurstDownloadHelp7 { get; set; } = LangFallback?._SettingsPage.FileDownloadSettings_BurstDownloadHelp7; } } #endregion diff --git a/Hi3Helper.Core/Lang/en_US.json b/Hi3Helper.Core/Lang/en_US.json index 43bfc1b1d..87c7e7879 100644 --- a/Hi3Helper.Core/Lang/en_US.json +++ b/Hi3Helper.Core/Lang/en_US.json @@ -463,6 +463,8 @@ "AppThreads_Attention4": "the value if you have an existing download as it might", "AppThreads_Attention5": "RE-DOWNLOAD THE ENTIRE THING", "AppThreads_Attention6": "due to the session count needed for the download do not match.", + "AppThreads_AttentionTop1": "The issues below will no longer occur if you have", + "AppThreads_AttentionTop2": "setting enabled.", "DiscordRPC": "Discord Rich Presence", "DiscordRPC_Toggle": "Show Discord Presence", @@ -578,7 +580,40 @@ "NetworkSettings_Http_Redirect": "Allow HTTP Redirection", "NetworkSettings_Http_SimulateCookies": "Allow Simulate HTTP Cookies", "NetworkSettings_Http_UntrustedHttps": "Allow Untrusted HTTPS Certificate", - "NetworkSettings_Http_Timeout": "HTTP Client Timeout (in Seconds)" + "NetworkSettings_Http_Timeout": "HTTP Client Timeout (in Seconds)", + + "FileDownloadSettings_Title": "File Download Settings", + "FileDownloadSettings_SpeedLimit_Title": "Limit Download Speed", + "FileDownloadSettings_SpeedLimit_NumBox": "Speed Limit (in MiB unit)", + "FileDownloadSettings_SpeedLimitHelp1": "Default:", + "FileDownloadSettings_SpeedLimitHelp2": "Speed Limit value range:", + "FileDownloadSettings_SpeedLimitHelp3": "1 - 1000 MiB/s", + "FileDownloadSettings_SpeedLimitHelp4": "Limiting the bandwidth for download. This setting cannot be used alongside", + "FileDownloadSettings_SpeedLimitHelp5": "setting.", + + "FileDownloadSettings_NewPreallocChunk_Title": "New Pre-allocated Downloader", + "FileDownloadSettings_NewPreallocChunk_Subtitle": "For Game Installation, Game Repair and Cache Updates only.", + "FileDownloadSettings_NewPreallocChunk_NumBox": "Chunk Size (in MiB unit)", + "FileDownloadSettings_NewPreallocChunkHelp1": "Default:", + "FileDownloadSettings_NewPreallocChunkHelp2": "Chunk Size value range:", + "FileDownloadSettings_NewPreallocChunkHelp3": "1 - 32 MiB", + "FileDownloadSettings_NewPreallocChunkHelp4": "When enabled, the downloader will dynamically pre-allocate the size of the file while downloading it.", + "FileDownloadSettings_NewPreallocChunkHelp5": "This enables the downloader to directly writes data chunks into the file without splitting it into separate files.", + "FileDownloadSettings_NewPreallocChunkHelp6": "When disabled, the launcher will use an old method where data chunks will be written into separate files. It will also disable", + "FileDownloadSettings_NewPreallocChunkHelp7": "and", + "FileDownloadSettings_NewPreallocChunkHelp8": "settings.", + "FileDownloadSettings_NewPreallocChunkHelp9": "Note:", + "FileDownloadSettings_NewPreallocChunkHelp10": "This feature is only available for Game Installation (including Initial Install, Update and Preload), Game Repair and Cache Update.", + + "FileDownloadSettings_BurstDownload_Title": "Burst File-Download Mode", + "FileDownloadSettings_BurstDownload_Subtitle": "For Game Repair and Cache Updates only.", + "FileDownloadSettings_BurstDownloadHelp1": "Default:", + "FileDownloadSettings_BurstDownloadHelp2": "When enabled, this feature will allow the download process on", + "FileDownloadSettings_BurstDownloadHelp3": "and", + "FileDownloadSettings_BurstDownloadHelp4": "feature to run in parallel at the same time to speed up the download process.", + "FileDownloadSettings_BurstDownloadHelp5": "When disabled, the download process on", + "FileDownloadSettings_BurstDownloadHelp6": "and", + "FileDownloadSettings_BurstDownloadHelp7": "will use a sequential download process." }, "_Misc": { @@ -706,7 +741,11 @@ "LauncherNameSteam": "Steam", "LauncherNameUnknown": "(Launcher Name is Unknown)", - "ImageCropperTitle": "Crop the image" + "ImageCropperTitle": "Crop the image", + + "IsBytesMoreThanBytes": "= {0} bytes (-/+ {1})", + "IsBytesUnlimited": "= Unlimited", + "IsBytesNotANumber": "= NaN" }, "_BackgroundNotification": {