示例#1
0
        /// <summary>
        /// 获取指定的序列频率扫描数据
        /// </summary>
        /// <param name="filePath">读取的文件地址</param>
        /// <param name="gsm"></param>
        /// <param name="mode">REV,FWD</param>
        /// <param name="imOder">阶数</param>
        /// <param name="cate">fixed,sweep</param>
        internal FreqSweepParam GetFreqSweepParam(Settings_Pim settings,
                                                  string filePath,
                                                  string gsm,
                                                  string mode,
                                                  string cate,
                                                  int imOrder)
        {
            IniFile.SetFileName(filePath);
            string         name = GetName(gsm, mode, imOrder, cate);
            FreqSweepParam fsp  = new FreqSweepParam();

            FreqSweepItem[] sweepItem1 = null;
            FreqSweepItem[] sweepItem2 = null;
            string          tx1_1      = IniFile.GetString(name, "tx1_1", "935");
            string          tx2_1      = IniFile.GetString(name, "tx2_1", "960");
            string          rx_1       = IniFile.GetString(name, "rx_1", "910");

            string tx1_2 = IniFile.GetString(name, "tx1_2", "935");
            string tx2_2 = IniFile.GetString(name, "tx2_2", "960");
            string rx_2  = IniFile.GetString(name, "rx_2", "910");

            string[] strTx1_1 = tx1_1.Split(char.Parse(","));
            string[] strTx2_1 = tx2_1.Split(char.Parse(","));
            string[] strRx_1  = rx_1.Split(char.Parse(","));

            string[] strTx1_2 = tx1_2.Split(char.Parse(","));
            string[] strTx2_2 = tx2_2.Split(char.Parse(","));
            string[] strRx_2  = rx_2.Split(char.Parse(","));
            sweepItem1 = new FreqSweepItem[strTx1_1.Length];
            sweepItem2 = new FreqSweepItem[strTx1_2.Length];
            for (int i = 0; i < strTx1_1.Length; i++)
            {
                sweepItem1[i]     = new FreqSweepItem();
                sweepItem1[i].Tx1 = float.Parse(strTx1_1[i]);
                sweepItem1[i].Tx2 = float.Parse(strTx2_1[i]);
                sweepItem1[i].Rx  = float.Parse(strRx_1[i]);

                sweepItem2[i]     = new FreqSweepItem();
                sweepItem2[i].Tx1 = float.Parse(strTx1_2[i]);
                sweepItem2[i].Tx2 = float.Parse(strTx2_2[i]);
                sweepItem2[i].Rx  = float.Parse(strRx_2[i]);

                if (App_Configure.Cnfgs.Cal_Use_Table)
                {
                    //----------------------------------------

                    sweepItem1[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem1[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    sweepItem1[i].P2 = settings.Tx2 + Tx_Tables.pim_rev_tx2.Offset(sweepItem1[i].Tx2, settings.Tx2, Tx_Tables.pim_rev_offset2);
                    sweepItem2[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem2[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    sweepItem2[i].P2 = settings.Tx2 + Tx_Tables.pim_rev_tx2.Offset(sweepItem2[i].Tx2, settings.Tx2, Tx_Tables.pim_rev_offset2);

                    //if (settings.PimSchema == ImSchema.REV)
                    //{
                    //    sweepItem1[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem1[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    //    sweepItem1[i].P2 = settings.Tx + Tx_Tables.pim_rev_tx2.Offset(sweepItem1[i].Tx2, settings.Tx, Tx_Tables.pim_rev_offset2);
                    //    sweepItem2[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem2[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    //    sweepItem2[i].P2 = settings.Tx + Tx_Tables.pim_rev_tx2.Offset(sweepItem2[i].Tx2, settings.Tx, Tx_Tables.pim_rev_offset2);
                    //}
                    //else
                    //{
                    //    sweepItem1[i].P1 = settings.Tx + Tx_Tables.pim_frd_tx1.Offset(sweepItem1[i].Tx1, settings.Tx, Tx_Tables.pim_frd_offset1);
                    //    sweepItem1[i].P2 = settings.Tx + Tx_Tables.pim_frd_tx2.Offset(sweepItem1[i].Tx2, settings.Tx, Tx_Tables.pim_frd_offset2);
                    //    sweepItem2[i].P1 = settings.Tx + Tx_Tables.pim_frd_tx1.Offset(sweepItem2[i].Tx1, settings.Tx, Tx_Tables.pim_frd_offset1);
                    //    sweepItem2[i].P2 = settings.Tx + Tx_Tables.pim_frd_tx2.Offset(sweepItem2[i].Tx2, settings.Tx, Tx_Tables.pim_frd_offset2);
                    //}
                    //----------------------------------------
                }
                else
                {
                    sweepItem1[i].P1 = (float)App_Factors.pim_tx1.ValueWithOffset(sweepItem1[i].Tx1, settings.Tx);
                    sweepItem1[i].P2 = (float)App_Factors.pim_tx2.ValueWithOffset(sweepItem1[i].Tx2, settings.Tx2);
                    sweepItem2[i].P1 = (float)App_Factors.pim_tx1.ValueWithOffset(sweepItem2[i].Tx1, settings.Tx);
                    sweepItem2[i].P2 = (float)App_Factors.pim_tx2.ValueWithOffset(sweepItem2[i].Tx2, settings.Tx2);
                }
            }
            fsp.Items1 = sweepItem1;
            fsp.Items2 = sweepItem2;
            return(fsp);
        }
示例#2
0
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);

            //=======ygq

            ms_switch_port_count = int.Parse(IniFile.GetString("cnfgs", "ms_switch_port_count", "0"));
            comaddr_switch       = int.Parse(IniFile.GetString("cnfgs", "comaddr_switch", "1"));
            rxRef            = float.Parse(IniFile.GetString("cnfgs", "rxRef", "0"));
            txRef            = float.Parse(IniFile.GetString("cnfgs", "txRef", "0"));
            openOffset       = int.Parse(IniFile.GetString("cnfgs", "openOffset", "1"));
            qiandanqian_mode = int.Parse(IniFile.GetString("cnfgs", "qiandanqiang_mode", "0"));
            mode             = int.Parse(IniFile.GetString("cnfgs", "mode", "0"));
            ishigh           = int.Parse(IniFile.GetString("cnfgs", "ishigh", "0"));
            //======ygq
            macdesc = IniFile.GetString("cnfgs", "macdesc", "JCIMA-II-900P");

            macid = int.Parse(IniFile.GetString("cnfgs", "macid", "1"));

            sn = IniFile.GetString("cnfgs", "sn", "none sn");

            cal = IniFile.GetString("cnfgs", "cal", "none cal");

            comaddr1  = int.Parse(IniFile.GetString("cnfgs", "comaddr1", "1"));
            comaddr2  = int.Parse(IniFile.GetString("cnfgs", "comaddr2", "2"));
            rfclass   = int.Parse(IniFile.GetString("cnfgs", "rfclass", "0"));
            rfformula = int.Parse(IniFile.GetString("cnfgs", "rfformula", "0"));

            spectrum = int.Parse(IniFile.GetString("cnfgs", "spectrum", "0"));

            max_vswr = float.Parse(IniFile.GetString("cnfgs", "max_vswr", "2.0"));
            min_temp = float.Parse(IniFile.GetString("cnfgs", "min_temp", "-20.0"));
            max_temp = float.Parse(IniFile.GetString("cnfgs", "max_temp", "60.0"));
            min_curr = float.Parse(IniFile.GetString("cnfgs", "min_curr", "0.1"));
            max_curr = float.Parse(IniFile.GetString("cnfgs", "max_curr", "3.0"));

            path_def = IniFile.GetString("cnfgs", "path_def", "settings");

            //file_def_pim = IniFile.GetString("cnfgs", "file_def_pim", "Settings_Pim.ini");
            //file_def_spc = IniFile.GetString("cnfgs", "file_def_spc", "Settings_Spc.ini");
            //file_def_iso = IniFile.GetString("cnfgs", "file_def_iso", "Settings_Iso.ini");
            //file_def_vsw = IniFile.GetString("cnfgs", "file_def_vsw", "Settings_Vsw.ini");
            //file_def_har = IniFile.GetString("cnfgs", "file_def_har", "Settings_Har.ini");

            path_usr = IniFile.GetString("cnfgs", "path_usr", "d:\\usr_settings");

            path_usr_pim = IniFile.GetString("cnfgs", "path_usr_pim", "d:\\usr_settings\\pim");
            path_usr_spc = IniFile.GetString("cnfgs", "path_usr_spc", "d:\\usr_settings\\spc");
            path_usr_iso = IniFile.GetString("cnfgs", "path_usr_iso", "d:\\usr_settings\\iso");
            path_usr_vsw = IniFile.GetString("cnfgs", "path_usr_vsw", "d:\\usr_settings\\vsw");
            path_usr_har = IniFile.GetString("cnfgs", "path_usr_har", "d:\\usr_settings\\har");

            //file_usr_pim = IniFile.GetString("cnfgs", "file_usr_pim", "Settings_Pim.ini");
            //file_usr_spc = IniFile.GetString("cnfgs", "file_usr_spc", "Settings_Spc.ini");
            //file_usr_iso = IniFile.GetString("cnfgs", "file_usr_iso", "Settings_Iso.ini");
            //file_usr_vsw = IniFile.GetString("cnfgs", "file_usr_vsw", "Settings_Vsw.ini");
            //file_usr_har = IniFile.GetString("cnfgs", "file_usr_har", "Settings_Har.ini");

            path_rpt = IniFile.GetString("cnfgs", "path_rpt", "d:\\report");

            path_rpt_pim = IniFile.GetString("cnfgs", "path_rpt_pim", "d:\\report\\pim");
            path_rpt_spc = IniFile.GetString("cnfgs", "path_rpt_spc", "d:\\report\\spc");
            path_rpt_iso = IniFile.GetString("cnfgs", "path_rpt_iso", "d:\\report\\iso");
            path_rpt_vsw = IniFile.GetString("cnfgs", "path_rpt_vsw", "d:\\report\\vsw");
            path_rpt_har = IniFile.GetString("cnfgs", "path_rpt_har", "d:\\report\\har");

            cal_use_table = int.Parse(IniFile.GetString("cnfgs", "cal_use_table", "0"));

            lang_pack_path = IniFile.GetString("cnfgs", "lang_pack_path", "");
            skin_pack_path = IniFile.GetString("cnfgs", "skin_pack_path", "");

            //enable_pim = int.Parse(IniFile.GetString("cnfgs", "enable_pim", "1"));
            //enable_spc = int.Parse(IniFile.GetString("cnfgs", "enable_spc", "1"));
            //enable_iso = int.Parse(IniFile.GetString("cnfgs", "enable_iso", "0"));
            //enable_vsw = int.Parse(IniFile.GetString("cnfgs", "enable_vsw", "0"));
            //enable_har = int.Parse(IniFile.GetString("cnfgs", "enable_har", "0"));
            //enable_tst = int.Parse(IniFile.GetString("cnfgs", "enable_tst", "0"));

            _desc  = IniFile.GetString("cnfgs", "desc", "here is no [description]");
            _modno = IniFile.GetString("cnfgs", "modno", "here is no [model no.]");
            _opeor = IniFile.GetString("cnfgs", "opeor", "here is no [serial no.]");
            _serno = IniFile.GetString("cnfgs", "serno", "default user");

            csv_checked = int.Parse(IniFile.GetString("cnfgs", "csv_checked", "0"));
            jpg_checked = int.Parse(IniFile.GetString("cnfgs", "jpg_checked", "0"));
            pdf_checked = int.Parse(IniFile.GetString("cnfgs", "pdf_checked", "0"));

            _channel      = int.Parse(IniFile.GetString("cnfgs", "channel", "0"));
            _gpio         = int.Parse(IniFile.GetString("cnfgs", "gpio", "0"));
            _battery      = int.Parse(IniFile.GetString("cnfgs", "battery", "0"));
            _width_pinNum = int.Parse(IniFile.GetString("cnfgs", "width_pinNum", "0"));
            _power_pinNum = int.Parse(IniFile.GetString("cnfgs", "power_pinNum", "1"));

            _enableSuperConfig = int.Parse(IniFile.GetString("cnfgs", "enableSuperConfig", "0"));
            isScroll           = IniFile.GetString("cnfgs", "scroll", "1") == "0" ? true : false;
            switchOrGpio       = IniFile.GetString("cnfgs", "SwitchOrGpio", "0") == "0" ? true : false;

            //_pim_wait = int.Parse(IniFile.GetString("cnfgs", "pimWait", "1000"));
            _password   = IniFile.GetString("cnfgs", "password", "82F8A4F03E18723F");
            _switchMode = int.Parse(IniFile.GetString("cnfgs", "switchMode", "0"));
            _switchO    = IniFile.GetString("cnfgs", "switchO", "0");
            _switchN    = IniFile.GetString("cnfgs", "switchN", "0");
            if (_password == "")
            {
                _password = "******";
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                si.ftpaddr = tB_ftpaddr.Text;
                si.ftpuser = tB_ftpuser.Text;
                si.ftppw   = tB_ftppw.Text;

                si.sqladdr     = tB_sqladdr.Text;
                si.sqlname     = tB_sqldatabase.Text;
                si.sqluser     = tB_sqluser.Text;
                si.sqlpw       = tB_sqlpassward.Text;
                si.PimOperator = tB_Tester.Text;
                si.ftpaddr     = tB_ftpaddr.Text;

                #region 尝试连接数据库,并检查数据库
                SqlConnection conn = new SqlConnection();
                conn.ConnectionString = "Data Source=" + tB_sqladdr.Text + ";Initial Catalog=" + tB_sqldatabase.Text + ";User Id=" + tB_sqluser.Text + ";Password="******"select count(1) from sys.objects where name='" + device + "'";
                SqlCommand cmd = new SqlCommand(sql, conn);
                int        n   = Convert.ToInt32(cmd.ExecuteScalar());
                if (n == 0)//不存在表
                {
                    sql = "create table " + device + "("
                          + "SN char(20) not null,"
                          + "Type nchar(20),"
                          + "Op nchar(20) not null,"
                          + "Pim char(20) not null,"
                          + "Result char(20) not null,"
                          + "Fpim char(20) not null,"
                          + "\"Power\" char(20) not null,"
                          + "Mode char(20) not null,"
                          + "\"Order\" char(20) not null,"
                          + "Band char(20) not null,"
                          + "Limit char(20) not null,"
                          + "Time char(20) not null,"
                          + "Remark char(20) not null)";
                    cmd = new SqlCommand(sql, conn);
                    cmd.ExecuteScalar();

                    //MessageBox.Show("新建数据库:" + device);
                }
                else
                {
                    sql = "select count(name) from syscolumns where id=object_id('" + device + "')";
                    cmd = new SqlCommand(sql, conn);
                    int i = Convert.ToInt32(cmd.ExecuteScalar());
                    if (i == 11)
                    {
                        sql = "alter table " + device + " add Time char(20)";
                        cmd = new SqlCommand(sql, conn);
                        cmd.ExecuteScalar();
                        sql = "alter table " + device + " add Remark char(20)";
                        cmd = new SqlCommand(sql, conn);
                        cmd.ExecuteScalar();
                    }
                }

                conn.Close();
                #endregion

                IniFile.SetString("sqlinfo", "sqladdr", si.sqladdr, Application.StartupPath + "\\SqlInfo.ini");
                IniFile.SetString("sqlinfo", "sqlname", si.sqlname, Application.StartupPath + "\\SqlInfo.ini");
                IniFile.SetString("sqlinfo", "sqluser", si.sqluser, Application.StartupPath + "\\SqlInfo.ini");
                IniFile.SetString("sqlinfo", "operator", si.PimOperator, Application.StartupPath + "\\SqlInfo.ini");
                IniFile.SetString("sqlinfo", "ftpaddr", si.ftpaddr, Application.StartupPath + "\\SqlInfo.ini");
                IniFile.SetString("sqlinfo", "ftpuser", si.ftpuser, Application.StartupPath + "\\SqlInfo.ini");
                if (checkBox1.Checked)
                {
                    IniFile.SetString("sqlinfo", "deson", "1", Application.StartupPath + "\\SqlInfo.ini");
                    string mn = EncryptDES(si.sqlpw);
                    if (mn != "Error")
                    {
                        IniFile.SetString("sqlinfo", "sqlpw", mn, Application.StartupPath + "\\SqlInfo.ini");
                    }

                    string mn2 = EncryptDES(si.ftppw);
                    if (mn2 != "Error")
                    {
                        IniFile.SetString("sqlinfo", "ftppw", mn2, Application.StartupPath + "\\SqlInfo.ini");
                    }
                }
                else
                {
                    IniFile.SetString("sqlinfo", "deson", "0", Application.StartupPath + "\\SqlInfo.ini");
                }


                MessageBox.Show("连接成功!");

                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show("数据库连接失败: " + ex.Message);
            }
        }