public async Task <TVDBActorResponse> SeriesActorInformation(uint tvdbID) { string apiCallURL = string.Format("{0}/api/{1}/series/{2}/actors.xml", _baseURL, _apiKey, tvdbID); string tvdbResponse = string.Empty; TVDBActorResponse tvdbActorResponse = new TVDBActorResponse(); try { tvdbResponse = await GetHTTPString(new Uri(apiCallURL)); } catch (HttpRequestException) { tvdbActorResponse.serverUnavailable = true; return(tvdbActorResponse); } // return an empty response if the the tvdb was dead if (string.IsNullOrEmpty(tvdbResponse)) { return(null); } // read the response in through a memory stream and use the xml serializer using (MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(tvdbResponse))) { var serializer = new XmlSerializer(typeof(TVDBActorResponse)); tvdbActorResponse = (serializer.Deserialize(memoryStream) as TVDBActorResponse); } // we should have some info now so return it return(tvdbActorResponse); }
public async Task<TVDBActorResponse> SeriesActorInformation(uint tvdbID) { string apiCallURL = string.Format("{0}/api/{1}/series/{2}/actors.xml", _baseURL, _apiKey, tvdbID); string tvdbResponse = string.Empty; TVDBActorResponse tvdbActorResponse = new TVDBActorResponse(); try { tvdbResponse = await GetHTTPString(new Uri(apiCallURL)); } catch (HttpRequestException) { tvdbActorResponse.serverUnavailable = true; return tvdbActorResponse; } // return an empty response if the the tvdb was dead if (string.IsNullOrEmpty(tvdbResponse)) return null; // read the response in through a memory stream and use the xml serializer using (MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(tvdbResponse))) { var serializer = new XmlSerializer(typeof(TVDBActorResponse)); tvdbActorResponse = (serializer.Deserialize(memoryStream) as TVDBActorResponse); } // we should have some info now so return it return tvdbActorResponse; }