This commit is contained in:
rootdarkarchon
2023-03-18 11:28:08 +01:00
3 changed files with 15 additions and 4 deletions

View File

@@ -36,4 +36,5 @@ public class MareConfig : IMareConfiguration
public int TransferBarsWidth { get; set; } = 250;
public int Version { get; set; } = 1;
public NotificationLocation WarningNotification { get; set; } = NotificationLocation.Both;
public string ExportFolder { get; set; } = string.Empty;
}

View File

@@ -43,12 +43,16 @@ public class GposeUi : WindowMediatorSubscriberBase
{
if (UiSharedService.IconTextButton(FontAwesomeIcon.FolderOpen, "Load MCDF"))
{
_fileDialogManager.OpenFileDialog("Pick MCDF file", ".mcdf", (success, path) =>
_fileDialogManager.OpenFileDialog("Pick MCDF file", ".mcdf", (success, paths) =>
{
if (!success) return;
if (paths.FirstOrDefault() is not { } path) return;
_configService.Current.ExportFolder = Path.GetDirectoryName(path) ?? string.Empty;
_configService.Save();
Task.Run(() => _mareCharaFileManager.LoadMareCharaFile(path));
});
}, 1, Directory.Exists(_configService.Current.ExportFolder) ? _configService.Current.ExportFolder : null);
}
UiSharedService.AttachToolTip("Applies it to the currently selected GPose actor");
if (_mareCharaFileManager.LoadedCharaFile != null)

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);