private void configSaveBtn_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; int num = 0; IniHelper helper = new IniHelper(this.configFilePathVal.Text); if (!File.Exists(this.configFilePathVal.Text)) { this.writeNewConfig(this.configFilePathVal.Text); } else { if (MessageBox.Show("File exists! -- Overwrite?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { this.Cursor = Cursors.Default; return; } if ((File.GetAttributes(this.configFilePathVal.Text) & FileAttributes.ReadOnly) != FileAttributes.ReadOnly) { while (num < (this.configDataGridView.Rows.Count - 1)) { string str = this.configDataGridView.Rows[num].Cells[0].Value.ToString().Trim(); if (((str == "EXTRA_HOST_APP_ARGVS") || (str == "SIM_FILE")) || str.StartsWith("TEST_")) { helper.IniWriteValue(this.configDataGridView.Rows[num].HeaderCell.Value.ToString().Trim().Replace(" ", ""), this.configDataGridView.Rows[num].Cells[0].Value.ToString().Trim().Replace(" ", ""), this.configDataGridView.Rows[num].Cells[1].Value.ToString().Trim()); } else { helper.IniWriteValue(this.configDataGridView.Rows[num].HeaderCell.Value.ToString().Trim().Replace(" ", ""), this.configDataGridView.Rows[num].Cells[0].Value.ToString().Trim().Replace(" ", ""), this.configDataGridView.Rows[num].Cells[1].Value.ToString().Trim().Replace(" ", "")); } num++; } } else { MessageBox.Show("File is read only!\nPlease change property and retry", "Error"); this.Cursor = Cursors.Default; return; } } helper.IniSiRFLiveRxSetupErrorCheck(this.configFilePathVal.Text); string text1 = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols_AI3_Request.xml"; helper.GetIniFileString("TEST_SETUP", "REQUIRED_AIDING", ""); this.Cursor = Cursors.Default; }
private int saveToConfigFile() { this.Cursor = Cursors.WaitCursor; IniHelper helper = new IniHelper(this._configFilePath); if (File.Exists(this._configFilePath)) { if ((File.GetAttributes(this._configFilePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { MessageBox.Show(string.Format("Config File is read only!\nPlease change property and retry\n\n{0}", this._configFilePath), "Error"); this.Cursor = Cursors.Default; return 1; } string section = "TESTS"; string key = "SENSITIVITY_TEST1"; int num = 1; int num2 = 0; if (this.frm3GPPConfigTest1ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "NOMINAL_ACCURACY_TEST2"; if (this.frm3GPPConfigTest2ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "DYNAMIC_RANGE_TEST3"; if (this.frm3GPPConfigTest3ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "MULTIPATH_TEST4"; if (this.frm3GPPConfigTest4ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "MOVING_SCENARIO_TEST5"; if (this.frm3GPPConfigTest5ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } section = "TEST_SETUP"; key = "CYCLES_TEST" + num.ToString(); try { num2 = Convert.ToInt32(this.frm3GPPConfigTest1CyclesComboBox.Text.ToString()); helper.IniWriteValue(section, key, num2.ToString()); } catch (Exception exception) { MessageBox.Show("Test " + num.ToString() + "# Cycles: " + exception.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "CYCLES_TEST" + num.ToString(); try { num2 = Convert.ToInt32(this.frm3GPPConfigTest2CyclesComboBox.Text.ToString()); helper.IniWriteValue(section, key, num2.ToString()); } catch (Exception exception2) { MessageBox.Show("Test " + num.ToString() + "# Cycles: " + exception2.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "CYCLES_TEST" + num.ToString(); try { num2 = Convert.ToInt32(this.frm3GPPConfigTest3CyclesComboBox.Text.ToString()); helper.IniWriteValue(section, key, num2.ToString()); } catch (Exception exception3) { MessageBox.Show("Test " + num.ToString() + "# Cycles: " + exception3.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "CYCLES_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, Convert.ToInt32(this.frm3GPPConfigTest4CyclesComboBox.Text.ToString()).ToString()); } catch (Exception exception4) { MessageBox.Show("Test " + num.ToString() + "# Cycles: " + exception4.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } key = "MS_BASED_TEST"; if (this.frm3GPPConfigMsBasedChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "MS_ASSIST1_TEST"; if (this.frm3GPPConfigMsAssist1ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "MS_ASSIST2_TEST"; if (this.frm3GPPConfigMsAssist2ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "MSAB_B_TEST"; if (this.frm3GPPConfigMsAB_BChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "MSAB_A1_TEST"; if (this.frm3GPPConfigMsAB_A1ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "MSAB_A2_TEST"; if (this.frm3GPPConfigMsAB_A2ChkBox.Checked) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } List<string> list = new List<string>(); list.Add(this.frm3GPPConfigMsBasedMarginTxtBox.Text); list.Add(this.frm3GPPConfigMsAssist1MarginTxtBox.Text); list.Add(this.frm3GPPConfigMsAssist2MarginTxtBox.Text); list.Add(this.frm3GPPConfigMsAB_BMarginTxtBox.Text); list.Add(this.frm3GPPConfigMsAB_A1MarginTxtBox.Text); list.Add(this.frm3GPPConfigMsAB_A2MarginTxtBox.Text); foreach (string str4 in list) { string[] strArray = str4.Split(new char[] { ',' }); double num3 = 0.0; try { if (strArray.Length > 1) { foreach (string str5 in strArray) { num3 = Convert.ToDouble(str5); if ((num3 > 9.9) || (num3 < -9.9)) { MessageBox.Show("Margin: " + num3.ToString() + " is not valid (range: -9.9 to 9.9)", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } } } else { num3 = Convert.ToDouble(strArray[0]); if ((num3 > 9.9) || (num3 < -9.9)) { MessageBox.Show("Margin: " + num3.ToString() + " is not valid (range: -9.9 to 9.9)", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } } } catch (Exception exception5) { MessageBox.Show("Margin: " + exception5.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } } key = "MS_BASED_MARGIN"; helper.IniWriteValue(section, key, this.frm3GPPConfigMsBasedMarginTxtBox.Text); key = "MS_ASSIST1_MARGIN"; helper.IniWriteValue(section, key, this.frm3GPPConfigMsAssist1MarginTxtBox.Text); key = "MS_ASSIST2_MARGIN"; helper.IniWriteValue(section, key, this.frm3GPPConfigMsAssist2MarginTxtBox.Text); key = "MSAB_B_MARGIN"; helper.IniWriteValue(section, key, this.frm3GPPConfigMsAB_BMarginTxtBox.Text); key = "MSAB_A1_MARGIN"; helper.IniWriteValue(section, key, this.frm3GPPConfigMsAB_A1MarginTxtBox.Text); key = "MSAB_A2_MARGIN"; helper.IniWriteValue(section, key, this.frm3GPPConfigMsAB_A2MarginTxtBox.Text); key = "CABLE_LOSS"; try { helper.IniWriteValue(section, key, Convert.ToDouble(this.frm3GPPConfigCableLossTxtBox.Text.ToString()).ToString()); } catch (Exception exception6) { MessageBox.Show("Cable Loss: " + exception6.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } section = "AIDING_PARAMS"; key = "FREQ_TRANFER_METHOD"; string str6 = "FREQ_AIDING"; string str7 = "FREQ_METHOD"; if (this.frm3GPPConfigCounterRadioBtn.Checked) { helper.IniWriteValue(section, key, "Counter"); helper.IniWriteValue(str6, str7, "0"); str7 = "USE_FREQ_AIDING"; helper.IniWriteValue(str6, str7, "0"); } else if (this.frm3GPPConfigNonCounterRadioBtn.Checked) { helper.IniWriteValue(section, key, "NonCounter"); helper.IniWriteValue(str6, str7, "1"); str7 = "USE_FREQ_AIDING"; helper.IniWriteValue(str6, str7, "0"); } else if (this.frm3GPPConfigNoFreqReqRadioBtn.Checked) { str7 = "USE_FREQ_AIDING"; helper.IniWriteValue(section, key, "NoFreqReq"); helper.IniWriteValue(str6, str7, "2"); } else { helper.IniWriteValue(section, key, "NoFreqReq"); } num = 1; key = "REL_FREQ_ACC_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest1RelFreqAccTxtBox.Text); } catch (Exception exception7) { MessageBox.Show("REL_FREQ_ACC_TEST " + num.ToString() + ": " + exception7.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "REL_FREQ_ACC_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest2RelFreqAccTxtBox.Text); } catch (Exception exception8) { MessageBox.Show("REL_FREQ_ACC_TEST " + num.ToString() + ": " + exception8.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "REL_FREQ_ACC_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest3RelFreqAccTxtBox.Text); } catch (Exception exception9) { MessageBox.Show("REL_FREQ_ACC_TEST " + num.ToString() + ": " + exception9.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "REL_FREQ_ACC_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest4RelFreqAccTxtBox.Text); } catch (Exception exception10) { MessageBox.Show("REL_FREQ_ACC_TEST " + num.ToString() + ": " + exception10.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num = 1; key = "HRZ_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest1HrzQoSTxtBox.Text); } catch (Exception exception11) { MessageBox.Show("HRZ_QOS_TEST " + num.ToString() + ": " + exception11.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "HRZ_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest2HrzQoSTxtBox.Text); } catch (Exception exception12) { MessageBox.Show("HRZ_QOS_TEST " + num.ToString() + ": " + exception12.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "HRZ_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest3HrzQoSTxtBox.Text); } catch (Exception exception13) { MessageBox.Show("HRZ_QOS_TEST " + num.ToString() + ": " + exception13.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "HRZ_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest4HrzQoSTxtBox.Text); } catch (Exception exception14) { MessageBox.Show("HRZ_QOS_TEST " + num.ToString() + ": " + exception14.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num = 1; key = "VRT_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest1VrtQoSTxtBox.Text); } catch (Exception exception15) { MessageBox.Show("VRT_QOS_TEST " + num.ToString() + ": " + exception15.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "VRT_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest2VrtQoSTxtBox.Text); } catch (Exception exception16) { MessageBox.Show("VRT_QOS_TEST " + num.ToString() + ": " + exception16.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "VRT_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest3VrtQoSTxtBox.Text); } catch (Exception exception17) { MessageBox.Show("VRT_QOS_TEST " + num.ToString() + ": " + exception17.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "VRT_QOS_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest4VrtQoSTxtBox.Text); } catch (Exception exception18) { MessageBox.Show("VRT_QOS_TEST " + num.ToString() + ": " + exception18.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num = 1; key = "RESPONSE_TIME_MAX_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest1RespMaxTimeTxtBox.Text); } catch (Exception exception19) { MessageBox.Show("RESPONSE_TIME_MAX_TEST " + num.ToString() + ": " + exception19.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "RESPONSE_TIME_MAX_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest2RespMaxTimeTxtBox.Text); } catch (Exception exception20) { MessageBox.Show("RESPONSE_TIME_MAX_TEST " + num.ToString() + ": " + exception20.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "RESPONSE_TIME_MAX_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest3RespMaxTimeTxtBox.Text); } catch (Exception exception21) { MessageBox.Show("RESPONSE_TIME_MAX_TEST " + num.ToString() + ": " + exception21.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "RESPONSE_TIME_MAX_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest4RespMaxTimeTxtBox.Text); } catch (Exception exception22) { MessageBox.Show("RESPONSE_TIME_MAX_TEST " + num.ToString() + ": " + exception22.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num = 1; key = "PRIORITY_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest1PriorityTxtBox.Text); } catch (Exception exception23) { MessageBox.Show("PRIORITY_TEST " + num.ToString() + ": " + exception23.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "PRIORITY_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest2PriorityTxtBox.Text); } catch (Exception exception24) { MessageBox.Show("PRIORITY_TEST " + num.ToString() + ": " + exception24.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "PRIORITY_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest3PriorityTxtBox.Text); } catch (Exception exception25) { MessageBox.Show("PRIORITY_TEST " + num.ToString() + ": " + exception25.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } num++; key = "PRIORITY_TEST" + num.ToString(); try { helper.IniWriteValue(section, key, this.frm3GPPConfigTest4PriorityTxtBox.Text); } catch (Exception exception26) { MessageBox.Show("PRIORITY_TEST " + num.ToString() + ": " + exception26.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; return 1; } } this.Cursor = Cursors.Default; return 0; }
private void writeAutoReplyData() { this.Cursor = Cursors.WaitCursor; IniHelper helper = new IniHelper(clsGlobal.InstalledDirectory + @"\scripts\SiRFLiveAutomationSetupAutoReply.cfg"); string section = string.Empty; string key = string.Empty; section = "TTB_TIME_AIDING"; key = "ENABLE"; if (this.comm.AutoReplyCtrl.TTBTimeAidingParams.Enable) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "TYPE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Type.ToString()); key = "TIME_ACC"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Accuracy.ToString()); key = "TIME_SKEW"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Skew.ToString()); this.Cursor = Cursors.Default; }
private int saveNExit() { int num = 0; IniHelper helper = new IniHelper(this.automationIniPath); string str = string.Empty; foreach (string str2 in this.scriptsFullPathLists) { str = str + str2 + ","; } str = str.TrimEnd(new char[] { ',' }); if (str.Length != 0) { str.Replace(" ", ""); } if (File.Exists(this.automationIniPath)) { if ((File.GetAttributes(this.automationIniPath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { MessageBox.Show(string.Format("{0} File is read only!\nPlease change property and retry", this.automationIniPath), "Error"); return 1; } helper.IniWriteValue("SETUP", "AVAILABLE_SCRIPTS", str); helper.IniWriteValue("SETUP", "SCRIPTS_DIR", this.autoTestDirVal.Text); if (this.autoTestSendEmailChkVal.Checked) { helper.IniWriteValue("SETUP", "SEND_EMAIL", "1"); } else { helper.IniWriteValue("SETUP", "SEND_EMAIL", "0"); } string str4 = this.autoTestEmailListVal.Text.Replace(" ", ""); helper.IniWriteValue("EMAIL", "Email.Recipient", str4); return num; } StreamWriter writer = File.CreateText(this.automationIniPath); writer.WriteLine("[EMAIL]"); writer.WriteLine("Email.Recipient={0}", this.autoTestEmailListVal.Text.Replace(" ", "")); writer.WriteLine("Email.Sender=\"[email protected]\""); writer.WriteLine("Email.Copy=\"\""); writer.WriteLine("Email.Priority=\"MailPriority.Normal\""); writer.WriteLine("Email.Encoding=\"Encoding.ASCII\""); writer.WriteLine("Email.Subject=\"SiRFLive Auto Test Report\""); writer.WriteLine("Email.Message=\"\nBest Regards\n\n SiRFLive Team\""); writer.WriteLine("Email.Smtp=\"192.168.2.254\""); writer.WriteLine("[SETUP]"); writer.WriteLine("RESET_PERIOD_RANDOMIZATION_SEC=5"); writer.WriteLine("SCRIPTS_DIR={0}", this.autoTestDirVal.Text); writer.WriteLine("AVAILABLE_SCRIPTS={0}", str); if (this.autoTestSendEmailChkVal.Checked) { writer.WriteLine("SEND_EMAIL=1"); } else { writer.WriteLine("SEND_EMAIL=0"); } writer.Close(); return num; }
private void frmLowPowerSaveSettings() { this.Cursor = Cursors.WaitCursor; string path = clsGlobal.InstalledDirectory + @"\scripts\SiRFLiveAutomationSetup.cfg"; if (!File.Exists(path)) { MessageBox.Show("Config file does not exist -- Not saving" + path, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand); } if ((File.GetAttributes(path) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { MessageBox.Show("Config file is read only!-- Not saving\n" + path, "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } IniHelper helper = new IniHelper(path); string section = string.Empty; string key = string.Empty; section = "POWER_MODE"; key = "MODE"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.Mode.ToString()); key = "APM_NUM_FIXES"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMNumFixes.ToString()); key = "APM_TBF"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMTBF.ToString()); key = "APM_DUTY_CYCLE"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMDutyCycle.ToString()); key = "APM_MAX_HOR_ERR"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMMaxHrzError.ToString()); key = "APM_MAX_VERT_ERR"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMMaxVrtError.ToString()); key = "APM_PRIORITY"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMPriority.ToString()); key = "APM_MAX_OFFTIME"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMMaxOffTime.ToString()); key = "APM_MAX_SEARCH_TIME"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMMaxSearchTime.ToString()); key = "APM_TIME_ACC_PRIORITY"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.APMTimeAccPriority.ToString()); key = "TP_UPDATE"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.TPUpdateRate.ToString()); key = "TP_ONTIME"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.TPOnTime.ToString()); key = "TP_MAX_OFF_TIME"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.TPMaxOffTime.ToString()); key = "TP_MAX_SEARCH_TIME"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.TPMaxSearchTime.ToString()); key = "PTF_PERIOD"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.PTFPeriod.ToString()); key = "PTF_MAX_SEARCH_TIME"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.PTFMaxSearchTime.ToString()); key = "PTF_MAX_OFF_TIME"; helper.IniWriteValue(section, key, this.comm.LowPowerParams.PTFMaxOffTime.ToString()); this.Cursor = Cursors.Default; }
private int saveConfigToHash(string configFilePath) { if (File.Exists(configFilePath) && ((File.GetAttributes(configFilePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)) { MessageBox.Show(configFilePath + "\nFile is read only! Please change property and retry.", "Error"); this.Cursor = Cursors.Default; return 1; } this.Cursor = Cursors.WaitCursor; IniHelper helper = new IniHelper(configFilePath); List<string> sections = helper.GetSections(); List<string> list2 = new List<string>(); foreach (string str in sections) { foreach (string str2 in helper.GetKeys(str)) { if (!str2.Contains("#") && clsGlobal.AutomationParamsHash.ContainsKey(str2)) { helper.IniWriteValue(str, str2, (string) clsGlobal.AutomationParamsHash[str2]); } } } int num = helper.IniSiRFLiveRxSetupErrorCheck(configFilePath); this.Cursor = Cursors.Default; return num; }
private void doneBtn_Click(object sender, EventArgs e) { this._errorFound = false; if (clsGlobal.AutomationParamsHash.ContainsKey("BASE_TEST_LOG") && (this.resultLogDirectoryTxtBox.Text != string.Empty)) { clsGlobal.AutomationParamsHash["BASE_TEST_LOG"] = this.resultLogDirectoryTxtBox.Text; } if (clsGlobal.AutomationParamsHash.ContainsKey("PLAYBACK_FILES") && (this.playbackFileListTxtBox.Text != string.Empty)) { clsGlobal.AutomationParamsHash["PLAYBACK_FILES"] = this.playbackFileListTxtBox.Text; } if (clsGlobal.AutomationParamsHash.ContainsKey("PLAY_TIME_LISTS") && (this.playbackTimeListTxtBox.Text != string.Empty)) { clsGlobal.AutomationParamsHash["PLAY_TIME_LISTS"] = this.playbackTimeListTxtBox.Text; } if (clsGlobal.AutomationParamsHash.ContainsKey("SIM_ADDRESS") && (this.simIPAddressTxtBox.Text != string.Empty)) { clsGlobal.AutomationParamsHash["SIM_ADDRESS"] = this.simIPAddressTxtBox.Text; } if (clsGlobal.AutomationParamsHash.ContainsKey("SIM_PORT") && (this.simPortTxtBox.Text != string.Empty)) { clsGlobal.AutomationParamsHash["SIM_PORT"] = this.simPortTxtBox.Text; } if (clsGlobal.AutomationParamsHash.ContainsKey("SIM_FILE") && (this.simFilePathTxtBox.Text != string.Empty)) { clsGlobal.AutomationParamsHash["SIM_FILE"] = this.simFilePathTxtBox.Text; } if (clsGlobal.AutomationParamsHash.ContainsKey("SIM_START_ATTEN") && (this.simInitialAttenTxtBox.Text != string.Empty)) { clsGlobal.AutomationParamsHash["SIM_START_ATTEN"] = this.simInitialAttenTxtBox.Text; } string path = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts\SiRFLiveAutomationSetup.cfg"; if (!File.Exists(path)) { MessageBox.Show(string.Format("Config File does not exist!\n {0}", path), "Automation Test Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); base.DialogResult = System.Windows.Forms.DialogResult.Cancel; this._errorFound = true; } else { if (clsGlobal.IsMarketingUser()) { this.updateConfigFile(); } if (this.saveConfigToHash(path) == 0) { if ((this._testName == "3GPP") || (this._testName == "TIA916")) { string str2 = string.Empty; if (this._testName == "3GPP") { str2 = clsGlobal.InstalledDirectory + @"\scripts\3GPP\3GPP.cfg"; } else { str2 = clsGlobal.InstalledDirectory + @"\scripts\TIA916\TIA916.cfg"; } if (File.Exists(str2)) { if ((File.GetAttributes(str2) & FileAttributes.ReadOnly) != FileAttributes.ReadOnly) { IniHelper helper = new IniHelper(str2); if (this.simIPAddressTxtBox.Text != string.Empty) { helper.IniWriteValue("SIM", "SIM_ADDRESS", this.simIPAddressTxtBox.Text); } if (this.simPortTxtBox.Text != string.Empty) { helper.IniWriteValue("SIM", "SIM_PORT", this.simPortTxtBox.Text.Replace(" ", "")); } } else { MessageBox.Show(string.Format("Readonly file! Please make sure file is not readonly before proceeding!\n{0}", str2), "Station Setup Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); base.DialogResult = System.Windows.Forms.DialogResult.Cancel; this._errorFound = true; return; } } } base.DialogResult = DialogResult.OK; clsGlobal.AutomationParamsHash.Clear(); base.Close(); } } }
private void writeAutoReplyData(string filepath) { this.Cursor = Cursors.WaitCursor; IniHelper helper = new IniHelper(filepath); string section = string.Empty; string key = string.Empty; section = "HW_CONFIG"; key = "REPLY"; if (this.comm.AutoReplyCtrl.HWCfgCtrl.Reply) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "PRECISE_TIME_ENABLED"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.PreciseTimeEnabled.ToString()); key = "PRECISE_TIME_DIRECTION"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.PreciseTimeDirection.ToString()); key = "FREQ_AIDED_ENABLED"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.FreqAidEnabled.ToString()); key = "FREQ_AIDED_ENABLED"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.FreqAidEnabled.ToString()); key = "FREQ_AIDED_METHOD"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.FreqAidMethod.ToString()); key = "RTC_AVAILABLE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.RTCAvailabe.ToString()); key = "RTC_SOURCE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.RTCSource.ToString()); key = "COARSE_TIME_ENABLE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.CoarseTimeEnabled.ToString()); key = "REF_CLOCK_ENABLED"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.RefClkEnabled.ToString()); key = "NORMINAL_FREQ_HZ"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.NorminalFreqHz.ToString()); key = "ENHANCED_NETWORK"; if (this.comm.AutoReplyCtrl.HWCfgCtrl.PreciseTimeEnabled == 0) { helper.IniWriteValue(section, key, "0"); this.comm.AutoReplyCtrl.HWCfgCtrl.NetworkEnhanceType = 0; } else { helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.HWCfgCtrl.NetworkEnhanceType.ToString()); } section = "APPROXIMATE_POSITION"; key = "REPLY"; if (this.comm.AutoReplyCtrl.ApproxPositionCtrl.Reply) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "REJECT"; if (this.comm.AutoReplyCtrl.ApproxPositionCtrl.Reject) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "LAT"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.ApproxPositionCtrl.Lat.ToString()); key = "LON"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.ApproxPositionCtrl.Lon.ToString()); key = "ALT"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.ApproxPositionCtrl.Alt.ToString()); key = "EST_HOR_ERR"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.ApproxPositionCtrl.EstHorrErr.ToString()); key = "EST_VER_ERR"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.ApproxPositionCtrl.EstVertiErr.ToString()); key = "LAT_SKEW"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.ApproxPositionCtrl.DistanceSkew.ToString()); key = "LON_SKEW"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.ApproxPositionCtrl.HeadingSkew.ToString()); key = "LOC_NAME"; helper.IniWriteValue(section, key, this.comm.m_NavData.RefLocationName); section = "TIME_AIDING"; key = "REPLY"; if (this.comm.AutoReplyCtrl.TimeTransferCtrl.Reply) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "REJECT"; if (this.comm.AutoReplyCtrl.TimeTransferCtrl.Reject) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "TIME_AIDING_TYPE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TimeTransferCtrl.TTType.ToString()); key = "TIME_ACC"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TimeTransferCtrl.Accuracy.ToString()); key = "SKEW"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TimeTransferCtrl.Skew.ToString()); key = "UTC_OFFSET"; helper.IniWriteValue(section, key, this.comm.RxCtrl.UTCOffset.ToString()); key = "TIME_AIDING_SOURCE"; int num = 0; if (this.comm.AutoReplyCtrl.AutoReplyParams.UseDOS_ForTimeAid) { num = 1; this.comm.AutoReplyCtrl.TTBTimeAidingParams.Enable = false; } else if (this.comm.AutoReplyCtrl.AutoReplyParams.UseTTB_ForTimeAid) { num = 2; this.comm.AutoReplyCtrl.TTBTimeAidingParams.Enable = true; } else { num = 0; this.comm.AutoReplyCtrl.TTBTimeAidingParams.Enable = false; } helper.IniWriteValue(section, key, num.ToString()); section = "TTB_TIME_AIDING"; key = "ENABLE"; if (this.comm.AutoReplyCtrl.TTBTimeAidingParams.Enable) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "TYPE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Type.ToString()); key = "TIME_ACC"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Accuracy.ToString()); key = "TIME_SKEW"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Skew.ToString()); section = "FREQ_AIDING"; key = "REPLY"; if (this.comm.AutoReplyCtrl.FreqTransferCtrl.Reply) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "USE_FREQ_AIDING"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.UseFreqAiding.ToString()); key = "TIME_TAG"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.TimeTag.ToString()); key = "REF_CLOCK_INFO"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.RefClkInfo.ToString()); key = "REL_FREQ_ACC"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.Accuracy.ToString()); key = "SCALED_FREQ_OFFSET"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.ScaledFreqOffset.ToString()); key = "EXT_CLOCK_SKEW"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.ExtClkSkewppm.ToString()); key = "NORMIMAL_FREQ"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.NomFreq.ToString()); key = "INCLUDE_NORM_FREQ"; if (this.comm.AutoReplyCtrl.FreqTransferCtrl.IncludeNormFreq) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "FREQ_METHOD"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.FreqAidingMethod.ToString()); key = "DEFAULT_FREQ_GUI_INDEX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.DefaultFreqIndex.ToString()); key = "SPECIFIED_FREQ_GUI_INDEX"; if (this.comm.AutoReplyCtrl.FreqTransferCtrl.SpecifiedRefFreq) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "SLC_REPORT_FREQ_GUI_INDEX"; if (this.comm.AutoReplyCtrl.FreqTransferCtrl.SLCReportFreqGuiIndex) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "REF_CLOCK_REQUEST_GUI_INDEX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.RefClockRequestGuiIndex.ToString()); key = "REF_CLOCK_ONOFF_GUI_INDEX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.RefClockOnOffGuiIndex.ToString()); key = "EXT_REF_CLOCK_GUI_INDEX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.ExtRefClockGuiIndex.ToString()); key = "SCALED_FREQ_OFFSET_GUI_INDEX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.ScaledFreqOffsetGuiIndex.ToString()); key = "FREQ_ACC_USER_GUI"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.FreqAccUserSpecifiedGui.ToString()); key = "FREQ_OFFSET_USER_GUI"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.FreqOffsetUserSpecifiedGui.ToString()); key = "FREQ_ACC_RX_GUI"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.FreqAccFromRxGui.ToString()); key = "FREQ_OFFSET_RX_GUI"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.FreqTransferCtrl.FreqOffsetFromRxGui.ToString()); key = "USE_TTB_FREQ"; if (this.comm.AutoReplyCtrl.AutoReplyParams.UseTTB_ForFreqAid) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "IGNORE_XO"; if (this.comm.AutoReplyCtrl.AutoReplyParams.FreqAidingIgnoreXO) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } section = "POSITION_AIDING"; key = "REPLY"; if (this.comm.AutoReplyCtrl.AutoReplyParams.AutoPosReq) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "NUM_FIXED"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.NumFixes.ToString()); key = "TIME_BETWEEN_FIXES"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.TimeBtwFixes.ToString()); key = "HOR_ERR_MAX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.HorrErrMax.ToString()); key = "VERT_ERR_MAX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.VertErrMax.ToString()); key = "RESP_TIME_MAX"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.RespTimeMax.ToString()); key = "TIME_ACC_PRIORITY"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.TimeAccPriority.ToString()); key = "LOC_METHOD"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.LocMethod.ToString()); key = "EPH_SOURCE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.EphSource.ToString()); key = "EPH_FILEPATH"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.EphFilePath.ToString()); key = "EPH_REPLY"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.EphReply.ToString()); key = "ACQ_ASSIST_SOURCE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.AcqAssistSource.ToString()); key = "ACQ_ASSIST_REPLY"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.AcqAssistReply.ToString()); key = "ACQ_ASSIST_FILEPATH"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.AcqDataFilePath.ToString()); key = "ALM_SOURCE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.AlmSource.ToString()); key = "ALM_REPLY"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.AlmReply.ToString()); key = "NAVBIT_SOURCE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.NavBitSource.ToString()); key = "NAVBIT_REPLY"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.PositionRequestCtrl.NavBitReply.ToString()); this.Cursor = Cursors.Default; }