mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* Switch to System.Text.Json Removed Newtonsoft.Json and DouglasCrockford.JsMin * Update GameConfiguration.cs * Update MasterConfiguration.cs * Update ThreadConfiguration.cs * Update StarterSpell.cs * Update StarterGearFactory.cs * Update Program_Setup.cs * Update LifestonedConverter.cs * Update Program_Setup.cs * Update Program_Setup.cs * Update ACE.Adaptor Shift JSON weenie [de]serialization to System.Text.Json * Update LifestonedConverter.cs * Update StarterGearFactory.cs * Update ACE.Server.csproj * Update ACE.Server.Tests.csproj * Update Program.cs * Update MySqlConfiguration.cs * Update DDDConfiguration.cs * Update ModContainer.cs * Update ModManager.cs * Update ModMetadata.cs * Update ModMetadata.cs
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace ACE.Server.Entity
|
|
{
|
|
public class StarterSpell
|
|
{
|
|
[JsonPropertyName("spellId")]
|
|
public uint SpellId { get; set; }
|
|
|
|
/// <summary>
|
|
/// not used, but in the json file for readability
|
|
/// </summary>
|
|
[JsonPropertyName("name")]
|
|
public string Name { get; set; }
|
|
|
|
[JsonPropertyName("specializedOnly"), JsonConverter(typeof(StringToBoolConverter))]
|
|
public bool SpecializedOnly { get; set; }
|
|
}
|
|
|
|
public class StringToBoolConverter : JsonConverter<bool>
|
|
{
|
|
public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
{
|
|
if (reader.TokenType == JsonTokenType.String)
|
|
{
|
|
var boolString = reader.GetString();
|
|
|
|
return Convert.ToBoolean(boolString);
|
|
}
|
|
else if (reader.TokenType == JsonTokenType.True)
|
|
{
|
|
return true;
|
|
}
|
|
else if (reader.TokenType == JsonTokenType.False)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
throw new JsonException();
|
|
}
|
|
|
|
public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options)
|
|
{
|
|
writer.WriteBooleanValue(value);
|
|
}
|
|
|
|
}
|
|
}
|