public IEnumerable <TResult> GetData() { IWhazzup whazzupData = _dataSource.GetIVAOData(); ISelectedData selectedData = Selector.SelectData(whazzupData); selectedData = FilterSelectedData(selectedData); IParser parser = ParserFactory.CreateParser(Selector); object resultData = parser.Parse(selectedData); return(GetResult(resultData)); }
protected override ISelectedData FilterSelectedData(ISelectedData selectedData) { selectedData = base.FilterSelectedData(selectedData); List <string> data = new List <string>(); var selectorData = selectedData.Data.FirstOrDefault(d => d == Selector.Value); if (!string.IsNullOrEmpty(selectorData)) { data.Add(selectorData); } data.AddRange(selectedData.Data.Where(CheckItem)); return(new SelectedData(data.ToArray())); }
public override object Parse(ISelectedData selectedData) { string[] data = RemoveSelector(selectedData.Data); if (data.Length == 0) { return(null); } return(GeneralDataBuilder.Create() .WithVersion(_ivaoStringService.IVAO_GetInt(new VersionExtractor().ExtractValue(data))) .WithReload(_ivaoStringService.IVAO_GetInt(new ReloadExtractor().ExtractValue(data))) .WithUpdate(_ivaoStringService.IVAO_GetDateTime(new UpdateExtractor().ExtractValue(data)) ?? DateTime.MinValue) .WithConnectedClients(_ivaoStringService.IVAO_GetInt(new ConnectedClientsExtractor().ExtractValue(data))) .WithConnectedServers(_ivaoStringService.IVAO_GetInt(new ConnectedServersExtractor().ExtractValue(data))) .WithConnectedAirports(_ivaoStringService.IVAO_GetInt(new ConnectedAirportsExtractor().ExtractValue(data))) .Build()); }
public virtual object Parse(ISelectedData selectedData) { string[] data = RemoveSelector(selectedData.Data); List <TModel> result = new List <TModel>(); foreach (string row in data) { TModel item = CreateItem(row); if (item != null) { result.Add(item); } } return(result); }
protected virtual ISelectedData FilterSelectedData(ISelectedData selectedData) { return(selectedData); }