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();
                }
            }
        }
Пример #2
0
        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();
                }
            }
        }
        private static void SetMetaDataSection(Type cmdLineObjType, ChoObjectInfo objectInfo)
        {
            if (cmdLineObjType == null)
            {
                return;
            }

            string elementPath = cmdLineObjType.Name;

            using (ChoXmlDocument xmlDocument = new ChoXmlDocument(_metaDataFilepath))
            {
                if (elementPath.IsNullOrEmpty())
                {
                    return;
                }

                XmlNode node = xmlDocument.XmlDocument.SelectSingleNode(elementPath);
                if (node == null)
                {
                    node = xmlDocument.XmlDocument.MakeXPath(elementPath);
                }

                if (node != null)
                {
                    xmlDocument.XmlDocument.InnerXml = ChoXmlDocument.AppendToInnerXml(node, objectInfo.ToXml());

                    xmlDocument.Save();
                }
            }
        }
        private static void SetMetaDataSection(ChoCommandLineArgObject cmdLineArgObject, ChoPropertyInfos propertyInfos)
        {
            return;

            if (cmdLineArgObject == null)
            {
                return;
            }

            string elementPath = cmdLineArgObject.GetType().Name;

            using (ChoXmlDocument xmlDocument = new ChoXmlDocument(_metaDataFilepath))
            {
                if (elementPath.IsNullOrEmpty())
                {
                    return;
                }

                XmlNode node = xmlDocument.XmlDocument.SelectSingleNode(elementPath);
                if (node == null)
                {
                    node = xmlDocument.XmlDocument.MakeXPath(elementPath);
                }

                if (node != null)
                {
                    xmlDocument.XmlDocument.InnerXml = ChoXmlDocument.AppendToInnerXml(node, propertyInfos.ToXml());

                    xmlDocument.Save();
                }
            }
        }
        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();
                }
            }
        }