示例#1
0
        /// <summary>
        /// Download available languages
        /// </summary>
        /// <returns></returns>
        internal List <TvdbLanguage> DownloadLanguages()
        {
            String xml  = "";
            String link = "";

            try
            {
                link = TvdbLinks.CreateLanguageLink(m_apiKey);
                xml  = m_webClient.DownloadString(link);
                return(m_xmlHandler.ExtractLanguages(xml));
            }
            catch (XmlException ex)
            {
                Log.Error("Error parsing the xml file " + link + "\n\n" + 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 the list of available languages" +
                                                         ", it seems like you use an invalid api key");
                }
                else
                {
                    throw new TvdbNotAvailableException("Couldn't connect to Thetvdb.com to retrieve the list of available languages" +
                                                        ", check your internet connection and the status of http://thetvdb.com");
                }
            }
        }
示例#2
0
        /// <summary>
        /// Download available languages
        /// </summary>
        /// <returns></returns>
        internal List <TvdbLanguage> DownloadLanguages()
        {
            TvdbXmlReader hand = new TvdbXmlReader();
            String        xml  = m_webClient.DownloadString(TvdbLinks.CreateLanguageLink(m_apiKey));

            return(hand.ExtractLanguages(xml));
        }