Migrate to new tribufu project structure (#2)

* Migrate to new tribufu project structure

* Update .gitignore

* Remove old api files

* Update Directory.Build.props

* Rename solution
This commit is contained in:
Guilherme Werner 2026-06-21 12:27:05 -03:00 committed by GitHub
parent be25ee8fe3
commit 7e8e192dc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
115 changed files with 41 additions and 262 deletions

View file

@ -1,46 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Newtonsoft.Json;
using System;
using System.Globalization;
namespace Tribufu.Serialization
{
public class DecimalNullableStringConverter : JsonConverter<decimal?>
{
public override decimal? ReadJson(JsonReader reader, Type objectType, decimal? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
{
return null;
}
if (reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Integer)
{
string value = reader.Value?.ToString();
if (string.IsNullOrWhiteSpace(value))
{
return null;
}
return decimal.Parse(value);
}
throw new JsonSerializationException($"Unexpected token {reader.TokenType} when parsing decimal?.");
}
public override void WriteJson(JsonWriter writer, decimal? value, JsonSerializer serializer)
{
if (value.HasValue)
{
writer.WriteValue(value.Value.ToString(CultureInfo.InvariantCulture));
}
else
{
writer.WriteNull();
}
}
}
}