fix not being able to pause players, some other bullshit, update to api4

This commit is contained in:
Stanley Dimant
2022-07-10 14:20:43 +02:00
parent 1577ec93fd
commit 1eccd791d1
6 changed files with 7 additions and 7 deletions

View File

@@ -166,6 +166,7 @@ public class CachedPlayer
private void ApplyCharacterData(CharacterCacheDto cache, Dictionary<string, string> moddedPaths) private void ApplyCharacterData(CharacterCacheDto cache, Dictionary<string, string> moddedPaths)
{ {
if (PlayerCharacter is null) return;
_ipcManager.PenumbraRemoveTemporaryCollection(PlayerName!); _ipcManager.PenumbraRemoveTemporaryCollection(PlayerName!);
var tempCollection = _ipcManager.PenumbraCreateTemporaryCollection(PlayerName!); var tempCollection = _ipcManager.PenumbraCreateTemporaryCollection(PlayerName!);
_dalamudUtil.WaitWhileCharacterIsDrawing(PlayerCharacter!.Address); _dalamudUtil.WaitWhileCharacterIsDrawing(PlayerCharacter!.Address);

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors></Authors> <Authors></Authors>
<Company></Company> <Company></Company>
<Version>0.1.4.0</Version> <Version>0.1.5.0</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl> <PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>

View File

@@ -282,7 +282,7 @@ namespace MareSynchronos.UI
ImGui.BeginChild("list", new Vector2(_windowContentWidth, ySize), false); ImGui.BeginChild("list", new Vector2(_windowContentWidth, ySize), false);
foreach (var entry in users.ToList()) foreach (var entry in users.ToList())
{ {
UiShared.DrawWithID("client", () => DrawPairedClient(entry)); UiShared.DrawWithID(entry.OtherUID, () => DrawPairedClient(entry));
} }
ImGui.EndChild(); ImGui.EndChild();
} }

View File

@@ -111,7 +111,7 @@ namespace MareSynchronos.Utils
Thread.Sleep(500); Thread.Sleep(500);
} }
public void WaitWhileSelfIsDrawing(CancellationToken token) => WaitWhileCharacterIsDrawing(_clientState.LocalPlayer?.Address ?? new IntPtr(), token); public void WaitWhileSelfIsDrawing(CancellationToken? token) => WaitWhileCharacterIsDrawing(_clientState.LocalPlayer?.Address ?? new IntPtr(), token);
public void Dispose() public void Dispose()
{ {

View File

@@ -32,7 +32,7 @@ namespace MareSynchronos.WebAPI
await _fileHub!.SendAsync(FilesHubAPI.SendDeleteAllFiles); await _fileHub!.SendAsync(FilesHubAPI.SendDeleteAllFiles);
} }
public async Task<string> DownloadFile(string hash, CancellationToken ct) private async Task<string> DownloadFile(string hash, CancellationToken ct)
{ {
var reader = _fileHub!.StreamAsync<byte[]>(FilesHubAPI.StreamDownloadFileAsync, hash, ct); var reader = _fileHub!.StreamAsync<byte[]>(FilesHubAPI.StreamDownloadFileAsync, hash, ct);
string fileName = Path.GetTempFileName(); string fileName = Path.GetTempFileName();

View File

@@ -162,7 +162,7 @@ namespace MareSynchronos.WebAPI
var token = _connectionCancellationTokenSource.Token; var token = _connectionCancellationTokenSource.Token;
while (ServerState is not ServerState.Connected && !token.IsCancellationRequested) while (ServerState is not ServerState.Connected && !token.IsCancellationRequested)
{ {
await StopAllConnections(_connectionCancellationTokenSource.Token); await StopAllConnections(token);
try try
{ {
@@ -195,7 +195,7 @@ namespace MareSynchronos.WebAPI
} }
_connectionDto = _connectionDto =
await _connectionHub.InvokeAsync<ConnectionDto>(ConnectionHubAPI.InvokeHeartbeat, token); await _connectionHub.InvokeAsync<ConnectionDto>(ConnectionHubAPI.InvokeHeartbeat, _dalamudUtil.PlayerNameHashed, token);
if (ServerState is ServerState.Connected) // user is authorized && server is legit if (ServerState is ServerState.Connected) // user is authorized && server is legit
{ {
Logger.Debug("Initializing data"); Logger.Debug("Initializing data");
@@ -269,7 +269,6 @@ namespace MareSynchronos.WebAPI
if (!string.IsNullOrEmpty(SecretKey) && !_pluginConfiguration.FullPause) if (!string.IsNullOrEmpty(SecretKey) && !_pluginConfiguration.FullPause)
{ {
options.Headers.Add("Authorization", SecretKey); options.Headers.Add("Authorization", SecretKey);
options.Headers.Add("CharacterNameHash", _dalamudUtil.PlayerNameHashed);
} }
options.Transports = HttpTransportType.WebSockets; options.Transports = HttpTransportType.WebSockets;