Exemple #1
0
        public BackupRestore(CmdProcess adbFrm, FormMethods formMethodsFrm)
        {
            InitializeComponent();

            _adb         = adbFrm;
            _formMethods = formMethodsFrm;
        }
Exemple #2
0
        // STEP 3
        private void ImageBatchProcessQueue_Task()
        {
            String DarknetDir   = Properties.Settings.Default.Darknet_Path;
            String QueueFileDir = Path.Combine(Properties.Settings.Default.ProjectDir, "ImageBatch", "ImageQueue.txt");
            String WorkspaceDir = Properties.Settings.Default.ProjectDir;
            String VideoName    = Path.GetFileName(VideoPath);

            CmdProcess Proc = new CmdProcess(DarknetDir);

            if (ShowResultImage)
            {
                Proc.AddToQueue(@"darknet.exe detect cfg/yolov3.cfg weights/yolov3.weights " + " > " + QueueFileDir);
                // Proc.QueueCopy(ImageCopyStartPath, ImageCopyEndPath);
            }
            else
            {
                Proc.AddToQueue(@"darknet.exe detect cfg/yolov3.cfg -dont_show weights/yolov3.weights " + " > " + QueueFileDir);
            }
            // Proc.QueueCopy(ResultFileStartPath, ResultFileEndPath);

            int    counter = 0;
            string line;


            System.Console.WriteLine("There were {0} lines.", counter);
            // Suspend the screen.
            System.Console.ReadLine();
        }
Exemple #3
0
        private void ImageTagging_Task(List <String> ImageList, bool ShowImages = false, String ImageOutputPath = "ImageTag", String DataOutputPath = "ImageData")
        {
            // MessageBox.Show();
            String DarknetDir   = Properties.Settings.Default.Darknet_Path;
            String WorkspaceDir = Properties.Settings.Default.ProjectDir;

            CmdProcess Proc = new CmdProcess(DarknetDir);

            foreach (String str in ImageList)
            {
                // Section to copy over image
                // String ImageCopyStartPath = Path.Combine(DarknetDir, "predictions.jpg");
                String ImageCopyEndPath = Path.Combine(WorkspaceDir, ImageOutputPath, Path.GetFileName(str));

                // Check if file already exists (Bounding rectangle output file)
                // String ResultFileStartPath = Path.Combine(DarknetDir, "result.json");
                String ResultFileEndPath = Path.Combine(WorkspaceDir, DataOutputPath, Path.GetFileName(str) + ".txt");

                if (ShowImages)
                {
                    Proc.AddToQueue(@"darknet.exe detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights -ext_output -out result.json " + str);
                    Proc.QueueCopy("predictions.jpg", ImageCopyEndPath);
                }
                else
                {
                    Proc.AddToQueue(@"darknet.exe detect cfg/yolov3.cfg weights/yolov3.weights -ext_output -dont_show -out result.json " + str);
                }
                Proc.QueueCopy("result.json", ResultFileEndPath);
            }
            Proc.ExecuteAndDispose();
        }
Exemple #4
0
 private static void FixFFmpegPermissionForOSX()
 {
     CmdProcess.Run("chmod", "a+x " + PathConfig.ffmpegPath);
     UnityEngine.Debug.Log("Grant permission for: " + PathConfig.ffmpegPath);
     CmdProcess.Run("chmod", "a+x " + PathConfig.injectorPath);
     UnityEngine.Debug.Log("Grant permission for: " + PathConfig.injectorPath);
 }
Exemple #5
0
        public Sideload(CmdProcess adbFrm, FormMethods formMethodsFrm)
        {
            InitializeComponent();

            _adb         = adbFrm;
            _formMethods = formMethodsFrm;
        }
Exemple #6
0
        private void RefreshInstalledApps()
        {
            cbx_InstallUninstallPackageUninstall.Items.Clear();

            cbx_InstallUninstallPackageUninstall.Enabled = false;

            var output =
                CmdProcess.StartProcessingInThread("adb shell pm list packages -3", _formMethods.SelectedDevice());

            if (!string.IsNullOrEmpty(output))
            {
                foreach (var item in output.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    cbx_InstallUninstallPackageUninstall.Items.Add(item.Remove(0, 8));
                }

                cbx_InstallUninstallPackageUninstall.Sorted = true;

                if (cbx_InstallUninstallPackageUninstall.Items.Count > 0)
                {
                    cbx_InstallUninstallPackageUninstall.SelectedIndex = 0;
                }
            }

            cbx_InstallUninstallPackageUninstall.Enabled = true;
        }
