private void btnMapping_Click(object sender, EventArgs e)
 {
     string StrTestData = txtTestDataPath.Text.Trim();
     string StrOutPutData = txtOutputPath.Text.Trim();
     if (StrTestData == String.Empty)
     {
         MessageBox.Show("Please Choose one file for TestData!", "Error");
         return;
     }
     if (StrOutPutData == String.Empty)
     {
         MessageBox.Show("Please Choose one file for OutPut!", "Error");
         return;
     }
     else
     {
         ExcelOperation(StrTestData, StrOutPutData);
         //Edit work Flow for Mapping
         ExcelOpera GetData = new ExcelOpera();
         GetData.EditWorkFlow(StrTestData);
         //Get the Driver Script path
         PublicFunction GetDriverScriptPath = new PublicFunction();
         string DriverScriptPath = GetDriverScriptPath.DriverPath(StrTestData);
         DirectoryInfo dir = new DirectoryInfo("Rescources");
         string StrPath = dir.Parent.Parent.Parent.FullName.ToString();
         //Get the Path of the vbs
         string tempVBSPath = StrPath + @"\Resources" + @"\" + "RunDriver.vbs";
         //Run the Driver VBS
         ProcessStartInfo startInfo = new ProcessStartInfo();
         startInfo.FileName = "wscript.exe";
         startInfo.Arguments = tempVBSPath + " " + DriverScriptPath;
         Process.Start(startInfo);
     }
 }
        private void btnRun_Click(object sender, EventArgs e)
        {
            string StrTestData = txtTestDataPath.Text.Trim();
            //string strDriverPath;
            //string strTemp;
            if (StrTestData == String.Empty)
            {
             MessageBox.Show("Please Choose one file for TestData!", "Error");
             return;
            }
            if (cboRunTimeValues.Visible == false)
            {
                MessageBox.Show("Please Click Show RunTime to Choose RunTime for First Run!", "Error");
                return;
            }
            else
            {
               PublicFunction GetPath  = new PublicFunction();
               string strDriverPath = GetPath.strDriverPath(StrTestData);
               string strTempPath = GetPath.strTemp(StrTestData);
               string strTestDataPath = GetPath.strTestDataPath(StrTestData);

                //Get Driver Script Path
               string DriverScriptPath = GetPath.DriverPath(StrTestData);
               //Get the Driver Script path
               string DriverPath = GetPath.DriverPath(StrTestData);
               //Copy the OutPut into the Temp
               DirectoryInfo dir = new DirectoryInfo("Rescources");
               string StrPath = dir.FullName.ToString();
                //Get the Path of the vbs
               string tempVBSPath = StrPath + @"\Resources" + @"\" + "RunDriver.vbs";
                //Get the Path of the output
               string templateXlsPath = StrPath + @"\Resources" + @"\" + "Output.xlsx";
               //byte[] OutputXls = BatchRunResources.Output;
               //FileStream outputExcelFile = new FileStream(templateXlsPath, FileMode.Create, FileAccess.Write);
               //outputExcelFile.Write(OutputXls, 0, OutputXls.Length);
               //outputExcelFile.Close();
               bool isrewrite = true; // true=覆盖已存在的同名文件,false则反之   Copy a New OutPut to the Temp
               System.IO.File.Copy(templateXlsPath, strTempPath, isrewrite);

               //Get Data name
               string strTestDataNameValue = GetPath.StrDataName(StrTestData);

               ExcelOpera GetData = new ExcelOpera();

               string StrRunTimeValue = cboRunTimeValues.SelectedValue.ToString();  // in the Last Version  we can Get the RunTime from Test Data to Add in Driver.xls
              //Get the Values that would be add in the Driver.xls
               List<String> StrExcelValues = GetData.GetExcelValuesList(StrTestData, StrRunTimeValue);
               string StrComCodeValue = StrExcelValues[0];
               string StrTestAssentValue = StrExcelValues[1];
               string StrTestCaseName = StrComCodeValue + "_" + strTestDataNameValue + "_" + StrTestAssentValue;

               GetData.InsertRowsValues(strDriverPath, StrTestCaseName, strTestDataPath, StrComCodeValue, StrTestAssentValue, StrRunTimeValue);

              //Run the Driver VBS
               ProcessStartInfo startInfo = new ProcessStartInfo();
               startInfo.FileName = "wscript.exe";
               startInfo.Arguments = tempVBSPath + " " + DriverScriptPath;
               Process.Start(startInfo);
               cboRunTimeValues.Visible = false;
            }
        }