From 04ab5f6af004e45a56624b5b458d02d95f878e33 Mon Sep 17 00:00:00 2001 From: rootdarkarchon Date: Thu, 1 Jun 2023 09:53:22 +0200 Subject: [PATCH] fix storage selection --- MareSynchronos/UI/SettingsUi.cs | 7 +++---- MareSynchronos/UI/UISharedService.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/MareSynchronos/UI/SettingsUi.cs b/MareSynchronos/UI/SettingsUi.cs index 6dc8f13..4a8a793 100644 --- a/MareSynchronos/UI/SettingsUi.cs +++ b/MareSynchronos/UI/SettingsUi.cs @@ -310,12 +310,11 @@ public class SettingsUi : WindowMediatorSubscriberBase #if DEBUG if (LastCreatedCharacterData != null && ImGui.TreeNode("Last created character data")) { - foreach (var l in JsonSerializer.Serialize(LastCreatedCharacterData, new JsonSerializerOptions() { WriteIndented = true }).Split('\n')) { ImGui.Text($"{l}"); } - + ImGui.TreePop(); } #endif @@ -391,7 +390,7 @@ public class SettingsUi : WindowMediatorSubscriberBase _configService.Current.ExportFolder = Path.GetDirectoryName(path) ?? string.Empty; _configService.Save(); - Task.Run(() => + _ = Task.Run(() => { try { @@ -446,7 +445,7 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.BeginDisabled(); if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Clear local storage") && UiSharedService.CtrlPressed() && _readClearCache) { - Task.Run(() => + _ = Task.Run(() => { foreach (var file in Directory.GetFiles(_configService.Current.CacheFolder)) { diff --git a/MareSynchronos/UI/UISharedService.cs b/MareSynchronos/UI/UISharedService.cs index 8e043a1..217b5c5 100644 --- a/MareSynchronos/UI/UISharedService.cs +++ b/MareSynchronos/UI/UISharedService.cs @@ -474,7 +474,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase _isPenumbraDirectory = string.Equals(path.ToLowerInvariant(), _ipcManager.PenumbraModDirectory?.ToLowerInvariant(), StringComparison.Ordinal); _isDirectoryWritable = IsDirectoryWritable(path); - _cacheDirectoryHasOtherFilesThanCache = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Any(f => new FileInfo(f).Name.Length != 40); + _cacheDirectoryHasOtherFilesThanCache = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Any(f => Path.GetFileNameWithoutExtension(f).Length != 40); _cacheDirectoryIsValidPath = PathRegex().IsMatch(path); if (!string.IsNullOrEmpty(path)