Implement Print methods that work with Lumina SeString/ReadOnlySeString (#2106)

* Implement Print methods that work with Lumina SeString/ReadOnlySeString

* null terminate before passing to Utf8String

* Rename XivChatEntryReadOnly to XivChatEntryRaw

* Fix error from wrong conversion method

* Follow Rider suggestion

* Switch from AppendMacroString to BeginMacro for optimization

* More optimization suggested by kizer

* More kizer suggested optimizations

* Fix small mistake

* Use XivChatEntry and read/write to Byte fields accordingly
This commit is contained in:
Infi 2024-11-19 03:05:28 +01:00 committed by GitHub
parent bf7ef00ec0
commit 3a3d6b6e6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 118 additions and 45 deletions

View file

@ -20,12 +20,30 @@ public sealed class XivChatEntry
/// <summary>
/// Gets or sets the sender name.
/// </summary>
public SeString Name { get; set; } = string.Empty;
public SeString Name
{
get => SeString.Parse(this.NameBytes);
set => this.NameBytes = value.Encode();
}
/// <summary>
/// Gets or sets the message.
/// </summary>
public SeString Message { get; set; } = string.Empty;
public SeString Message
{
get => SeString.Parse(this.MessageBytes);
set => this.MessageBytes = value.Encode();
}
/// <summary>
/// Gets or Sets the name payloads
/// </summary>
public byte[] NameBytes { get; set; } = [];
/// <summary>
/// Gets or Sets the message payloads.
/// </summary>
public byte[] MessageBytes { get; set; } = [];
/// <summary>
/// Gets or sets a value indicating whether new message sounds should be silenced or not.