From 358730bcc976fdc16bd47790a0dac7d1ca2ce458 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Sat, 3 Jun 2023 13:29:22 +0200 Subject: [PATCH] Cemu Panel - Added try catch to 'TryApplyCemuConfig' and check that the settings file also exists --- PCK-Studio/Features/CemuPanel.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/PCK-Studio/Features/CemuPanel.cs b/PCK-Studio/Features/CemuPanel.cs index 9a7dc1c1..49c32205 100644 --- a/PCK-Studio/Features/CemuPanel.cs +++ b/PCK-Studio/Features/CemuPanel.cs @@ -43,12 +43,21 @@ namespace PckStudio.Features private bool TryApplyCemuConfig(string settingsPath) { string cemuPath = Path.Combine(Path.GetDirectoryName(settingsPath), "Cemu.exe"); - if (File.Exists(cemuPath)) + if (File.Exists(settingsPath) && File.Exists(cemuPath)) { + try + { var xml = new XmlDocument(); xml.Load(settingsPath); GameDirectoryTextBox.Text = xml.SelectSingleNode("content").SelectSingleNode("mlc_path").InnerText; + GameDirectoryTextBox.ReadOnly = true; BrowseDirectoryBtn.Enabled = false; + } + catch (Exception ex) + { + Debug.WriteLine(ex, category: $"{nameof(CemuPanel)}:{nameof(TryApplyCemuConfig)}"); + return false; + } } return false; } @@ -70,6 +79,7 @@ namespace PckStudio.Features var configNode = xml.SelectSingleNode("config"); var mlcpathNode = configNode.SelectSingleNode("MlcPath"); GameDirectoryTextBox.Text = mlcpathNode.InnerText; + GameDirectoryTextBox.ReadOnly = true; BrowseDirectoryBtn.Enabled = false; return true; }