Remember folder for MCDF Import and Export (#48)

* remember last MCDF directory

* name mcdf export from description
This commit is contained in:
Cara
2023-03-18 20:56:14 +10:30
committed by GitHub
parent fe61b5044b
commit 26db03f215
3 changed files with 15 additions and 4 deletions

View File

@@ -362,10 +362,16 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.InputTextWithHint("Export Descriptor", "This description will be shown on loading the data", ref _exportDescription, 255);
if (UiSharedService.IconTextButton(FontAwesomeIcon.Save, "Export Character as MCDF"))
{
_uiShared.FileDialogManager.SaveFileDialog("Export Character to file", ".mcdf", "export.mcdf", ".mcdf", (success, path) =>
string defaultFileName = string.IsNullOrEmpty(_exportDescription)
? "export.mcdf"
: string.Join('_', $"{_exportDescription}.mcdf".Split(Path.GetInvalidFileNameChars()));
_uiShared.FileDialogManager.SaveFileDialog("Export Character to file", ".mcdf", defaultFileName, ".mcdf", (success, path) =>
{
if (!success) return;
_configService.Current.ExportFolder = Path.GetDirectoryName(path) ?? string.Empty;
_configService.Save();
Task.Run(() =>
{
try
@@ -378,7 +384,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_logger.LogCritical(ex, "Error saving data");
}
});
});
}, Directory.Exists(_configService.Current.ExportFolder) ? _configService.Current.ExportFolder : null);
}
UiSharedService.ColorTextWrapped("Note: For best results make sure you have everything you want to be shared as well as the correct character appearance" +
" equipped and redraw your character before exporting.", ImGuiColors.DalamudYellow);