コード例 #1
0
ファイル: BodyStream.cs プロジェクト: anurse/gate
        public BodyStream(Func<ArraySegment<byte>, Action<Exception>, Owin.TempEnum> write, Action<Exception> end, CancellationToken cancellationToken)
        {
            stateMachine = new StateMachine<BodyStreamCommand, BodyStreamState>();
            stateMachine.Initialize(BodyStreamState.Ready);

            stateMachine.MapTransition(BodyStreamCommand.Pause, BodyStreamState.Paused);
            stateMachine.MapTransition(BodyStreamCommand.Start, BodyStreamState.Started);
            stateMachine.MapTransition(BodyStreamCommand.Cancel, BodyStreamState.Cancelled);
            stateMachine.MapTransition(BodyStreamCommand.Resume, BodyStreamState.Resumed);
            stateMachine.MapTransition(BodyStreamCommand.Stop, BodyStreamState.Stopped);

            Write = write;
            End = end;
            CancellationToken = cancellationToken;
        }