예제 #1
0
        public override async Task <ProcessTimeResponseMessage> ProcessTime(ProcessTimeRequestMessage request, ServerCallContext context)
        {
            var mediatorRequest  = new ProcessTimeQuery(request.Tracks.Select(x => convertTrack(x)).ToList(), request.StartTime.ToDateTime(), request.TrackSplits.Select(x => x.ToDateTime()).ToList());
            var mediatorResponse = await mediator.Send(mediatorRequest);

            var result = new ProcessTimeResponseMessage();

            result.Tracks.AddRange(mediatorResponse.Select(x => convertTimedTrack(x)));
            return(result);
        }
예제 #2
0
        public async Task <List <TimedTrack> > ProcessTime(List <Track> tracks, DateTime start, List <DateTime> splits, CancellationToken cancellationToken = default)
        {
            var message = new ProcessTimeRequestMessage();

            message.StartTime = Timestamp.FromDateTime(start);
            message.TrackSplits.AddRange(splits.Select(x => Timestamp.FromDateTime(x)));
            message.Tracks.AddRange(tracks.Select(x => convertTrack(x)));
            var result = await client.ProcessTimeAsync(message, cancellationToken : cancellationToken);

            return(result.Tracks.Select(x => convertTrack(x)).ToList());
        }