mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
feat(SeStringHandling): Add NewLinePayload
This commit is contained in:
parent
ea9ce0d776
commit
6bedebba87
3 changed files with 50 additions and 2 deletions
|
|
@ -131,6 +131,10 @@ namespace Dalamud.Game.Text.SeStringHandling
|
|||
payload = new EmphasisItalicPayload();
|
||||
break;
|
||||
|
||||
case SeStringChunkType.NewLine:
|
||||
payload = NewLinePayload.Payload;
|
||||
break;
|
||||
|
||||
case SeStringChunkType.SeHyphen:
|
||||
payload = SeHyphenPayload.Payload;
|
||||
break;
|
||||
|
|
@ -295,6 +299,11 @@ namespace Dalamud.Game.Text.SeStringHandling
|
|||
/// </summary>
|
||||
EmphasisItalic = 0x1A,
|
||||
|
||||
/// <summary>
|
||||
/// See the <see cref="NewLinePayload"/>
|
||||
/// </summary>
|
||||
NewLine = 0x10,
|
||||
|
||||
/// <summary>
|
||||
/// See the <see cref="SeHyphenPayload"/> class.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ namespace Dalamud.Game.Text.SeStringHandling
|
|||
/// </summary>
|
||||
public enum PayloadType
|
||||
{
|
||||
/// <summary>
|
||||
/// An unknown SeString.
|
||||
/// </summary>
|
||||
Unknown,
|
||||
|
||||
/// <summary>
|
||||
/// An SeString payload representing a player link.
|
||||
/// </summary>
|
||||
|
|
@ -66,9 +71,9 @@ namespace Dalamud.Game.Text.SeStringHandling
|
|||
DalamudLink,
|
||||
|
||||
/// <summary>
|
||||
/// An SeString payload representing any data we don't handle.
|
||||
/// An SeString payload representing a newline character.
|
||||
/// </summary>
|
||||
Unknown,
|
||||
NewLine,
|
||||
|
||||
/// <summary>
|
||||
/// An SeString payload representing a doublewide SE hypen.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Dalamud.Game.Text.SeStringHandling.Payloads
|
||||
{
|
||||
/// <summary>
|
||||
/// A wrapped newline character.
|
||||
/// </summary>
|
||||
public class NewLinePayload : Payload, ITextProvider
|
||||
{
|
||||
private readonly byte[] bytes = { START_BYTE, (byte)SeStringChunkType.NewLine, 0x01, END_BYTE };
|
||||
|
||||
/// <summary>
|
||||
/// Gets an instance of NewLinePayload.
|
||||
/// </summary>
|
||||
public static NewLinePayload Payload => new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the text of this payload, evaluates to <c>Environment.NewLine</c>
|
||||
/// </summary>
|
||||
public string Text => Environment.NewLine;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override PayloadType Type => PayloadType.NewLine;
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override byte[] EncodeImpl() => this.bytes;
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void DecodeImpl(BinaryReader reader, long endOfStream)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue