mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-16 02:01:29 -07:00
add exception handling to jsonmanager save
This commit is contained in:
parent
c58a8ab739
commit
3f438e99b1
@ -60,7 +60,21 @@ namespace Bloxstrap
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Saving to {FileLocation}...");
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(FileLocation)!);
|
||||
File.WriteAllText(FileLocation, JsonSerializer.Serialize(Prop, new JsonSerializerOptions { WriteIndented = true }));
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(FileLocation, JsonSerializer.Serialize(Prop, new JsonSerializerOptions { WriteIndented = true }));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
App.Logger.WriteLine(LOG_IDENT, "Failed to save");
|
||||
App.Logger.WriteException(LOG_IDENT, ex);
|
||||
|
||||
string errorMessage = string.Format(Resources.Strings.Bootstrapper_JsonManagerSaveFailed, ClassName, ex.Message);
|
||||
Frontend.ShowMessageBox(errorMessage, System.Windows.MessageBoxImage.Warning);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
App.Logger.WriteLine(LOG_IDENT, "Save complete!");
|
||||
}
|
||||
|
9
Bloxstrap/Resources/Strings.Designer.cs
generated
9
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -170,6 +170,15 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to save {0}: {1}.
|
||||
/// </summary>
|
||||
public static string Bootstrapper_JsonManagerSaveFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("Bootstrapper.JsonManagerSaveFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bloxstrap does not have enough disk space to download and install Roblox. Please free up some disk space and try again..
|
||||
/// </summary>
|
||||
|
@ -1192,4 +1192,7 @@ Please manually delete Bloxstrap.exe from the install location or try restarting
|
||||
<data name="Common.RobloxNotInstalled" xml:space="preserve">
|
||||
<value>Roblox has not yet been installed. Please launch Roblox using Bloxstrap at least once before trying to use this option.</value>
|
||||
</data>
|
||||
<data name="Bootstrapper.JsonManagerSaveFailed" xml:space="preserve">
|
||||
<value>Failed to save {0}: {1}</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user