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)); }
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); }); }
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); }
public void Switch(Action <HttpStatusCode> matchFunc, Action <byte> matchFunc2) => _input4.Switch(matchFunc, matchFunc2);
public void Switch(Action <DateTime> matchFunc, Action <string> matchFunc2, Action <long> matchFunc3, Action defaultFunc) => _input2.Switch(matchFunc, matchFunc2, matchFunc3);