Exemple #7
0
        private static void GrantFFmpegPermissionForOSX()
        {
#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
            CmdProcess.Run("chmod", "a+x " + PathConfig.macOSFFmpegPath);
            UnityEngine.Debug.Log("Grant permission for: " + PathConfig.macOSFFmpegPath);
#endif
        }
Exemple #8
0
        public InstallUninstall(CmdProcess adbFrm, FormMethods formMethodsFrm)
        {
            InitializeComponent();

            adb         = adbFrm;
            formMethods = formMethodsFrm;
        }
Exemple #9
0
        /* Processes individual image entries one by one.
         * NOTE: There is an overhead for reading the weight file every iteration.
         * Route to the other async function to batch process files
         */
        private void Async_ImageTagging_Start()
        {
            String DarknetDir   = Properties.Settings.Default.Darknet_Path;
            String WorkspaceDir = Properties.Settings.Default.ProjectDir;

            CmdProcess Proc = new CmdProcess(DarknetDir);

            foreach (string str in ImageQueue)
            {
                // Section to copy over image
                String ImageCopyStartPath = Path.Combine(DarknetDir, "predictions.jpg");
                String ImageCopyEndPath   = Path.Combine(WorkspaceDir, "ImageTag", Path.GetFileName(str));

                // Check if file already exists (Bounding rectangle output file)
                String ResultFileStartPath = Path.Combine(DarknetDir, "output.txt");
                String ResultFileEndPath   = Path.Combine(WorkspaceDir, "ImageData", Path.GetFileName(str) + ".txt");

                if (ShowResultImage)
                {
                    Proc.AddToQueue(@"darknet.exe detect cfg/yolov3.cfg weights/yolov3.weights " + str);
                    Proc.QueueCopy(ImageCopyStartPath, ImageCopyEndPath);
                }
                else
                {
                    Proc.AddToQueue(@"darknet.exe detect cfg/yolov3.cfg -dont_show weights/yolov3.weights " + str);
                }
                Proc.QueueCopy(ResultFileStartPath, ResultFileEndPath);
            }
            Proc.ExecuteAndDispose();
        }
Exemple #10
0
        /**线程接收函数*/
        private void recPacketFun(object clientSocket)
        {
            if (clientSocket == null)
            {
                return;
            }
            Socket client = (Socket)clientSocket;

            if (!client.Connected)
            {
                return;
            }
            NetworkStream stream = new NetworkStream(client);
            BinaryReader  reader = new BinaryReader(stream);

            while (isClientRun)
            {
                //Console.WriteLine("recPacketThread***********");
                try
                {
                    ENUMS.MESSAGETYPE messageType = (ENUMS.MESSAGETYPE)reader.ReadByte();
                    CmdProcess.processCmd(this, reader, messageType);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("readThread:client is off line");
                    stopClient();/**clean socket*/
                    Console.WriteLine(ex.Message);
                    ErrorInfo.getErrorWriter().writeErrorMassageToFile(ex.Message + "\r\n" + ex.StackTrace + "\r\n");
                }
            }
        }
        public static void RunDOT(String filePath, String outputPath)
        {
            String CWD = Properties.Settings.Default.GraphViz_Path;

            CmdProcess Proc = new CmdProcess(CWD);

            Proc.AddToQueue("dot -Tpng " + filePath + " > " + outputPath);
            Proc.ExecuteAndDispose();
        }
Exemple #12
0
 private static void DownloadFFmpegForWindows()
 {
     if (!Directory.Exists(PathConfig.windowsFFmpegFolderPath))
     {
         Directory.CreateDirectory(PathConfig.windowsFFmpegFolderPath);
     }
     CmdProcess.Run("curl", PathConfig.windowsFFmpegDownloadUrl + " --output " + "\"" + PathConfig.windowsFFmpegPath + "\"");
     UnityEngine.Debug.Log("Download Windows FFmpeg done!");
 }
