mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Refactoring to asynchronous. (partially completed)
This commit is contained in:
parent
7ee08092d4
commit
096ea0c70c
72 changed files with 6033 additions and 5080 deletions
39
MinecraftClient/AsyncTaskHandler.cs
Normal file
39
MinecraftClient/AsyncTaskHandler.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MinecraftClient.Protocol.ProfileKey;
|
||||
using MinecraftClient.Protocol.Session;
|
||||
|
||||
namespace MinecraftClient
|
||||
{
|
||||
internal static class AsyncTaskHandler
|
||||
{
|
||||
private static readonly List<Task> Tasks = new();
|
||||
|
||||
internal static Task CheckUpdate = Task.CompletedTask;
|
||||
|
||||
internal static Task CacheSessionReader = Task.CompletedTask;
|
||||
|
||||
internal static Task SaveSessionToDisk = Task.CompletedTask;
|
||||
|
||||
internal static Task WritebackSettingFile = Task.CompletedTask;
|
||||
|
||||
internal static async void ExitCleanUp()
|
||||
{
|
||||
await WritebackSettingFile;
|
||||
|
||||
await CacheSessionReader;
|
||||
|
||||
await SaveSessionToDisk;
|
||||
|
||||
foreach (var task in Tasks)
|
||||
{
|
||||
await task;
|
||||
}
|
||||
|
||||
Tasks.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue