private void SendData() { try { // New MinerInfo var miner = new MinerInfo { Wallet = txtWallet.Text.ToLower().Trim(), EmailId = txtEmail.Text.ToLower().Trim(), Name = StringHelper.RemoveSign4VietnameseString(txtName.Text.Trim()), CreatedDate = DateTime.Now, StatisticsDate = DateTime.Now }; // Stats from ethermine.org try { var obj = JsonConvert.DeserializeObject <MonitorObject>(ConvertHelper.ToString(File.ReadAllText(DataFilePath))); if (obj != null) { // Ghi nhớ thời gian Stats obj.StatsDate = DateTime.Now; File.Delete(DataFilePath); File.Create(DataFilePath).Close(); File.WriteAllText(DataFilePath, JsonConvert.SerializeObject(obj)); miner = StatsHelper.GetStatsFromEthermine(miner); } } catch (Exception ex) { SetTextBoxData($"Error \"{ex.Message}\" when get data from Ethermine.org with wallet: {miner.Wallet}"); } // Monitor Workers var i = 1; while (true) { var host = txtHost.Text.Replace("http://", string.Empty); var port = txtPort.Text; var content = client.DownloadString("http://" + host + ":" + port); //var content = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "test.txt"); var html = new HtmlAgilityPack.HtmlDocument(); html.LoadHtml(content); var doc = html.DocumentNode; // Lấy dữ liệu MinerInfo // Lấy danh sách dòng var arrTrs = doc.QuerySelectorAll("tr").ToList(); // Xóa cột th arrTrs.RemoveAt(0); var arrWorkers = arrTrs.Select(node => node.QuerySelectorAll("td").ToList()).Select(arrCols => new Worker { Name = arrCols[0].InnerText, Ip = arrCols[1].InnerText, RunningTime = arrCols[2].InnerText, EthereumStats = arrCols[3].InnerText, DcrInfo = arrCols[4].InnerText, GpuTemperature = arrCols[5].InnerText, Pool = arrCols[6].InnerText, Version = arrCols[7].InnerText, Comments = arrCols[8].InnerText, CreatedDate = DateTime.Now }).ToList(); miner.Workers = arrWorkers.ToArray(); var minerUniqueName = monitorService.SendtMiner(miner); linkLabel1.Text = @"http://ethmonitor.net/miners/" + minerUniqueName.ToLower(); SetTextBoxData($"{i}. Sent infomation miner '{miner.Name}' and {arrWorkers.Count} workers to EthMonitor.NET successful at {DateTime.Now}"); Thread.Sleep(SLEEP_TIME_MONITOR); i++; } } catch (Exception ex) { thMonitor?.Abort(); MessageBox.Show(ex.Message); } }