public void Parse() { if (Clipboard.ContainsText(TextDataFormat.Html)) { var watch = new Stopwatch( ); var Text = Clipboard.GetText(TextDataFormat.Html); var htmlDoc = new HtmlDocument( ); htmlDoc.LoadHtml(Text); //=> Only current selected group! Handle var group = htmlDoc.DocumentNode.SelectNodes("//strong[@class=\"group-menu-item\"]"); if (group != null) { var test = group.ElementAt(0); //=> >Group< Console.WriteLine(test.InnerText. Replace(">", ""). Replace("<", "")); } //=> Parse Troups var unitsTable = htmlDoc.DocumentNode.SelectNodes("//table[@id=\"units_table\"]"); if (unitsTable != null && group != null) { watch.Start( ); Task.Run(() => { foreach (var node in unitsTable.Elements( )) { var troupData = ""; var matchCoord = Regex.Match(node.InnerText, @"\(\d+\|\d+\)"); if (matchCoord.Success) { troupData += matchCoord.Value + " "; } foreach (var villageNode in node.ChildNodes) { foreach (var troupNode in villageNode.ChildNodes) { if (!troupNode.InnerHtml.Contains("href")) { troupData += troupNode.InnerText + " "; } } } _groupHandler.HandleSelected(group.ElementAt(0).InnerText.Replace(">", "").Replace("<", ""), matchCoord.Value); _resourceTroup.Parse(troupData); } Application.Current.Dispatcher.Invoke(() => App.Instance.ViewModelTroupList.Update( )); }); //_resourceTroup.Save( ); watch.Stop( ); App.Instance.TrayIcon.ShowInfo("Loading", $"Loading Troups Finished!"); } //=> Parse Groups var groupsTable = htmlDoc.DocumentNode.SelectNodes("//table[@id=\"group_assign_table\"]"); if (groupsTable != null) { foreach (var node in groupsTable.Elements()) { var groupDetails = node.SelectNodes("//tr[@class=\" row_a\"]"); foreach (var nodeInner in groupDetails) { foreach (var detailsInner in nodeInner.ChildNodes) { var villageGroups = detailsInner.ChildNodes[4]; } var villageId = nodeInner.SelectSingleNode("//input[@type=\"checkbox\"]").GetAttributeValue("value", ""); } } } } }