/// <summary> /// Populates every ConverterMapping in each Section with potential cards from the converterSets /// </summary> /// <param name="converterSets">List of all ConverterSets. Only those with flag IncludeInSearches will be used.</param> public void PopulateConverterMappings(Dictionary <Guid, ConverterSet> converterSets) { Dictionary <string, List <Tuple <ConverterCard, ConverterSet> > > normalizedConverterCards = ConverterMapping.NormalizeConverterCards(converterSets.Values); foreach (ConverterSection converterSection in this.ConverterSections) { foreach (ConverterMapping converterMapping in converterSection.SectionMappings) { converterMapping.PopulateWithPotentialCards(normalizedConverterCards); } // Try matching each incorrectly formatted line, and assume a quantity of 1 List <string> linesWithoutQuantityButMatchingName = new List <string>(); foreach (string incorrectlyFormattedLine in converterSection.IncorrectlyFormattedLines) { if (!string.IsNullOrWhiteSpace(incorrectlyFormattedLine)) { ConverterMapping cm = new ConverterMapping(incorrectlyFormattedLine, string.Empty, 1); cm.PopulateWithPotentialCards(normalizedConverterCards); if (cm.PotentialOCTGNCards.Count > 0) { converterSection.AddConverterMapping(cm); linesWithoutQuantityButMatchingName.Add(incorrectlyFormattedLine); } } } // Incorrectly formatted lines which were found to match a card name should be removed from incorrect list. foreach (string line in linesWithoutQuantityButMatchingName) { converterSection.RemoveIncorrectlyFormattedLine(line); } } }