style: apply csharpier formatting to cycle files
This commit is contained in:
@@ -187,6 +187,7 @@ public class Configuration : IPluginConfiguration
|
|||||||
public bool CollapseKeepUniqueLinks;
|
public bool CollapseKeepUniqueLinks;
|
||||||
public bool SymbolPickerEnabled = true;
|
public bool SymbolPickerEnabled = true;
|
||||||
public bool PlaySounds = true;
|
public bool PlaySounds = true;
|
||||||
|
|
||||||
// UI-2: toast when a tell the user sent could not be delivered.
|
// UI-2: toast when a tell the user sent could not be delivered.
|
||||||
public bool NotifyFailedTell = true;
|
public bool NotifyFailedTell = true;
|
||||||
public bool KeepInputFocus = true;
|
public bool KeepInputFocus = true;
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ internal sealed class AutoTellTabsServiceInitHostedService(AutoTellTabsService s
|
|||||||
|
|
||||||
// Eager-resolve trigger: resolving FailedTellNotifier in this adapter's ctor
|
// Eager-resolve trigger: resolving FailedTellNotifier in this adapter's ctor
|
||||||
// enables its game hook during host startup. StartAsync itself is a no-op.
|
// enables its game hook during host startup. StartAsync itself is a no-op.
|
||||||
internal sealed class FailedTellNotifierInitHostedService(
|
internal sealed class FailedTellNotifierInitHostedService(FailedTellNotifier notifier)
|
||||||
FailedTellNotifier notifier) : IHostedService
|
: IHostedService
|
||||||
{
|
{
|
||||||
// No-op adapter: the ctor dependency above is the actual eager-resolve
|
// No-op adapter: the ctor dependency above is the actual eager-resolve
|
||||||
// trigger. Field kept to match the IpcManager/TypingIpc/ExtraChat no-op
|
// trigger. Field kept to match the IpcManager/TypingIpc/ExtraChat no-op
|
||||||
|
|||||||
@@ -27,21 +27,29 @@ internal sealed class FailedTellNotifier : IDisposable
|
|||||||
// Creating/enabling a hook is safe off the framework thread (the
|
// Creating/enabling a hook is safe off the framework thread (the
|
||||||
// ctor runs during host startup on the framework thread,
|
// ctor runs during host startup on the framework thread,
|
||||||
// eager-resolved via FailedTellNotifierInitHostedService).
|
// eager-resolved via FailedTellNotifierInitHostedService).
|
||||||
_hook = Plugin.GameInteropProvider
|
_hook =
|
||||||
.HookFromAddress<RaptureLogModule.Delegates.ShowLogMessageString>(
|
Plugin.GameInteropProvider.HookFromAddress<RaptureLogModule.Delegates.ShowLogMessageString>(
|
||||||
RaptureLogModule.MemberFunctionPointers.ShowLogMessageString,
|
RaptureLogModule.MemberFunctionPointers.ShowLogMessageString,
|
||||||
ShowLogMessageStringDetour);
|
ShowLogMessageStringDetour
|
||||||
|
);
|
||||||
_hook.Enable();
|
_hook.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void ShowLogMessageStringDetour(
|
private unsafe void ShowLogMessageStringDetour(
|
||||||
RaptureLogModule* module, uint logMessageId, Utf8String* value)
|
RaptureLogModule* module,
|
||||||
|
uint logMessageId,
|
||||||
|
Utf8String* value
|
||||||
|
)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (FailedTellMatcher.ShouldNotify(
|
if (
|
||||||
logMessageId, Plugin.Config.NotifyFailedTell,
|
FailedTellMatcher.ShouldNotify(
|
||||||
FailedTellMatcher.FailedTellLogMessageIds))
|
logMessageId,
|
||||||
|
Plugin.Config.NotifyFailedTell,
|
||||||
|
FailedTellMatcher.FailedTellLogMessageIds
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var recipient = value is null ? string.Empty : value->ToString();
|
var recipient = value is null ? string.Empty : value->ToString();
|
||||||
var content = string.IsNullOrEmpty(recipient)
|
var content = string.IsNullOrEmpty(recipient)
|
||||||
|
|||||||
@@ -347,11 +347,14 @@ internal class MessageManager : IAsyncDisposable
|
|||||||
// inactive tab that wants it, keeping a message matching several
|
// inactive tab that wants it, keeping a message matching several
|
||||||
// background tabs from stacking sounds.
|
// background tabs from stacking sounds.
|
||||||
// TEST-MIRROR: ../_Helpers/TabSoundDecision.cs
|
// TEST-MIRROR: ../_Helpers/TabSoundDecision.cs
|
||||||
if (notificationSound is null
|
if (
|
||||||
|
notificationSound is null
|
||||||
&& TabSoundDecision.ShouldPlay(
|
&& TabSoundDecision.ShouldPlay(
|
||||||
Plugin.CurrentTab == tab,
|
Plugin.CurrentTab == tab,
|
||||||
tab.EnableNotificationSound,
|
tab.EnableNotificationSound,
|
||||||
Plugin.Config.PlaySounds))
|
Plugin.Config.PlaySounds
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
notificationSound = tab.NotificationSoundId;
|
notificationSound = tab.NotificationSoundId;
|
||||||
}
|
}
|
||||||
@@ -363,8 +366,13 @@ internal class MessageManager : IAsyncDisposable
|
|||||||
// ProcessMessage runs on the PendingMessageThread worker; the native
|
// ProcessMessage runs on the PendingMessageThread worker; the native
|
||||||
// UIGlobals.PlaySoundEffect must be marshalled onto the framework
|
// UIGlobals.PlaySoundEffect must be marshalled onto the framework
|
||||||
// thread (reference_dalamud_framework_thread).
|
// thread (reference_dalamud_framework_thread).
|
||||||
Plugin.Framework.RunOnFrameworkThread(
|
Plugin.Framework.RunOnFrameworkThread(() =>
|
||||||
() => { unsafe { UIGlobals.PlaySoundEffect(soundId); } });
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
UIGlobals.PlaySoundEffect(soundId);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageProcessed?.Invoke(message);
|
MessageProcessed?.Invoke(message);
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ internal static class PluginHostFactory
|
|||||||
sp.GetRequiredService<IFramework>()
|
sp.GetRequiredService<IFramework>()
|
||||||
));
|
));
|
||||||
services.AddSingleton(sp => new Integrations.FailedTellNotifier(
|
services.AddSingleton(sp => new Integrations.FailedTellNotifier(
|
||||||
sp.GetRequiredService<ILogger<Integrations.FailedTellNotifier>>()));
|
sp.GetRequiredService<ILogger<Integrations.FailedTellNotifier>>()
|
||||||
|
));
|
||||||
|
|
||||||
services.AddSingleton(sp => new MessageManager(
|
services.AddSingleton(sp => new MessageManager(
|
||||||
sp.GetRequiredService<Plugin>(),
|
sp.GetRequiredService<Plugin>(),
|
||||||
@@ -174,8 +175,11 @@ internal static class PluginHostFactory
|
|||||||
services.AddHostedService(sp => new AutoTellTabsServiceInitHostedService(
|
services.AddHostedService(sp => new AutoTellTabsServiceInitHostedService(
|
||||||
sp.GetRequiredService<AutoTellTabsService>()
|
sp.GetRequiredService<AutoTellTabsService>()
|
||||||
));
|
));
|
||||||
services.AddHostedService(sp => new Infrastructure.Hosting.FailedTellNotifierInitHostedService(
|
services.AddHostedService(
|
||||||
sp.GetRequiredService<Integrations.FailedTellNotifier>()));
|
sp => new Infrastructure.Hosting.FailedTellNotifierInitHostedService(
|
||||||
|
sp.GetRequiredService<Integrations.FailedTellNotifier>()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,15 +173,19 @@ internal sealed class Tabs : ISettingsTab
|
|||||||
if (tab.EnableNotificationSound)
|
if (tab.EnableNotificationSound)
|
||||||
{
|
{
|
||||||
using var indent = ImRaii.PushIndent(10.0f);
|
using var indent = ImRaii.PushIndent(10.0f);
|
||||||
var soundPreview = $"{HellionStrings.Tabs_NotificationSound_Option} {tab.NotificationSoundId}";
|
var soundPreview =
|
||||||
|
$"{HellionStrings.Tabs_NotificationSound_Option} {tab.NotificationSoundId}";
|
||||||
using var combo = ImRaii.Combo($"##notif-sound-{i}", soundPreview);
|
using var combo = ImRaii.Combo($"##notif-sound-{i}", soundPreview);
|
||||||
if (combo.Success)
|
if (combo.Success)
|
||||||
{
|
{
|
||||||
for (uint s = 1; s <= 16; s++)
|
for (uint s = 1; s <= 16; s++)
|
||||||
{
|
{
|
||||||
if (ImGui.Selectable(
|
if (
|
||||||
|
ImGui.Selectable(
|
||||||
$"{HellionStrings.Tabs_NotificationSound_Option} {s}",
|
$"{HellionStrings.Tabs_NotificationSound_Option} {s}",
|
||||||
tab.NotificationSoundId == s))
|
tab.NotificationSoundId == s
|
||||||
|
)
|
||||||
|
)
|
||||||
tab.NotificationSoundId = s;
|
tab.NotificationSoundId = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ public static class FailedTellMatcher
|
|||||||
3832u,
|
3832u,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static bool ShouldNotify(uint logMessageId, bool notifyEnabled, IReadOnlySet<uint> failedTellIds)
|
public static bool ShouldNotify(
|
||||||
=> notifyEnabled && failedTellIds.Contains(logMessageId);
|
uint logMessageId,
|
||||||
|
bool notifyEnabled,
|
||||||
|
IReadOnlySet<uint> failedTellIds
|
||||||
|
) => notifyEnabled && failedTellIds.Contains(logMessageId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ public static class TabSoundDecision
|
|||||||
// True only when the message landed in a tab the user is not looking at,
|
// True only when the message landed in a tab the user is not looking at,
|
||||||
// that tab has its own sound switched on, and the global sound master is
|
// that tab has its own sound switched on, and the global sound master is
|
||||||
// not muted.
|
// not muted.
|
||||||
public static bool ShouldPlay(bool isActiveTab, bool tabSoundEnabled, bool globalSoundsEnabled)
|
public static bool ShouldPlay(
|
||||||
=> !isActiveTab && tabSoundEnabled && globalSoundsEnabled;
|
bool isActiveTab,
|
||||||
|
bool tabSoundEnabled,
|
||||||
|
bool globalSoundsEnabled
|
||||||
|
) => !isActiveTab && tabSoundEnabled && globalSoundsEnabled;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user