mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 07:12:27 +02:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using YamlDotNet.RepresentationModel;
|
|
|
|
namespace Robust.Shared.Serialization.Markdown.Value
|
|
{
|
|
public sealed class ValueDataNode : DataNode<ValueDataNode>
|
|
{
|
|
public ValueDataNode(string value) : base(NodeMark.Invalid, NodeMark.Invalid)
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public ValueDataNode(YamlScalarNode node) : base(node.Start, node.End)
|
|
{
|
|
Value = node.Value ?? string.Empty;
|
|
Tag = node.Tag;
|
|
}
|
|
|
|
public string Value { get; set; }
|
|
|
|
public override ValueDataNode Copy()
|
|
{
|
|
return new(Value)
|
|
{
|
|
Tag = Tag,
|
|
Start = Start,
|
|
End = End
|
|
};
|
|
}
|
|
|
|
public override ValueDataNode? Except(ValueDataNode node)
|
|
{
|
|
return node.Value == Value ? null : Copy();
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
return obj is ValueDataNode node && node.Value == Value;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return Value.GetHashCode();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Value;
|
|
}
|
|
}
|
|
}
|