Exemplo n.º 1
0
        public BoardsInfo OpenListBoards(string listBoardName)
        {
            BoardsInfo    boards    = new BoardsInfo();
            XmlTextReader reader    = new XmlTextReader(listBoardName);
            string        boardName = null;

            double dI27MAX = 999;
            double dI15MAX = 999;
            double dI12MAX = 999;
            double dI05MAX = 999;
            double dI03MAX = 999;


            string        commentString       = string.Empty;
            string        imageLinkString     = string.Empty;
            string        commentHelpString   = string.Empty;
            string        imageLinkHelpString = string.Empty;
            List <string> listImageLink_Help  = null;
            //            string str;

            string paramName = string.Empty;
            string fileName  = string.Empty;

            // UInt16 delay = 1000;


            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // Узел является элементом.
                    paramName = reader.Name;
                    if (reader.Name == "BOARD")
                    {
                        dI27MAX = 999;
                        dI15MAX = 999;
                        dI12MAX = 999;
                        dI05MAX = 999;
                        dI03MAX = 999;

                        reader.MoveToNextAttribute();
                        if (reader.Name == "NAME")
                        {
                            boardName          = reader.Value;
                            listImageLink_Help = new List <string>();
                        }
                    }

                    break;

                case XmlNodeType.Text:     // Вывести текст в каждом элементе.

                    if (paramName == "FILENAME")
                    {
                        fileName = reader.Value;
                    }


                    if (paramName == "COMMENT")
                    {
                        commentString = reader.Value;
                    }

                    if (paramName == "IMAGELINK")
                    {
                        imageLinkString = reader.Value;
                    }

                    if (paramName == "COMMENT_HELP")
                    {
                        commentHelpString = reader.Value;
                    }

                    if (paramName == "IMAGELINK_HELP")
                    {
                        imageLinkHelpString = reader.Value;
                        listImageLink_Help.Add(imageLinkHelpString);
                    }

                    if (paramName == "I27MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI27MAX = dValue;
                        }
                    }

                    if (paramName == "I15MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI15MAX = dValue;
                        }
                    }

                    if (paramName == "I12MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI12MAX = dValue;
                        }
                    }

                    if (paramName == "I5MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI05MAX = dValue;
                        }
                    }

                    if (paramName == "I3MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI03MAX = dValue;
                        }
                    }

                    break;

                case XmlNodeType.EndElement:     // Вывести конец элемента.
                    if (reader.Name == "BOARD")
                    {
                        // BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, imageLinkHelpString, commentHelpString);
                        //BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, imageLinkHelpString, commentHelpString);
                        //BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, listImageLink_Help, commentHelpString);
                        BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, listImageLink_Help, commentHelpString,
                                                           dI27MAX, dI15MAX, dI12MAX, dI05MAX, dI03MAX);

                        commentString       = string.Empty;
                        imageLinkString     = string.Empty;
                        commentHelpString   = string.Empty;
                        imageLinkHelpString = string.Empty;
                        fileName            = string.Empty;
                        listImageLink_Help  = null;

                        boards.listBoardInfo.Add(boardInf);
                    }

                    break;
                }
            }


            return(boards);
        }