mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 15:47:22 +01:00
add more resilience to MCDF export and loading
This commit is contained in:
parent
bd32a55ce5
commit
8a197e6387
3 changed files with 52 additions and 31 deletions
|
|
@ -54,6 +54,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||
private Task<List<FileCacheEntity>>? _validationTask;
|
||||
private CancellationTokenSource? _validationCts;
|
||||
private (int, int, FileCacheEntity) _currentProgress;
|
||||
private Task? _exportTask;
|
||||
|
||||
public SettingsUi(ILogger<SettingsUi> logger,
|
||||
UiSharedService uiShared, MareConfigService configService,
|
||||
|
|
@ -439,17 +440,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||
_configService.Current.ExportFolder = Path.GetDirectoryName(path) ?? string.Empty;
|
||||
_configService.Save();
|
||||
|
||||
_ = Task.Run(() =>
|
||||
_exportTask = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_mareCharaFileManager.SaveMareCharaFile(LastCreatedCharacterData, _exportDescription, path);
|
||||
_exportDescription = string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical(ex, "Error saving data");
|
||||
}
|
||||
var desc = _exportDescription;
|
||||
_exportDescription = string.Empty;
|
||||
_mareCharaFileManager.SaveMareCharaFile(LastCreatedCharacterData, desc, path);
|
||||
});
|
||||
}, Directory.Exists(_configService.Current.ExportFolder) ? _configService.Current.ExportFolder : null);
|
||||
}
|
||||
|
|
@ -461,6 +456,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||
UiSharedService.ColorTextWrapped("Export in progress", ImGuiColors.DalamudYellow);
|
||||
}
|
||||
|
||||
if (_exportTask?.IsFaulted ?? false)
|
||||
{
|
||||
UiSharedService.ColorTextWrapped("Export failed, check /xllog for more details.", ImGuiColors.DalamudRed);
|
||||
}
|
||||
|
||||
ImGui.Unindent();
|
||||
}
|
||||
bool openInGpose = _configService.Current.OpenGposeImportOnGposeStart;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue