Add MCDO (#80)

* update api

* mcd online editor impl

* most of chara data hub impl

* some state of things

* some refactoring

* random bullshit go

* more nearby impl

* add uid to peformance msg

* cleanup/homogenization

* some split, update nuget packages

* migrate to latest packages where possible, remove lz4net, do some split, idk

* some polish and cleanup

* more cleanup, beautification, etc.

* fixes and cleanups

---------

Co-authored-by: Stanley Dimant <root.darkarchon@outlook.com>
This commit is contained in:
rootdarkarchon
2025-01-11 22:43:11 +01:00
committed by Loporrit
parent ad42b29a44
commit 30caedbf3a
44 changed files with 5128 additions and 486 deletions

View File

@@ -13,7 +13,6 @@ using MareSynchronos.FileCache;
using MareSynchronos.Interop.Ipc;
using MareSynchronos.MareConfiguration;
using MareSynchronos.MareConfiguration.Models;
using MareSynchronos.PlayerData.Export;
using MareSynchronos.PlayerData.Handlers;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services;
@@ -47,7 +46,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
private readonly FileUploadManager _fileTransferManager;
private readonly FileTransferOrchestrator _fileTransferOrchestrator;
private readonly FileCacheManager _fileCacheManager;
private readonly MareCharaFileManager _mareCharaFileManager;
private readonly PairManager _pairManager;
private readonly ChatService _chatService;
private readonly GuiHookService _guiHookService;
@@ -58,16 +56,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
private readonly UiSharedService _uiShared;
private bool _deleteAccountPopupModalShown = false;
private bool _deleteFilesPopupModalShown = false;
private string _exportDescription = string.Empty;
private string _lastTab = string.Empty;
private bool? _notesSuccessfullyApplied = null;
private bool _overwriteExistingLabels = false;
private bool _readClearCache = false;
private bool _readExport = false;
private CancellationTokenSource? _validationCts;
private Task<List<FileCacheEntity>>? _validationTask;
private bool _wasOpen = false;
private readonly IProgress<(int, int, FileCacheEntity)> _validationProgress;
private Task<List<FileCacheEntity>>? _validationTask;
private CancellationTokenSource? _validationCts;
private (int, int, FileCacheEntity) _currentProgress;
private Task? _exportTask;
@@ -77,7 +73,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
public SettingsUi(ILogger<SettingsUi> logger,
UiSharedService uiShared, MareConfigService configService,
MareCharaFileManager mareCharaFileManager, PairManager pairManager, ChatService chatService, GuiHookService guiHookService,
PairManager pairManager, ChatService chatService, GuiHookService guiHookService,
ServerConfigurationManager serverConfigurationManager,
PlayerPerformanceConfigService playerPerformanceConfigService, PlayerPerformanceService playerPerformanceService,
MareMediator mediator, PerformanceCollectorService performanceCollector,
@@ -89,7 +85,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
DalamudUtilService dalamudUtilService) : base(logger, mediator, "Loporrit Settings", performanceCollector)
{
_configService = configService;
_mareCharaFileManager = mareCharaFileManager;
_pairManager = pairManager;
_chatService = chatService;
_guiHookService = guiHookService;
@@ -742,62 +737,18 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.BigText("Export MCDF");
UiSharedService.TextWrapped("This feature allows you to pack your character appearance into a MCDF file and manually send it to other people. MCDF files can imported during GPose.");
ImGuiHelpers.ScaledDummy(10);
ImGui.Checkbox("##readExport", ref _readExport);
ImGui.SameLine();
UiSharedService.TextWrapped("I understand that by exporting my character data and sending it to other people I am giving away my current character appearance irrevocably. People I am sharing my data with have the ability to share it with other people without limitations.");
if (_readExport)
UiSharedService.ColorTextWrapped("Exporting MCDF has moved.", ImGuiColors.DalamudYellow);
ImGuiHelpers.ScaledDummy(5);
UiSharedService.TextWrapped("It is now found in the Main UI under \"Character Data Hub\"");
if (_uiShared.IconTextButton(FontAwesomeIcon.Running, "Open Character Data Hub"))
{
ImGui.Indent();
if (!_mareCharaFileManager.CurrentlyWorking)
{
ImGui.InputTextWithHint("Export Descriptor", "This description will be shown on loading the data", ref _exportDescription, 255);
if (_uiShared.IconTextButton(FontAwesomeIcon.Save, "Export Character as MCDF"))
{
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();
_exportTask = Task.Run(() =>
{
var desc = _exportDescription;
_exportDescription = string.Empty;
_mareCharaFileManager.SaveMareCharaFile(LastCreatedCharacterData, desc, path);
});
}, 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);
}
else
{
UiSharedService.ColorTextWrapped("Export in progress", ImGuiColors.DalamudYellow);
}
if (_exportTask?.IsFaulted ?? false)
{
UiSharedService.ColorTextWrapped("Export failed, check /xllog for more details.", ImGuiColors.DalamudRed);
}
ImGui.Unindent();
Mediator.Publish(new UiToggleMessage(typeof(CharaDataHubUi)));
}
bool openInGpose = _configService.Current.OpenGposeImportOnGposeStart;
if (ImGui.Checkbox("Open MCDF import window when GPose loads", ref openInGpose))
{
_configService.Current.OpenGposeImportOnGposeStart = openInGpose;
_configService.Save();
}
_uiShared.DrawHelpText("This will automatically open the import menu when loading into Gpose. If unchecked you can open the menu manually with /sync gpose");
UiSharedService.TextWrapped("Note: this entry will be removed in the near future. Please use the Main UI to open the Character Data Hub.");
ImGuiHelpers.ScaledDummy(5);
ImGui.Separator();
_uiShared.BigText("Storage");
@@ -1958,7 +1909,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Export & Storage"))
if (ImGui.BeginTabItem("Storage"))
{
DrawFileStorageSettings();
ImGui.EndTabItem();