コード例 #1
0
 public static void Populate(this AniDB_Anime_Character character, Raw_AniDB_Character rawChar)
 {
     character.CharID         = rawChar.CharID;
     character.AnimeID        = rawChar.AnimeID;
     character.CharType       = rawChar.CharType;
     character.EpisodeListRaw = rawChar.EpisodeListRaw;
 }
コード例 #2
0
 public void Populate(Raw_AniDB_Character rawChar)
 {
     this.CharID         = rawChar.CharID;
     this.AnimeID        = rawChar.AnimeID;
     this.CharType       = rawChar.CharType;
     this.EpisodeListRaw = rawChar.EpisodeListRaw;
 }
コード例 #3
0
        public static List <Raw_AniDB_Character> ProcessCharacters(XmlDocument docAnime, int animeID)
        {
            List <Raw_AniDB_Character> chars = new List <Raw_AniDB_Character>();

            XmlNodeList charItems = docAnime?["anime"]?["characters"]?.GetElementsByTagName("character");

            if (charItems == null)
            {
                return(chars);
            }
            foreach (XmlNode node in charItems)
            {
                try
                {
                    Raw_AniDB_Character chr = new Raw_AniDB_Character();
                    chr.ProcessFromHTTPResult(node, animeID);
                    chars.Add(chr);
                }
                catch (Exception ex)
                {
                    logger.Error(ex, $"Error in AniDBHTTPHelper.ProcessCharacters: {ex}");
                }
            }

            return(chars);
        }
コード例 #4
0
ファイル: AniDB_Character.cs プロジェクト: alimbada/jmmserver
 private void Populate(Raw_AniDB_Character rawChar)
 {
     this.CharID          = rawChar.CharID;
     this.CharDescription = rawChar.CharDescription;
     this.CharKanjiName   = rawChar.CharKanjiName;
     this.CharName        = rawChar.CharName;
     this.PicName         = rawChar.PicName;
     this.CreatorListRaw  = rawChar.CreatorListRaw;
 }
コード例 #5
0
 private static void Populate(this AniDB_Character character, Raw_AniDB_Character rawChar)
 {
     character.CharID          = rawChar.CharID;
     character.CharDescription = rawChar.CharDescription;
     character.CharKanjiName   = rawChar.CharKanjiName;
     character.CharName        = rawChar.CharName;
     character.PicName         = rawChar.PicName;
     character.CreatorListRaw  = rawChar.CreatorListRaw;
 }
コード例 #6
0
        public virtual enHelperActivityType Process(ref Socket soUDP,
                                                    ref IPEndPoint remoteIpEndPoint, string sessionID, Encoding enc)
        {
            ProcessCommand(ref soUDP, ref remoteIpEndPoint, sessionID, enc);

            // handle 555 BANNED and 598 - UNKNOWN COMMAND
            if (ResponseCode == 598)
            {
                return(enHelperActivityType.UnknownCommand_598);
            }
            if (ResponseCode == 555)
            {
                return(enHelperActivityType.Banned_555);
            }

            if (errorOccurred)
            {
                return(enHelperActivityType.NoSuchChar);
            }

            //BaseConfig.MyAnimeLog.Write("AniDBCommand_GetCharacterInfo.Process: Response: {0}", socketResponse);

            // Process Response
            string sMsgType = socketResponse.Substring(0, 3);


            switch (sMsgType)
            {
            case "235":
            {
                // 235 CHARACTER INFO
                // the first 11 characters should be "235 CHARACTER"
                // the rest of the information should be the data list

                charInfo = new Raw_AniDB_Character(socketResponse);
                return(enHelperActivityType.GotCharInfo);


                // Response: 235 CHARACTER 99297|6267|25|539|5|01|The Girl Returns|Shoujo Kikan|????|1238976000
            }

            case "335":
            {
                return(enHelperActivityType.NoSuchChar);
            }

            case "501":
            {
                return(enHelperActivityType.LoginRequired);
            }
            }

            return(enHelperActivityType.NoSuchChar);
        }
コード例 #7
0
ファイル: AniDB_Character.cs プロジェクト: alimbada/jmmserver
 public void PopulateFromUDP(Raw_AniDB_Character rawChar)
 {
     if (this.CharID == 0)             // a new object
     {
         Populate(rawChar);
     }
     else
     {
         // only update the fields that com from UDP API
         this.CharKanjiName = rawChar.CharKanjiName;
         this.CharName      = rawChar.CharName;
         //this.CreatorListRaw = rawChar.CreatorListRaw;
     }
 }
