Create C# projects

This commit is contained in:
2024-08-18 16:27:33 -03:00
parent 16c9711596
commit 30075eca9a
16 changed files with 254 additions and 2 deletions

View File

@ -0,0 +1 @@
# Tribufu

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Tribufu</PackageId>
<Version>0.1.0</Version>
<Description>Tribufu .NET SDK</Description>
<Authors>Tribufu</Authors>
<Company>Tribufu</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,21 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using Newtonsoft.Json;
namespace Tribufu.Serialization.Newtonsoft
{
public class DecimalStringConverter : JsonConverter<decimal>
{
public override decimal ReadJson(JsonReader reader, Type objectType, decimal existingValue, bool hasExistingValue, JsonSerializer serializer)
{
return decimal.Parse(reader.ToString());
}
public override void WriteJson(JsonWriter writer, decimal value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
}
}

View File

@ -0,0 +1,21 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using Newtonsoft.Json;
namespace Tribufu.Serialization.Newtonsoft
{
public class LongStringConverter : JsonConverter<ulong>
{
public override ulong ReadJson(JsonReader reader, Type objectType, ulong existingValue, bool hasExistingValue, JsonSerializer serializer)
{
return ulong.Parse(reader.ToString());
}
public override void WriteJson(JsonWriter writer, ulong value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
}
}

View File

@ -0,0 +1 @@
# Tribufu

View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Tribufu.Serialization.Newtonsoft</PackageId>
<Version>0.1.0</Version>
<Description>Tribufu Serialization Helpers for Newtonsoft.Json</Description>
<Authors>Tribufu</Authors>
<Company>Tribufu</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,22 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Tribufu.Serialization
{
public class DecimalStringConverter : JsonConverter<decimal>
{
public override decimal Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return Convert.ToUInt64(reader.GetString());
}
public override void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options)
{
writer.WriteStringValue(value.ToString());
}
}
}

View File

@ -0,0 +1,22 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Tribufu.Serialization
{
public class LongStringConverter : JsonConverter<ulong>
{
public override ulong Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return Convert.ToUInt64(reader.GetString());
}
public override void Write(Utf8JsonWriter writer, ulong value, JsonSerializerOptions options)
{
writer.WriteStringValue(value.ToString());
}
}
}

View File

@ -0,0 +1 @@
# Tribufu

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Tribufu.Serialization</PackageId>
<Version>0.1.0</Version>
<Description>Tribufu Serialization Helpers</Description>
<Authors>Tribufu</Authors>
<Company>Tribufu</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>