Exemple #13
0
        public static void TagVideo(String VideoPath, bool PreviewOutput = false)
        {
            String VideoOutputPath = Path.Combine(Properties.Settings.Default.ProjectDir, "TaggedVideos", Path.GetFileName(VideoPath));

            CmdProcess Proc = new CmdProcess(Properties.Settings.Default.Darknet_Path);

            Proc.AddToQueue(@"darknet.exe detector demo data/coco.data cfg/yolov3.cfg weights/yolov3.weights " + VideoPath + " -out_filename " + VideoOutputPath);
            Proc.ExecuteAndDispose();
        }
Exemple #14
0
        public InstallUninstall(CmdProcess adbFrm, FormMethods formMethodsFrm)
        {
            InitializeComponent();
            this.btn_InstallUninstallInstall.DragEnter += new DragEventHandler(Btn_InstallUninstallInstall_DragEnter);
            this.btn_InstallUninstallInstall.DragDrop  += new DragEventHandler(Btn_InstallUninstallInstall_DragDrop);

            adb         = adbFrm;
            formMethods = formMethodsFrm;
        }
Exemple #15
0
        // STEP 2
        private void MakeImageQueueFileFromFolder_Task()
        {
            String CWD = Path.Combine(Properties.Settings.Default.ProjectDir, "ImageBatch");

            CmdProcess Proc = new CmdProcess(CWD);

            Proc.AddToQueue("dir /s/b *.jpg > ImageQueue.txt");
            Proc.Execute();
            Proc.Dispose();
        }
Exemple #16
0
        // STEP 1
        private void GenerateImageBatch_Task()
        {
            String BatchOutputDir = API_FS.GetSpecialFolderPath(SpecialFolder.ImageBatch);

            CmdProcess Proc = new CmdProcess(Environment.CurrentDirectory);

            Proc.AddToQueue(@"VideoToImage.exe " + BatchOutputDir + " cap_video " + VideoPath + " " + FramesToDrop);
            Proc.ExecuteAndDispose();

            // PowerShell_Process.Invoke("", "Scripts/SampleVideo.ps1", VideoPath);
        }
Exemple #17
0
        private void TagImages_NeverShow_Task(String InputFile)
        {
            String DarknetDir        = Properties.Settings.Default.Darknet_Path;
            String WorkspaceDir      = Properties.Settings.Default.ProjectDir;
            String ResultFileEndPath = Path.Combine(WorkspaceDir, "VideoData", Path.GetFileName(VideoPath) + ".json");

            CmdProcess Proc2 = new CmdProcess(DarknetDir);

            Proc2.AddToQueue("type nul > " + ResultFileEndPath);
            Proc2.AddToQueue(@"darknet.exe detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights -ext_output -dont_show -out " + ResultFileEndPath + " < " + InputFile);
            Proc2.ExecuteAndDispose();
            Proc2.Dispose();
        }
Exemple #18
0
        private static void DownloadFFmpegForOSX()
        {
            if (!Directory.Exists(PathConfig.macOSFFmpegFolderPath))
            {
                Directory.CreateDirectory(PathConfig.macOSFFmpegFolderPath);
            }
            CmdProcess.Run("curl", PathConfig.macOSFFmpegDownloadUrl + " --output " + "\"" + PathConfig.macOSFFmpegPath + "\"");
#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
            CmdProcess.Run("chmod", "a+x " + "\"" + PathConfig.macOSFFmpegPath + "\"");
            UnityEngine.Debug.Log("Grant permission for: " + PathConfig.macOSFFmpegPath);
#endif
            UnityEngine.Debug.Log("Download macOS FFmpeg done!");
        }
Exemple #19
0
        private int DeviceCheck(ThirdPartyTool tool, out string strRet)
        {
            int        ret        = -1;
            CmdProcess cmdProcess = new CmdProcess(); //cmd类

            strRet = cmdProcess.ExeCommand(tool);     //"azsphere device wifi show-status"
            if (strRet.Contains("error: Could not connect to the device."))
            {
                //frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                return(ret);
            }
            ret = 0;
            return(ret);
        }
Exemple #20
0
        public LogcatAdvanced(CmdProcess adbFrm, FormMethods formMethodsFrm)
        {
            InitializeComponent();

            _adb         = adbFrm;
            _formMethods = formMethodsFrm;

            _altAdb.GetProcess.Start();
            _altAdb.GetProcess.BeginOutputReadLine();
            _altAdb.GetProcess.BeginErrorReadLine();

            _altAdb.GetProcess.OutputDataReceived += GetProcess_OutputDataReceived;
            _altAdb.GetProcess.ErrorDataReceived  += GetProcess_OutputDataReceived;

            _altAdb.CommandExecutionStarted += AltAdb_CommandExecutionStarted;
        }
