From c8aeedad323a1e51f1f95555d85d53df401d597c Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 29 Mar 2019 11:42:30 +0100 Subject: [PATCH] Fixed counting --- Licor4300_Collect/Program.cs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Licor4300_Collect/Program.cs b/Licor4300_Collect/Program.cs index d405861..cef2aaa 100644 --- a/Licor4300_Collect/Program.cs +++ b/Licor4300_Collect/Program.cs @@ -140,7 +140,15 @@ static void Main(string[] args) var doc2 = new HtmlAgilityPack.HtmlDocument(); int groupCount = 0; - int allGroups = node.Descendants().Count(); + int allGroups = 0; + + foreach (var nNodeCnt in node.Descendants()) + { + if (nNodeCnt.NodeType == HtmlNodeType.Element) + { + allGroups++; + } + } foreach (var nNode in node.Descendants()) { @@ -157,7 +165,7 @@ static void Main(string[] args) groupCount++; - Console.WriteLine("Processing group: " + group + "("+groupCount+"/"+allGroups+")"); + Console.WriteLine("Processing group: " + group + "("+groupCount+"/"+allGroups+")"+Environment.NewLine); Directory.CreateDirectory(selectedPath + @"\" + group); @@ -213,9 +221,17 @@ static void Main(string[] args) string tmpResponseText2 = null; int runCount = 0; - int allRuns = node2.Descendants().Count(); + int allRuns = 0; + + foreach (var nNode2Cnt in node2.Descendants()) + { + if (nNode2Cnt.NodeType == HtmlNodeType.Element) + { + allRuns++; + } + } - foreach (var nNode2 in node2.Descendants()) + foreach (var nNode2 in node2.Descendants()) { if (nNode2.NodeType == HtmlNodeType.Element) { @@ -230,7 +246,7 @@ static void Main(string[] args) runCount++; //Console.WriteLine(" Processing scan: " + scan); - drawTextProgressBar(runCount, node2.Descendants().Count()); + drawTextProgressBar(runCount, allRuns); //Console.WriteLine(" Processing 700"); //Directory.CreateDirectory(selectedPath + @"LiCor4300\" + group + @"\" + scan);