protected override void ParseSpecificNode(XmlNode xmlNode, HattrickBase entity) { try { Players players = (Players)entity; switch (xmlNode.Name) { case Tags.UserIsSupporter: players.userIsSupporterField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.IsYouth: players.isYouthField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.ActionType: players.actionTypeField = xmlNode.InnerText; break; case Tags.IsPlayingMatch: players.isPlayingMatchField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.Team: if (xmlNode.ChildNodes != null) { players.teamField = ParseTeamNode(xmlNode); } break; } } catch (Exception ex) { throw ex; } }
protected override void ParseSpecificNode(XmlNode xmlNode, HM.Entities.Hattrick.HattrickBase entity) { try { MatchDetails matchDetails = (MatchDetails)entity; switch (xmlNode.Name) { case Tags.UserIsSupporter: matchDetails.userIsSupporterField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.IsYouth: matchDetails.isYouthField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.Match: matchDetails.matchField = ParseMatchNode(xmlNode); break; } } catch (Exception ex) { throw ex; } }
private YouthSquad ParseYouthSquadNode(XmlNode youthSquadNode) { try { YouthSquad youthSquad = new YouthSquad(); foreach (XmlNode xmlNode in youthSquadNode.ChildNodes) { switch (xmlNode.Name) { case Tags.Investment: youthSquad.investmentField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.HasPromoted: youthSquad.hasPromotedField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.YouthLevel: youthSquad.youthLevelField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; } } return(youthSquad); } catch (Exception ex) { throw ex; } }
private CurrentCapacity ParseCurrentCapacityNode(XmlNode xmlNodeCurrentCapacity) { try { CurrentCapacity currentCapacity = new CurrentCapacity(); if (xmlNodeCurrentCapacity.ChildNodes != null) { foreach (XmlNode xmlNode in xmlNodeCurrentCapacity.ChildNodes) { switch (xmlNode.Name) { case Tags.RebuiltDate: if (xmlNode.Attributes[Tags.Available] != null) { currentCapacity.availableField = GenericFunctions.ConvertStringToBool(xmlNode.Attributes[Tags.Available].Value); if (currentCapacity.availableField) { currentCapacity.rebuiltDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); } } break; case Tags.Basic: currentCapacity.basicField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.Terraces: currentCapacity.terracesField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.Roof: currentCapacity.roofField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.VIP: currentCapacity.vipField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.Total: currentCapacity.totalField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; } } } return(currentCapacity); } catch (Exception ex) { throw ex; } }
private ExpandedCapacity ParseExpandedCapacityNode(XmlNode xmlNodeExpandedCapacity) { try { ExpandedCapacity expandedCapacity = new ExpandedCapacity(); if (xmlNodeExpandedCapacity.ChildNodes != null) { if (xmlNodeExpandedCapacity.Attributes[Tags.Available] != null) { expandedCapacity.availableField = GenericFunctions.ConvertStringToBool(xmlNodeExpandedCapacity.Attributes[Tags.Available].Value); } if (expandedCapacity.availableField) { foreach (XmlNode xmlNode in xmlNodeExpandedCapacity.ChildNodes) { switch (xmlNode.Name) { case Tags.ExpansionDate: expandedCapacity.expansionDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; case Tags.Basic: expandedCapacity.basicField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.Terraces: expandedCapacity.terracesField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.Roof: expandedCapacity.roofField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.VIP: expandedCapacity.vipField = Convert.ToInt32(xmlNode.InnerText); break; } } } } return(expandedCapacity); } catch (Exception ex) { throw ex; } }
private SupportersPopularity ParseSupportersPopularityNode(XmlNode supportersNode) { try { SupportersPopularity supportersPopularity = new SupportersPopularity(); supportersPopularity.availableField = GenericFunctions.ConvertStringToBool(supportersNode.Attributes[Tags.Available].Value); supportersPopularity.supportersPopularityField = (SupportersMood)Convert.ToInt32(supportersNode.InnerText); return(supportersPopularity); } catch (Exception ex) { throw ex; } }
private Cup ParseCupNode(XmlNode cupNode) { try { Cup cup = new Cup(); foreach (XmlNode xmlNode in cupNode.ChildNodes) { switch (xmlNode.Name) { case Tags.StillInCup: cup.stillInCupField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; } } return(cup); } catch (Exception ex) { throw ex; } }
private BotStatus ParseBotStatusNode(XmlNode botStatusNode) { try { BotStatus botStatus = new BotStatus(); foreach (XmlNode xmlNode in botStatusNode.ChildNodes) { switch (xmlNode.Name) { case Tags.IsBot: botStatus.isBotField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; } } return(botStatus); } catch (Exception ex) { throw ex; } }
protected override void ParseSpecificNode(XmlNode xmlNode, HattrickBase entity) { Matches matches = (Matches)entity; switch (xmlNode.Name) { case Tags.IsYouth: matches.isYouth = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.Team: if (xmlNode.ChildNodes != null) { matches.team = ParseTeamNode(xmlNode); } break; default: throw new Exception(string.Format("Invalid XML: Matches.xml", Tags.Team)); } }
protected override void ParseSpecificNode(XmlNode xmlNode, HattrickBase entity) { try { MatchesArchive matchesArchive = (MatchesArchive)entity; switch (xmlNode.Name) { case Tags.IsYouth: matchesArchive.isYouthField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.Team: if (xmlNode.ChildNodes != null) { matchesArchive.teamField = ParseTeamNode(xmlNode); } break; } } catch (Exception ex) { throw ex; } }
protected override void ParseSpecificNode(XmlNode xmlNode, HattrickBase entity) { MatchLineup matchLineup = (MatchLineup)entity; switch (xmlNode.Name) { case Tags.MatchId: matchLineup.matchIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.IsYouth: matchLineup.isYouthField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.MatchType: matchLineup.matchTypeField = (MatchType)Convert.ToInt32(xmlNode.InnerText); break; case Tags.MatchDate: matchLineup.matchDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; case Tags.HomeTeam: matchLineup.homeTeamField = ParseHomeTeamNode(xmlNode); break; case Tags.AwayTeam: matchLineup.awayTeamField = ParseAwayTeamNode(xmlNode); break; case Tags.Arena: matchLineup.arenaField = ParseArenaNode(xmlNode); break; case Tags.Team: matchLineup.teamField = ParseTeamNode(xmlNode); break; } }
private Achievement ParseAchievementNode(XmlNode achievementListNode) { Achievement achievement = new Achievement(); foreach (XmlNode achievementNode in achievementListNode.ChildNodes) { switch (achievementNode.Name) { case Tags.AchievementTypeID: achievement.achievementTypeIdField = GenericFunctions.ConvertStringToUInt(achievementNode.InnerText); break; case Tags.AchievementText: achievement.achievementTextField = achievementNode.InnerText; break; case Tags.CategoryID: achievement.categoryIdField = (AchievementCategory)Convert.ToInt32(achievementNode.InnerText); break; case Tags.EventDate: achievement.eventDateField = GenericFunctions.ConvertStringToDateTime(achievementNode.InnerText); break; case Tags.Points: achievement.pointsField = Convert.ToInt32(achievementNode.InnerText); break; case Tags.MultiLevel: achievement.multilevelField = GenericFunctions.ConvertStringToBool(achievementNode.InnerText); break; case Tags.NumberOfEvents: achievement.numberOfEventsField = GenericFunctions.ConvertStringToUInt(achievementNode.InnerText); break; } } return(achievement); }
private Match ParseMatchNode(XmlNode matchNode) { Match match = new Match(); foreach (XmlNode xmlNode in matchNode.ChildNodes) { switch (xmlNode.Name) { case Tags.MatchId: match.matchIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.HomeTeam: if (xmlNode.ChildNodes != null) { match.homeTeamField = ParseHomeTeamNode(xmlNode); } break; case Tags.AwayTeam: if (xmlNode.ChildNodes != null) { match.awayTeamField = ParseAwayTeamNode(xmlNode); } break; case Tags.MatchDate: match.matchDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; case Tags.MatchType: match.matchTypeField = (MatchType)Convert.ToInt32(xmlNode.InnerText); break; case Tags.HomeGoals: match.homeGoalsField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.AwayGoals: match.awayGoalsField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.Status: string statusString = xmlNode.InnerText; MatchStatus status = MatchStatus.Finished; switch (statusString) { case General.StatusFinished: status = MatchStatus.Finished; break; case General.StatusUpcoming: status = MatchStatus.Upcoming; break; } match.statusField = status; break; case Tags.OrdersGiven: match.ordersGivenField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; } } return(match); }
private List <Player> ParsePlayerListNode(XmlNode playerListNode) { try { List <Player> playerList = new List <Player>(); foreach (XmlNode xmlPlayerNode in playerListNode.ChildNodes) { if (xmlPlayerNode.ChildNodes != null) { Player player = new Player(); foreach (XmlNode xmlNode in xmlPlayerNode.ChildNodes) { switch (xmlNode.Name) { case Tags.PlayerID: player.playerIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.FirstName: player.firstNameField = xmlNode.InnerText; break; case Tags.NickName: player.nickNameField = xmlNode.InnerText; break; case Tags.LastName: player.lastNameField = xmlNode.InnerText; break; case Tags.PlayerNumber: player.playerNumberField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.Age: player.ageField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.AgeDays: player.ageDaysField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.TSI: player.tsiField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.PlayerForm: player.playerFormField = (PlayerForm)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Statement: player.statementField = xmlNode.InnerText; break; case Tags.Experience: player.experienceField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Leadership: player.leadershipField = (Leadership)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Salary: player.salaryField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.IsAbroad: player.isAbroadField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.Agreeability: player.agreeabilityField = (Agreeability)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Aggressiveness: player.aggressivenessField = (Aggressiveness)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Honesty: player.honestyField = (Honesty)Convert.ToInt32(xmlNode.InnerText); break; case Tags.LeagueGoals: player.leagueGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CupGoals: player.cupGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.FriendliesGoals: player.friendliesGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CareerGoals: player.careerGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CareerHattricks: player.careerHattricksField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.Specialty: player.specialtyField = (PlayerSpecialty)Convert.ToInt32(xmlNode.InnerText); break; case Tags.TransferListed: player.transferlistedField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.NationalTeamID: player.nationalTeamIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.CountryID: player.countryIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); player.leagueIdField = HM.Resources.Constants.EnumNames.CountryToLeagueID[player.countryIdField]; break; case Tags.Caps: player.capsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CapsU20: player.capsU20Field = Convert.ToInt32(xmlNode.InnerText); break; case Tags.Cards: player.cardsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.InjuryLevel: player.injuryLevelField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.MotherClubBonus: player.motherClubField = Convert.ToBoolean(xmlNode.InnerText); break; case Tags.Loyalty: player.loyaltyField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.StaminaSkill: player.staminaSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.KeeperSkill: player.keeperSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.PlaymakerSkill: player.playmakerSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.ScorerSkill: player.scorerSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.PassingSkill: player.passingSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.WingerSkill: player.wingerSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.DefenderSkill: player.defenderSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.SetPiecesSkill: player.setPiecesSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.PlayerCategoryId: player.playerCategoryIdField = (PlayerCategory)Convert.ToInt32(xmlNode.InnerText); break; case Tags.LastMatch: if (xmlNode.ChildNodes != null) { player.lastMatchField = ParseLastMatchDataNode(xmlNode); } break; case Tags.TrainerData: if (xmlNode.ChildNodes != null) { player.trainerDataField = ParseTrainerDataNode(xmlNode); } break; } } playerList.Add(player); } } return(playerList); } catch (Exception ex) { throw ex; } }
private User ParseUserNode(XmlNode userNode) { try { User user = new User(); foreach (XmlNode xmlNode in userNode.ChildNodes) { switch (xmlNode.Name) { case Tags.UserID: user.userIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.Language: if (xmlNode.ChildNodes != null) { user.languageField = ParseLanguageNode(xmlNode); } break; case Tags.HasSupporter: user.hasSupporterField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.Loginname: user.loginnameField = xmlNode.InnerText; break; case Tags.Name: user.nameField = xmlNode.InnerText; break; case Tags.ICQ: user.icqField = xmlNode.InnerText; break; case Tags.SignupDate: user.signupDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; case Tags.ActivationDate: user.activationDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; case Tags.LastLoginDate: user.lastLoginDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; case Tags.NationalTeamCoach: if (xmlNode.ChildNodes != null) { user.nationalTeamCoachField = ParseNationalTeamCoachNode(xmlNode); } break; } } return(user); } catch (Exception ex) { throw ex; } }