public void insertNodeAfterNode(string BeforeNodeName, UGNode NodeInserted)
 {
     Nodes.FindIndex(x => x.NodeName == BeforeNodeName);
 }
        private bool loadPLV()
        {
            try
            {
                var file = new System.IO.StreamReader(Filename);
                UGNode node = null;
                var comments = new List<string>();

                while (!file.EndOfStream)
                {
                    string line = file.ReadLine();

                    var NL = new UGNodeLine(line);
                    switch (NL.Key)
                    {
                        case "NODE":
                            node = new UGNode(NL.Value);
                            break;
                        case "TABLE":
                            node.Table = NL.Value;
                            break;
                        case "NAME":
                            node.Name = NL.Value;
                            break;
                        case "SUBNODES":
                            node.SubNodes.Add(NL.Value);
                            break;
                        case "END_OF_NODE":
                            node.CommentsBeforeNode.AddRange(comments);
                            Nodes.Add(node);
                            comments.Clear();
                            break;
                        default:
                            comments.Add(line);
                            break;
                    }
                }
            } catch (Exception) {
                return false;
            }

            return true;
        }
예제 #3
0
        //Запись в PIPING
        void Button3Click(object sender, EventArgs e)
        {
            string NewNodeName   = textBox1.Text;
            string NewVisualName = textBox2.Text;
            var UGN = new UGNodesRouteMech();

            var NewNode = UGN.findNode(NewNodeName);
            if (NewNode != null)
            {
                var MBResult = MessageBox.Show(NewNodeName + " уже присутствует. Заменить информацию?", "Запрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (MBResult == DialogResult.No) return;

                NewNode.Clear();
            } else
            {
                NewNode = new UGNode(NewNodeName);
            }
            NewNode.Name = NewVisualName;
            NewNode.Table = System.IO.Path.GetFileName(ptb.FilenamePTB);

            var node = UGN.findNode("PIPING_STOCK");
            if (!node.isPresentInSubNode(NewNodeName)) node.SubNodes.Add(NewNodeName);
        }