Code cleanup and more doc

This commit is contained in:
Stone_Red
2022-10-14 14:48:28 +02:00
parent 69ee283950
commit c17d61b3f0
9 changed files with 76 additions and 70 deletions
+12 -28
View File
@@ -1,15 +1,15 @@
using Stone_Red_Utilities.Http;
using Stone_Red_C_Sharp_Utilities;
using Stone_Red_C_Sharp_Utilities.Logging;
using Stone_Red_Utilities.Logging;
using Stone_Red_Utilities.Reflection;
using System;
using System.Net.Http;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
namespace Stone_Red_C_Sharp_Utilities_Test
{
internal class Program
internal static class Program
{
private static readonly Logger logger = new Logger()
{
@@ -42,36 +42,20 @@ namespace Stone_Red_C_Sharp_Utilities_Test
},
FormatConfig = new FormatConfig()
{
ConsoleFormat = $"{{{LogFormatType.DateTime}:hh:mm:ss}} | {{{LogFormatType.LogSeverity},-5}} | {{{LogFormatType.Message}}}"
ConsoleFormat = $"{{{LogFormatType.DateTime}:HH:mm:ss}} | {{{LogFormatType.LogSeverity},-5}} | {{{LogFormatType.Message}}}"
}
}
};
private static async Task Main()
{
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);
TaskQueue taskQueue = new TaskQueue();
await taskQueue.Enqueue(() => Console.WriteLine("YES1"));
await taskQueue.Enqueue(() => Console.WriteLine("YES2"));
await taskQueue.Enqueue(() => Thread.Sleep(2000));
await taskQueue.Enqueue(() => Console.WriteLine("YES3"));
Quote q = quote.CopyProperties<Quote>();
Console.WriteLine(q.Id);
Console.WriteLine(q.Content);
Console.WriteLine(q.Author);
}
private class Quote
{
[JsonPropertyName("_id")]
public string Id { get; set; }
[JsonPropertyName("content")]
public string Content { get; set; }
[JsonPropertyName("author")]
public string Author { get; set; }
logger.Log("wow", LogSeverity.Info);
}
}
}