Exemple #21
0
        private void Cbo_BackupPackage_CheckedChanged(object sender, EventArgs e)
        {
            if (cbo_BackupPackage.Checked)
            {
                cbo_BackupNoSystem.Enabled = false;
                cbo_BackupNoSystem.Checked = false;
                cbo_BackupShared.Enabled   = false;
                cbo_BackupShared.Checked   = false;
                cbo_BackupWithApk.Enabled  = false;
                cbo_BackupWithApk.Checked  = false;
                cbx_BackupPackage.Visible  = true;
                label8.Visible             = true;

                groupBox8.Enabled  = false;
                groupBox14.Enabled = false;

                var output =
                    CmdProcess.StartProcessingInThread("adb shell pm list packages -3", _formMethods.SelectedDevice());

                if (!string.IsNullOrEmpty(output))
                {
                    foreach (var item in output.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        cbx_BackupPackage.Items.Add(item.Remove(0, 8));
                    }

                    cbx_BackupPackage.Sorted = true;

                    if (cbx_BackupPackage.Items.Count > 0)
                    {
                        cbx_BackupPackage.SelectedIndex = 0;
                    }
                }

                groupBox8.Enabled  = true;
                groupBox14.Enabled = true;
            }
            else
            {
                cbo_BackupNoSystem.Enabled = true;
                cbo_BackupShared.Enabled   = true;
                cbo_BackupWithApk.Enabled  = true;
                cbx_BackupPackage.Visible  = false;
                cbx_BackupPackage.Items.Clear();
                label8.Visible = false;
            }
        }
Exemple #22
0
        private void TagImages_AlwaysShow_Task(List <String> ImageList, String ImageOutputPath = "ImageTag", String DataOutputPath = "ImageData")
        {
            String DarknetDir   = Properties.Settings.Default.Darknet_Path;
            String WorkspaceDir = Properties.Settings.Default.ProjectDir;

            CmdProcess Proc = new CmdProcess(DarknetDir);

            foreach (String str in ImageList)
            {
                // Section to copy over image
                String ImageCopyStartPath = Path.Combine(DarknetDir, "predictions.jpg");
                String ImageCopyEndPath   = Path.Combine(WorkspaceDir, ImageOutputPath, Path.GetFileName(str));
                String ResultFileEndPath  = Path.Combine(WorkspaceDir, DataOutputPath, Path.GetFileName(str) + ".json");

                Proc.AddToQueue(@"darknet.exe detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights -ext_output -out " + ResultFileEndPath + " " + str);
                Proc.QueueCopy(ImageCopyStartPath, ImageCopyEndPath);
            }
            Proc.Execute();
            Proc.Dispose();
        }
Exemple #23
0
        private void TagImages_NeverShow_Task(List <String> ImageList, String DataOutputPath = "ImageData")
        {
            String DarknetDir        = Properties.Settings.Default.Darknet_Path;
            String WorkspaceDir      = Properties.Settings.Default.ProjectDir;
            String ResultFileEndPath = Path.Combine(WorkspaceDir, DataOutputPath, "_Result.json");
            String ImageListDir      = Path.Combine(Environment.CurrentDirectory, "Resources/ImageList.txt");

            CmdProcess Proc = new CmdProcess(DarknetDir);

            Proc.AddToQueue("type nul > " + ImageListDir);
            Proc.AddToQueue("type nul > " + ResultFileEndPath);
            Proc.ExecuteAndDispose();
            Proc.Dispose();

            // Write the string array to a new file named "WriteLines.txt".
            using (StreamWriter outputFile = new StreamWriter(Path.Combine(Environment.CurrentDirectory, "Resources", "ImageList.txt")))
            {
                foreach (string line in ImageList)
                {
                    outputFile.WriteLine(line);
                }
                outputFile.Close();
            }

            CmdProcess Proc2 = new CmdProcess(DarknetDir);

            Proc2.AddToQueue(@"darknet.exe detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights -ext_output -dont_show -out " + ResultFileEndPath + " < " + ImageListDir);
            Proc2.ExecuteAndDispose();
            Proc2.Dispose();

            // String ScriptPath = Path.Combine(Environment.CurrentDirectory, "Scripts/Darknet_ImageBatch.ps1");
            // Powershell_Custom cust = new Powershell_Custom(Properties.Settings.Default.Darknet_Path, ScriptPath);
            // cust.AddParameter("Images", ImageList);
            // cust.AddParameter("ImageListLoc", ImageListDir);
            // cust.AddParameter("OutputDataDir", ResultFileEndPath);
            // cust.Execute();
        }
