Example #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Start frmStart = new Start();
            frmStart.ShowDialog();
            if (frmStart.DialogResult != DialogResult.OK) return;

            #region *** Localtion ***
            FileInfo fileLocation_sys = new FileInfo(Program.strLocationr_FileName_sys);

            //string[] arrDLL = Directory.GetFiles(@"C:\Windows\System32\", "*.ini", SearchOption.TopDirectoryOnly);

            StreamReader srLocation;
            string temp;

            if (fileLocation_sys.Exists)
            {
                srLocation = new StreamReader(strLocationr_FileName_sys);
                temp = srLocation.ReadLine();
            }
            else
            {
                FileInfo fileLocation = new FileInfo(Program.strLocationr_FileName);
                if (fileLocation.Exists)
                {
                    srLocation = new StreamReader(strLocationr_FileName);
                    temp = srLocation.ReadLine();
                }
                else
                {
                    MessageBox.Show("Location Setting  file is not exist in " + Program.strLocationr_FileName
                                        + " \r\nPlease contact the developer",
                                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (temp != null)
            {
                if (temp == "1") Location = LocationList.SH_1;
                if (temp == "2") Location = LocationList.SH_2;
                if (temp == "3") Location = LocationList.SH_3;
                if (temp == "4") Location = LocationList.SH_4;
                if (temp == "4") Location = LocationList.SH_4;

                if (temp == "11") Location = LocationList.BJ_1;
                if (temp == "12") Location = LocationList.BJ_2;
                if (temp == "99") Location = LocationList.Simulation;
            }
            #endregion Localtion

            // check which program to start
            if (frmStart.DialogResult == DialogResult.OK && tp == Mipi)
            {
                debug_mipi = true;
                Application.Run(new Mipi());
            }
            else if (frmStart.DialogResult == DialogResult.OK && tp == SweepTest)
            {
                debug_mipi = false;

                #region *** Variable Define
                string line;
                double tmpFreq;
                string[] content;
                /////////////////////////////////////////////////////////////
                //// 2015012015 add Linear GMSK LB/HB, that is 4
                int ParameterIndentify = 17 + 5 + 4 + 4;

                #endregion *** Variable Define ***

                #region *** Read Parameter Setting & Build Frequence List ***
                FileInfo fileParameter = new FileInfo(Program.strSweepParameter_FileName);

                //for LB filter verify
                TestSetting.LOSS_SRC_ROLL.Add(997.6, 0.0);
                TestSetting.LOSS_MSR_FILTER_LB.Add(997.6, 0.0);
                //for HB filter verify
                TestSetting.LOSS_SRC_ROLL.Add(1806.7, 0.0);
                TestSetting.LOSS_MSR_FILTER_HB.Add(1806.7, 0.0);
                //for harmonic which up 6GHz
                TestSetting.LOSS_SRC_ROLL.Add(6000, 0.0);
                TestSetting.LOSS_MSR_FILTER_LB.Add(6000, 0.0);
                TestSetting.LOSS_MSR_FILTER_HB.Add(6000, 0.0);

                if (!fileParameter.Exists)
                {
                    MessageBox.Show("Parameter Setting  file is not exist in " + Program.strSweepParameter_FileName
                                        + " \r\nPlease contact the developer",
                                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                StreamReader srParameter = new StreamReader(strSweepParameter_FileName);
                line = srParameter.ReadLine();

                while (line != null)
                {
                    if (line.Contains("--- Setting ---"))
                    {
                        line = srParameter.ReadLine();
                        ParameterIndentify--;
                    }

                    #region  GMSK_LB Setting
                    if (line.Contains("--- GMSK_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_GMSK_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  GMSK Setting

                    #region  GMSK_HB Setting
                    if (line.Contains("--- GMSK_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_GMSK_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  GMSK Setting

                    #region  EDGE_LB Setting
                    if (line.Contains("--- EDGE_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_EDGE_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  EDGE_LB Setting

                    #region  EDGE_HB Setting
                    if (line.Contains("--- EDGE_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_EDGE_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  EDGE_HB Setting

                    #region  TDSCDMA Setting
                    if (line.Contains("--- TDSCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_TDSCDMA.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  TDSCDMA Setting

                    #region  WCDMA Setting
                    if (line.Contains("--- WCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_WCDMA.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  WCDMA Setting

                    #region  LTETDD_B38 Setting
                    if (line.Contains("--- LTETDD_B38 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTETDD_B38.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTETDD_B38 Setting

                    #region  LTETDD_B40 Setting
                    if (line.Contains("--- LTETDD_B40 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTETDD_B40.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTETDD_B40 Setting

                    #region  LTEFDD_LB Setting
                    if (line.Contains("--- LTEFDD_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTEFDD_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTEFDD_LB Setting

                    #region  LTEFDD_HB Setting
                    if (line.Contains("--- LTEFDD_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTEFDD_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTEFDD_HB Setting

                    #region  CDMA Setting
                    if (line.Contains("--- CDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_CDMA.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  CDMA Setting

                    #region  EVDO Setting
                    if (line.Contains("--- EVDO ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_EVDO.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  EVDO Setting

                    #region  Linear_GMSK_LB Setting
                    if (line.Contains("--- Linear_GMSK_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LGMSK_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  Linear GMSK Setting

                    #region  Linear GMSK_HB Setting
                    if (line.Contains("--- Linear_GMSK_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LGMSK_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion Linear GMSK Setting

                    if (line.Contains("--- Frequency List ---"))
                    {
                        line = srParameter.ReadLine();
                        ParameterIndentify--;
                    }

                    #region CW LB Frequency list
                    if (line.Contains("--- CW LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_CW_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_CW_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 6; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_LB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_LB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region CW HB Frequency list
                    if (line.Contains("--- CW HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_CW_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_CW_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 3; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_HB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_HB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region EDGE LB Frequency list
                    if (line.Contains("--- EDGE LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_EDGE_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_EDGE_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region EDGE HB Frequency list
                    if (line.Contains("--- EDGE HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_EDGE_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_EDGE_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region TDSCDMA Frequency list
                    if (line.Contains("--- TDSCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_TDSCDMA.ContainsKey(tmpFreq)) TestSetting.FREQ_TDSCDMA.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region WCDMA Frequency list
                    if (line.Contains("--- WCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_WCDMA.ContainsKey(tmpFreq)) TestSetting.FREQ_WCDMA.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE TDD_B38 Frequency list
                    if (line.Contains("--- LTETDD_B38 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTETDD_B38.ContainsKey(tmpFreq)) TestSetting.FREQ_LTETDD_B38.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE TDD_B40 Frequency list
                    if (line.Contains("--- LTETDD_B40 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTETDD_B40.ContainsKey(tmpFreq)) TestSetting.FREQ_LTETDD_B40.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE FDD LB Frequency list
                    if (line.Contains("--- LTEFDD_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTEFDD_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_LTEFDD_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE FDD HB Frequency list
                    if (line.Contains("--- LTEFDD_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTEFDD_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_LTEFDD_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region CDMA Frequency list
                    if (line.Contains("--- CDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_CDMA.ContainsKey(tmpFreq)) TestSetting.FREQ_CDMA.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region EVDO Frequency list
                    if (line.Contains("--- EVDO ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_EVDO.ContainsKey(tmpFreq)) TestSetting.FREQ_EVDO.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LCW LB Frequency list
                    if (line.Contains("--- LCW LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LCW_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_LCW_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 6; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_LB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_LB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LCW HB Frequency list
                    if (line.Contains("--- LCW HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LCW_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_LCW_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 3; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_HB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_HB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    if (!line.Contains("---"))
                        line = srParameter.ReadLine();
                    else if (line.Contains("--- The End ---"))
                        break;

                }

                srParameter.Close();

                if (ParameterIndentify != 0)
                {
                    MessageBox.Show("Parameter Setting  file is interrupt in " + Program.strSweepParameter_FileName
                                        + " \r\nPlease contact the developer",
                                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                #endregion *** Read Parameter Setting & Build Frequence List ***

                #region *** Start Test Program ***
                // everything is ready, start the test program
                if (MessageBox.Show("Perform Loss Comp?", "Loss Comp", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    NewLossComp frmNewLossComp = new NewLossComp();
                    frmNewLossComp.ShowDialog();
                    if (frmNewLossComp.DialogResult == DialogResult.OK)        //if Losscomp form closed, start Benchtest from
                        Application.Run(new SweepTest());
                }
                else
                    Application.Run(new SweepTest());

                #endregion *** Start Test Program ***
            }
            // if read configuration file fail, abort load the test program.
            else if (frmStart.DialogResult == DialogResult.OK)
            {
                debug_mipi = false;

                #region *** Check tp Configuration file ***
                strFilePath_Testcfg = strFilePath + tp + ".csv";
                if (!File.Exists(strFilePath_Testcfg))
                {
                    MessageBox.Show("Read " + tp + " configuration file fail.\r\nThere is no configuration file '"
                                        + tp + ".csv' in cfg folder", "oops!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                #endregion *** Check tp Configuration file ***

                #region *** Get program configuration information ***
                int i = 1;
                string line;
                string[] content;
                ProductTest = new Vanchip.Common.ProductTest[TestSetting.MaxTestItem];

                StreamReader srProduct = new StreamReader(strFilePath_Testcfg);
                //Last Cal Date
                line = srProduct.ReadLine();
                content = line.Split(',');
                lastCalDate = content[0];
                //csv Header
                csvHeader = srProduct.ReadLine();
                while ((line = srProduct.ReadLine()) != null)
                {
                    if (line == "") break;
                    content = line.Split(',');
                    ProductTest[i].Item = Convert.ToInt32(content[0]);
                    ProductTest[i].TestItem = content[1];
                    ProductTest[i].Description = content[2];
                    ProductTest[i].Units = content[3];
                    ProductTest[i].LowLimit = Convert.ToDouble(content[4]);
                    ProductTest[i].HighLimit = Convert.ToDouble(content[5]);
                    ProductTest[i].VCC = Convert.ToDouble(content[6]);

                    if (content[7] == "0")
                        ProductTest[i].VBAT = 0.01;
                    else
                        ProductTest[i].VBAT = Convert.ToDouble(content[7]);

                    if (content[8] == "0")
                        ProductTest[i].Vramp = 0.01;
                    else
                        ProductTest[i].Vramp = Convert.ToDouble(content[8]);

                    if (content[9] == "0")
                        ProductTest[i].Txen_Ven = 0.01;
                    else
                        ProductTest[i].Txen_Ven = Convert.ToDouble(content[9]);

                    if (content[10] == "0")
                        ProductTest[i].Gpctrl0_Vmode0 = 0.01;
                    else
                        ProductTest[i].Gpctrl0_Vmode0 = Convert.ToDouble(content[10]);

                    if (content[11] == "0")
                        ProductTest[i].Gpctrl1_Vmode1 = 0.01;
                    else
                        ProductTest[i].Gpctrl1_Vmode1 = Convert.ToDouble(content[11]);

                    if (content[12] == "0")
                        ProductTest[i].Gpctrl2_Vmode2 = 0.01;
                    else
                        ProductTest[i].Gpctrl2_Vmode2 = Convert.ToDouble(content[12]);

                    ProductTest[i].Pin = Convert.ToDouble(content[13]);
                    ProductTest[i].Pout = Convert.ToDouble(content[14]);
                    ProductTest[i].FreqIn = Convert.ToDouble(content[15]);
                    ProductTest[i].FreqOut = Convert.ToDouble(content[16]);
                    ProductTest[i].LossIn = Convert.ToDouble(content[17]);
                    ProductTest[i].LossOut = Convert.ToDouble(content[18]);
                    ProductTest[i].SocketOffset = Convert.ToDouble(content[19]);

                    i++;
                }
                srProduct.Close();
                #endregion Get program configuration information

                #region *** Start Test Program ***
                // everything is ready, start the test program
                if (MessageBox.Show("Perform Loss Comp?", "Loss Comp", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    LossComp frmLoss = new LossComp();
                    frmLoss.ShowDialog();
                    if (frmLoss.DialogResult == DialogResult.OK)        //if Losscomp form closed, start Benchtest from
                        Application.Run(new BenchTest());
                }
                else
                    Application.Run(new BenchTest());

                #endregion *** Start Test Program ***
            }
        }