mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
SeString add EncodeWithNullTerminator (#1931)
This commit is contained in:
parent
d966e5338a
commit
7f6bbafbbf
1 changed files with 20 additions and 0 deletions
|
|
@ -492,6 +492,26 @@ public class SeString
|
|||
return messageBytes.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encodes the Payloads in this SeString into a binary representation
|
||||
/// suitable for use by in-game handlers, such as the chat log.
|
||||
/// Includes a null terminator at the end of the string.
|
||||
/// </summary>
|
||||
/// <returns>The binary encoded payload data.</returns>
|
||||
public byte[] EncodeWithNullTerminator()
|
||||
{
|
||||
var messageBytes = new List<byte>();
|
||||
foreach (var p in this.Payloads)
|
||||
{
|
||||
messageBytes.AddRange(p.Encode());
|
||||
}
|
||||
|
||||
// Add Null Terminator
|
||||
messageBytes.Add(0);
|
||||
|
||||
return messageBytes.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the text value of this SeString.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue