Add SeString.Parse(byte*) (#1937)

This commit is contained in:
Haselnussbomber 2024-07-16 20:41:41 +02:00 committed by GitHub
parent f7f52ddc77
commit 378ef0a052
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Dalamud.Data;
@ -162,6 +163,13 @@ public class SeString
/// <returns>An SeString containing parsed Payload objects for each payload in the data.</returns>
public static SeString Parse(byte[] bytes) => Parse(new ReadOnlySpan<byte>(bytes));
/// <summary>
/// Parse a binary game message into an SeString.
/// </summary>
/// <param name="ptr">Pointer to the string's data in memory. Needs to be null-terminated.</param>
/// <returns>An SeString containing parsed Payload objects for each payload in the data.</returns>
public static unsafe SeString Parse(byte* ptr) => Parse(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ptr));
/// <summary>
/// Creates an SeString representing an entire Payload chain that can be used to link an item in the chat log.
/// </summary>