From 9eba20f28aef6a1e5f2a1590cf2b3a385f7e7c1e Mon Sep 17 00:00:00 2001 From: fyr77 Date: Mon, 26 Feb 2024 19:46:46 +0100 Subject: [PATCH] save autodl setting --- EnvyUpdate/MainWindow.xaml.cs | 6 ++++++ EnvyUpdate/SettingsPage.xaml.cs | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index d139842..6522ee3 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -115,6 +115,12 @@ namespace EnvyUpdate GlobalVars.isMobile = Util.IsMobile(); Debug.LogToFile("INFO Mobile: " + GlobalVars.isMobile); + + if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy"))) + { + Debug.LogToFile("INFO Auto-download is enabled."); + GlobalVars.autoDownload = true; + } } private void Window_StateChanged(object sender, EventArgs e) { diff --git a/EnvyUpdate/SettingsPage.xaml.cs b/EnvyUpdate/SettingsPage.xaml.cs index 6534512..77698d7 100644 --- a/EnvyUpdate/SettingsPage.xaml.cs +++ b/EnvyUpdate/SettingsPage.xaml.cs @@ -95,11 +95,19 @@ namespace EnvyUpdate private void chkAutodl_Checked(object sender, RoutedEventArgs e) { GlobalVars.autoDownload = true; + if (!File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy"))) + { + File.Create(Path.Combine(GlobalVars.saveDirectory, "autodl.envy")); + } } private void chkAutodl_Unchecked(object sender, RoutedEventArgs e) { GlobalVars.autoDownload = false; + if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy"))) + { + File.Delete(Path.Combine(GlobalVars.saveDirectory, "autodl.envy")); + } } } }