Compare commits
8 Commits
ui-updates
...
main
Author | SHA1 | Date | |
---|---|---|---|
f0cef81b5e | |||
d8160effd0
|
|||
18da07763c
|
|||
3c448f2290
|
|||
cadc7e223f | |||
e1baca7940 | |||
c2e0cf65a8 | |||
a3d0408d6f |
@@ -2,8 +2,8 @@
|
|||||||
<Project Sdk="Dalamud.NET.Sdk/13.0.0">
|
<Project Sdk="Dalamud.NET.Sdk/13.0.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AssemblyName>Snowcloak</AssemblyName>
|
<AssemblyName>Snowcloak</AssemblyName>
|
||||||
<Version>0.2.1</Version>
|
<Version>0.2.2</Version>
|
||||||
<PackageProjectUrl>https://github.com/Eauldane/SnowcloakClient/</PackageProjectUrl>
|
<PackageProjectUrl>https://git.snowcloak-sync.com/Eauldane/SnowcloakClient/</PackageProjectUrl>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -235,11 +235,17 @@ public class Pair : DisposableMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
string? noteOrName = GetNoteOrName();
|
string? noteOrName = GetNoteOrName();
|
||||||
|
|
||||||
if (noteOrName != null)
|
if (_mareConfig.Current.SortSyncshellsByVRAM)
|
||||||
|
{
|
||||||
|
return($"0{LastAppliedApproximateVRAMBytes}");
|
||||||
|
}
|
||||||
|
else if (noteOrName != null) {
|
||||||
return $"0{noteOrName}";
|
return $"0{noteOrName}";
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
return $"9{UserData.AliasOrUID}";
|
return $"9{UserData.AliasOrUID}";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string GetPlayerNameHash()
|
public string GetPlayerNameHash()
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
private readonly GroupPairFullInfoDto _fullInfoDto;
|
private readonly GroupPairFullInfoDto _fullInfoDto;
|
||||||
private readonly GroupFullInfoDto _group;
|
private readonly GroupFullInfoDto _group;
|
||||||
private readonly CharaDataManager _charaDataManager;
|
private readonly CharaDataManager _charaDataManager;
|
||||||
public long VramUsage { get; set; }
|
public long VRAMUsage { get; set; }
|
||||||
|
|
||||||
public DrawGroupPair(string id, Pair entry, ApiController apiController,
|
public DrawGroupPair(string id, Pair entry, ApiController apiController,
|
||||||
MareMediator mareMediator, GroupFullInfoDto group, GroupPairFullInfoDto fullInfoDto,
|
MareMediator mareMediator, GroupFullInfoDto group, GroupPairFullInfoDto fullInfoDto,
|
||||||
@@ -87,7 +87,6 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
presenceText += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
presenceText += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
||||||
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
||||||
{
|
{
|
||||||
VramUsage = _pair.LastAppliedApproximateVRAMBytes;
|
|
||||||
presenceText += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
presenceText += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
||||||
}
|
}
|
||||||
if (_pair.LastAppliedDataTris >= 0)
|
if (_pair.LastAppliedDataTris >= 0)
|
||||||
@@ -130,7 +129,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
|
|
||||||
protected override float DrawRightSide(float textPosY, float originalY)
|
protected override float DrawRightSide(float textPosY, float originalY)
|
||||||
{
|
{
|
||||||
var pauseIcon = _fullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
var pauseIcon = _pair.IsPaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||||
var pauseIconSize = _uiSharedService.GetIconButtonSize(pauseIcon);
|
var pauseIconSize = _uiSharedService.GetIconButtonSize(pauseIcon);
|
||||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||||
var entryUID = _fullInfoDto.UserAliasOrUID;
|
var entryUID = _fullInfoDto.UserAliasOrUID;
|
||||||
@@ -297,9 +296,10 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
|
|
||||||
if (_uiSharedService.IconButton(pauseIcon))
|
if (_uiSharedService.IconButton(pauseIcon))
|
||||||
{
|
{
|
||||||
var perm = _fullInfoDto.GroupUserPermissions;
|
var perm = _pair.UserPair!.OwnPermissions;
|
||||||
var newPaused = !perm.IsPaused();
|
perm.SetPaused(!perm.IsPaused());
|
||||||
perm.SetPaused(newPaused);
|
_ = _apiController.UserSetPairPermissions(new(_pair.UserData, perm));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UiSharedService.AttachToolTip(!_fullInfoDto.GroupUserPermissions.IsPaused()
|
UiSharedService.AttachToolTip(!_fullInfoDto.GroupUserPermissions.IsPaused()
|
||||||
|
@@ -428,6 +428,7 @@ internal sealed class GroupPanel
|
|||||||
var onlineUsers = new List<DrawGroupPair>();
|
var onlineUsers = new List<DrawGroupPair>();
|
||||||
var offlineUsers = new List<DrawGroupPair>();
|
var offlineUsers = new List<DrawGroupPair>();
|
||||||
|
|
||||||
|
|
||||||
foreach (var pair in sortedPairs)
|
foreach (var pair in sortedPairs)
|
||||||
{
|
{
|
||||||
var drawPair = new DrawGroupPair(
|
var drawPair = new DrawGroupPair(
|
||||||
@@ -452,16 +453,9 @@ internal sealed class GroupPanel
|
|||||||
{
|
{
|
||||||
ImGui.TextUnformatted("Visible");
|
ImGui.TextUnformatted("Visible");
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
if (_mareConfig.Current.SortSyncshellsByVRAM)
|
|
||||||
{
|
|
||||||
List<DrawGroupPair> sortedVisibleUsers = visibleUsers.OrderBy(o=>o.VramUsage).ToList();
|
|
||||||
_uidDisplayHandler.RenderPairList(sortedVisibleUsers);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_uidDisplayHandler.RenderPairList(visibleUsers);
|
_uidDisplayHandler.RenderPairList(visibleUsers);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onlineUsers.Count > 0)
|
if (onlineUsers.Count > 0)
|
||||||
|
@@ -183,6 +183,8 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
|
|
||||||
_connectionDto = await GetConnectionDto().ConfigureAwait(false);
|
_connectionDto = await GetConnectionDto().ConfigureAwait(false);
|
||||||
|
|
||||||
|
await CheckClientHealth().ConfigureAwait(false);
|
||||||
|
|
||||||
ServerState = ServerState.Connected;
|
ServerState = ServerState.Connected;
|
||||||
|
|
||||||
var currentClientVer = Assembly.GetExecutingAssembly().GetName().Version!;
|
var currentClientVer = Assembly.GetExecutingAssembly().GetName().Version!;
|
||||||
@@ -308,14 +310,24 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
_ = Task.Run(async () => await StopConnection(ServerState.Disconnected).ConfigureAwait(false));
|
_ = Task.Run(async () => await StopConnection(ServerState.Disconnected).ConfigureAwait(false));
|
||||||
_connectionCancellationTokenSource?.Cancel();
|
_connectionCancellationTokenSource?.Cancel();
|
||||||
}
|
}
|
||||||
|
private int _unhealthy = 0;
|
||||||
private async Task ClientHealthCheck(CancellationToken ct)
|
private async Task ClientHealthCheck(CancellationToken ct)
|
||||||
{
|
{
|
||||||
while (!ct.IsCancellationRequested && _mareHub != null)
|
while (!ct.IsCancellationRequested && _mareHub != null)
|
||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
|
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
|
||||||
Logger.LogDebug("Checking Client Health State");
|
var healthy = await CheckClientHealth().ConfigureAwait(false);
|
||||||
_ = await CheckClientHealth().ConfigureAwait(false);
|
if (!healthy || _mareHub.State != HubConnectionState.Connected)
|
||||||
|
{
|
||||||
|
_unhealthy++;
|
||||||
|
if (_unhealthy > 0)
|
||||||
|
{
|
||||||
|
Logger.LogWarning("Health check failed, forcing reconnect. ClientHealth: {0} HubConnected: {1}", healthy, _mareHub.State != HubConnectionState.Connected);
|
||||||
|
await ForceResetConnection().ConfigureAwait(false);
|
||||||
|
_unhealthy = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else _unhealthy = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,5 +490,30 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
|
|
||||||
ServerState = state;
|
ServerState = state;
|
||||||
}
|
}
|
||||||
|
//Because this plugin really likes to bug out with connections, lets "fix" it....
|
||||||
|
public async Task ForceResetConnection()
|
||||||
|
{
|
||||||
|
if (!_initialized) return;
|
||||||
|
Logger.LogInformation("ForceReconnect called");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
|
||||||
|
|
||||||
|
// Cancel any ongoing health checks to prevent conflicts
|
||||||
|
_healthCheckTokenSource?.Cancel();
|
||||||
|
_healthCheckTokenSource?.Dispose();
|
||||||
|
_healthCheckTokenSource = null;
|
||||||
|
|
||||||
|
await CreateConnections().ConfigureAwait(false);
|
||||||
|
|
||||||
|
Logger.LogInformation("ForceReconnect completed successfully");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError(ex, "Failure during ForceReconnect, disconnecting");
|
||||||
|
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore MA0040
|
#pragma warning restore MA0040
|
Reference in New Issue
Block a user