Catch invalid skin file

I accidentally tried to load 0.0.x skin file, and it crashed. Added a
try/catch around it and if caught, give an infobox saying "This skin is
not compatible with this version of ShiftOS.".
This commit is contained in:
AShifter 2017-05-02 20:08:43 -06:00
parent 5b8d350af0
commit 2fede89938

View file

@ -313,7 +313,15 @@ namespace ShiftOS.WinForms.Applications
{
AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action<string>((filename) =>
{
LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename));
try
{
LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename));
}
catch
{
Infobox.Show("Invalid Skin", "This skin is not compatible with this version of ShiftOS.");
}
SetupUI();
})));
}