Files
HellionChat/HellionChat/_Helpers/PluginDisclosureScanner.cs
T

31 lines
1.2 KiB
C#

namespace HellionChat._Helpers;
// UI-11 pure decision helper: does a message about to be sent carry a glyph
// that only renders correctly for players running HellionChat or a similar
// plugin? Those are FFXIV Private-Use-Area icon codepoints (the same range
// SeIconChar covers); a recipient without a plugin sees an empty box.
//
// Works on raw char codepoints on purpose: SeIconChar is a Dalamud type, and a
// helper that touched it could not run in the xUnit AppDomain
// (feedback_dalamud_test_isolation, point 7).
// TEST-MIRROR: ../../../Hellion Build test/Ui/PluginDisclosureScannerTests.cs
public static class PluginDisclosureScanner
{
// FFXIV packs its icon glyphs into this slice of the Unicode Private Use
// Area. The whole range is inside the BMP, so a single char per codepoint
// is enough — no surrogate-pair handling needed.
private const char PrivateUseFirst = '';
private const char PrivateUseLast = '';
public static bool ContainsPrivateUseGlyph(string text)
{
foreach (var c in text)
{
if (c >= PrivateUseFirst && c <= PrivateUseLast)
return true;
}
return false;
}
}