7d5496e959
81 namespace declarations and 100 using directives converted via sed, plus two FQN-aliases (ChatTwoPartyFinderPayload in PayloadHandler.cs and ModifierFlag in KeybindManager.cs) updated. Critical: Language.Designer.cs and HellionStrings.Designer.cs ResourceManager string arguments updated synchronously — these are runtime reflection lookups not caught by the C# compiler. Two intentional ChatTwo references remain: the legacy migration path 'ChatTwo.json' in Plugin.cs (still points to upstream Chat 2's config file by design) and the InternalsVisibleTo declaration in AssemblyInfo.cs (handled in the upcoming repo-folder rename task). The local alias names 'ChatTwoPartyFinderPayload' and 'ChatTwoConflictDetector' are preserved as local symbols; only their target namespaces and references changed.
75 lines
2.5 KiB
C#
75 lines
2.5 KiB
C#
using Dalamud.Plugin.Ipc;
|
|
|
|
namespace HellionChat.Ipc;
|
|
|
|
public sealed class ExtraChat : IDisposable
|
|
{
|
|
#pragma warning disable CS0649 // Assigned through IPC
|
|
[Serializable]
|
|
private struct OverrideInfo
|
|
{
|
|
public string? Channel;
|
|
public ushort UiColour;
|
|
public uint Rgba;
|
|
}
|
|
#pragma warning restore CS0649
|
|
|
|
private ICallGateSubscriber<OverrideInfo, object> OverrideChannelGate { get; }
|
|
private ICallGateSubscriber<Dictionary<string, uint>, Dictionary<string, uint>> ChannelCommandColoursGate { get; }
|
|
private ICallGateSubscriber<Dictionary<Guid, string>, Dictionary<Guid, string>> ChannelNamesGate { get; }
|
|
|
|
internal (string, uint)? ChannelOverride { get; set; }
|
|
|
|
private Dictionary<string, uint> ChannelCommandColoursInternal { get; set; } = new();
|
|
internal IReadOnlyDictionary<string, uint> ChannelCommandColours => ChannelCommandColoursInternal;
|
|
|
|
private Dictionary<Guid, string> ChannelNamesInternal { get; set; } = new();
|
|
internal IReadOnlyDictionary<Guid, string> ChannelNames => ChannelNamesInternal;
|
|
|
|
internal ExtraChat()
|
|
{
|
|
OverrideChannelGate = Plugin.Interface.GetIpcSubscriber<OverrideInfo, object>("ExtraChat.OverrideChannelColour");
|
|
ChannelCommandColoursGate = Plugin.Interface.GetIpcSubscriber<Dictionary<string, uint>, Dictionary<string, uint>>("ExtraChat.ChannelCommandColours");
|
|
ChannelNamesGate = Plugin.Interface.GetIpcSubscriber<Dictionary<Guid, string>, Dictionary<Guid, string>>("ExtraChat.ChannelNames");
|
|
|
|
OverrideChannelGate.Subscribe(OnOverrideChannel);
|
|
ChannelCommandColoursGate.Subscribe(OnChannelCommandColours);
|
|
ChannelNamesGate.Subscribe(OnChannelNames);
|
|
try
|
|
{
|
|
ChannelCommandColoursInternal = ChannelCommandColoursGate.InvokeFunc(null!);
|
|
ChannelNamesInternal = ChannelNamesGate.InvokeFunc(null!);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// no-op
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
OverrideChannelGate.Unsubscribe(OnOverrideChannel);
|
|
}
|
|
|
|
private void OnOverrideChannel(OverrideInfo info)
|
|
{
|
|
if (info.Channel == null)
|
|
{
|
|
ChannelOverride = null;
|
|
return;
|
|
}
|
|
|
|
ChannelOverride = (info.Channel, info.Rgba);
|
|
}
|
|
|
|
private void OnChannelCommandColours(Dictionary<string, uint> obj)
|
|
{
|
|
ChannelCommandColoursInternal = obj;
|
|
}
|
|
|
|
private void OnChannelNames(Dictionary<Guid, string> obj)
|
|
{
|
|
ChannelNamesInternal = obj;
|
|
}
|
|
}
|