handle not being able to fetch emoji preset

This commit is contained in:
bluepilledgreat 2024-05-04 17:07:34 +01:00
parent c386695078
commit 052324d276
3 changed files with 26 additions and 3 deletions

View File

@ -4,6 +4,7 @@ using System.Windows.Forms;
using Microsoft.Win32;
using Bloxstrap.Integrations;
using Bloxstrap.Resources;
namespace Bloxstrap
{
@ -1185,9 +1186,19 @@ namespace Bloxstrap
Directory.CreateDirectory(contentFonts);
var response = await App.HttpClient.GetAsync(App.Settings.Prop.EmojiType.GetUrl());
await using var fileStream = new FileStream(emojiFontLocation, FileMode.CreateNew);
await response.Content.CopyToAsync(fileStream);
try
{
var response = await App.HttpClient.GetAsync(App.Settings.Prop.EmojiType.GetUrl());
response.EnsureSuccessStatusCode();
await using var fileStream = new FileStream(emojiFontLocation, FileMode.CreateNew);
await response.Content.CopyToAsync(fileStream);
}
catch (HttpRequestException ex)
{
App.Logger.WriteLine(LOG_IDENT, $"Failed to fetch emoji preset from Github: {ex}");
Frontend.ShowMessageBox(string.Format(Strings.Bootstrapper_EmojiPresetFetchFailed, App.Settings.Prop.EmojiType), MessageBoxImage.Error);
App.Settings.Prop.EmojiType = EmojiType.Default;
}
}
// check custom font mod

View File

@ -133,6 +133,15 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Failed to fetch the {0} emoji preset. Your preferred emoji type has been set back to default..
/// </summary>
public static string Bootstrapper_EmojiPresetFetchFailed {
get {
return ResourceManager.GetString("Bootstrapper.EmojiPresetFetchFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You must first install Bloxstrap before uninstalling..
/// </summary>

View File

@ -142,6 +142,9 @@ Would you like to switch to the default channel ({1})?</value>
<data name="Bootstrapper.DeeplinkTempEnabled" xml:space="preserve">
<value>Roblox was launched via a deeplink, however the desktop app is required for deeplink launching to work. Because you've opted to disable the desktop app, it will temporarily be re-enabled for this launch only.</value>
</data>
<data name="Bootstrapper.EmojiPresetFetchFailed" xml:space="preserve">
<value>Failed to fetch the {0} emoji preset. Your preferred emoji type has been set back to default.</value>
</data>
<data name="Bootstrapper.FirstRunUninstall" xml:space="preserve">
<value>You must first install Bloxstrap before uninstalling.</value>
</data>