/// <summary> /// /// </summary> /// <param name="resourceMetadata"></param> /// <param name="FileType"></param> /// <returns></returns> public async Task <File> GetResource(string resourceMetadata, FileType FileType) { HttpResponseMessage response = await baseController.GetFile(System.IO.Path.Combine(this.pollingPath, resourceMetadata), FileType); if (response.StatusCode == System.Net.HttpStatusCode.OK) { string responseData = await response.Content.ReadAsStringAsync(); return(TransportFetcher.ParseJson <File>(responseData)); } else { Trace.TraceError("Got error code {0} while trying to fetch file {1}", response.StatusCode, resourceMetadata); } return(null); }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <param name="FileType"></param> /// <returns></returns> protected async Task <Tuple <File, HttpResponseMessage> > GetNextFile(string path, FileType FileType) { TransportFetcher fetcher = new TransportFetcher(this, path); Tuple <IList <string>, HttpResponseMessage> listingResponseTuple = await fetcher.OnListing(); IList <string> listOfFiles = listingResponseTuple.Item1; HttpResponseMessage message = listingResponseTuple.Item2; foreach (string fileName in listOfFiles) { File fileDescription = await fetcher.GetResource(fileName, FileType); if (fileDescription != null) { return(new Tuple <File, HttpResponseMessage>(fileDescription, message)); } } return(new Tuple <File, HttpResponseMessage>(null, message)); }