/// <summary> /// Adds a middleware to the front of the pipeline. /// </summary> /// <param name="middleware">The middleware to add.</param> public void InsertFirst(ITiffImageEncoderMiddleware <TPixel> middleware) { if (middleware is null) { throw new ArgumentNullException(nameof(middleware)); } _middlewares.Insert(0, middleware); }
/// <summary> /// Adds a middleware to the end of the pipeline. /// </summary> /// <param name="middleware">The middleware to add.</param> public void Add(ITiffImageEncoderMiddleware <TPixel> middleware) { if (middleware is null) { throw new ArgumentNullException(nameof(middleware)); } _middlewares.Add(middleware); }
public ValueTask RunAsync(TiffImageEncoderContext <TPixel> context) { ITiffImageEncoderMiddleware <TPixel> middleware = Middleware; ITiffImageEncoderPipelineNode <TPixel>?next = Next; context.CancellationToken.ThrowIfCancellationRequested(); if (next is null) { return(middleware.InvokeAsync(context, EmptyImplementation.Instance)); } else { return(middleware.InvokeAsync(context, next)); } }
public TiffImageEncoderPipelineNode(ITiffImageEncoderMiddleware <TPixel> middleware) { Middleware = middleware; }