Modify XML Layout for config.

This commit is contained in:
Jim Norman 2006-07-13 16:31:07 +00:00
parent 4a0f17ecb9
commit 60713b3408
2 changed files with 27 additions and 11 deletions

View File

@ -199,15 +199,23 @@ public class ICASAPol
string mode = modeNode.InnerText; string mode = modeNode.InnerText;
// Load config settings // Load config settings
XmlNode configNode = uiNode.SelectSingleNode("//ConfigSettings");
XmlNodeList nodeList = configNode.ChildNodes;
XmlNode node;
System.Collections.Specialized.NameValueCollection nvc = new System.Collections.Specialized.NameValueCollection(); System.Collections.Specialized.NameValueCollection nvc = new System.Collections.Specialized.NameValueCollection();
XmlNode configNode = uiNode.SelectSingleNode("//ConfigSettings");
if (configNode != null)
{
XmlNodeList nodeList = configNode.ChildNodes;
XmlNode setting;
for (int i=0; i<nodeList.Count; i++) for (int i=0; i<nodeList.Count; i++)
{ {
node = nodeList[i]; setting = nodeList[i];
//Console.WriteLine(node.Name + ":"+node.InnerText); XmlNode nameNode = setting.SelectSingleNode("Name");
nvc.Add(node.Name, node.InnerText);
XmlNode valueNode = setting.SelectSingleNode("Value");
Console.WriteLine(nameNode.InnerText + ":" + valueNode.InnerText);
nvc.Add(nameNode.InnerText, valueNode.InnerText);
}
} }
UIPol uiPol = new UIPol(showInTaskBar, showSecretValue, showSecretInClearText, mode, nvc); UIPol uiPol = new UIPol(showInTaskBar, showSecretValue, showSecretInClearText, mode, nvc);

View File

@ -142,9 +142,17 @@ namespace Novell.CASA.CASAPolicy
for (int i=0; i<m_nvc.Count; i++) for (int i=0; i<m_nvc.Count; i++)
{ {
elem = doc.CreateElement(m_nvc.GetKey(i)); XmlElement settingElem = doc.CreateElement("Setting");
elem.InnerText = m_nvc.GetValues(i)[0]; configElem.AppendChild(settingElem);
configElem.AppendChild(elem);
XmlElement nameElem = doc.CreateElement("Name");
nameElem.InnerText = m_nvc.GetKey(i);
settingElem.AppendChild(nameElem);
XmlElement valueElem = doc.CreateElement("Value");
valueElem.InnerXml = m_nvc.GetValues(i)[0];
settingElem.AppendChild(valueElem);
} }
} }
catch(Exception e) catch(Exception e)