コード例 #8
0
ファイル: AniDB_Character.cs プロジェクト: alimbada/jmmserver
 public void PopulateFromHTTP(Raw_AniDB_Character rawChar)
 {
     if (this.CharID == 0)             // a new object
     {
         Populate(rawChar);
     }
     else
     {
         // only update the fields that come from HTTP API
         this.CharDescription = rawChar.CharDescription;
         this.CharName        = rawChar.CharName;
         this.CreatorListRaw  = rawChar.CreatorListRaw;
         this.PicName         = rawChar.PicName;
     }
 }
コード例 #9
0
        public static bool Populate(this AniDB_Anime_Character character, Raw_AniDB_Character rawChar)
        {
            if (rawChar == null)
            {
                return(false);
            }
            if (rawChar.AnimeID <= 0 || rawChar.CharID <= 0 || string.IsNullOrEmpty(rawChar.CharType))
            {
                return(false);
            }
            character.CharID         = rawChar.CharID;
            character.AnimeID        = rawChar.AnimeID;
            character.CharType       = rawChar.CharType;
            character.EpisodeListRaw = rawChar.EpisodeListRaw;

            return(true);
        }
コード例 #10
0
		public virtual enHelperActivityType Process(ref Socket soUDP,
			ref IPEndPoint remoteIpEndPoint, string sessionID, Encoding enc)
		{
			ProcessCommand(ref soUDP, ref remoteIpEndPoint, sessionID, enc);

			// handle 555 BANNED and 598 - UNKNOWN COMMAND
			if (ResponseCode == 598) return enHelperActivityType.UnknownCommand_598;
			if (ResponseCode == 555) return enHelperActivityType.Banned_555;

			if (errorOccurred) return enHelperActivityType.NoSuchChar;

			//BaseConfig.MyAnimeLog.Write("AniDBCommand_GetCharacterInfo.Process: Response: {0}", socketResponse);

			// Process Response
			string sMsgType = socketResponse.Substring(0, 3);


			switch (sMsgType)
			{
				case "235":
					{
						// 235 CHARACTER INFO
						// the first 11 characters should be "235 CHARACTER"
						// the rest of the information should be the data list

						charInfo = new Raw_AniDB_Character(socketResponse);
						return enHelperActivityType.GotCharInfo;


						// Response: 235 CHARACTER 99297|6267|25|539|5|01|The Girl Returns|Shoujo Kikan|????|1238976000
					}
				case "335":
					{
						return enHelperActivityType.NoSuchChar;
					}
				case "501":
					{
						return enHelperActivityType.LoginRequired;
					}
			}

			return enHelperActivityType.NoSuchChar;

		}
コード例 #11
0
 public static bool PopulateFromUDP(this AniDB_Character character, Raw_AniDB_Character rawChar)
 {
     if (character.CharID == 0) // a new object
     {
         return(character.Populate(rawChar));
     }
     else
     {
         if (string.IsNullOrEmpty(rawChar?.CharKanjiName) || string.IsNullOrEmpty(rawChar.CharName))
         {
             return(false);
         }
         // only update the fields that com from UDP API
         character.CharKanjiName = rawChar.CharKanjiName;
         character.CharName      = rawChar.CharName;
         //this.CreatorListRaw = rawChar.CreatorListRaw;
     }
     return(true);
 }
コード例 #12
0
        private static bool Populate(this AniDB_Character character, Raw_AniDB_Character rawChar)
        {
            if (rawChar == null)
            {
                return(false);
            }
            if (rawChar.CharID <= 0 || string.IsNullOrEmpty(rawChar.CharName))
            {
                return(false);
            }
            character.CharID          = rawChar.CharID;
            character.CharDescription = rawChar.CharDescription ?? string.Empty;
            character.CharKanjiName   = rawChar.CharKanjiName ?? string.Empty;
            character.CharName        = rawChar.CharName;
            character.PicName         = rawChar.PicName ?? string.Empty;
            character.CreatorListRaw  = rawChar.CreatorListRaw ?? string.Empty;

            return(true);
        }
コード例 #13
0
 public static bool PopulateFromHTTP(this AniDB_Character character, Raw_AniDB_Character rawChar)
 {
     if (character.CharID == 0) // a new object
     {
         return(character.Populate(rawChar));
     }
     else
     {
         // only update the fields that come from HTTP API
         if (string.IsNullOrEmpty(rawChar?.CharName))
         {
             return(false);
         }
         character.CharDescription = rawChar.CharDescription ?? string.Empty;
         character.CharName        = rawChar.CharName;
         character.CreatorListRaw  = rawChar.CreatorListRaw ?? string.Empty;
         character.PicName         = rawChar.PicName ?? string.Empty;
     }
     return(true);
 }