mirror of
https://github.com/Stone-Red-Code/Stone_Red-C-Sharp-Utilities.git
synced 2026-09-04 00:56:24 +02:00
Code cleanup and more doc
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user