MTResult TestMiner() { string s; TestMinerBreakFlag = false; EDMTestInfo eti = new EDMTestInfo(); UpdateEDMTestInfo(eti); EDMMiner em = new EDMMiner((EDMMinerInfo)eti.MinerInf); MTResult result = em.Start(); if (BaseTest.CheckResult(result)) { int t0 = Environment.TickCount; int t1 = t0; int t2 = t1; ssl1.Text = "Miner test: " + ((int)((t1 - t0) / 1000)).ToString(); while (!TestMinerBreakFlag) { t1 = Environment.TickCount; t2 = t1; while (((t2 - t1) <= 500) && (!TestMinerBreakFlag)) { t2 = Environment.TickCount; Application.DoEvents(); } //ssl1.Text = "Miner test: " + ((int)((t1 - t0) / 1000)).ToString(); EDMResult er = em.GetCurrentResult(); s = "Miner test: " + ((int)((t1 - t0) / 1000)).ToString() + ". " + ( (er.Data == null) ? "ErrorStr: " + er.Response.ErrorStr() : "ETHTotalHashrate: " + er.Data.ETHTotalHashrate.ToString() ); ssl1.Text = s; //if (er.Data == null) // ssl1.Text += (". ErrorStr: " + er.Response.ErrorStr()); //else // ssl1.Text += ". ETHTotalHashrate: " + er.Data.ETHTotalHashrate.ToString();// er.Data.DCRHashrate; Application.DoEvents(); } result = em.Close(); } ssl1.Text = "Miner test: " + result.ToString(); return(result); }
private MTResult DoTest(bool NewTest) { MTResult result = MTResult.Success; string fn = ""; UpdateEDMTestInfo(Test.TestInfo); if (String.IsNullOrWhiteSpace(Test.TestInfo.GPUId)) { result = MTResult.BadData; } if (BaseTest.CheckResult(result)) { fn = NewTest ? TestCommonPath + CommonProc.DateTimeToStr(DateTime.Now) + @"_" + Test.TestInfo.GPUId + ".tst" : ""; result = Test.Save(fn); } if (BaseTest.CheckResult(result)) { try { fn = Test.FileName; using (StreamWriter file = new StreamWriter(TestPathFileName, false)) { file.Write(fn); file.Close(); } } catch { result = MTResult.FileOutputError; } } if (BaseTest.CheckResult(result)) { result = Test.DoTest(NewTest); } return(result); }