mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 05:43:40 +01:00
feat: expose RawData of text payload
This commit is contained in:
parent
bfbdaa5fc6
commit
3980929f71
3 changed files with 19 additions and 3 deletions
|
|
@ -50,8 +50,6 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads
|
|||
// unk
|
||||
bytes.AddRange(new byte[] { 0x02, 0x01, END_BYTE });
|
||||
|
||||
|
||||
|
||||
return bytes.ToArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,24 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads
|
|||
{
|
||||
public override PayloadType Type => PayloadType.RawText;
|
||||
|
||||
public string Text { get; set; }
|
||||
private string textConverted = null;
|
||||
|
||||
/// <summary>
|
||||
/// The Text of this text payload as an UTF-8 converted string.
|
||||
/// Don't rely on this for accurate representation of SE payload data, please check RawData instead.
|
||||
/// </summary>
|
||||
public string Text {
|
||||
get { return this.textConverted ??= Encoding.UTF8.GetString(RawData); }
|
||||
set {
|
||||
this.textConverted = value;
|
||||
RawData = Encoding.UTF8.GetBytes(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The raw unconverted data of this text payload.
|
||||
/// </summary>
|
||||
public byte[] RawData { get; set; }
|
||||
|
||||
public TextPayload() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ namespace Dalamud.Game.Internal.Gui {
|
|||
Log.Verbose("SeString was edited, taking precedence over StdString edit.");
|
||||
message.RawData = newEdited;
|
||||
}
|
||||
Log.Debug($"\nOLD: {BitConverter.ToString(originalMessageData)}\nNEW: {BitConverter.ToString(newEdited)}");
|
||||
|
||||
var messagePtr = pMessage;
|
||||
OwnedStdString allocatedString = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue