Beispiel #1
0
        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);
        }
Beispiel #2
0
        public MTResult Start()
        {
            MTResult result = MTResult.Success;

            if (!MiningApp.Start(String.IsNullOrWhiteSpace(MinerInf.PacketFilePath) ? MinerInf.ExeFileName : MinerInf.PacketFilePath, MinerInf.Arguments, AppStartInfo))
            {
                result = MTResult.ExtAppStartError;
            }

            return(result);
        }
Beispiel #3
0
        public MTResult Close()
        {
            MTResult result = MTResult.Success;

            if ((MiningApp != null) && (MiningApp.IsAppRunning))
            {
                if (!MiningApp.Close(AppStartInfo.CloseWaitingTime))
                {
                    result = MTResult.ExtAppCloseError;
                }
            }

            return(result);
        }
Beispiel #4
0
        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);
        }