- Add FluentMath methods

- Fix spelling mistakes
- Minor code improvements
This commit is contained in:
Stone-Red-Code
2021-10-28 00:43:03 +02:00
parent 8d99bc9fa5
commit 40ceaeed46
48 changed files with 777 additions and 151 deletions
+23 -29
View File
@@ -1,10 +1,11 @@
using Stone_Red_Utilities.BoolExtentions;
using Stone_Red_Utilities.ConsoleExtentions;
using Stone_Red_Utilities.FluentMath;
using Stone_Red_Utilities.Http;
using Stone_Red_Utilities.Logging;
using Stone_Red_Utilities.Reflection;
using System;
using System.Diagnostics;
using System.Net.Http;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Stone_Red_C_Sharp_Utilities_Test
{
@@ -46,38 +47,31 @@ namespace Stone_Red_C_Sharp_Utilities_Test
}
};
private static void Main()
private static async Task Main()
{
Trace.WriteLine("kek1");
Debug.WriteLine("kek2");
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
HttpClient httpClient = new HttpClient();
Quote quote = await httpClient.GetJsonObjectAsync<Quote>("https://api.quotable.io/random");
Console.WriteLine(quote.Id);
Console.WriteLine(quote.Content);
Console.WriteLine(quote.Author);
while (true)
{
ConsoleExt.Write("Enter the first number: ", ConsoleColor.Green);
bool success = int.TryParse(Console.ReadLine(), out int num1);
Quote q = quote.CopyProperties<Quote>();
ConsoleExt.Write("Enter the second number: ", ConsoleColor.Green);
success.OneWayFalse(int.TryParse(Console.ReadLine(), out int num2));
logger.LogIf(success, "Valid input!", LogSeverity.Debug);
if (success)
{
Console.WriteLine($"{num1}/{num2} = {num1.Divide(num2)}");
}
else
{
logger.Log("Invalid input!", "Calculator", LogSeverity.Warn);
}
}
Console.WriteLine(q.Id);
Console.WriteLine(q.Content);
Console.WriteLine(q.Author);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
private class Quote
{
Exception exception = (Exception)e.ExceptionObject;
[JsonPropertyName("_id")]
public string Id { get; set; }
logger.Log(exception + (e.IsTerminating ? "\t Process terminating!" : ""), exception.Source, LogSeverity.Fatal);
[JsonPropertyName("content")]
public string Content { get; set; }
[JsonPropertyName("author")]
public string Author { get; set; }
}
}
}
@@ -14,7 +14,18 @@
"Stone_Red-C-Sharp-Utilities-Test.dll": {}
}
},
"System.Text.Json/5.0.2": {
"runtime": {
"lib/netcoreapp3.0/System.Text.Json.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.521.16609"
}
}
},
"Stone_Red-C-Sharp-Utilities/1.0.3.1": {
"dependencies": {
"System.Text.Json": "5.0.2"
},
"runtime": {
"Stone_Red-C-Sharp-Utilities.dll": {}
}
@@ -27,6 +38,13 @@
"serviceable": false,
"sha512": ""
},
"System.Text.Json/5.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==",
"path": "system.text.json/5.0.2",
"hashPath": "system.text.json.5.0.2.nupkg.sha512"
},
"Stone_Red-C-Sharp-Utilities/1.0.3.1": {
"type": "project",
"serviceable": false,
@@ -6,7 +6,7 @@
<members>
<member name="T:Stone_Red_Utilities.BoolExtentions.BoolExt">
<summary>
<see cref="T:System.Boolean"/> Extentions
<see cref="T:System.Boolean"/> Extensions
</summary>
</member>
<member name="M:Stone_Red_Utilities.BoolExtentions.BoolExt.OneWayTrue(System.Boolean@,System.Boolean)">
@@ -44,7 +44,7 @@
</member>
<member name="F:Stone_Red_Utilities.CollectionExtentions.TableStyle.Default">
<summary>
The default representaion of the table
The default representation of the table
</summary>
</member>
<member name="F:Stone_Red_Utilities.CollectionExtentions.TableStyle.Minimum">
@@ -54,17 +54,17 @@
</member>
<member name="F:Stone_Red_Utilities.CollectionExtentions.TableStyle.Alternative">
<summary>
The alternative representaion of the table
The alternative representation of the table
</summary>
</member>
<member name="F:Stone_Red_Utilities.CollectionExtentions.TableStyle.List">
<summary>
The list representaion of the table
The list representation of the table
</summary>
</member>
<member name="T:Stone_Red_Utilities.CollectionExtentions.CollectionExt">
<summary>
<see cref="T:System.Collections.Generic.IEnumerable`1"/> and <see cref="T:System.Array"/> Extentions
<see cref="T:System.Collections.Generic.IEnumerable`1"/> and <see cref="T:System.Array"/> Extensions
</summary>
</member>
<member name="M:Stone_Red_Utilities.CollectionExtentions.CollectionExt.Print``1(System.Collections.Generic.IEnumerable{``0},System.Char,System.Boolean)">
@@ -85,7 +85,7 @@
</member>
<member name="T:Stone_Red_Utilities.ConsoleExtentions.ConsoleExt">
<summary>
<see cref="T:System.Console"/> Extentions
<see cref="T:System.Console"/> Extensions
</summary>
</member>
<member name="M:Stone_Red_Utilities.ConsoleExtentions.ConsoleExt.Write(System.Object,System.ConsoleColor)">
@@ -102,12 +102,18 @@
<param name="value"></param>
<param name="color"></param>
</member>
<member name="M:Stone_Red_Utilities.ConsoleExtentions.ConsoleExt.Pause(System.Boolean,System.String)">
<member name="M:Stone_Red_Utilities.ConsoleExtentions.ConsoleExt.Pause(System.ConsoleKey,System.String)">
<summary>
Suspends execution of the current method until the user presses a key
</summary>
<param name="enterKeyOnly"></param>
<param name="customMessage"></param>
<param name="key">The key that has to be pressed</param>
<param name="message">The message that will be displayed</param>
</member>
<member name="M:Stone_Red_Utilities.ConsoleExtentions.ConsoleExt.Pause(System.String)">
<summary>
Suspends execution of the current method until the user presses a key
</summary>
<param name="message">The message that will be displayed</param>
</member>
<member name="T:Stone_Red_Utilities.FluentMath.Shapes.Rectangle">
<summary>
@@ -143,8 +149,8 @@
<summary>
Creates a new rectangle instance
</summary>
<param name="length"></param>
<param name="width"></param>
<param name="length">The length of the rectangle</param>
<param name="width">The width of the rectangle</param>
</member>
<member name="T:Stone_Red_Utilities.FluentMath.DecimalFluent">
<summary>
@@ -204,7 +210,7 @@
</member>
<member name="M:Stone_Red_Utilities.FluentMath.DecimalFluent.Multiply(System.Decimal,System.Decimal)">
<summary>
Multiplys the two nums
Multiples the two nums
</summary>
<param name="num"></param>
<param name="value"></param>
@@ -306,7 +312,7 @@
</member>
<member name="M:Stone_Red_Utilities.FluentMath.DoubleFluent.Multiply(System.Double,System.Double)">
<summary>
Multiplys the two nums
Multiples the two nums
</summary>
<param name="num"></param>
<param name="value"></param>
@@ -471,7 +477,7 @@
</member>
<member name="M:Stone_Red_Utilities.FluentMath.Int16Fluent.Multiply(System.Int16,System.Int16)">
<summary>
Multiplys the two nums
Multiples the two nums
</summary>
<param name="num"></param>
<param name="value"></param>
@@ -552,7 +558,7 @@
</member>
<member name="M:Stone_Red_Utilities.FluentMath.Int32Fluent.Multiply(System.Int32,System.Int32)">
<summary>
Multiplys the two nums
Multiples the two nums
</summary>
<param name="num"></param>
<param name="value"></param>
@@ -633,7 +639,7 @@
</member>
<member name="M:Stone_Red_Utilities.FluentMath.Int64Fluent.Multiply(System.Int64,System.Int64)">
<summary>
Multiplys the two nums
Multiples the two nums
</summary>
<param name="num"></param>
<param name="value"></param>
@@ -714,7 +720,7 @@
</member>
<member name="M:Stone_Red_Utilities.FluentMath.SingleFluent.Multiply(System.Single,System.Single)">
<summary>
Multiplys the two nums
Multiples the two nums
</summary>
<param name="num"></param>
<param name="value"></param>
@@ -863,7 +869,7 @@
</member>
<member name="P:Stone_Red_Utilities.Logging.OutputConfig.Color">
<summary>
The onsole color of the log message.
The console color of the log message.
</summary>
</member>
<member name="P:Stone_Red_Utilities.Logging.OutputConfig.LogTarget">
@@ -878,7 +884,7 @@
</member>
<member name="T:Stone_Red_Utilities.Logging.FormatConfig">
<summary>
Foramt configuration.
Format configuration.
</summary>
</member>
<member name="P:Stone_Red_Utilities.Logging.FormatConfig.DebugConsoleFormat">
@@ -1047,7 +1053,7 @@
</member>
<member name="T:Stone_Red_Utilities.RandomExtentions.RandomExt">
<summary>
<see cref="T:System.Random"/> Extentions
<see cref="T:System.Random"/> Extensions
</summary>
</member>
<member name="M:Stone_Red_Utilities.RandomExtentions.RandomExt.NextItem``1(System.Random,System.Collections.Generic.IEnumerable{``0})">
@@ -1100,7 +1106,7 @@
</member>
<member name="T:Stone_Red_Utilities.StringExtentions.StringExt">
<summary>
<see cref="T:System.String"/> Extentions
<see cref="T:System.String"/> Extensions
</summary>
</member>
<member name="M:Stone_Red_Utilities.StringExtentions.StringExt.EqualsIgnoreCase(System.String,System.String)">
@@ -1169,7 +1175,7 @@
</member>
<member name="M:Stone_Red_Utilities.StringExtentions.StringExt.RemoveWhitespaces(System.String)">
<summary>
Revoves all whitespaces from the specified <see cref="T:System.String"/>
Removes all white spaces from the specified <see cref="T:System.String"/>
</summary>
<param name="str"></param>
<returns></returns>
@@ -1 +1 @@
5375b33f90ea389df924475d2d3675a20dffae64
29b9737293ccbe2493bdaac0f5685c008bec1abb
@@ -38,3 +38,4 @@ C:\Users\David\Programmieren\Stone_Red-C-Sharp-Utilities\Stone_Red-C-Sharp-Utili
C:\Users\David\Programmieren\Stone_Red-C-Sharp-Utilities\Stone_Red-C-Sharp-Utilities-Test\obj\Release\net5.0\ref\Stone_Red-C-Sharp-Utilities-Test.dll
C:\Users\David\Programmieren\Stone_Red-C-Sharp-Utilities\Stone_Red-C-Sharp-Utilities-Test\obj\Release\net5.0\Stone_Red-C-Sharp-Utilities-Test.pdb
C:\Users\David\Programmieren\Stone_Red-C-Sharp-Utilities\Stone_Red-C-Sharp-Utilities-Test\obj\Release\net5.0\Stone_Red-C-Sharp-Utilities-Test.genruntimeconfig.cache
C:\Users\David\Programmieren\Stone_Red-C-Sharp-Utilities\Stone_Red-C-Sharp-Utilities-Test\bin\Release\net5.0\System.Text.Json.dll
@@ -63,7 +63,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.401\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json"
}
}
},
@@ -108,6 +108,10 @@
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"dependencies": {
"System.Text.Json": {
"target": "Package",
"version": "[5.0.2, )"
},
"Vsxmd": {
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
"suppressParent": "All",
@@ -130,7 +134,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.401\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json"
}
}
}
@@ -2,9 +2,21 @@
"version": 3,
"targets": {
"net5.0": {
"System.Text.Json/5.0.2": {
"type": "package",
"compile": {
"lib/netcoreapp3.0/System.Text.Json.dll": {}
},
"runtime": {
"lib/netcoreapp3.0/System.Text.Json.dll": {}
}
},
"Stone_Red-C-Sharp-Utilities/1.0.3.1": {
"type": "project",
"framework": ".NETStandard,Version=v2.1",
"dependencies": {
"System.Text.Json": "5.0.2"
},
"compile": {
"bin/placeholder/Stone_Red-C-Sharp-Utilities.dll": {}
},
@@ -15,6 +27,28 @@
}
},
"libraries": {
"System.Text.Json/5.0.2": {
"sha512": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==",
"type": "package",
"path": "system.text.json/5.0.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"lib/net461/System.Text.Json.dll",
"lib/net461/System.Text.Json.xml",
"lib/netcoreapp3.0/System.Text.Json.dll",
"lib/netcoreapp3.0/System.Text.Json.xml",
"lib/netstandard2.0/System.Text.Json.dll",
"lib/netstandard2.0/System.Text.Json.xml",
"system.text.json.5.0.2.nupkg.sha512",
"system.text.json.nuspec",
"useSharedDesignerContext.txt",
"version.txt"
]
},
"Stone_Red-C-Sharp-Utilities/1.0.3.1": {
"type": "project",
"path": "../Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.csproj",
@@ -89,7 +123,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.401\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json"
}
}
}
@@ -1,8 +1,11 @@
{
"version": 2,
"dgSpecHash": "i9sxl0DK4prGdivFoHN0urjiTdeJN7pdMVng46dayLfJokZ9N5lHYpWasE93pEfNg8KMgQDtDsbVnvjJQeZa6g==",
"dgSpecHash": "Vx9qsK3Yk9tZYtINnXECOYONnvtrMwwty0hl6iIWBvlkyK4NCks9Q8TNs/UBn8LVsiXed1iLDXPWnVB0LDNx5g==",
"success": true,
"projectFilePath": "C:\\Users\\David\\Programmieren\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities-Test\\Stone_Red-C-Sharp-Utilities-Test.csproj",
"expectedPackageFiles": [],
"expectedPackageFiles": [
"C:\\Users\\David\\.nuget\\packages\\system.text.json\\5.0.2\\system.text.json.5.0.2.nupkg.sha512",
"C:\\Users\\David\\.nuget\\packages\\stone_red-c-sharp-utilities\\1.0.3.1\\stone_red-c-sharp-utilities.1.0.3.1.nupkg.sha512"
],
"logs": []
}