From dde66e2767559a5b44d8ea8bf496a1943276db69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayta=C3=A7=20Kayadelen?= Date: Sat, 14 Oct 2023 15:30:37 +0200 Subject: [PATCH] fixed device informations not loading when no update is there --- .../Modules/OnlineConfigs/OnlineConfigsRepository.cs | 8 +------- Project-Aurora/Project-Aurora/Modules/OnlineSettings.cs | 8 +++++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Project-Aurora/Project-Aurora/Modules/OnlineConfigs/OnlineConfigsRepository.cs b/Project-Aurora/Project-Aurora/Modules/OnlineConfigs/OnlineConfigsRepository.cs index e8dfb0398..1fd43cb7a 100644 --- a/Project-Aurora/Project-Aurora/Modules/OnlineConfigs/OnlineConfigsRepository.cs +++ b/Project-Aurora/Project-Aurora/Modules/OnlineConfigs/OnlineConfigsRepository.cs @@ -31,13 +31,7 @@ public static async Task> GetDeviceTooltips() await using var jsonTextReader = new JsonTextReader(stream); var serializer = JsonSerializer.CreateDefault(); - var result = serializer.Deserialize>(jsonTextReader) ?? new Dictionary(); - - //Save to local cache - await using var jsonTextWriter = new JsonTextWriter(new StreamWriter(File.Create(DeviceTooltipsLocalCache))); - serializer.Serialize(jsonTextWriter, result); - - return result; + return serializer.Deserialize>(jsonTextReader) ?? new Dictionary(); } private static StreamReader GetJsonStream(string cachePath) diff --git a/Project-Aurora/Project-Aurora/Modules/OnlineSettings.cs b/Project-Aurora/Project-Aurora/Modules/OnlineSettings.cs index cbf6cb8e1..914479601 100644 --- a/Project-Aurora/Project-Aurora/Modules/OnlineSettings.cs +++ b/Project-Aurora/Project-Aurora/Modules/OnlineSettings.cs @@ -34,12 +34,13 @@ protected override async Task Initialize() { SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; + await DownloadAndExtract(); await Refresh(); RunningProcessMonitor.Instance.RunningProcessesChanged += OnRunningProcessesChanged; } - private async Task Refresh() + private async Task DownloadAndExtract() { try { @@ -74,7 +75,10 @@ private async Task Refresh() _layoutUpdateTaskSource.TrySetResult(); Global.Configuration.OnlineSettingsTime = commitDate; + } + private async Task Refresh() + { try { await UpdateConflicts(); @@ -83,6 +87,7 @@ private async Task Refresh() { Global.logger.Error(e, "Failed to update conflicts"); } + try { await UpdateDeviceInfos(); @@ -132,6 +137,7 @@ private async void SystemEvents_SessionSwitch(object sender, SessionSwitchEventA { return; } + await DownloadAndExtract(); await Refresh(); }