示例#1
0
        /// <summary>
        /// Чтение узлов ввода-вывода.
        /// </summary>
        private void ReadNodes()
        {
            foreach (var function in functionsForSearching)
            {
                bool needToSkip = NeedSkipNode(function);
                if (needToSkip == true)
                {
                    continue;
                }

                isContainsNodes = true;
                var    match      = IONameRegex.Match(function.VisibleName);
                int    nodeNumber = Convert.ToInt32(match.Groups["n"].Value);
                string name       = $"A{nodeNumber}";
                string ipAdress   = GetIPAdressFromFunction(function);
                string type       = GetNodeTypeFromFunction(function);

                if (type != "")
                {
                    if (isContainsA1 == true)
                    {
                        if (nodeNumber == numberA1)
                        {
                            IOManager.AddNode(numberA1, type, ipAdress, name);
                        }
                        else
                        {
                            IOManager.AddNode(nodeNumber / 100 + numberA1, type,
                                              ipAdress, name);
                        }
                    }
                    else
                    {
                        IOManager.AddNode(nodeNumber / 100, type, ipAdress,
                                          name);
                    }
                }
                else
                {
                    ProjectManager.GetInstance().AddLogMessage($"У модуля \"" +
                                                               $"{function.VisibleName}\" не задан параметр изделия" +
                                                               $" (номер типа изделия).");
                }
            }
        }