Refactor mafile storage: async, modular, bulk rename

- Fix crash: Updated SaveMafileAsync to properly update or add to MaFiles collection
- Fix naming logic: Added Filename reset logic to adding new mafile to prevent inconsistent and duplicating import
- Extracted mafile path and naming logic to MafilesStorageHelper for better modularity
- Refactored Storage methods to use MafilesStorageHelper
- Replaced all sync mafile save/add calls with async/await versions throughout the codebase
- Performed code cleanups and improved maintainability for mafile-related operations
This commit is contained in:
achiez
2026-01-02 21:23:11 +02:00
parent f2b1cdfcc9
commit 5242b0009b
15 changed files with 88 additions and 80 deletions
+3 -2
View File
@@ -13,6 +13,7 @@ using NebulaAuth.Core;
using NebulaAuth.Model;
using NebulaAuth.Model.Entities;
using NebulaAuth.Model.Exceptions;
using NebulaAuth.Model.Mafiles;
using NebulaAuth.Utility;
using NebulaAuth.View;
using NebulaAuth.View.Dialogs;
@@ -78,7 +79,7 @@ public partial class MainVM //File //TODO: Refactor
{
try
{
Storage.AddNewMafile(str, confirmOverwrite ?? false);
await Storage.AddNewMafile(str, confirmOverwrite ?? false);
added++;
}
catch (FormatException)
@@ -92,7 +93,7 @@ public partial class MainVM //File //TODO: Refactor
if (confirmOverwrite == true)
{
Storage.AddNewMafile(str, true);
await Storage.AddNewMafile(str, true);
added++;
}
else if (confirmOverwrite == false)