private void generageTree(string parentName, int nodeReservedCount, int depth) { maxNodes = maxNodes + depth; int firstNodeIndex = Convert.ToInt32(parentName); int lastNodeIndex = nodeReservedCount + depth; for (int i = 1; i <= depth; i++) { string innerNodeName = (nodeReservedCount + i).ToString(); Connection newCon = new Connection(innerNodeName); if (searchInLineTypeTuple(nodeReservedCount + i, firstNodeIndex, lastNodeIndex, out string _lineType)) { newCon.lineType = _lineType; } else { LogTextEvent(System.Drawing.Color.Red, $"Не указан тип линии мужду узлами {parentName} и {innerNodeName}"); } newCon.ParentName = parentName; newCon.IsAnker = ankers.Text.Split(' ').Contains(innerNodeName); if (clientsList.ContainsKey(innerNodeName)) { newCon.clients.AddRange(clientsList[innerNodeName]); } mainNode.AddChild(parentName, newCon); if (searchInRouteTuple(_routes, parentName, out int aDepth)) { generageTree(parentName, maxNodes, aDepth); } parentName = innerNodeName; } }