internal static void SetCustomColors(int[] colors)
{
string optFileName = AppDomain.CurrentDomain.BaseDirectory + "designerstate.xml";
StringBuilder sb = new StringBuilder();
foreach (int c in colors)
{
sb.Append(c.ToString());
sb.Append(",");
}
sb.Remove(sb.Length - 1, 1); // remove last ","
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.PreserveWhitespace = false;
xDoc.Load(optFileName);
XmlNode xNode;
xNode = xDoc.SelectSingleNode("//designerstate");
// Loop thru all the child nodes
XmlNode cNode = null;
foreach (XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.Name == "CustomColors")
{
cNode = xNodeLoop;
break;
}
}
if (cNode == null)
{
cNode = xDoc.CreateElement("CustomColors");
xNode.AppendChild(cNode);
}
cNode.InnerText = sb.ToString();
xDoc.Save(optFileName);
}
catch (Exception e)
{
MessageBox.Show(e.Message, Strings.RdlDesigner_Show_CustomColorSaveFailed);
}
return;
}