Пример #1
0
        public void CleanXRefList()
        {
            BlockListMgr.CleanBlockList();
            CompoundBlockMgr.CleanBlockList();
            SharedMemoryMgr.CleanList();

            try
            {
                XmlDocument doc = new XmlDocument();
                if (File.Exists(XRefListPath))
                {
                    doc.Load(XRefListPath);
                }

                if (doc.DocumentElement == null || doc.DocumentElement.Name != "xref")
                {
                    doc.RemoveAll();
                    doc.AppendChild(doc.CreateElement("xref"));
                }

                XmlNode node = doc.SelectSingleNode("xref//Blocks");
                if (node == null)
                {
                    node = doc.CreateElement("Blocks");
                    doc.DocumentElement.AppendChild(node);
                }
                node.RemoveAll();

                node = doc.SelectSingleNode("xref//IOConnections");
                if (node == null)
                {
                    node = doc.CreateElement("IOConnections");
                    doc.DocumentElement.AppendChild(node);
                }
                node.RemoveAll();

                //KHo 20111226
                node = doc.SelectSingleNode("xref//CompoundBlocks");
                if (node == null)
                {
                    node = doc.CreateElement("CompoundBlocks");
                    doc.DocumentElement.AppendChild(node);
                }
                node.RemoveAll();

                //lsu 20120509
                node = doc.SelectSingleNode("xref//BuildManager");
                if (node == null)
                {
                    node = doc.CreateElement("BuildManager");
                    doc.DocumentElement.AppendChild(node);
                }
                node.RemoveAll();

                doc.Save(XRefListPath);

                // set dirty flag
                BlockListMgr.Dirty     = true;
                IOAddressMgr.Dirty     = true;
                CompoundBlockMgr.Dirty = true;
                BuildListMgr.Dirty     = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                //logger.Error(e.Message + " at " + e.StackTrace);
            }
        }