mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +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();
|
payload = new EmphasisItalicPayload();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SeStringChunkType.NewLine:
|
||||||
|
payload = NewLinePayload.Payload;
|
||||||
|
break;
|
||||||
|
|
||||||
case SeStringChunkType.SeHyphen:
|
case SeStringChunkType.SeHyphen:
|
||||||
payload = SeHyphenPayload.Payload;
|
payload = SeHyphenPayload.Payload;
|
||||||
break;
|
break;
|
||||||
|
|
@ -295,6 +299,11 @@ namespace Dalamud.Game.Text.SeStringHandling
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EmphasisItalic = 0x1A,
|
EmphasisItalic = 0x1A,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// See the <see cref="NewLinePayload"/>
|
||||||
|
/// </summary>
|
||||||
|
NewLine = 0x10,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// See the <see cref="SeHyphenPayload"/> class.
|
/// See the <see cref="SeHyphenPayload"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,11 @@ namespace Dalamud.Game.Text.SeStringHandling
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum PayloadType
|
public enum PayloadType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An unknown SeString.
|
||||||
|
/// </summary>
|
||||||
|
Unknown,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An SeString payload representing a player link.
|
/// An SeString payload representing a player link.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -66,9 +71,9 @@ namespace Dalamud.Game.Text.SeStringHandling
|
||||||
DalamudLink,
|
DalamudLink,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An SeString payload representing any data we don't handle.
|
/// An SeString payload representing a newline character.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Unknown,
|
NewLine,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An SeString payload representing a doublewide SE hypen.
|
/// 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