private TrainerData ParseTrainerDataNode(XmlNode trainerDataNode) { try { TrainerData trainerData = new TrainerData(); foreach (XmlNode xmlNode in trainerDataNode.ChildNodes) { switch (xmlNode.Name) { case Tags.TrainerType: { trainerData.trainerTypeField = (TrainerType)Convert.ToInt32(xmlNode.InnerText); break; } case Tags.TrainerSkill: { trainerData.trainerSkillField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; } } } return(trainerData); } catch (Exception ex) { throw ex; } }
private LeagueLevelUnit ParseLeagueLevelUnitNode(XmlNode leagueLevelUnitNode) { try { LeagueLevelUnit leagueLevelUnit = new LeagueLevelUnit(); foreach (XmlNode xmlNode in leagueLevelUnitNode.ChildNodes) { switch (xmlNode.Name) { case Tags.LeagueLevelUnitID: leagueLevelUnit.leagueLevelUnitIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.LeagueLevelUnitName: leagueLevelUnit.leagueLevelUnitNameField = xmlNode.InnerText; break; case Tags.LeagueLevel: leagueLevelUnit.leagueLevelField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; } } return(leagueLevelUnit); } 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 Event ParseEventNode(XmlNode xmlNode) { try { Event eventField = new Event(); if (xmlNode.Attributes[Tags.Index] != null) { eventField.indexField = Convert.ToInt32(xmlNode.Attributes[Tags.Index].Value); } if (xmlNode.ChildNodes != null) { foreach (XmlNode eventNode in xmlNode.ChildNodes) { switch (xmlNode.Name) { case Tags.Minute: eventField.minuteField = GenericFunctions.ConvertStringToByte(eventNode.InnerText); break; case Tags.SubjectPlayerID: eventField.subjectPlayerIdField = GenericFunctions.ConvertStringToUInt(eventNode.InnerText); break; case Tags.SubjectTeamID: eventField.subjectTeamIdField = GenericFunctions.ConvertStringToUInt(eventNode.InnerText); break; case Tags.ObjectPlayerID: eventField.objectPlayerIdField = GenericFunctions.ConvertStringToUInt(eventNode.InnerText); break; case Tags.EventKey: eventField.eventKeyField = eventNode.InnerText; break; case Tags.EventText: eventField.eventTextField = eventNode.InnerText; break; } } } return(eventField); } catch (Exception ex) { throw ex; } }
private Match ParseMatchNode(XmlNode matchNode) { try { 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; } } return(match); } catch (Exception ex) { throw ex; } }
private Goal ParseGoalNode(XmlNode xmlNode) { try { Goal goal = new Goal(); if (xmlNode.Attributes[Tags.Index] != null) { goal.indexField = Convert.ToInt32(xmlNode.Attributes[Tags.Index].Value); } if (xmlNode.ChildNodes != null) { foreach (XmlNode goalNode in xmlNode.ChildNodes) { switch (goalNode.Name) { case Tags.ScorerPlayerID: goal.scorerPlayerIdField = GenericFunctions.ConvertStringToUInt(goalNode.InnerText); break; case Tags.ScorerPlayerName: goal.scorerPlayerNameField = goalNode.InnerText; break; case Tags.ScorerTeamID: goal.scorerTeamIdField = GenericFunctions.ConvertStringToUInt(goalNode.InnerText); break; case Tags.ScorerHomeGoals: goal.scorerHomeGoalsField = GenericFunctions.ConvertStringToByte(goalNode.InnerText); break; case Tags.ScorerAwayGoals: goal.scorerAwayGoalsField = GenericFunctions.ConvertStringToByte(goalNode.InnerText); break; case Tags.ScorerMinute: goal.scorerMinuteField = GenericFunctions.ConvertStringToByte(goalNode.InnerText); break; } } } return(goal); } catch (Exception ex) { throw ex; } }
private Booking ParseBookingNode(XmlNode xmlNode) { try { Booking booking = new Booking(); if (xmlNode.Attributes[Tags.Index] != null) { booking.indexField = Convert.ToInt32(xmlNode.Attributes[Tags.Index].Value); } if (xmlNode.ChildNodes != null) { foreach (XmlNode bookingNode in xmlNode.ChildNodes) { switch (bookingNode.Name) { case Tags.BookingPlayerID: booking.bookingPlayerIdField = GenericFunctions.ConvertStringToUInt(bookingNode.InnerText); break; case Tags.BookingPlayerName: booking.bookingPlayerNameField = bookingNode.InnerText; break; case Tags.BookingTeamID: booking.bookingTeamIdField = GenericFunctions.ConvertStringToUInt(bookingNode.InnerText); break; case Tags.BookingType: booking.bookingTypeField = Convert.ToInt32(bookingNode.InnerText); break; case Tags.BookingMinute: booking.bookingMinuteField = GenericFunctions.ConvertStringToByte(bookingNode.InnerText); break; } } } return(booking); } catch (Exception ex) { throw ex; } }
private Team ParseTeamNode(XmlNode teamArrayNode) { Team team = new Team(); foreach (XmlNode teamNode in teamArrayNode.ChildNodes) { switch (teamNode.Name) { case Tags.TeamID: team.teamIdField = GenericFunctions.ConvertStringToUInt(teamNode.InnerText); break; case Tags.TeamName: team.teamNameField = teamNode.InnerText; break; case Tags.Position: team.positionField = GenericFunctions.ConvertStringToByte(teamNode.InnerText); break; case Tags.PositionChange: team.positionChangeField = (PositionChange)Convert.ToInt32(teamNode.InnerText); break; case Tags.Matches: team.matchesField = GenericFunctions.ConvertStringToByte(teamNode.InnerText); break; case Tags.GoalsFor: team.goalsForField = GenericFunctions.ConvertStringToByte(teamNode.InnerText); break; case Tags.GoalsAgainst: team.goalsAgainstField = GenericFunctions.ConvertStringToByte(teamNode.InnerText); break; case Tags.Points: team.pointsField = GenericFunctions.ConvertStringToByte(teamNode.InnerText); break; } } return(team); }
protected override void ParseSpecificNode(System.Xml.XmlNode xmlNode, HM.Entities.Hattrick.HattrickBase entity) { LeagueDetails leagueDetails = (LeagueDetails)entity; switch (xmlNode.Name) { case Tags.LeagueID: leagueDetails.leagueIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.LeagueName: leagueDetails.leagueNameField = xmlNode.InnerText; break; case Tags.LeagueLevel: leagueDetails.leagueLevelField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.MaxLevel: leagueDetails.maxLevelField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.LeagueLevelUnitID: leagueDetails.leagueLevelUnitIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.LeagueLevelUnitName: leagueDetails.leagueLevelUnitNameField = xmlNode.InnerText; break; case Tags.CurrentMatchRound: leagueDetails.currentMatchRound = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.Team: Team newTeam = ParseTeamNode(xmlNode); leagueDetails.teamField[newTeam.positionField - 1] = newTeam; break; default: throw new Exception(string.Format("Invalid XML: LeagueDetails.xml", Tags.Team)); } }
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 League ParseLeagueNode(XmlNode leagueNode) { try { League league = new League(); foreach (XmlNode xmlNode in leagueNode.ChildNodes) { switch (xmlNode.Name) { case (Tags.LeagueID): { league.leagueIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; } case (Tags.LeagueName): { league.leagueNameField = xmlNode.InnerText; break; } case (Tags.Season): { league.seasonField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; } case (Tags.MatchRound): { league.matchRoundField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; } case (Tags.ShortName): { league.shortNameField = xmlNode.InnerText; break; } case (Tags.Continent): { league.continentField = xmlNode.InnerText; break; } case (Tags.ZoneName): { league.zoneNameField = xmlNode.InnerText; break; } case (Tags.EnglishName): { league.englishNameField = xmlNode.InnerText; break; } case (Tags.Country): { if (xmlNode.ChildNodes != null) { league.countryField = ParseCountryNode(xmlNode); } break; } case (Tags.Cup): { if (xmlNode.ChildNodes != null) { league.cupField = ParseCupNode(xmlNode); } break; } case (Tags.ActiveUsers): { league.activeUsersField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; } case (Tags.WaitingUsers): { league.waitingUsersField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; } case (Tags.TrainingDate): { league.trainingDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; } case (Tags.EconomyDate): { league.economyDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; } case (Tags.CupMatchDate): { league.cupMatchDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; } case (Tags.SeriesMatchDate): { league.seriesMatchDateField = GenericFunctions.ConvertStringToDateTime(xmlNode.InnerText); break; } case (Tags.NumberOfLevels): { league.numberOfLevelsField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; } } } return(league); } catch (Exception ex) { throw ex; } }
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 Match ParseMatchNode(XmlNode xmlNode) { try { Match match = new Match(); foreach (XmlNode matchNode in xmlNode.ChildNodes) { switch (matchNode.Name) { case Tags.MatchId: match.matchIdField = GenericFunctions.ConvertStringToUInt(matchNode.InnerText); break; case Tags.MatchType: match.matchTypeField = (MatchType)Convert.ToInt32(matchNode.InnerText); break; case Tags.MatchDate: match.matchDateField = GenericFunctions.ConvertStringToDateTime(matchNode.InnerText); break; case Tags.FinishedDate: match.finishedDateField = GenericFunctions.ConvertStringToDateTime(matchNode.InnerText); break; case Tags.HomeTeam: match.homeTeamField = ParseHomeTeamNode(matchNode); break; case Tags.AwayTeam: match.awayTeamField = ParseAwayTeamNode(matchNode); break; case Tags.Arena: match.arenaField = ParseArenaNode(matchNode); break; case Tags.Scorers: match.scorersField = ParseScorersNode(matchNode); break; case Tags.Bookings: match.bookingsField = ParseBookingsNode(matchNode); break; case Tags.PossessionFirstHalfHome: match.possesionFirstHalfHomeField = GenericFunctions.ConvertStringToByte(matchNode.InnerText); break; case Tags.PossessionFirstHalfAway: match.possesionFirstHalfAwayField = GenericFunctions.ConvertStringToByte(matchNode.InnerText); break; case Tags.PossessionSecondHalfHome: match.possesionSecondHalfHomeField = GenericFunctions.ConvertStringToByte(matchNode.InnerText); break; case Tags.PossessionSecondHalfAway: match.possesionSecondHalfAwayField = GenericFunctions.ConvertStringToByte(matchNode.InnerText); break; case Tags.EventList: match.eventListField = ParseEventListNode(matchNode); break; } } return(match); } catch (Exception ex) { throw ex; } }
private AwayTeam ParseAwayTeamNode(XmlNode xmlNode) { try { AwayTeam awayTeam = new AwayTeam(); if (xmlNode.ChildNodes != null) { foreach (XmlNode awayTeamNode in xmlNode.ChildNodes) { switch (awayTeamNode.Name) { case Tags.AwayTeamID: awayTeam.awayTeamIdField = GenericFunctions.ConvertStringToUInt(awayTeamNode.InnerText); break; case Tags.AwayTeamName: awayTeam.awayTeamNameField = awayTeamNode.InnerText; break; case Tags.Dress: awayTeam.dressField = awayTeamNode.InnerText; break; case Tags.Formation: awayTeam.formationField = awayTeamNode.InnerText; break; case Tags.AwayGoals: awayTeam.awayGoalsField = GenericFunctions.ConvertStringToByte(awayTeamNode.InnerText); break; case Tags.TacticType: awayTeam.tacticTypeField = (TacticType)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.TacticSkill: awayTeam.tacticSkillField = (TacticSkill)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.RatingMidfield: awayTeam.ratingMidfieldField = (SectorRating)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.RatingRightDef: awayTeam.ratingRightDefField = (SectorRating)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.RatingMidDef: awayTeam.ratingMidDefField = (SectorRating)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.RatingLeftDef: awayTeam.ratingLeftDefField = (SectorRating)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.RatingRightAtt: awayTeam.ratingRightAttField = (SectorRating)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.RatingMidAtt: awayTeam.ratingMidAttField = (SectorRating)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.RatingLeftAtt: awayTeam.ratingLeftAttField = (SectorRating)Convert.ToInt32(awayTeamNode.InnerText); break; case Tags.TeamAttitude: awayTeam.teamAttitudeField = (TeamAttitude)Convert.ToInt32(awayTeamNode.InnerText); break; } } } return(awayTeam); } catch (Exception ex) { throw ex; } }