예제 #1
0
        public void TestConfNodeEditor_AddNode_ToTagParent()
        {
            ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/DefaultSpec.xml");

            conf.Save($@"{GlobalVar.ResultPath}\root.xml");
            conf = Builder.Xml.Generate($@"{GlobalVar.ResultPath}\root.xml");

            var node = conf.Find(@"Specs/BR", new List <string>()
            {
                "HighTemp"
            });

            Assert.IsTrue(node == null);

            ConfTree newnode = new ConfTree("BR");

            newnode.Add(new ConfItem("Max", "10"));
            newnode.Add(new ConfItem("Min", "0"));
            var tree = conf.GetItem(@"HighTemp:Specs") as ConfTree;

            tree.AddNode(newnode);
            conf.Save();

            conf = Builder.Xml.Generate($@"{GlobalVar.ResultPath}\root.xml");
            node = conf.Find(@"Specs/BR", new List <string>()
            {
                "HighTemp"
            });
            Assert.IsTrue(node != null);
        }
예제 #2
0
        private ConfItem GetSelectedItem(int rowIdx, int colIdx)
        {
            var    validCol = GetValidColIdx(rowIdx, colIdx);
            string path     = GetPath(DGV_ConfigItems, rowIdx, validCol);

            SelectedItem = Conf.GetItem(path);

            return(SelectedItem);
        }
예제 #3
0
        public void TestConfNodeEditor_GetSonStructure()
        {
            ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/DefaultSpec.xml");

            conf.Save($@"{GlobalVar.ResultPath}\root.xml");
            conf = Builder.Xml.Generate($@"{GlobalVar.ResultPath}\root.xml");

            var item = (conf.GetItem(@"Specs") as ConfTree).Sons[0].Clone();

            Assert.IsTrue(item != null);
        }