コード例 #1
0
        public void delNodeAll(string _filePath, string _nodeNm)
        {
            uniUtil     util   = new uniUtil();
            XmlDocument XmlDoc = new XmlDocument();

            try
            {
                XmlDoc.Load(_filePath);
                XmlNodeList bookNodes = XmlDoc.DocumentElement.SelectNodes(_nodeNm);
                for (int i = 0; i < bookNodes.Count; i++)
                {
                    bookNodes[i].ParentNode.RemoveChild(bookNodes[i]);
                }
                XmlDoc.Save(_filePath);
            }
            catch (IOException e1)
            {
                util.setLogFile("delNodeAll error:" + e1.ToString());
                string xmlText = "<?xml version=\"1.0\" standalone=\"yes\"?>\r\n"
                                 + "<dataset>\r\n"
                                 + "</dataset>\r\n";
                //파일 생성
                util.fileCreate(_filePath, _filePath.Substring(_filePath.LastIndexOf("\\") + 1), xmlText);
            }
            catch (Exception e)
            {
                util.setLogFile("delNodeAll error:" + e.ToString());
            }

            XmlDoc = null;
            util   = null;
        }
コード例 #2
0
        //플레이 카운터 설정
        public void BasicPlayInfo(string _filePath, string _playFile, string _xmlTxt)
        {
            string fileInfo = _filePath + DateTime.Now.ToString("yyyyMMdd") + ".xml";
            //플레이 정보 기록 하기
            uniUtil util = new uniUtil();

            util.setLogFile("playFile:" + _playFile);
            if (util.fileCreate(_filePath, DateTime.Now.ToString("yyyyMMdd") + ".xml", _xmlTxt) == true)
            {
                string nodeCnt = xmlNodeRead(fileInfo, "filePlayList", "playFile", _playFile);
                //Console.Write("nodeCnt:" + nodeCnt);
                if (nodeCnt == "")
                {
                    xmlCreateNodeAttr("filePlayList", fileInfo, "playFile", _playFile, "1");
                }
                else
                {
                    //노드 삭제 후 재 입력
                    xmlNodeChangeUni(fileInfo, "filePlayList", "playFile", _playFile, "playCnt");
                }
            }
            util = null;
        }