public void LoadFromPolicy(string filePath) { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(filePath); XmlNodeList fileList = doc.SelectNodes("Files//File"); foreach (XmlNode node in fileList) { FilePushPolicy policy = new FilePushPolicy(); try { policy.clsid = node.Attributes["clsid"].Value; policy.name = node.Attributes["name"].Value; policy.status = node.Attributes["status"].Value; policy.image = int.Parse(node.Attributes["image"].Value); policy.changed = node.Attributes["changed"].Value; XmlNode propertiesNode = node.SelectSingleNode("Properties"); FilePushPolicyProperties properties = new FilePushPolicyProperties(); properties.action = propertiesNode.Attributes["action"].Value; properties.fromPath = propertiesNode.Attributes["fromPath"].Value; properties.targetPath = propertiesNode.Attributes["targetPath"].Value; properties.readOnly = int.Parse(propertiesNode.Attributes["readOnly"].Value); properties.archive = int.Parse(propertiesNode.Attributes["archive"].Value); properties.hidden = int.Parse(propertiesNode.Attributes["hidden"].Value); policy.Properties = properties; this.FilePushPolicies.Add(policy); } catch (NullReferenceException) { throw new WSSGGroupPolicyException(); } //Console.WriteLine(node.Attributes["name"].Value); } }
public void LoadFromPolicy(string filePath) { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(filePath); XmlNodeList fileList = doc.SelectNodes("Files//File"); foreach (XmlNode node in fileList) { FilePushPolicy policy = new FilePushPolicy(); try { policy.clsid = node.Attributes["clsid"].Value; policy.name = node.Attributes["name"].Value; policy.status = node.Attributes["status"].Value; policy.image = int.Parse(node.Attributes["image"].Value); policy.changed = node.Attributes["changed"].Value; XmlNode propertiesNode = node.SelectSingleNode("Properties"); FilePushPolicyProperties properties = new FilePushPolicyProperties(); properties.action = propertiesNode.Attributes["action"].Value; properties.fromPath = propertiesNode.Attributes["fromPath"].Value; properties.targetPath = propertiesNode.Attributes["targetPath"].Value; properties.readOnly = int.Parse(propertiesNode.Attributes["readOnly"].Value); properties.archive = int.Parse(propertiesNode.Attributes["archive"].Value); properties.hidden = int.Parse(propertiesNode.Attributes["hidden"].Value); policy.Properties = properties; this.FilePushPolicies.Add(policy); } catch (NullReferenceException) { throw new WSSGGroupPolicyException(); } //Console.WriteLine(node.Attributes["name"].Value); } }