コード例 #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);
        }
コード例 #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);
        }
コード例 #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));
            }
        }
コード例 #4
0
 public TiffImageEncoderPipelineNode(ITiffImageEncoderMiddleware <TPixel> middleware)
 {
     Middleware = middleware;
 }