diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index ea0cd74..265891a 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -18,6 +18,7 @@ using System.Windows.Forms; using System.Windows.Shell; using Microsoft.Win32; +using Windows.Networking.Connectivity; using Bloxstrap.AppData; using Bloxstrap.RobloxInterfaces; @@ -578,6 +579,24 @@ namespace Bloxstrap string version = App.Version; #endif + // check if we are on a metered connection, as updating Bloxstrap might incur additional costs + var profile = NetworkInformation.GetInternetConnectionProfile(); + bool meteredConnection = (profile != null) && (profile.GetConnectionCost().NetworkCostType != NetworkCostType.Unrestricted); + + if (meteredConnection) + { + App.Logger.WriteLine(LOG_IDENT, "Metered connection detected"); + + var result = Frontend.ShowMessageBox( + Strings.Bootstrapper_AutoUpdateMetered, + MessageBoxImage.Exclamation, + MessageBoxButton.YesNo + ); + + if (result != MessageBoxResult.Yes) + return false; + } + SetStatus(Strings.Bootstrapper_Status_UpgradingBloxstrap); try diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index fd14b8f..006aabd 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -160,6 +160,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to An update for Bloxstrap is available, but it has been detected you are currently using a metered connection. Would you like to update now?. + /// + public static string Bootstrapper_AutoUpdateMetered { + get { + return ResourceManager.GetString("Bootstrapper.AutoUpdateMetered", resourceCulture); + } + } + /// /// Looks up a localized string similar to Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching?. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index c8a5479..3b60744 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1267,4 +1267,7 @@ Please close any applications that may be using Roblox's files, and relaunch.All Bloxstrap logs Label that appears next to a checkbox + + An update for Bloxstrap is available, but it has been detected you are currently using a metered connection. Would you like to update now? + \ No newline at end of file