Exemple #24
0
 public ScreenRecord(CmdProcess adbFrm, FormMethods formMethodsFrm)
 {
     InitializeComponent();
     _adb         = adbFrm;
     _formMethods = formMethodsFrm;
 }
Exemple #25
0
 public SetProp(CmdProcess adbFrm, FormMethods fMethods)
 {
     adb         = adbFrm;
     formMethods = fMethods;
     InitializeComponent();
 }
Exemple #26
0
 public FileOps(CmdProcess adbFrm, FormMethods formMethodsFrm)
 {
     InitializeComponent();
     adb         = adbFrm;
     formMethods = formMethodsFrm;
 }
Exemple #27
0
 public Density(CmdProcess adbFrm, FormMethods formMethodsFrm)
 {
     InitializeComponent();
     _adb         = adbFrm;
     _formMethods = formMethodsFrm;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="adbFrm"></param>
 /// <param name="formMethodsFrm"></param>
 public ResolutionChange(CmdProcess adbFrm, FormMethods formMethodsFrm)
 {
     InitializeComponent();
     _adb         = adbFrm;
     _formMethods = formMethodsFrm;
 }
Exemple #29
0
 public SpoofMac(CmdProcess adbFrm, FormMethods formMethodsFrm)
 {
     InitializeComponent();
     adb         = adbFrm;
     formMethods = formMethodsFrm;
 }
Exemple #30
0
        /// <summary>
        /// 任务流
        /// </summary>
        /// <returns></returns>
        private int TestTaskFlow()
        {
            int ret = -1;

            //string pattern = null;
            //eidRead = "NULL";

            //两种情况进入此处:1、超时跳出了do while,2、按了空格确认上电
            if (readWriteIdHandle.IsTimeOut)
            {
                frmMain.DisplayLog("测试超时\r\n");
                return(ret);
            }

            do
            {
                frmMain.DisplayLog("测试中...\r\n");
                CmdProcess cmdProcess = new CmdProcess();   //cmd类
                tool = new ThirdPartyTool()
                {
                    ToolDirectory = "Microsoft Azure Sphere SDK",
                    ToolName      = "InitializeCommandPrompt",
                    Cmd           = "azsphere device wifi show-status"
                };

                string strRet;
                #region //获取OS版本
                //strRet = cmdProcess.ExeCommand("", "azsphere device show-ota-status");//"azsphere device wifi show-status"
                //if (strRet.Contains("error: Could not connect to the device."))
                //{
                //    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}
                //if (strRet.Contains("is not a valid value"))
                //{
                //    frmMain.DisplayLog(string.Format("未claim设备 获取OS版本失败 FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}
                #endregion
                //对比模块MAC地址-标签MAC地址
                strRet = cmdProcess.ExeCommand("", "azsphere device wifi show-status");//"azsphere device wifi show-status"
                if (strRet.Contains("error: Could not connect to the device."))
                {
                    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                //ret = DeviceCheck(tool, out strRet);
                //if (ret!=0)
                //{
                //    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}
                string mouduleMac = cmdProcess.GetValueByKeyword(strRet, "MAC Address");
                if (mouduleMac != labelSn)
                {
                    frmMain.DisplayLog(string.Format("MAC检查:模块{0},标签{1} 对比不一致  FAIL\r\n", mouduleMac, labelSn));
                    break;
                }
                frmMain.DisplayLog(string.Format("MAC检查:模块{0},标签{1} 对比一致  PASS\r\n", mouduleMac, labelSn));

                //检查是否有测试程序

                //azsphere device sideload show-status
                //azsphere device sideload delete
                //azsphere device sideload deploy -p mt_app.img


                //删除当前程序
                frmMain.DisplayLog("当前程序删除中...\r\n");
                strRet = cmdProcess.ExeCommand("", "azsphere device sideload delete");//"azsphere device wifi show-status"
                if (strRet.Contains("error: Could not connect to the device."))
                {
                    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                if (!strRet.Contains("Command completed successfully"))
                {
                    frmMain.DisplayLog(string.Format("当前程序删除: 失败  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                frmMain.DisplayLog("当前程序删除:成功 PASS\r\n");
                Thread.Sleep(500);

                //Side load(加载测试固件)
                frmMain.DisplayLog("测试固件加载中...\r\n");
                strRet = cmdProcess.ExeCommand("", string.Format("azsphere device sideload deploy -p ../app/{0}", TestAppName));//"azsphere device wifi show-status"
                if (strRet.Contains("error: Could not connect to the device."))
                {
                    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }

                //tool.Cmd = "azsphere device sideload deploy -p mt_app.img";

                //ret = DeviceCheck(tool, out strRet);
                //if (ret != 0)
                //{
                //    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}
                if (!strRet.Contains("Command completed successfully"))
                {
                    frmMain.DisplayLog(string.Format("加载测试固件:失败  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                frmMain.DisplayLog(string.Format("加载测试固件:成功 PASS\r\n", strRet));


                string pinTestRetinfo;
                //Socket复位
                frmMain.DisplayLog("复位测试中...\r\n");          //成功 为有效信息
                bool pinTestRet = PinTestBySocket("reset_tests", out pinTestRetinfo);
                frmMain.DisplayLog(pinTestRetinfo + "\r\n"); //失败 为错误信息
                if (!pinTestRet)
                {
                    frmMain.DisplayLog("复位测试:失败 FAIL\r\n");//失败 为错误信息
                    break;
                }
                frmMain.DisplayLog("复位测试:合格 PASS\r\n");//成功 为有效信息

                //Socket GPIO检查
                frmMain.DisplayLog("GPIO测试中...\r\n");
                pinTestRet = PinTestBySocket("get_gpios", out pinTestRetinfo);
                frmMain.DisplayLog(pinTestRetinfo + "\r\n");//失败 为错误信息

                if (!pinTestRet)
                {
                    frmMain.DisplayLog("GPIO测试:测试失败 FAIL\r\n");//失败 为错误信息
                    break;
                }
                string errorStr;
                bool   gpioRet = GetGIPOResultBySocketRet(pinTestRetinfo, out errorStr);
                //展示返回的GPIO数据
                //strRet = strRet.Replace("P", "PASS").Replace("F", "FAIL") + "\r\n";
                //frmMain.DisplayLog(strRet);
                //GPIO结果显示
                if (!gpioRet)
                {
                    frmMain.DisplayLog("GPIO测试: 不合格  FAIL \r\n");
                    break;
                }
                frmMain.DisplayLog("GPIO测试:合格 PASS\r\n");//成功 为有效信息

                #region 串口测试 复位和GPIO
                ////串口发送Reset System\r\n
                //strRet = readWriteIdHandle.Read(ATReadCmd.ReadIdType.Reset);
                //if (string.IsNullOrEmpty(strRet))
                //{
                //    frmMain.DisplayLog(string.Format("复位命令未得到回应 串口失败  FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}
                ////if (!strRet.Contains("Get RST command"))
                ////{
                ////    frmMain.DisplayLog(string.Format("复位未得到回应 串口失败  FAIL\r\n详细:{0}  \r\n", strRet));
                ////    break;
                ////}
                ////复位命令得到回应
                //frmMain.DisplayLog(string.Format("复位中... \r\n"));
                ////跳出循环说明复位成功
                //readWriteIdHandle.ReadRestInfo("init completed");
                //frmMain.DisplayLog(string.Format("复位成功  PASS\r\n"));


                ////GPIO测试
                ////串口发送Reset System\r\n
                //Thread.Sleep(1000);
                //strRet = readWriteIdHandle.Read(ATReadCmd.ReadIdType.GPIOTest);
                //if (string.IsNullOrEmpty(strRet))
                //{
                //    frmMain.DisplayLog("GPIO测试命令未得到回应 串口失败  FAIL\r\n");
                //    break;
                //}
                ////GPIO测试命令得到回应
                ////frmMain.DisplayLog("GPIO测试中... \r\n");
                ////string errorInfo;
                ////bool gpioRet = checkGIPOResult(strRet, out errorInfo);
                //////展示返回的GPIO数据
                ////strRet = strRet.Replace("P", "PASS").Replace("F", "FAIL") + "\r\n";
                ////frmMain.DisplayLog(strRet);
                //////GPIO结果显示
                ////if (!gpioRet)
                ////{
                ////    frmMain.DisplayLog(string.Format("GPIO测试:失败  FAIL \r\n详细:{0}\r\n", errorInfo));
                ////    break;
                ////}
                ////frmMain.DisplayLog("GPIO测试:成功  PASS\r\n");
                #endregion
                //删除APPtest
                frmMain.DisplayLog("测试固件删除中...\r\n");
                strRet = cmdProcess.ExeCommand("", "azsphere device sideload delete");//"azsphere device wifi show-status"
                if (strRet.Contains("error: Could not connect to the device."))
                {
                    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                //tool.Cmd = "azsphere device sideload deploy -p mt_app.img";

                //ret = DeviceCheck(tool, out strRet);
                //if (ret != 0)
                //{
                //    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}
                if (!strRet.Contains("Command completed successfully"))
                {
                    frmMain.DisplayLog(string.Format("测试固件删除:失败  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                frmMain.DisplayLog("测试固件删除:成功 PASS\r\n");

                frmMain.DisplayLog("Wifi列表网络检查中...\r\n");
                //检查网络 wifi表
                strRet = cmdProcess.ExeCommand("", "azsphere device wifi list");//"azsphere device wifi show-status"
                if (strRet.Contains("error: Could not connect to the device."))
                {
                    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                if (!strRet.Contains("No networks found") && strRet.Contains("ID"))
                {
                    //Get ID
                    string[] wifiIdList = cmdProcess.GetListByKeyword(strRet, "ID").ToArray();

                    foreach (var item in wifiIdList)
                    {
                        frmMain.DisplayLog("WIFI列表检查:含有WIFI列表ID,删除中...\r\n");
                        //不为空
                        if (!string.IsNullOrEmpty(item))
                        {
                            //删除ID
                            strRet = cmdProcess.ExeCommand("", string.Format("azsphere device wifi delete –i {0}", item));//"azsphere device wifi show-status"
                            if (strRet.Contains("error: Could not connect to the device."))
                            {
                                frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                                return(ret);
                            }
                            //不包含成功信息且不包含
                            if (!strRet.Contains("Successfully removed network") && !strRet.Contains("Command completed successfully"))
                            {
                                frmMain.DisplayLog(string.Format("WIFI列表ID删除:失败  FAIL\r\n详细:{0}  \r\n", strRet));
                                return(ret);
                            }
                        }
                    }
                }
                frmMain.DisplayLog("WIFI列表检查:PASS\r\n");
                //性能测试
                frmMain.DisplayLog("capabilties测试中...\r\n");
Capability:
                strRet = cmdProcess.ExeCommand("", "azsphere device capability show-attached");//"azsphere device wifi show-status"
                if (strRet.Contains("error: Could not connect to the device."))
                {
                    frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                if (!strRet.Contains("Command completed successfully"))
                {
                    frmMain.DisplayLog(string.Format("capabilties测试:失败  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                List <string> capabilitiesList = cmdProcess.GetListCapabilitiesKeyword(strRet, "Enable");
                if (capabilitiesList.Count > 0)
                {
                    //manufacture set complete status,只能设置一次,设置后就不能够RF测试和校准了,测试阶段不要轻易尝试。
                    #region
                    if (IsManufactureComplete == 1)
                    {
                        strRet = cmdProcess.ExeCommand("", "manufacture set complete status");//"azsphere device wifi show-status"
                        if (strRet.Contains("error: Could not connect to the device."))
                        {
                            frmMain.DisplayLog(string.Format("未上电连接上设备,请检查连接或驱动  FAIL\r\n详细:{0}  \r\n", strRet));
                            break;
                        }
                        frmMain.DisplayLog(string.Format("已设置制作完成状态,继续测试capabilties中...  \r\n详细:{0}  \r\n", strRet));
                        goto Capability;
                    }
                    #endregion
                    frmMain.DisplayLog(string.Format("capabilties测试:失败  FAIL\r\n详细:{0}  \r\n", strRet));
                    break;
                }
                frmMain.DisplayLog("capabilties测试:PASS\r\n");

                //E-fuse测试
                tool = new ThirdPartyTool()
                {
                    ToolDirectory = "RFToolCli",
                    Cmd           = string.Format("RfSettingsTool check --expected ../bin/{0}", EfuseBin)
                };
                //strRet = cmdProcess.ExeCommand(tool);//"azsphere device wifi show-status"
                //if (strRet.Contains("error"))
                //{
                //    frmMain.DisplayLog(string.Format("E-fuse测试:失败  FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}

                //python
                //tool.Cmd = "python RunHeaderTest.py ";//reset_system
                //tool.ToolDirectory = "PC";
                //strRet = cmdProcess.ExeCommand(tool, "");
                //if (strRet.Contains("error"))
                //{
                //    frmMain.DisplayLog(string.Format("E-fuse测试:失败  FAIL\r\n详细:{0}  \r\n", strRet));
                //    break;
                //}
                //E-fuse具体测试内容
                frmMain.DisplayLog("e-fuse测试中...\r\n");
                strRet = cmdProcess.ExeCommand(tool, "");
                string hasReadFlag = "Comparing configurations.";
                string startFlag   = "Reading configuration data from device.";

                string erroInfo = StringHelp.SubCentre(strRet, startFlag, "\r\n\r\n");

                if (!strRet.Contains(hasReadFlag))
                {
                    frmMain.DisplayLog(string.Format("E-fuse测试:命令失败 \r\n详细:{0}  \r\n", erroInfo));
                    break;
                }

                strRet = StringHelp.SubCentre(strRet, hasReadFlag, "\r\n\r\n");
                frmMain.DisplayLog(strRet + "\r\n");
                if (strRet.Contains("ERROR") || strRet.Contains("异常"))
                {
                    frmMain.DisplayLog("E-fuse测试结果: FAIL \r\n");
                    break;
                }

                frmMain.DisplayLog("E-fuse测试:PASS\r\n");
                ret = 0;



                //cd RFToolCli

                //List<string> listValue = readWriteIdHandle.ReadId();
                //if (listValue.Count <= 3)
                //{
                //    break;
                //}
                ////多组:1,1,01,01,,,40,0*61
                //int sum = 0;
                //string[] arryData;
                //try
                //{
                //    foreach (string strData in listValue)
                //    {
                //        arryData = strData.Split(',');
                //        应滤除其他可视卫星
                //        int cn0Value = int.Parse(arryData[6]);
                //        sum += cn0Value;
                //    }
                //}
                //catch (Exception ex)
                //{
                //    frmMain.DisplayLog(string.Format("数据解析错误:{0}\r\n", ex.Message));
                //    break;
                //}
                //int argVale = sum / listValue.Count;
                //frmMain.DisplayLog(string.Format("获取C/N0值:{0}\r\n", argVale));
                //if (argVale < StandardCN01)
                //{
                //    frmMain.DisplayLog(string.Format("C/N0值:{0},小于设定范围{1}  FAIL\r\n", argVale, StandardCN01));
                //    break;
                //}
                //frmMain.DisplayLog(string.Format("C/N0值:{0},大于设定范围{1}   PASS\r\n", argVale,StandardCN01));
                //ret = 0;

                ////从芯片获取eid
                ////eidRead = "081603FFFFF35293" + eidlast.ToString("X").PadLeft(4,'0');
                //eidRead = readWriteIdHandle.ReadId(ATReadCmd.ReadIdType.EidRead);
                //pattern = @"[0-9A-Z]{20}";
                //if (string.IsNullOrEmpty(eidRead) || !Regex.IsMatch(eidRead, pattern))
                //{
                //    frmMain.DisplayLog("EID读取失败\r\n");
                //    break;
                //}
                //frmMain.DisplayLog(string.Format("已获取模块EID:{0}\r\n", eidRead));
                //frmMain.SetText(AllForms.EnumControlWidget.txtEid.ToString(), eidRead, false);
            } while (false);



            ProductionInfo.SystemType systemType = ProductionInfo.Type;

            //使用do..while(false)的原因,是为了当测试流程为fail时,使用break跳出该结构,仍然执行结果上报

            return(ret);
        }