Skip to content

Commit

Permalink
add server URI IPC
Browse files Browse the repository at this point in the history
  • Loading branch information
marzent committed Mar 29, 2023
1 parent bf04aa3 commit e87f054
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 5 additions & 9 deletions IINACT/IpcProviders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace IINACT;

internal class IpcProviders : IDisposable
{
internal static Version IpcVersion => new(1, 0, 0);
internal static Version IpcVersion => new(2, 0, 0);
internal readonly ICallGateProvider<Version> GetVersion;
internal readonly ICallGateProvider<Version> GetIpcVersion;

Expand All @@ -15,8 +15,7 @@ internal class IpcProviders : IDisposable
internal readonly ICallGateProvider<int> GetServerPort;
internal readonly ICallGateProvider<string> GetServerIp;
internal readonly ICallGateProvider<bool> GetServerSslEnabled;

internal readonly ICallGateProvider<bool> GetInCombat;
internal readonly ICallGateProvider<Uri?> GetServerUri;

internal IpcProviders(DalamudPluginInterface pluginInterface)
{
Expand All @@ -27,8 +26,7 @@ internal IpcProviders(DalamudPluginInterface pluginInterface)
GetServerPort = pluginInterface.GetIpcProvider<int>("IINACT.Server.Port");
GetServerIp = pluginInterface.GetIpcProvider<string>("IINACT.Server.Ip");
GetServerSslEnabled = pluginInterface.GetIpcProvider<bool>("IINACT.Server.SslEnabled");

GetInCombat = pluginInterface.GetIpcProvider<bool>("IINACT.InCombat");
GetServerUri = pluginInterface.GetIpcProvider<Uri?>("IINACT.Server.Uri");

Register();
}
Expand All @@ -42,8 +40,7 @@ private void Register()
GetServerPort.RegisterFunc(() => Server?.Port ?? 0);
GetServerIp.RegisterFunc(() => Server?.Address ?? "");
GetServerSslEnabled.RegisterFunc(() => Server?.Secure ?? false);

GetInCombat.RegisterFunc(() => Advanced_Combat_Tracker.ActGlobals.oFormActMain.InCombat);
GetServerUri.RegisterFunc(() => Server?.Uri);
}

public void Dispose()
Expand All @@ -55,7 +52,6 @@ public void Dispose()
GetServerPort.UnregisterFunc();
GetServerIp.UnregisterFunc();
GetServerSslEnabled.UnregisterFunc();

GetInCombat.UnregisterFunc();
GetServerUri.UnregisterFunc();
}
}
1 change: 1 addition & 0 deletions OverlayPlugin.Core/WebSocket/ServerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public ServerController(TinyIoCContainer container)
public string? Address => Server?.Address;
public int? Port => Server?.Port;
public bool Secure => false;
public Uri Uri => new Uri($"{(Secure ? "wss" : "ws")}//{Address}:{Port}");

public void Stop()
{
Expand Down

0 comments on commit e87f054

Please sign in to comment.