Exemplo n.º 1
0
        /// <summary>
        /// 将指定目录下的xml转成cs文件
        /// </summary>
        /// <param name="inPath">xml所在路径</param>
        /// <param name="inFolderName">根节点名</param>
        /// <param name="inNameSpace">命名空间</param>
        /// <param name="inHeritNames">继承</param>
        /// <returns></returns>
        public bool Xml2CS(string inPath, string inFolderName, string inRootName, string inNameSpace, string inHeritNames)
        {
            Assist.CheckFolderExist(inFolderName);

            Dictionary <string, XmlDocument> doc = Assist.GetXml(inPath);

            foreach (KeyValuePair <string, XmlDocument> item in doc)
            {
                XmlUnit b = new XmlUnit(inNameSpace, item.Key, inFolderName);
                b.SetInherit(inHeritNames);
                b.SetNodeValue(item.Value.SelectSingleNode(inRootName).ChildNodes[0]);
            }
            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 将指定目录下的xml转成cs文件
        /// </summary>
        /// <param name="inPath">xml所在路径</param>
        /// <param name="inFolderName">根节点名</param>
        /// <param name="inNameSpace">命名空间</param>
        /// <param name="inHeritNames">继承</param>
        /// <returns></returns>
        public bool Xml2CS(string inPath, string inFolderName, string inRootName, string inNameSpace, string inHeritNames)
        {
            Assist.CheckFolderExist(inFolderName);

            Dictionary<string, XmlDocument> doc = Assist.GetXml(inPath);

            foreach (KeyValuePair<string, XmlDocument> item in doc)
            {
                XmlUnit b = new XmlUnit(inNameSpace, item.Key, inFolderName);
                b.SetInherit(inHeritNames);
                b.SetNodeValue(item.Value.SelectSingleNode(inRootName).ChildNodes[0]);
            }
            return true;
        }