public static List<ArcheryRank> CalculateArcheryRanks(ArcheryParticipationRecord record, out string missingRequirements) { var rank = new KnightWarden(); var results = rank.GetHighestQualifiedRank(record, out missingRequirements); return results .OfType<ArcheryRank>() .ToList(); }
public ArcheryRank(int BowmEP, int BowmTW, int HuntEP, int HuntTW, int War, int Demo) { minimumRecordForRank = new ArcheryParticipationRecord() { War = War, HuntsmanWins = HuntTW, HuntsmanParticipations = HuntEP, Demo = Demo, BowmanWins = BowmTW, BowmanParticipations = BowmEP }; }
public static ArcheryParticipationRecord GetArcheryRecord(int id) { var webContent = GetWebContentForId(id); var stringContents = webContent.Split(new string[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries); string relevantString = stringContents.First(str => str.Contains("<tr ALIGN=CENTER BGCOLOR=\"#82CA9C\">")); var values = relevantString.Split(new string[] { "<td>", "</td>" }, StringSplitOptions.RemoveEmptyEntries); int sillyInt = 0; var valArray = values .Where(val => int.TryParse(val, out sillyInt)) .Select(val => int.Parse(val)) .ToArray(); ArcheryParticipationRecord record = new ArcheryParticipationRecord() { BowmanParticipations = valArray[0], BowmanWins = valArray[1], HuntsmanParticipations = valArray[2], HuntsmanWins = valArray[3], War = valArray[4], Demo = valArray[5] }; return record; }