Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        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));
            }
        }
Exemplo n.º 4
0
 public TiffImageEncoderPipelineNode(ITiffImageEncoderMiddleware <TPixel> middleware)
 {
     Middleware = middleware;
 }