Ejemplo n.º 1
0
        public static CrossRef_AniDB_TraktResult Get_CrossRef_AniDB_Trakt(int animeID)
        {
            if (!ServerSettings.WebCache_TvDB_Get)
            {
                return(null);
            }

            try
            {
                string username = ServerSettings.AniDB_Username;
                if (ServerSettings.WebCache_Anonymous)
                {
                    username = Constants.AnonWebCacheUsername;
                }

                string uri = string.Format("http://{0}/GetCrossRef_AniDB_Trakt.aspx?uname={1}&AnimeID={2}",
                                           ServerSettings.WebCache_Address, username, animeID);
                string xml = GetData(uri);

                if (xml.Trim().Length == 0)
                {
                    return(null);
                }

                XmlDocument docFile = new XmlDocument();
                docFile.LoadXml(xml);

                string sTraktID           = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "TraktID");
                string sTraktSeasonNumber = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "TraktSeasonNumber");
                string sAdminApproved     = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "AdminApproved");
                string showName           = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "ShowName");


                int SeasonNumber = 0;
                int.TryParse(sTraktSeasonNumber, out SeasonNumber);

                int AdminApproved = 0;
                int.TryParse(sAdminApproved, out AdminApproved);

                CrossRef_AniDB_TraktResult result = new CrossRef_AniDB_TraktResult();
                result.AnimeID           = animeID;
                result.TraktID           = sTraktID;
                result.TraktSeasonNumber = SeasonNumber;
                result.ShowName          = showName;

                return(result);
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error in XMLService.Get_CrossRef_AniDB_Trakt:: {0}", ex);
                return(null);
            }
        }
Ejemplo n.º 2
0
		public static CrossRef_AniDB_TraktResult Get_CrossRef_AniDB_Trakt(int animeID)
		{
			if (!ServerSettings.WebCache_TvDB_Get) return null;

			try
			{
				string username = ServerSettings.AniDB_Username;
				if (ServerSettings.WebCache_Anonymous)
					username = Constants.AnonWebCacheUsername;

				string uri = string.Format("http://{0}/GetCrossRef_AniDB_Trakt.aspx?uname={1}&AnimeID={2}",
					ServerSettings.WebCache_Address, username, animeID);
				string xml = GetData(uri);

				if (xml.Trim().Length == 0) return null;

				XmlDocument docFile = new XmlDocument();
				docFile.LoadXml(xml);

				string sTraktID = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "TraktID");
				string sTraktSeasonNumber = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "TraktSeasonNumber");
				string sAdminApproved = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "AdminApproved");
				string showName = TryGetProperty(docFile, "CrossRef_AniDB_TraktResult", "ShowName");


				int SeasonNumber = 0;
				int.TryParse(sTraktSeasonNumber, out SeasonNumber);

				int AdminApproved = 0;
				int.TryParse(sAdminApproved, out AdminApproved);

				CrossRef_AniDB_TraktResult result = new CrossRef_AniDB_TraktResult();
				result.AnimeID = animeID;
				result.TraktID = sTraktID;
				result.TraktSeasonNumber = SeasonNumber;
				result.ShowName = showName;

				return result;
			}
			catch (Exception ex)
			{
				logger.ErrorException("Error in XMLService.Get_CrossRef_AniDB_Trakt:: {0}", ex);
				return null;
			}
		}