改了一亿个东西,修了一亿个 BUG

This commit is contained in:
2021-10-19 17:42:18 +02:00
parent 5b907309e0
commit 888ddce4ef
40 changed files with 1870 additions and 1715 deletions

View File

@@ -0,0 +1,23 @@
using System;
using System.Threading.Tasks;
namespace AnotherReplayReader.Utils
{
internal static class CancellableTaskExtensions
{
public static async Task IgnoreCancel(this Task task)
{
try
{
await task.ConfigureAwait(false);
}
catch (OperationCanceledException) { }
}
public static void Forget(this Task task)
{
const TaskContinuationOptions flags = TaskContinuationOptions.NotOnRanToCompletion | TaskContinuationOptions.ExecuteSynchronously;
task.ContinueWith(t => t.Exception?.Handle(_ => true), flags);
}
}
}