Ejemplo n.º 1
0
        public static CrossRef_AniDB_OtherResult Get_CrossRef_AniDB_Other(int animeID, CrossRefType xrefType)
        {
            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_Other.aspx?uname={1}&AnimeID={2}&CrossRefType={3}",
                                           ServerSettings.WebCache_Address, username, animeID, (int)xrefType);
                string xml = GetData(uri);

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

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

                string sOtherDBID = TryGetProperty(docFile, "CrossRef_AniDB_OtherResult", "CrossRefID");

                if (string.IsNullOrEmpty(sOtherDBID))
                {
                    return(null);
                }

                CrossRef_AniDB_OtherResult result = new CrossRef_AniDB_OtherResult();
                result.AnimeID    = animeID;
                result.CrossRefID = sOtherDBID;

                return(result);
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error in XMLService.Get_FileHash:: {0}", ex);
                return(null);
            }
        }
Ejemplo n.º 2
0
		public static CrossRef_AniDB_OtherResult Get_CrossRef_AniDB_Other(int animeID, CrossRefType xrefType)
		{
			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_Other.aspx?uname={1}&AnimeID={2}&CrossRefType={3}",
					ServerSettings.WebCache_Address, username, animeID, (int)xrefType);
				string xml = GetData(uri);

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

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

				string sOtherDBID = TryGetProperty(docFile, "CrossRef_AniDB_OtherResult", "CrossRefID");

				if (string.IsNullOrEmpty(sOtherDBID)) return null;

				CrossRef_AniDB_OtherResult result = new CrossRef_AniDB_OtherResult();
				result.AnimeID = animeID;
				result.CrossRefID = sOtherDBID;

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