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.Linq;
|
||||
using System.Threading;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
@@ -71,7 +70,7 @@ public class CharacterDataFactory
|
||||
Logger.Warn("Could not get model data for " + objectKind);
|
||||
return;
|
||||
}
|
||||
PluginLog.Verbose("Adding File Replacement for Model " + mdlPath);
|
||||
Logger.Verbose("Adding File Replacement for Model " + mdlPath);
|
||||
|
||||
FileReplacement mdlFileReplacement = CreateFileReplacement(mdlPath);
|
||||
DebugPrint(mdlFileReplacement, objectKind, "Model", inheritanceLevel);
|
||||
@@ -101,7 +100,7 @@ public class CharacterDataFactory
|
||||
return;
|
||||
}
|
||||
|
||||
PluginLog.Verbose("Adding File Replacement for Material " + fileName);
|
||||
Logger.Verbose("Adding File Replacement for Material " + fileName);
|
||||
var mtrlPath = fileName.Split("|")[2];
|
||||
|
||||
var mtrlFileReplacement = CreateFileReplacement(mtrlPath);
|
||||
@@ -124,7 +123,7 @@ public class CharacterDataFactory
|
||||
{
|
||||
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);
|
||||
DebugPrint(texFileReplacement, objectKind, "Texture", inheritanceLevel);
|
||||
|
||||
@@ -189,7 +189,6 @@ public class OnlinePlayerManager : IDisposable
|
||||
var playerCharacters = _dalamudUtil.GetPlayerCharacters();
|
||||
foreach (var pChar in playerCharacters)
|
||||
{
|
||||
var pObjName = pChar.Name.ToString();
|
||||
var hashedName = Crypto.GetHash256(pChar);
|
||||
var existingCachedPlayer = _onlineCachedPlayers.SingleOrDefault(p => p.PlayerNameHash == hashedName && !string.IsNullOrEmpty(p.PlayerName));
|
||||
if (existingCachedPlayer != null)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.1.6.0</Version>
|
||||
<Version>0.1.7.0</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace MareSynchronos
|
||||
_ipcManager?.Dispose();
|
||||
_playerManager?.Dispose();
|
||||
_characterCacheManager?.Dispose();
|
||||
PluginLog.Information("Shut down");
|
||||
Logger.Debug("Shut down");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace MareSynchronos.UI
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash))
|
||||
{
|
||||
if (ImGui.GetIO().KeyCtrl)
|
||||
if (UiShared.CtrlPressed())
|
||||
{
|
||||
_ = _apiController.SendPairedClientRemoval(entry.OtherUID);
|
||||
_apiController.PairedClients.Remove(entry);
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace MareSynchronos.UI
|
||||
|
||||
if (ImGui.Button("I agree##toSetup"))
|
||||
{
|
||||
if (ImGui.GetIO().KeyCtrl)
|
||||
if (UiShared.CtrlPressed())
|
||||
{
|
||||
_pluginConfiguration.AcceptedAgreement = true;
|
||||
_pluginConfiguration.Save();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
@@ -17,6 +18,9 @@ namespace MareSynchronos.UI
|
||||
{
|
||||
public class UiShared : IDisposable
|
||||
{
|
||||
[DllImport("user32")]
|
||||
public static extern short GetKeyState(int nVirtKey);
|
||||
|
||||
private readonly IpcManager _ipcManager;
|
||||
private readonly ApiController _apiController;
|
||||
private readonly FileCacheManager _fileCacheManager;
|
||||
@@ -32,6 +36,8 @@ namespace MareSynchronos.UI
|
||||
public ImFontPtr UidFont { 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)
|
||||
{
|
||||
_ipcManager = ipcManager;
|
||||
@@ -304,7 +310,7 @@ namespace MareSynchronos.UI
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -339,6 +345,7 @@ namespace MareSynchronos.UI
|
||||
|
||||
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.InputText("Enter Secret Key", ref _secretKey, 255);
|
||||
ImGui.SameLine();
|
||||
@@ -415,7 +422,8 @@ namespace MareSynchronos.UI
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,11 @@ namespace MareSynchronos.Utils
|
||||
public static void Verbose(string verbose)
|
||||
{
|
||||
var caller = new StackTrace().GetFrame(1)?.GetMethod()?.ReflectedType?.Name ?? "Unknown";
|
||||
#if DEBUG
|
||||
PluginLog.Debug($"[{caller}] {verbose}");
|
||||
#else
|
||||
PluginLog.Verbose($"[{caller}] {verbose}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,6 +259,7 @@ namespace MareSynchronos.WebAPI
|
||||
_dalamudUtil.LogOut -= DalamudUtilOnLogOut;
|
||||
|
||||
Task.Run(async () => await StopAllConnections(_connectionCancellationTokenSource.Token));
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
}
|
||||
|
||||
private HubConnection BuildHubConnection(string hubName)
|
||||
|
||||
Reference in New Issue
Block a user