baseline: OpenMU upstream b5a0961 (fresh source)

This commit is contained in:
Acentech Dev
2026-07-14 19:00:35 +03:00
parent 450402e47d
commit 36fc125d5c
11968 changed files with 748705 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
// <copyright file="AsyncDisposable.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.GameLogic;
/// <summary>
/// Base class for classes which want to implement <see cref="IAsyncDisposable"/>.
/// </summary>
public class AsyncDisposable : Disposable, IAsyncDisposable
{
private bool _isDisposing;
/// <summary>
/// Gets a value indicating whether this instance is disposing.
/// </summary>
/// <value>
/// <c>true</c> if this instance is disposing; otherwise, <c>false</c>.
/// </value>
public new bool IsDisposing
{
get => this._isDisposing || base.IsDisposing;
private set => this._isDisposing = value;
}
/// <inheritdoc />
public async ValueTask DisposeAsync()
{
if (!this.IsDisposed && !this.IsDisposing)
{
this.IsDisposing = true;
try
{
await this.DisposeAsyncCore().ConfigureAwait(false);
this.Dispose(true);
GC.SuppressFinalize(this);
}
finally
{
this.IsDisposing = false;
}
}
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or
/// resetting unmanaged resources asynchronously.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "VSTHRD200:Use \"Async\" suffix for async methods", Justification = "This naming is suggested by microsoft itself.")]
protected virtual ValueTask DisposeAsyncCore()
{
return ValueTask.CompletedTask;
}
}