Got at least one data fetching method working; turns out, we can't use a patched LogicStack to get the data

This commit is contained in:
2026-01-14 22:11:11 +01:00
parent 40a8431464
commit 3f7122d30a
350 changed files with 41444 additions and 119 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Swan;
namespace EmbedIO
{
/// <summary>
/// Provides extension methods for types implementing <see cref="IWebServer"/>.
/// </summary>
public static partial class WebServerExtensions
{
/// <summary>
/// Starts a web server by calling <see cref="IWebServer.RunAsync"/>
/// in another thread.
/// </summary>
/// <param name="this">The <see cref="IWebServer"/> on which this method is called.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> used to stop the web server.</param>
/// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
/// <exception cref="InvalidOperationException">The web server has already been started.</exception>
public static void Start(this IWebServer @this, CancellationToken cancellationToken = default)
{
#pragma warning disable CS4014 // The call is not awaited - it is expected to run in parallel.
Task.Run(() => @this.RunAsync(cancellationToken));
#pragma warning restore CS4014
while (@this.State < WebServerState.Listening)
Task.Delay(1, cancellationToken).Await();
}
}
}