1
0
forked from liza/Questionable
Questionable/Questionable.Model/V1/QuestWorkValue.cs

31 lines
840 B
C#
Raw Normal View History

using System;
using System.Text.Json.Serialization;
2024-07-20 17:09:51 +00:00
using Questionable.Model.V1.Converter;
namespace Questionable.Model.V1;
[JsonConverter(typeof(QuestWorkConfigConverter))]
public sealed class QuestWorkValue(byte? high, byte? low, EQuestWorkMode mode)
2024-07-20 17:09:51 +00:00
{
public QuestWorkValue(byte value)
: this((byte)(value >> 4), (byte)(value & 0xF), EQuestWorkMode.Bitwise)
2024-07-20 17:09:51 +00:00
{
}
public byte? High { get; set; } = high;
public byte? Low { get; set; } = low;
public EQuestWorkMode Mode { get; set; } = mode;
public override string ToString()
{
if (High != null && Low != null)
return ((byte)(High << 4) + Low).ToString();
else if (High != null)
return High + "H";
else if (Low != null)
return Low + "L";
else
return "-";
}
2024-07-20 17:09:51 +00:00
}