コード例 #1
0
        static ClosedList()
        {
            Collection <ClosedList> coll = new Collection <ClosedList>();

            if (File.Exists(listsFile))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(listsFile);

                XmlElement root = doc.DocumentElement;

                for (int i = 0; i < root.ChildNodes.Count; i++)
                {
                    coll.Add(ClosedList.CreateFromXmlNode(root.ChildNodes[i]));
                }
            }

            ClosedLists = new ReadOnlyCollection <ClosedList>(coll);
        }
コード例 #2
0
        public static ClosedList CreateFromXmlNode(XmlNode xmlNode)
        {
            string netName = xmlNode.Attributes["Name"].Value;

            ClosedList result = new ClosedList(netName);

            XmlAttribute attr;

            for (int i = 0; i < xmlNode.ChildNodes.Count; i++)
            {
                XmlNode node = xmlNode.ChildNodes[i];

                attr = node.Attributes["Word"];

                if (attr != null && !string.IsNullOrEmpty(attr.Value))
                {
                    result.words.Add(attr.Value);
                }
            }

            return(result);
        }