From c3a0963e609bc71279841efd8ca72fb9a842c48d Mon Sep 17 00:00:00 2001 From: Ivan Martell Date: Sat, 20 Jul 2024 19:23:00 +0900 Subject: [PATCH] Windows did not like saving async (reverted)... --- LittleWarGameClient/Form1.cs | 4 ++-- LittleWarGameClient/Fullscreen.cs | 2 +- LittleWarGameClient/Settings.cs | 5 +++-- LittleWarGameClient/VersionHandler.cs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/LittleWarGameClient/Form1.cs b/LittleWarGameClient/Form1.cs index c42d457..f8598a5 100644 --- a/LittleWarGameClient/Form1.cs +++ b/LittleWarGameClient/Form1.cs @@ -74,7 +74,7 @@ private void webView_WebMessageReceived(object sender, Microsoft.Web.WebView2.Co else mouseLocked = false; settings.SetMouseLock(mouseLocked); - settings.SaveAsync(); + settings.Save(); CaptureCursor(); break; default: @@ -109,7 +109,7 @@ private void Form1_ResizeEnd(object sender, EventArgs e) { CaptureCursor(); settings.SetWindowSize(this.Size); - settings.SaveAsync(); + settings.Save(); } private void Form1_Resize(object sender, EventArgs e) diff --git a/LittleWarGameClient/Fullscreen.cs b/LittleWarGameClient/Fullscreen.cs index 971d545..68b2cde 100644 --- a/LittleWarGameClient/Fullscreen.cs +++ b/LittleWarGameClient/Fullscreen.cs @@ -33,7 +33,7 @@ internal void Toggle() Enter(); } settings.SetFullScreen(state); - settings.SaveAsync(); + settings.Save(); } private void Enter() diff --git a/LittleWarGameClient/Settings.cs b/LittleWarGameClient/Settings.cs index eb9ca08..3f24a22 100644 --- a/LittleWarGameClient/Settings.cs +++ b/LittleWarGameClient/Settings.cs @@ -83,7 +83,8 @@ internal void Save() settings.SaveTo(fileName); } - internal async void SaveAsync() + //This somehow triggers Windows Defender as a Trojan??? + /*internal async void SaveAsync() { await Task.Run(() => { for (int numTries = 0; numTries < 5; numTries++) @@ -99,7 +100,7 @@ await Task.Run(() => { } } }); - } + }*/ internal void SetMouseLock(bool value) { diff --git a/LittleWarGameClient/VersionHandler.cs b/LittleWarGameClient/VersionHandler.cs index 4a83409..c2f3daf 100644 --- a/LittleWarGameClient/VersionHandler.cs +++ b/LittleWarGameClient/VersionHandler.cs @@ -54,7 +54,7 @@ internal virtual void CheckForUpdate(object? sender, EventArgs e) System.Windows.Forms.Application.Exit(); } settings.SetLastUpdateChecked(DateTime.Now.Date); - settings.SaveAsync(); + settings.Save(); } private bool RequiresUpdate()