b598c03e9e
Reformats the entire Craftimizer source tree with dotnet csharpier 1.2.6 to match the Hellion Forge house style (matches what HellionChat enforces in its pre-push pipeline). Pure whitespace + using-block sorting; no semantic changes. This is a one-time noisy commit. Future code edits in this fork should land csharpier-clean because the pre-push hook (introduced in the next commit) runs `dotnet csharpier check Craftimizer/` as Block C of the preflight gate. Trade-off acknowledged: this widens the merge gap with upstream Craftimizer should Asriel ever resume maintenance. Given the upstream has been dormant since FFXIV 7.4 and the fork is light-rename only (internal namespaces unchanged), the marginal cost is acceptable.
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using System;
|
|
using FFXIVClientStructs.FFXIV.Client.System.String;
|
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
|
|
|
namespace Craftimizer.Utils;
|
|
|
|
// https://github.com/Caraxi/SimpleTweaksPlugin/blob/0973b93931cdf8a1b01153984d62f76d998747ff/Utility/ChatHelper.cs#L17
|
|
public static unsafe class Chat
|
|
{
|
|
public static void SendMessage(string message)
|
|
{
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(message);
|
|
|
|
var str = Utf8String.FromString(message);
|
|
try
|
|
{
|
|
ArgumentOutOfRangeException.ThrowIfZero(str->Length, nameof(message));
|
|
ArgumentOutOfRangeException.ThrowIfGreaterThan(str->Length, 500, nameof(message));
|
|
|
|
var unsanitizedLength = str->Length;
|
|
str->SanitizeString(
|
|
AllowedEntities.Unknown9
|
|
| // 200
|
|
AllowedEntities.Payloads
|
|
| // 40
|
|
AllowedEntities.OtherCharacters
|
|
| // 20
|
|
AllowedEntities.CharacterList
|
|
| // 10
|
|
AllowedEntities.SpecialCharacters
|
|
| // 8
|
|
AllowedEntities.Numbers
|
|
| // 4
|
|
AllowedEntities.LowercaseLetters
|
|
| // 2
|
|
AllowedEntities.UppercaseLetters, // 1
|
|
null
|
|
);
|
|
ArgumentOutOfRangeException.ThrowIfNotEqual(
|
|
unsanitizedLength,
|
|
str->Length,
|
|
nameof(message)
|
|
);
|
|
|
|
UIModule.Instance()->ProcessChatBoxEntry(str);
|
|
}
|
|
finally
|
|
{
|
|
str->Dtor(true);
|
|
}
|
|
}
|
|
}
|