added Support for parsing screen color in json

This commit is contained in:
Patrick Kranz 2019-03-29 21:52:04 +01:00
parent 1145336538
commit e6500864bc

View file

@ -76,7 +76,27 @@ namespace ColorTool
var node = children.OfType<XmlNode>().Where(n => n.Name == name).Single();
colorTable[i] = ParseColor(node.InnerText);
}
return new ColorScheme { colorTable = colorTable };
uint? screenForeground = null;
uint? screenBackground = null;
var screenNode = children.OfType<XmlNode>().Where(n => n.Name == "screen_colors").SingleOrDefault();
if (screenNode != null)
{
var parts = screenNode.InnerText.Split(',');
if (parts.Length == 2)
{
var foregroundIndex = (CONCFG_COLOR_NAMES as IList<string>).IndexOf(parts[0]);
var backgroundIndex = (CONCFG_COLOR_NAMES as IList<string>).IndexOf(parts[1]);
if (foregroundIndex != -1 && backgroundIndex != -1)
{
screenForeground = colorTable[foregroundIndex];
screenBackground = colorTable[backgroundIndex];
}
}
}
return new ColorScheme { colorTable = colorTable, background = screenBackground, foreground = screenForeground };
}
catch (Exception /*e*/)
{