add debug button to copy character data
This commit is contained in:
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MareSynchronos.Models;
|
||||
using MareSynchronos.FileCache;
|
||||
using MareSynchronos.UI;
|
||||
#if DEBUG
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
@@ -25,6 +26,7 @@ public class PlayerManager : IDisposable
|
||||
private readonly DalamudUtil _dalamudUtil;
|
||||
private readonly TransientResourceManager _transientResourceManager;
|
||||
private readonly PeriodicFileScanner _periodicFileScanner;
|
||||
private readonly SettingsUi _settingsUi;
|
||||
private readonly IpcManager _ipcManager;
|
||||
public event PlayerHasChanged? PlayerHasChanged;
|
||||
public CharacterCacheDto? LastCreatedCharacterData { get; private set; }
|
||||
@@ -38,7 +40,7 @@ public class PlayerManager : IDisposable
|
||||
|
||||
public unsafe PlayerManager(ApiController apiController, IpcManager ipcManager,
|
||||
CharacterDataFactory characterDataFactory, DalamudUtil dalamudUtil, TransientResourceManager transientResourceManager,
|
||||
PeriodicFileScanner periodicFileScanner)
|
||||
PeriodicFileScanner periodicFileScanner, SettingsUi settingsUi)
|
||||
{
|
||||
Logger.Verbose("Creating " + nameof(PlayerManager));
|
||||
|
||||
@@ -48,6 +50,7 @@ public class PlayerManager : IDisposable
|
||||
_dalamudUtil = dalamudUtil;
|
||||
_transientResourceManager = transientResourceManager;
|
||||
_periodicFileScanner = periodicFileScanner;
|
||||
_settingsUi = settingsUi;
|
||||
_apiController.Connected += ApiControllerOnConnected;
|
||||
_apiController.Disconnected += ApiController_Disconnected;
|
||||
_transientResourceManager.TransientResourceLoaded += HandleTransientResourceLoad;
|
||||
@@ -268,6 +271,8 @@ public class PlayerManager : IDisposable
|
||||
}
|
||||
if (cacheDto == null || token.IsCancellationRequested) return;
|
||||
|
||||
_settingsUi.LastCreatedCharacterData = cacheDto;
|
||||
|
||||
#if DEBUG
|
||||
//var json = JsonConvert.SerializeObject(cacheDto, Formatting.Indented);
|
||||
//Logger.Verbose(json);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.6.0</Version>
|
||||
<Version>0.6.1</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
|
||||
@@ -188,7 +188,7 @@ public sealed class Plugin : IDalamudPlugin
|
||||
var characterCacheFactory =
|
||||
new CharacterDataFactory(_dalamudUtil, _ipcManager, _transientResourceManager, _fileReplacementFactory);
|
||||
_playerManager = new PlayerManager(_apiController, _ipcManager,
|
||||
characterCacheFactory, _dalamudUtil, _transientResourceManager, _periodicFileScanner);
|
||||
characterCacheFactory, _dalamudUtil, _transientResourceManager, _periodicFileScanner, _settingsUi);
|
||||
_characterCacheManager = new OnlinePlayerManager(_apiController,
|
||||
_dalamudUtil, _ipcManager, _playerManager, _fileCacheManager, _configuration);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using MareSynchronos.API;
|
||||
using MareSynchronos.Utils;
|
||||
using MareSynchronos.WebAPI.Utils;
|
||||
using Dalamud.Utility;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MareSynchronos.UI;
|
||||
|
||||
@@ -22,6 +23,8 @@ public class SettingsUi : Window, IDisposable
|
||||
private readonly WindowSystem _windowSystem;
|
||||
private readonly ApiController _apiController;
|
||||
private readonly UiShared _uiShared;
|
||||
public CharacterCacheDto LastCreatedCharacterData { private get; set; }
|
||||
|
||||
public event SwitchUi? SwitchToIntroUi;
|
||||
private bool _overwriteExistingLabels = false;
|
||||
private bool? _notesSuccessfullyApplied = null;
|
||||
@@ -542,6 +545,19 @@ public class SettingsUi : Window, IDisposable
|
||||
{
|
||||
_uiShared.DrawServiceSelection(() => { });
|
||||
}
|
||||
|
||||
if (UiShared.IconTextButton(FontAwesomeIcon.Copy, "[DEBUG] Copy Last created Character Data to clipboard"))
|
||||
{
|
||||
if (LastCreatedCharacterData != null)
|
||||
{
|
||||
ImGui.SetClipboardText(JsonConvert.SerializeObject(LastCreatedCharacterData, Formatting.Indented));
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.SetClipboardText("ERROR: No created character data, cannot copy.");
|
||||
}
|
||||
}
|
||||
UiShared.AttachToolTip("Use this when reporting mods being rejected from the server.");
|
||||
}
|
||||
|
||||
private void DrawBlockedTransfers()
|
||||
|
||||
Reference in New Issue
Block a user