diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index d6f531d..e44dd49 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -191,6 +191,30 @@ namespace Bloxstrap ClientVersion clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel); + if (clientVersion.IsBehindDefaultChannel) + { + MessageBoxResult action = App.Settings.Prop.ChannelChangeMode switch + { + ChannelChangeMode.Prompt => Controls.ShowMessageBox( + $"The channel you're currently on ({App.Settings.Prop.Channel}) is out of date, and appears to no longer be receiving updates.\n" + + $"Would you like to switch to the default channel ({RobloxDeployment.DefaultChannel})?", + MessageBoxImage.Warning, + MessageBoxButton.YesNo + ), + ChannelChangeMode.Automatic => MessageBoxResult.Yes, + ChannelChangeMode.Ignore => MessageBoxResult.No, + _ => MessageBoxResult.None + }; + + if (action == MessageBoxResult.Yes) + { + App.Logger.WriteLine("Bootstrapper::CheckLatestVersion", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {RobloxDeployment.DefaultChannel}"); + + App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel; + clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel); + } + } + _latestVersionGuid = clientVersion.VersionGuid; _versionFolder = Path.Combine(Paths.Versions, _latestVersionGuid); _versionPackageManifest = await PackageManifest.Get(_latestVersionGuid); diff --git a/Bloxstrap/ProtocolHandler.cs b/Bloxstrap/ProtocolHandler.cs index c0fdd94..44ff873 100644 --- a/Bloxstrap/ProtocolHandler.cs +++ b/Bloxstrap/ProtocolHandler.cs @@ -94,7 +94,7 @@ namespace Bloxstrap return; } - App.Logger.WriteLine("Protocol::ParseUri", $"Changed Roblox build channel from {App.Settings.Prop.Channel} to {channel}"); + App.Logger.WriteLine("Protocol::ParseUri", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {channel}"); App.Settings.Prop.Channel = channel; } diff --git a/Bloxstrap/RobloxDeployment.cs b/Bloxstrap/RobloxDeployment.cs index bc04a53..cec53f2 100644 --- a/Bloxstrap/RobloxDeployment.cs +++ b/Bloxstrap/RobloxDeployment.cs @@ -120,7 +120,15 @@ namespace Bloxstrap clientVersion = JsonSerializer.Deserialize(rawResponse)!; } - + + // check if channel is behind LIVE + if (channel != DefaultChannel) + { + var defaultClientVersion = await GetInfo(DefaultChannel); + + if (Utilities.CompareVersions(clientVersion.Version, defaultClientVersion.Version) == -1) + clientVersion.IsBehindDefaultChannel = true; + } // for preferences if (extraInformation && clientVersion.Timestamp is null) @@ -138,15 +146,6 @@ namespace Bloxstrap App.Logger.WriteLine(LOG_IDENT, $"{manifestUrl} - Last-Modified: {lastModified}"); clientVersion.Timestamp = DateTime.Parse(lastModified).ToLocalTime(); } - - // check if channel is behind LIVE - if (channel != DefaultChannel) - { - var defaultClientVersion = await GetInfo(DefaultChannel); - - if (Utilities.CompareVersions(clientVersion.Version, defaultClientVersion.Version) == -1) - clientVersion.IsBehindDefaultChannel = true; - } } ClientVersionCache[channel] = clientVersion;