Convert INI format colors to standard System.Drawing.Color
Use Generic Color Configuration Support
This commit is contained in:
@@ -13,6 +13,8 @@ using System.IO;
|
||||
using System.Xml;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
@@ -45,9 +47,9 @@ namespace Config
|
||||
xParent.AppendChild(nd);
|
||||
return nd;
|
||||
}
|
||||
private void AddAttribute(XmlNode xParent, string sName, string sValue )
|
||||
private void AddAttribute(XmlNode xParent, string sName, string sValue)
|
||||
{
|
||||
XmlNode xa=xParent.Attributes.GetNamedItem(sName);
|
||||
XmlNode xa = xParent.Attributes.GetNamedItem(sName);
|
||||
// bug fix. 09/15/03
|
||||
// If there was a space after an equal sign, that space character
|
||||
// was becomming part of the value string (reading the user.CFG file).
|
||||
@@ -55,28 +57,32 @@ namespace Config
|
||||
// We now strip spaces before and after any Attribute that is written.
|
||||
sValue = sValue.Trim(' ');
|
||||
sName = sName.Replace(' ', '_');
|
||||
sName = sName.Replace("\\", "_slash_");
|
||||
|
||||
// Add an attribute
|
||||
if(sValue=="")
|
||||
sName = sName.Replace("\\", "_slash_");
|
||||
if (xParent.Name == "color")
|
||||
{
|
||||
if(xa != null)
|
||||
string[] parts = sValue.Split(",".ToCharArray());
|
||||
sValue = ColorConfig.FindKnownColor(int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2])).ToString();
|
||||
}
|
||||
// Add an attribute
|
||||
if (sValue == "")
|
||||
{
|
||||
if (xa != null)
|
||||
{
|
||||
xParent.Attributes.RemoveNamedItem(sName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(xa == null)
|
||||
if (xa == null)
|
||||
{
|
||||
xa = xParent.OwnerDocument.CreateNode(System.Xml.XmlNodeType.Attribute ,sName,"");
|
||||
xa = xParent.OwnerDocument.CreateNode(System.Xml.XmlNodeType.Attribute, sName, "");
|
||||
xParent.Attributes.SetNamedItem(xa);
|
||||
}
|
||||
xa.Value=sValue;
|
||||
xa.Value = sValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private XmlNode AddSection(XmlNode xParent, string sSection )
|
||||
private XmlNode AddSection(XmlNode xParent, string sSection)
|
||||
{
|
||||
// get the name. If it's not in the 'migrated elements' list, then
|
||||
// preface the name with a 'z'.
|
||||
|
Reference in New Issue
Block a user