private static void SaveMetaDataSection(ChoPerformanceCounter pc) { string xPath = GetXPath(pc); ChoPCMetaDataInfo metaDataInfo = pc.MetaDataInfo; using (ChoXmlDocument xmlDocument = new ChoXmlDocument(MetaDataFilepath, false, false)) { if (metaDataInfo == null) { return; } XmlNode node = xmlDocument.XmlDocument.SelectSingleNode(xPath); if (node == null) { node = xmlDocument.XmlDocument.MakeXPath(xPath); } if (node != null) { ChoXmlDocument.SetOuterXml(node, metaDataInfo.ToXml()); xmlDocument.Save(); } } }
private void SaveMetaDataSection(T pc) { string xPath = pc.NodeLocateXPath; TMetaDataInfo metaDataInfo = pc.MetaDataInfo; using (ChoXmlDocument xmlDocument = new ChoXmlDocument(MetaDataFilePath)) { if (metaDataInfo == null) { return; } XmlNode node = xmlDocument.XmlDocument.SelectSingleNode(xPath); if (node == null) { node = xmlDocument.XmlDocument.MakeXPath(pc.NodeCreateXPath); } if (node != null) { ChoXmlDocument.SetOuterXml(node, metaDataInfo.ToXml()); xmlDocument.Save(); } } }
protected void PersistAsPlainXml(object data, ChoDictionaryService <string, object> stateInfo) { string configFilePath = stateInfo[UNDERLYING_CONFIG_PATH] as string; if (configFilePath.IsNullOrWhiteSpace()) { return; } ChoXmlDocument.CreateXmlFileIfEmpty(configFilePath); using (ChoXmlDocument xmlDocument = new ChoXmlDocument(GetFullPath(configFilePath))) { PersistConfigSectionDefinition(xmlDocument.XmlDocument, data); XmlNode configNode = xmlDocument.XmlDocument.MakeXPath(ConfigElement.ConfigElementPath); if (configNode != null) { string configXml = ToXml(data); if (configXml.IsNull()) { return; } ChoXmlDocument.SetOuterXml(configNode, configXml); } } }
public static void SetMetaDataSection(ChoBaseConfigurationElement configElement) { if (configElement == null) { return; } if (ChoObject.Equals <ChoBaseConfigurationMetaDataInfo>(configElement.MetaDataInfo, GetMetaDataSection(configElement))) { return; } string configElementPath = configElement.ConfigElementPath; ChoBaseConfigurationMetaDataInfo configurationMetaDataInfo = configElement.MetaDataInfo; configurationMetaDataInfo = ChoObject.Merge <ChoBaseConfigurationMetaDataInfo>(configurationMetaDataInfo, GetDefaultMetaDataInfo(configElement)); if (configurationMetaDataInfo == null) { return; } using (ChoXmlDocument xmlDocument = new ChoXmlDocument(_metaDataFilepath)) { if (configElementPath.IsNullOrEmpty()) { return; } XmlNode node = xmlDocument.XmlDocument.SelectSingleNode(configElementPath); if (node == null) { node = xmlDocument.XmlDocument.MakeXPath(configElementPath); } if (node != null) { ChoXmlDocument.SetOuterXml(node, configurationMetaDataInfo.ToXml()); xmlDocument.XmlDocument.InnerXml = ChoXmlDocument.AppendToInnerXml(node, GetPropertyInfos(configElement).ToXml()); xmlDocument.Save(); } } }
public override void Persist(ChoConfigSectionObjectMap configSectionObjectMap) { File.WriteAllText(_configPath, ChoXmlDocument.SetOuterXml(_configPath, ConfigSectionName, ChoObject.ToXmlString(configSectionObjectMap.ConfigObject))); }