add tutorial guide

This commit is contained in:
Naruse
2026-05-11 17:11:47 +08:00
parent bdb4ee3d51
commit e4397f10ee
5 changed files with 53 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
using Newtonsoft.Json;
namespace MikuSB.Data.Config;
public class StringToUIntConverter : JsonConverter<uint>
{
public override uint ReadJson(JsonReader reader, Type objectType, uint existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.Value == null)
return 0;
var value = reader.Value.ToString();
if (string.IsNullOrWhiteSpace(value))
return 0;
return uint.TryParse(value, out var result) ? result : 0;
}
public override void WriteJson(JsonWriter writer, uint value, JsonSerializer serializer)
{
writer.WriteValue(value);
}
}