internal TvdbSeries DownloadSeriesZipped(int _seriesId, TvdbLanguage _language) { //download the xml data from this request byte[] xml = null; String link = ""; try { link = TvdbLinks.CreateSeriesLinkZipped(m_apiKey, _seriesId, _language); xml = m_webClient.DownloadData(link); ZipInputStream zip = new ZipInputStream(new MemoryStream(xml)); ZipEntry entry = zip.GetNextEntry(); String seriesString = null; String actorsString = null; String bannersString = null; while (entry != null) { Log.Debug("Extracting " + entry.Name); byte[] buffer = new byte[zip.Length]; int count = zip.Read(buffer, 0, (int)zip.Length); if (entry.Name.Equals(_language.Abbriviation + ".xml")) { seriesString = Encoding.UTF8.GetString(buffer); } else if (entry.Name.Equals("banners.xml")) { bannersString = Encoding.UTF8.GetString(buffer); } else if (entry.Name.Equals("actors.xml")) { actorsString = Encoding.UTF8.GetString(buffer); } entry = zip.GetNextEntry(); } zip.Close(); //extract all series the xml file contains List <TvdbSeries> seriesList = m_xmlHandler.ExtractSeries(seriesString); //if a request is made on a series id, one and only one result //should be returned, otherwise there obviously was an error if (seriesList != null && seriesList.Count == 1) { TvdbSeries series = seriesList[0]; series.EpisodesLoaded = true; series.Episodes = new List <TvdbEpisode>(); //add episode info to series List <TvdbEpisode> epList = m_xmlHandler.ExtractEpisodes(seriesString); foreach (TvdbEpisode e in epList) { Util.AddEpisodeToSeries(e, series); } //also load actors List <TvdbActor> actors = m_xmlHandler.ExtractActors(actorsString); if (actors != null) { series.TvdbActorsLoaded = true; series.TvdbActors = actors; } //also load banner paths List <TvdbBanner> banners = m_xmlHandler.ExtractBanners(bannersString); if (banners != null) { series.BannersLoaded = true; series.Banners = banners; } return(series); } else { Log.Warn("More than one series returned when trying to retrieve series " + _seriesId); return(null); } } catch (XmlException ex) { Log.Error("Error parsing the xml file " + link + "\n\n" + Encoding.Unicode.GetString(xml), ex); throw new TvdbInvalidXmlException("Error parsing the xml file " + link + "\n\n" + xml); } catch (WebException ex) { Log.Warn("Request not successfull", ex); if (ex.Message.Equals("The remote server returned an error: (404) Not Found.")) { throw new TvdbInvalidApiKeyException("Couldn't connect to Thetvdb.com to retrieve " + _seriesId + ", it seems like you have an invalid api key"); } else { throw new TvdbNotAvailableException("Couldn't connect to Thetvdb.com to retrieve " + _seriesId + ", check your internet connection and the status of http://thetvdb.com"); } } }