why must all of this be async
This commit is contained in:
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Dalamud.Logging;
|
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||||
@@ -71,7 +70,7 @@ public class CharacterDataFactory
|
|||||||
Logger.Warn("Could not get model data for " + objectKind);
|
Logger.Warn("Could not get model data for " + objectKind);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PluginLog.Verbose("Adding File Replacement for Model " + mdlPath);
|
Logger.Verbose("Adding File Replacement for Model " + mdlPath);
|
||||||
|
|
||||||
FileReplacement mdlFileReplacement = CreateFileReplacement(mdlPath);
|
FileReplacement mdlFileReplacement = CreateFileReplacement(mdlPath);
|
||||||
DebugPrint(mdlFileReplacement, objectKind, "Model", inheritanceLevel);
|
DebugPrint(mdlFileReplacement, objectKind, "Model", inheritanceLevel);
|
||||||
@@ -101,7 +100,7 @@ public class CharacterDataFactory
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginLog.Verbose("Adding File Replacement for Material " + fileName);
|
Logger.Verbose("Adding File Replacement for Material " + fileName);
|
||||||
var mtrlPath = fileName.Split("|")[2];
|
var mtrlPath = fileName.Split("|")[2];
|
||||||
|
|
||||||
var mtrlFileReplacement = CreateFileReplacement(mtrlPath);
|
var mtrlFileReplacement = CreateFileReplacement(mtrlPath);
|
||||||
@@ -124,7 +123,7 @@ public class CharacterDataFactory
|
|||||||
{
|
{
|
||||||
if (texPath.IsNullOrEmpty()) return;
|
if (texPath.IsNullOrEmpty()) return;
|
||||||
|
|
||||||
PluginLog.Verbose("Adding File Replacement for Texture " + texPath);
|
Logger.Verbose("Adding File Replacement for Texture " + texPath);
|
||||||
|
|
||||||
var texFileReplacement = CreateFileReplacement(texPath, doNotReverseResolve);
|
var texFileReplacement = CreateFileReplacement(texPath, doNotReverseResolve);
|
||||||
DebugPrint(texFileReplacement, objectKind, "Texture", inheritanceLevel);
|
DebugPrint(texFileReplacement, objectKind, "Texture", inheritanceLevel);
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ public class OnlinePlayerManager : IDisposable
|
|||||||
var playerCharacters = _dalamudUtil.GetPlayerCharacters();
|
var playerCharacters = _dalamudUtil.GetPlayerCharacters();
|
||||||
foreach (var pChar in playerCharacters)
|
foreach (var pChar in playerCharacters)
|
||||||
{
|
{
|
||||||
var pObjName = pChar.Name.ToString();
|
|
||||||
var hashedName = Crypto.GetHash256(pChar);
|
var hashedName = Crypto.GetHash256(pChar);
|
||||||
var existingCachedPlayer = _onlineCachedPlayers.SingleOrDefault(p => p.PlayerNameHash == hashedName && !string.IsNullOrEmpty(p.PlayerName));
|
var existingCachedPlayer = _onlineCachedPlayers.SingleOrDefault(p => p.PlayerNameHash == hashedName && !string.IsNullOrEmpty(p.PlayerName));
|
||||||
if (existingCachedPlayer != null)
|
if (existingCachedPlayer != null)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>0.1.6.0</Version>
|
<Version>0.1.7.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>
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace MareSynchronos
|
|||||||
_ipcManager?.Dispose();
|
_ipcManager?.Dispose();
|
||||||
_playerManager?.Dispose();
|
_playerManager?.Dispose();
|
||||||
_characterCacheManager?.Dispose();
|
_characterCacheManager?.Dispose();
|
||||||
PluginLog.Information("Shut down");
|
Logger.Debug("Shut down");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ namespace MareSynchronos.UI
|
|||||||
ImGui.SetCursorPosY(originalY);
|
ImGui.SetCursorPosY(originalY);
|
||||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash))
|
if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash))
|
||||||
{
|
{
|
||||||
if (ImGui.GetIO().KeyCtrl)
|
if (UiShared.CtrlPressed())
|
||||||
{
|
{
|
||||||
_ = _apiController.SendPairedClientRemoval(entry.OtherUID);
|
_ = _apiController.SendPairedClientRemoval(entry.OtherUID);
|
||||||
_apiController.PairedClients.Remove(entry);
|
_apiController.PairedClients.Remove(entry);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace MareSynchronos.UI
|
|||||||
|
|
||||||
if (ImGui.Button("I agree##toSetup"))
|
if (ImGui.Button("I agree##toSetup"))
|
||||||
{
|
{
|
||||||
if (ImGui.GetIO().KeyCtrl)
|
if (UiShared.CtrlPressed())
|
||||||
{
|
{
|
||||||
_pluginConfiguration.AcceptedAgreement = true;
|
_pluginConfiguration.AcceptedAgreement = true;
|
||||||
_pluginConfiguration.Save();
|
_pluginConfiguration.Save();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
@@ -17,6 +18,9 @@ namespace MareSynchronos.UI
|
|||||||
{
|
{
|
||||||
public class UiShared : IDisposable
|
public class UiShared : IDisposable
|
||||||
{
|
{
|
||||||
|
[DllImport("user32")]
|
||||||
|
public static extern short GetKeyState(int nVirtKey);
|
||||||
|
|
||||||
private readonly IpcManager _ipcManager;
|
private readonly IpcManager _ipcManager;
|
||||||
private readonly ApiController _apiController;
|
private readonly ApiController _apiController;
|
||||||
private readonly FileCacheManager _fileCacheManager;
|
private readonly FileCacheManager _fileCacheManager;
|
||||||
@@ -32,6 +36,8 @@ namespace MareSynchronos.UI
|
|||||||
public ImFontPtr UidFont { get; private set; }
|
public ImFontPtr UidFont { get; private set; }
|
||||||
public bool UidFontBuilt { get; private set; }
|
public bool UidFontBuilt { get; private set; }
|
||||||
|
|
||||||
|
public static bool CtrlPressed() => (GetKeyState(0xA2) & 0x8000) != 0 || (GetKeyState(0xA3) & 0x8000) != 0;
|
||||||
|
|
||||||
public UiShared(IpcManager ipcManager, ApiController apiController, FileCacheManager fileCacheManager, FileDialogManager fileDialogManager, Configuration pluginConfiguration, DalamudUtil dalamudUtil, DalamudPluginInterface pluginInterface)
|
public UiShared(IpcManager ipcManager, ApiController apiController, FileCacheManager fileCacheManager, FileDialogManager fileDialogManager, Configuration pluginConfiguration, DalamudUtil dalamudUtil, DalamudPluginInterface pluginInterface)
|
||||||
{
|
{
|
||||||
_ipcManager = ipcManager;
|
_ipcManager = ipcManager;
|
||||||
@@ -304,7 +310,7 @@ namespace MareSynchronos.UI
|
|||||||
|
|
||||||
PrintServerState(isIntroUi);
|
PrintServerState(isIntroUi);
|
||||||
|
|
||||||
if (_apiController.ServerAlive && !_pluginConfiguration.ClientSecret.ContainsKey(_pluginConfiguration.ApiUri))
|
if (_apiController.ServerAlive && (!_pluginConfiguration.ClientSecret.ContainsKey(_pluginConfiguration.ApiUri) || _pluginConfiguration.ClientSecret[_pluginConfiguration.ApiUri].IsNullOrEmpty()))
|
||||||
{
|
{
|
||||||
if (!_enterSecretKey)
|
if (!_enterSecretKey)
|
||||||
{
|
{
|
||||||
@@ -339,6 +345,7 @@ namespace MareSynchronos.UI
|
|||||||
|
|
||||||
if (_enterSecretKey)
|
if (_enterSecretKey)
|
||||||
{
|
{
|
||||||
|
ColorTextWrapped("This will overwrite your currently used secret key for the selected service. Make sure to have a backup for the current secret key if you want to switch back to this acocunt.", ImGuiColors.DalamudYellow);
|
||||||
ImGui.SetNextItemWidth(400);
|
ImGui.SetNextItemWidth(400);
|
||||||
ImGui.InputText("Enter Secret Key", ref _secretKey, 255);
|
ImGui.InputText("Enter Secret Key", ref _secretKey, 255);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
@@ -415,7 +422,8 @@ namespace MareSynchronos.UI
|
|||||||
else if (!Directory.Exists(cacheDirectory) || !_isDirectoryWritable)
|
else if (!Directory.Exists(cacheDirectory) || !_isDirectoryWritable)
|
||||||
{
|
{
|
||||||
ColorTextWrapped("The folder you selected does not exist or cannot be written to. Please provide a valid path.", ImGuiColors.DalamudRed);
|
ColorTextWrapped("The folder you selected does not exist or cannot be written to. Please provide a valid path.", ImGuiColors.DalamudRed);
|
||||||
} else if (_cacheDirectoryHasOtherFilesThanCache)
|
}
|
||||||
|
else if (_cacheDirectoryHasOtherFilesThanCache)
|
||||||
{
|
{
|
||||||
ColorTextWrapped("Your selected directory has files inside that are not Mare related. Use an empty directory or a previous Mare cache directory only.", ImGuiColors.DalamudRed);
|
ColorTextWrapped("Your selected directory has files inside that are not Mare related. Use an empty directory or a previous Mare cache directory only.", ImGuiColors.DalamudRed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ namespace MareSynchronos.Utils
|
|||||||
public static void Verbose(string verbose)
|
public static void Verbose(string verbose)
|
||||||
{
|
{
|
||||||
var caller = new StackTrace().GetFrame(1)?.GetMethod()?.ReflectedType?.Name ?? "Unknown";
|
var caller = new StackTrace().GetFrame(1)?.GetMethod()?.ReflectedType?.Name ?? "Unknown";
|
||||||
|
#if DEBUG
|
||||||
|
PluginLog.Debug($"[{caller}] {verbose}");
|
||||||
|
#else
|
||||||
PluginLog.Verbose($"[{caller}] {verbose}");
|
PluginLog.Verbose($"[{caller}] {verbose}");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ namespace MareSynchronos.WebAPI
|
|||||||
_dalamudUtil.LogOut -= DalamudUtilOnLogOut;
|
_dalamudUtil.LogOut -= DalamudUtilOnLogOut;
|
||||||
|
|
||||||
Task.Run(async () => await StopAllConnections(_connectionCancellationTokenSource.Token));
|
Task.Run(async () => await StopAllConnections(_connectionCancellationTokenSource.Token));
|
||||||
|
_connectionCancellationTokenSource?.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private HubConnection BuildHubConnection(string hubName)
|
private HubConnection BuildHubConnection(string hubName)
|
||||||
|
|||||||
Reference in New Issue
Block a user