Fix issues causing keyboard profiles to throw errors on load. (#1206)

* Fix issues causing keyboard profiles to throw errors on load.

* Re-add space before the using aliases
This commit is contained in:
riperiperi 2020-05-03 19:42:17 +01:00 committed by GitHub
parent cf1ea4d155
commit 28e12dad0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,17 +1,17 @@
using Gtk; using Gtk;
using OpenTK.Input; using OpenTK.Input;
using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Utilities;
using Ryujinx.Configuration;
using Ryujinx.HLE.FileSystem;
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Text.Json;
using System.Threading; using System.Threading;
using Ryujinx.Configuration;
using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Utilities;
using Ryujinx.HLE.FileSystem;
using GUI = Gtk.Builder.ObjectAttribute; using GUI = Gtk.Builder.ObjectAttribute;
using Key = Ryujinx.Configuration.Hid.Key; using Key = Ryujinx.Configuration.Hid.Key;
using Ryujinx.Common.Logging;
namespace Ryujinx.Ui namespace Ryujinx.Ui
{ {
@ -821,20 +821,23 @@ namespace Ryujinx.Ui
return; return;
} }
using (Stream stream = File.OpenRead(path)) try
{ {
try using (Stream stream = File.OpenRead(path))
{ {
config = JsonHelper.Deserialize<ControllerConfig>(stream); config = JsonHelper.Deserialize<ControllerConfig>(stream);
} }
catch (ArgumentException) }
catch (JsonException)
{
try
{ {
try using (Stream stream = File.OpenRead(path))
{ {
config = JsonHelper.Deserialize<KeyboardConfig>(stream); config = JsonHelper.Deserialize<KeyboardConfig>(stream);
} }
catch { }
} }
catch { }
} }
} }