예제 #1
0
        public static List <Raw_AniDB_Recommendation> ProcessRecommendations(XmlDocument docAnime, int animeID)
        {
            List <Raw_AniDB_Recommendation> recs = new List <Raw_AniDB_Recommendation>();

            try
            {
                if (docAnime["anime"]["recommendations"] != null)
                {
                    XmlNodeList recItems = docAnime["anime"]["recommendations"].GetElementsByTagName("recommendation");
                    if (recItems != null)
                    {
                        foreach (XmlNode node in recItems)
                        {
                            try
                            {
                                Raw_AniDB_Recommendation rec = new Raw_AniDB_Recommendation();
                                rec.ProcessFromHTTPResult(node, animeID);
                                recs.Add(rec);
                            }
                            catch (Exception ex)
                            {
                                //BaseConfig.MyAnimeLog.Write("Error in GetEpisodes: {0}", ex);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error in AniDBHTTPHelper.ProcessRecommendations: {0}", ex);
                return(null);
            }

            return(recs);
        }
예제 #2
0
        public static List <Raw_AniDB_Recommendation> ProcessRecommendations(XmlDocument docAnime, int animeID)
        {
            List <Raw_AniDB_Recommendation> recs = new List <Raw_AniDB_Recommendation>();

            XmlNodeList recItems = docAnime?["anime"]?["recommendations"]?.GetElementsByTagName("recommendation");

            if (recItems == null)
            {
                return(recs);
            }
            foreach (XmlNode node in recItems)
            {
                try
                {
                    Raw_AniDB_Recommendation rec = new Raw_AniDB_Recommendation();
                    rec.ProcessFromHTTPResult(node, animeID);
                    recs.Add(rec);
                }
                catch (Exception exc)
                {
                    logger.Error(exc, "Error in Processing Node in Recommendations: {0}" + exc);
                }
            }

            return(recs);
        }
        public void Populate(Raw_AniDB_Recommendation rawRec)
        {
            this.AnimeID = rawRec.AnimeID;
            this.UserID = rawRec.UserID;
            this.RecommendationText = rawRec.RecommendationText;

            RecommendationType = (int) AniDBRecommendationType.Recommended;

            if (rawRec.RecommendationTypeText.Equals("recommended", StringComparison.InvariantCultureIgnoreCase))
                RecommendationType = (int) AniDBRecommendationType.Recommended;

            if (rawRec.RecommendationTypeText.Equals("for fans", StringComparison.InvariantCultureIgnoreCase))
                RecommendationType = (int) AniDBRecommendationType.ForFans;

            if (rawRec.RecommendationTypeText.Equals("must see", StringComparison.InvariantCultureIgnoreCase))
                RecommendationType = (int) AniDBRecommendationType.MustSee;
        }
예제 #4
0
		public static List<Raw_AniDB_Recommendation> ProcessRecommendations(XmlDocument docAnime, int animeID)
		{
			List<Raw_AniDB_Recommendation> recs = new List<Raw_AniDB_Recommendation>();

			try
			{
				if (docAnime["anime"]["recommendations"] != null)
				{
					XmlNodeList recItems = docAnime["anime"]["recommendations"].GetElementsByTagName("recommendation");
					if (recItems != null)
					{
						foreach (XmlNode node in recItems)
						{
							try
							{
								Raw_AniDB_Recommendation rec = new Raw_AniDB_Recommendation();
								rec.ProcessFromHTTPResult(node, animeID);
								recs.Add(rec);
							}
							catch (Exception ex)
							{
								//BaseConfig.MyAnimeLog.Write("Error in GetEpisodes: {0}", ex);
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				logger.ErrorException("Error in AniDBHTTPHelper.ProcessRecommendations: {0}", ex);
				return null;
			}

			return recs;
		}