internal static int[] GetCustomColors()
{
string optFileName = AppDomain.CurrentDomain.BaseDirectory + "designerstate.xml";
int white = 16777215; // default to white (magic number)
int[] cArray = new int[] {white, white, white, white,white, white, white, white,
white, white, white, white, white, white, white, white};
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.PreserveWhitespace = false;
xDoc.Load(optFileName);
XmlNode xNode;
xNode = xDoc.SelectSingleNode("//designerstate");
string tcolors = "";
// Loop thru all the child nodes
foreach (XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.Name != "CustomColors")
continue;
tcolors = xNodeLoop.InnerText;
break;
}
string[] colorList = tcolors.Split(',');
int i = 0;
foreach (string c in colorList)
{
try { cArray[i] = int.Parse(c); }
catch { cArray[i] = white; }
i++;
if (i >= cArray.Length) // Only allow 16 custom colors
break;
}
}
catch
{ // Didn't sucessfully get the startup state but don't really care
}
return cArray;
}