Esempio n. 1
0
 public void MarkShot(BoardCoordinates coordinates, OneOf <Miss, Hit, Sink> shotOutcome)
 {
     shotOutcome.Switch(
         miss => _boardViewUpdater.Missed(coordinates),
         hit => _boardViewUpdater.GotHit(coordinates),
         sink => _boardViewUpdater.Sunken(sink.SunkenShipCoords));
 }
Esempio n. 2
0
 private void HandleSearchResult(OneOf <CustomerResult, CustomerSearchError> result)
 {
     result.Switch(sr =>
     {
         var formattedTextResult = JsonSerializer.Serialize(sr, new JsonSerializerOptions
         {
             WriteIndented = true
         });
         _consoleWriter.WriteLine(formattedTextResult);
     }, error =>
     {
         var formattedErrors = string.Join(", ", error.ErrorMessages);
         _consoleWriter.WriteLine(formattedErrors);
     });
 }
Esempio n. 3
0
            public async ValueTask <bool> MoveNextAsync()
            {
                if (!_pageInfo.HasNextPage)
                {
                    return(false);
                }

                Current = await NyaaSiService.SearchAsync(_request);

                if (Current.Match((IAniListError error) => true)
                    .Match(data => data.PageInfo?.HasNextPage != true))
                {
                    return(false);
                }

                _request.PageNumber += 1;
                Current.Switch(result => _pageInfo.HasNextPage = result.PageInfo.HasNextPage = result.Data.Count >= 75);

                return(true);
            }
Esempio n. 4
0
 public void Switch(Action <HttpStatusCode> matchFunc, Action <byte> matchFunc2)
 => _input4.Switch(matchFunc, matchFunc2);
Esempio n. 5
0
 public void Switch(Action <DateTime> matchFunc, Action <string> matchFunc2, Action <long> matchFunc3, Action defaultFunc)
 => _input2.Switch(matchFunc, matchFunc2, matchFunc3);