using RemoteExec.Server.Utilities; using RemoteExec.Shared.Models; namespace RemoteExec.Server.Services; public abstract class ExecutionEnvironment { public event EventHandler>? RequestAssembly; public abstract string Name { get; } public abstract Task PrepareEnvironmentAsync(CancellationToken cancellationToken); public abstract Task ExecuteTaskAsync(RemoteExecutionRequest request); public abstract Task CleanupEnvironmentAsync(CancellationToken cancellationToken); protected async Task RequestAssemblyAsync(string assemblyName) { CompletableEventArgs args = new CompletableEventArgs(assemblyName); RequestAssembly?.Invoke(this, args); return await args.WaitAsync(); } }