Class ComponentLegacySerializer
Namespace: Void.Minecraft.Components.Text.Serializers
Assembly: Void.Minecraft.dll
Converts component trees to and from section-style legacy formatting strings.
public static class ComponentLegacySerializerInheritance
object ← ComponentLegacySerializer
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Fields
ExampleComplexLegacyString
Provides a dense example that exercises legacy codes among varied literal characters.
public const string ExampleComplexLegacyString = "&0Aa1!b@2$&k3#Cd$Ef%&1Gh7%h^j&lKl8&Lm*&2No9(Q)r&mSt0_Op+&3Uv-1=Wx&nYz2!Za@&4b#3$Cd%&oEf4&Gh*&5Ij5)Kl(&rMn6)Op?&6Qr7_Rs-&7Tu8*Vw&&8Xy9@Za!&9Bc0#De$&aFg1%Hi^&bJk2&Lm*&cNo3(Pq)&dRs4_St+&eUv5=Wx-&fYz6!Ab@"Field Value
ExampleLegacyString
Provides an example containing legacy colors, a hexadecimal color, styles, and reset formatting.
public const string ExampleLegacyString = "&1Hello, &2this is a &x&F&F&A&A&0&1hex colored text, &lwith bold, &oitalic, &nunderline, &mstrikethrough, &kobfuscated, &rand reset."Field Value
Methods
Deserialize(string, char)
Deserializes legacy-formatted text into a component tree.
public static Component Deserialize(string source, char prefix = '&')Parameters
source string
The text to parse.
prefix char
The character introducing formatting codes.
Returns
A default component for empty input, a single component for one segment, or a root whose children contain subsequent segments.
Remarks
Unknown or incomplete formatting sequences are retained as literal text.
Serialize(Component, char)
Serializes a component and its direct children to legacy-formatted text.
public static string Serialize(Component component, char prefix = '&')Parameters
component Component
The root component.
prefix char
The character emitted before each formatting code. Use the null character to omit formatting codes.
Returns
The legacy text.
Remarks
Content that has no native legacy form is reduced to a textual approximation. Descendants below direct children are not traversed.