private static List <Landtile> ParseLandtiles(IDictionary <string, IDictionary <string, string> > sections) { var outList = new List <Landtile>(); foreach (var section in sections) { IDictionary <string, string> sectionPairs = section.Value; if (!IsSectionTypeOf(sectionPairs, iniValueTypeLandtile)) { continue; } IDictionary <string, string> landtilesSectionPairs = sectionPairs; string landtilesSectionName = section.Key; // Необязательные параметры. string displayedName = landtilesSectionPairs.TryParseValue(iniKeyDisplayedName, out string temp) ? temp : iniDefaultDisplayedName; // Обязательные параметры. ConsoleImage consoleImage; try { consoleImage = new ConsoleImage(char.Parse(landtilesSectionPairs[iniKeyUnitImageChar]), (ConsoleColor)Enum.Parse(typeof(ConsoleColor), landtilesSectionPairs[iniKeyTileColor])); } catch (FormatException) { continue; } catch (KeyNotFoundException) { continue; } outList.Add(new Landtile(landtilesSectionName, displayedName, consoleImage)); } return(outList); }
private static void WriteLineColored(ConsoleImage charImage) => WriteLineColored(charImage.Char, charImage.Color);