From 30075eca9a9f6f3a81eff9489925fcee61c53a44 Mon Sep 17 00:00:00 2001 From: Guilherme Werner Date: Sun, 18 Aug 2024 16:27:33 -0300 Subject: [PATCH] Create C# projects --- .editorconfig | 12 +++++++ .gitattributes | 1 + .gitignore | 7 ++++ LICENSE.txt | 21 ++++++++++++ README.md | 22 +++++++++++-- Tribufu.sln | 32 +++++++++++++++++++ src/Tribufu.Sdk/README.md | 1 + src/Tribufu.Sdk/Tribufu.Sdk.csproj | 23 +++++++++++++ .../DecimalStringConverter.cs | 21 ++++++++++++ .../LongStringConverter.cs | 21 ++++++++++++ .../README.md | 1 + .../Tribufu.Serialization.Newtonsoft.csproj | 26 +++++++++++++++ .../DecimalStringConverter.cs | 22 +++++++++++++ .../LongStringConverter.cs | 22 +++++++++++++ src/Tribufu.Serialization/README.md | 1 + .../Tribufu.Serialization.csproj | 23 +++++++++++++ 16 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE.txt create mode 100644 Tribufu.sln create mode 100644 src/Tribufu.Sdk/README.md create mode 100644 src/Tribufu.Sdk/Tribufu.Sdk.csproj create mode 100644 src/Tribufu.Serialization.Newtonsoft/DecimalStringConverter.cs create mode 100644 src/Tribufu.Serialization.Newtonsoft/LongStringConverter.cs create mode 100644 src/Tribufu.Serialization.Newtonsoft/README.md create mode 100644 src/Tribufu.Serialization.Newtonsoft/Tribufu.Serialization.Newtonsoft.csproj create mode 100644 src/Tribufu.Serialization/DecimalStringConverter.cs create mode 100644 src/Tribufu.Serialization/LongStringConverter.cs create mode 100644 src/Tribufu.Serialization/README.md create mode 100644 src/Tribufu.Serialization/Tribufu.Serialization.csproj diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..88df879 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd402ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.vs/ +bin/ +obj/ + +*.filters +*.user +.DS_Store diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..292d951 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Tribufu. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 7ef5f61..ba4f761 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ -# TribufuNet -Tribufu .NET SDK +# Tribufu .NET + +.NET SDK to access Tribufu APIs and services. + +[![MIT License][mit-badge]][mit-url] +[![Discord Chat][discord-badge]][discord-url] + +[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg +[mit-url]: https://github.com/Tribufu/TribufuNet/blob/main/LICENSE.txt +[discord-badge]: https://img.shields.io/discord/276504514616623104.svg?logo=discord&style=flat-square +[discord-url]: https://www.tribufu.com/discord + +[Website](https://www.tribufu.com) | +[Discord](https://www.tribufu.com/discord) + +## License + +This project is licensed under the [MIT License]. + +[MIT License]: https://github.com/Tribufu/TribufuNet/blob/main/LICENSE.txt diff --git a/Tribufu.sln b/Tribufu.sln new file mode 100644 index 0000000..a32fcda --- /dev/null +++ b/Tribufu.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Sdk", "src\Tribufu.Sdk\Tribufu.Sdk.csproj", "{C66D6B57-324D-EAF2-3B65-75C9A7C35054}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Serialization", "src\Tribufu.Serialization\Tribufu.Serialization.csproj", "{322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Serialization.Newtonsoft", "src\Tribufu.Serialization.Newtonsoft\Tribufu.Serialization.Newtonsoft.csproj", "{B7019B7B-A352-86BD-CCB6-747FB8661927}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Release|Any CPU.Build.0 = Release|Any CPU + {322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Release|Any CPU.Build.0 = Release|Any CPU + {B7019B7B-A352-86BD-CCB6-747FB8661927}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7019B7B-A352-86BD-CCB6-747FB8661927}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7019B7B-A352-86BD-CCB6-747FB8661927}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7019B7B-A352-86BD-CCB6-747FB8661927}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tribufu.Sdk/README.md b/src/Tribufu.Sdk/README.md new file mode 100644 index 0000000..54c1ab5 --- /dev/null +++ b/src/Tribufu.Sdk/README.md @@ -0,0 +1 @@ +# Tribufu diff --git a/src/Tribufu.Sdk/Tribufu.Sdk.csproj b/src/Tribufu.Sdk/Tribufu.Sdk.csproj new file mode 100644 index 0000000..c3a4788 --- /dev/null +++ b/src/Tribufu.Sdk/Tribufu.Sdk.csproj @@ -0,0 +1,23 @@ + + + Tribufu + 0.1.0 + Tribufu .NET SDK + Tribufu + Tribufu + README.md + MIT + Copyright (c) Tribufu. All Rights Reserved. + git + https://github.com/Tribufu/TribufuNet + + + Library + Properties + net8.0 + true + + + + + diff --git a/src/Tribufu.Serialization.Newtonsoft/DecimalStringConverter.cs b/src/Tribufu.Serialization.Newtonsoft/DecimalStringConverter.cs new file mode 100644 index 0000000..ba22445 --- /dev/null +++ b/src/Tribufu.Serialization.Newtonsoft/DecimalStringConverter.cs @@ -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 + { + 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()); + } + } +} diff --git a/src/Tribufu.Serialization.Newtonsoft/LongStringConverter.cs b/src/Tribufu.Serialization.Newtonsoft/LongStringConverter.cs new file mode 100644 index 0000000..417af47 --- /dev/null +++ b/src/Tribufu.Serialization.Newtonsoft/LongStringConverter.cs @@ -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 + { + 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()); + } + } +} diff --git a/src/Tribufu.Serialization.Newtonsoft/README.md b/src/Tribufu.Serialization.Newtonsoft/README.md new file mode 100644 index 0000000..54c1ab5 --- /dev/null +++ b/src/Tribufu.Serialization.Newtonsoft/README.md @@ -0,0 +1 @@ +# Tribufu diff --git a/src/Tribufu.Serialization.Newtonsoft/Tribufu.Serialization.Newtonsoft.csproj b/src/Tribufu.Serialization.Newtonsoft/Tribufu.Serialization.Newtonsoft.csproj new file mode 100644 index 0000000..7788afd --- /dev/null +++ b/src/Tribufu.Serialization.Newtonsoft/Tribufu.Serialization.Newtonsoft.csproj @@ -0,0 +1,26 @@ + + + Tribufu.Serialization.Newtonsoft + 0.1.0 + Tribufu Serialization Helpers for Newtonsoft.Json + Tribufu + Tribufu + README.md + MIT + Copyright (c) Tribufu. All Rights Reserved. + git + https://github.com/Tribufu/TribufuNet + + + Library + Properties + net8.0 + true + + + + + + + + diff --git a/src/Tribufu.Serialization/DecimalStringConverter.cs b/src/Tribufu.Serialization/DecimalStringConverter.cs new file mode 100644 index 0000000..d610ae5 --- /dev/null +++ b/src/Tribufu.Serialization/DecimalStringConverter.cs @@ -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 + { + 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()); + } + } +} diff --git a/src/Tribufu.Serialization/LongStringConverter.cs b/src/Tribufu.Serialization/LongStringConverter.cs new file mode 100644 index 0000000..e7f335a --- /dev/null +++ b/src/Tribufu.Serialization/LongStringConverter.cs @@ -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 + { + 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()); + } + } +} diff --git a/src/Tribufu.Serialization/README.md b/src/Tribufu.Serialization/README.md new file mode 100644 index 0000000..54c1ab5 --- /dev/null +++ b/src/Tribufu.Serialization/README.md @@ -0,0 +1 @@ +# Tribufu diff --git a/src/Tribufu.Serialization/Tribufu.Serialization.csproj b/src/Tribufu.Serialization/Tribufu.Serialization.csproj new file mode 100644 index 0000000..a60bf61 --- /dev/null +++ b/src/Tribufu.Serialization/Tribufu.Serialization.csproj @@ -0,0 +1,23 @@ + + + Tribufu.Serialization + 0.1.0 + Tribufu Serialization Helpers + Tribufu + Tribufu + README.md + MIT + Copyright (c) Tribufu. All Rights Reserved. + git + https://github.com/Tribufu/TribufuNet + + + Library + Properties + net8.0 + true + + + + +