Chara file data export (#38)

* add rudimentary saving of chara file data

* fix building

* working prototype for MCDF import and application

* adjust code to use streams

* rename cache -> storage
add ui for import/export mcdf

* minor wording adjustments, version bump

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
Co-authored-by: Stanley Dimant <stanley.dimant@varian.com>
This commit is contained in:
rootdarkarchon
2023-01-23 12:56:43 +01:00
committed by GitHub
parent 1c95a6d40e
commit 7a8655f6b1
15 changed files with 664 additions and 51 deletions

View File

@@ -15,6 +15,7 @@ using MareSynchronos.Utils;
using Dalamud.Game.ClientState.Conditions;
using MareSynchronos.FileCache;
using Dalamud.Game.Gui;
using MareSynchronos.Export;
namespace MareSynchronos;
@@ -42,6 +43,8 @@ public sealed class Plugin : IDalamudPlugin
private readonly UiShared _uiSharedComponent;
private readonly Dalamud.Localization _localization;
private readonly FileReplacementFactory _fileReplacementFactory;
private readonly MareCharaFileManager _mareCharaFileManager;
private readonly GposeUi _gposeUi;
public Plugin(DalamudPluginInterface pluginInterface, CommandManager commandManager,
@@ -50,6 +53,7 @@ public sealed class Plugin : IDalamudPlugin
{
Logger.Debug("Launching " + Name);
_pluginInterface = pluginInterface;
_pluginInterface.UiBuilder.DisableGposeUiHide = true;
_commandManager = commandManager;
_configuration = _pluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
_configuration.Initialize(_pluginInterface);
@@ -69,11 +73,13 @@ public sealed class Plugin : IDalamudPlugin
_apiController = new ApiController(_configuration, _dalamudUtil, _fileCacheManager);
_periodicFileScanner = new PeriodicFileScanner(_ipcManager, _configuration, _fileCacheManager, _apiController, _dalamudUtil);
_fileReplacementFactory = new FileReplacementFactory(_fileCacheManager, _ipcManager);
_mareCharaFileManager = new(_fileCacheManager, _ipcManager, _dalamudUtil);
_uiSharedComponent =
new UiShared(_ipcManager, _apiController, _periodicFileScanner, _fileDialogManager, _configuration, _dalamudUtil, _pluginInterface, _localization);
_settingsUi = new SettingsUi(_windowSystem, _uiSharedComponent, _configuration, _apiController);
_settingsUi = new SettingsUi(_windowSystem, _uiSharedComponent, _configuration, _apiController, _mareCharaFileManager);
_compactUi = new CompactUi(_windowSystem, _uiSharedComponent, _configuration, _apiController);
_gposeUi = new GposeUi(_windowSystem, _mareCharaFileManager, _dalamudUtil, _fileDialogManager, _configuration);
_introUi = new IntroUi(_windowSystem, _uiSharedComponent, _configuration, _periodicFileScanner);
_settingsUi.SwitchToIntroUi += () =>
@@ -120,6 +126,7 @@ public sealed class Plugin : IDalamudPlugin
_introUi?.Dispose();
_downloadUi?.Dispose();
_compactUi?.Dispose();
_gposeUi?.Dispose();
_periodicFileScanner?.Dispose();
_fileCacheManager?.Dispose();
@@ -206,31 +213,35 @@ public sealed class Plugin : IDalamudPlugin
private void OnCommand(string command, string args)
{
var splitArgs = args.ToLowerInvariant().Trim().Split(" ", StringSplitOptions.RemoveEmptyEntries);
var splitArgs = args.ToLowerInvariant().Trim().Split(" ", StringSplitOptions.RemoveEmptyEntries);
if (splitArgs == null || splitArgs.Length == 0)
if (splitArgs == null || splitArgs.Length == 0)
{
// Interpret this as toggling the UI
OpenUi();
return;
}
if (splitArgs[0] == "toggle")
{
var fullPause = splitArgs.Length > 1 ? splitArgs[1] switch
{
// Interpret this as toggling the UI
OpenUi();
return;
}
"on" => false,
"off" => true,
_ => !_configuration.FullPause,
} : !_configuration.FullPause;
if (splitArgs[0] == "toggle")
if (fullPause != _configuration.FullPause)
{
var fullPause = splitArgs.Length > 1 ? splitArgs[1] switch
{
"on" => false,
"off" => true,
_ => !_configuration.FullPause,
} : !_configuration.FullPause;
if (fullPause != _configuration.FullPause)
{
_configuration.FullPause = fullPause;
_configuration.Save();
_ = _apiController.CreateConnections();
}
_configuration.FullPause = fullPause;
_configuration.Save();
_ = _apiController.CreateConnections();
}
}
else if (splitArgs[0] == "gpose")
{
_gposeUi.Toggle();
}
}
private void OpenUi()