public static IBufferCollection AddBuffer(this IBufferCollection buffers, Action <BufferContext> configure)
        {
            var bc = new BufferContext();

            configure(bc);

            buffers.Add(bc);

            return(buffers);
        }
Example #2
0
        public AcroInput(AcroInputOptions options)
        {
            this.options = options;
            if (options.PipeOptions != null)
            {
                innerPipe = new Pipe(this.options.PipeOptions);
            }
            else
            {
                innerPipe = new Pipe();
            }

            Reader  = innerPipe.Reader;
            buffers = options.BufferCollection;

            foreach (var ctx in buffers)
            {
                ctx.Buffer     = new uint[ctx.End - ctx.Start + 1];
                ctx.ByteBuffer = new byte[ctx.Buffer.Length * sizeof(uint)];
            }
        }