internal void updateConfigList(string updatedData) { this.configDataGridView.Rows[this.currentSelectRowIdx].Cells[this.currentSelectCellIdx].Value = updatedData; int num = 0; string str3 = updatedData; if (str3 != null) { if (!(str3 == "RF_PLAYBACK")) { if (str3 == "SIM") { for (int i = 0; i < (this.configDataGridView.Rows.Count - 1); i++) { if (this.configDataGridView.Rows[i].HeaderCell.Value.ToString() == "RF_PLAYBACK") { this.configDataGridView.Rows.RemoveAt(i); i--; } if (this.configDataGridView.Rows[i].HeaderCell.Value.ToString() == "SIM") { num++; } } } else if (str3 == "LIVE") { for (int j = 0; j < (this.configDataGridView.Rows.Count - 1); j++) { if ((this.configDataGridView.Rows[j].HeaderCell.Value.ToString() == "RF_PLAYBACK") || (this.configDataGridView.Rows[j].HeaderCell.Value.ToString() == "SIM")) { this.configDataGridView.Rows.RemoveAt(j); j--; } } } } else { for (int k = 0; k < (this.configDataGridView.Rows.Count - 1); k++) { if (this.configDataGridView.Rows[k].HeaderCell.Value.ToString() == "SIM") { this.configDataGridView.Rows.RemoveAt(k); k--; } if (this.configDataGridView.Rows[k].HeaderCell.Value.ToString() == "RF_PLAYBACK") { num++; } } } } if (num == 0) { IniHelper helper = new IniHelper(this.configFilePathVal.Text); helper.GetSections(); List<string> list = new List<string>(); string str = string.Empty; char[] trimChars = new char[] { '\n', '\r', '\t', '\0' }; foreach (string str2 in helper.GetKeys(updatedData)) { if (!str2.Contains("#")) { int num5 = this.configDataGridView.Rows.Add(); str = helper.GetIniFileString(updatedData, str2, ""); this.configDataGridView.Rows[num5].HeaderCell.Value = updatedData; this.configDataGridView.Rows[num5].Cells[0].Value = str2; this.configDataGridView.Rows[num5].Cells[1].Value = str.TrimEnd(trimChars); } } } }
public frmAutomationTests() { this.InitializeComponent(); clsGlobal.Abort = false; clsGlobal.AbortSingle = false; clsGlobal.ScriptDone = true; IniHelper helper = new IniHelper(this.automationIniPath); string str = string.Empty; if (clsGlobal.IsMarketingUser()) { this.autoTestEmailListLabel.Visible = false; this.autoTestEmailListVal.Visible = false; this.autoTestSendEmailChkVal.Visible = false; } try { if (File.Exists(this.automationIniPath)) { foreach (string str2 in helper.GetKeys("EMAIL")) { if (!str2.Contains("#")) { str = helper.GetIniFileString("EMAIL", str2, ""); if (str.Length != 0) { str = str.Replace(" ", "").TrimEnd(new char[] { '\n' }).TrimEnd(new char[] { '\r' }); ConfigurationManager.AppSettings[str2] = str; if (str2 == "Email.Recipient") { this.autoTestEmailListVal.Text = ConfigurationManager.AppSettings[str2]; } } } } str = helper.GetIniFileString("SETUP", "AVAILABLE_SCRIPTS", ""); if (str.Length != 0) { this.scriptsFullPathLists.Clear(); foreach (string str3 in str.Split(new char[] { ',' })) { if (str3.Length != 0) { this.autoTestAddAvailableScripts(str3); } } } this.scriptsArray = this.scriptsFullPathLists.ToArray(); this.autoTestDirVal.Text = helper.GetIniFileString("SETUP", "SCRIPTS_DIR", ""); str = helper.GetIniFileString("SETUP", "SEND_EMAIL", ""); if (str.Length != 0) { if (str == "1") { this.autoTestSendEmailChkVal.Checked = true; } else { this.autoTestSendEmailChkVal.Checked = false; } } } } catch (Exception exception) { MessageBox.Show(exception.Message, "ERROR!"); } }
private void loadConfigFile() { this.Cursor = Cursors.WaitCursor; if (!File.Exists(this.configFilePathVal.Text)) { MessageBox.Show("Configuration File does not exist", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Cursor = Cursors.Default; } else { IniHelper helper = new IniHelper(this.configFilePathVal.Text); List<string> sections = helper.GetSections(); List<string> list2 = new List<string>(); string str = string.Empty; char[] trimChars = new char[] { '\n', '\r', '\t', '\0' }; this.configDataGridView.Rows.Clear(); foreach (string str2 in sections) { if (((str2 != "RF_PLAYBACK") && (str2 != "SIM")) && ((str2 != "LIVE") && (str2 != "AIDING_PARAMS"))) { foreach (string str3 in helper.GetKeys(str2)) { if (!str3.Contains("#")) { int num = this.configDataGridView.Rows.Add(); str = helper.GetIniFileString(str2, str3, ""); this.configDataGridView.Rows[num].HeaderCell.Value = str2; this.configDataGridView.Rows[num].Cells[0].Value = str3; this.configDataGridView.Rows[num].Cells[1].Value = str.TrimEnd(trimChars); if (!clsGlobal.AutomationParamsHash.ContainsKey(str3)) { if ((str3 != "BASE_TEST_LOG") && (str3 != "SIM_FILE")) { clsGlobal.AutomationParamsHash.Add(str3, this.configDataGridView.Rows[num].Cells[1].Value.ToString().Replace(" ", "")); } else { clsGlobal.AutomationParamsHash.Add(str3, this.configDataGridView.Rows[num].Cells[1].Value); } } } } } } string category = helper.GetIniFileString("TEST_SETUP", "SIGNAL_SOURCE", ""); foreach (string str5 in helper.GetKeys(category)) { if (!str5.Contains("#")) { int num2 = this.configDataGridView.Rows.Add(); str = helper.GetIniFileString(category, str5, ""); this.configDataGridView.Rows[num2].HeaderCell.Value = category; this.configDataGridView.Rows[num2].Cells[0].Value = str5; this.configDataGridView.Rows[num2].Cells[1].Value = str.TrimEnd(trimChars); if (!clsGlobal.AutomationParamsHash.ContainsKey(str5)) { clsGlobal.AutomationParamsHash.Add(str5, this.configDataGridView.Rows[num2].Cells[1].Value); } } } string str6 = helper.GetIniFileString("TEST_SETUP", "REQUIRED_AIDING", ""); foreach (string str7 in helper.GetKeys("AIDING_PARAMS")) { if (!str7.Contains("#")) { if (str6 == "1") { int num3 = this.configDataGridView.Rows.Add(); str = helper.GetIniFileString("AIDING_PARAMS", str7, ""); this.configDataGridView.Rows[num3].HeaderCell.Value = "AIDING_PARAMS"; this.configDataGridView.Rows[num3].Cells[0].Value = str7; this.configDataGridView.Rows[num3].Cells[1].Value = str.TrimEnd(trimChars); } if (!clsGlobal.AutomationParamsHash.ContainsKey(str7)) { clsGlobal.AutomationParamsHash.Add(str7, str.TrimEnd(trimChars)); } } } this.Cursor = Cursors.Default; } }
private void printResultStats(StreamWriter s, Hashtable dH) { if (((s != null) && (dH != null)) && (s != null)) { string path = clsGlobal.InstalledDirectory + @"\Config\sdoHeaderName.cfg"; if (!File.Exists(path)) { path = null; } else { IniHelper helper = new IniHelper(path); List<string> keys = helper.GetKeys("Stats"); s.WriteLine("Test Statistics:"); SDOStatsElememt elememt = new SDOStatsElememt(); if (keys != null) { foreach (string str2 in keys) { elememt.Init(); if (dH.ContainsKey(str2)) { elememt = (SDOStatsElememt) dH[str2]; if (elememt.Target != "N/A") { s.WriteLine(string.Format("\t{0}:", str2)); s.WriteLine(string.Format("\t\t- Target:{0}", elememt.Target)); s.WriteLine(string.Format("\t\t- Result:{0}", elememt.Value)); s.WriteLine(string.Format("\t\t- Comparison:{0}", elememt.Comparison)); s.WriteLine(string.Format("\t\t- Comparison Result:{0}", elememt.ComparisonResult)); } else { s.WriteLine(string.Format("\t{0}:{1}", str2, elememt.Value)); } } } } elememt = null; keys.Clear(); keys = null; helper = null; } } }
private bool prinSDOHeader(StreamWriter s, Hashtable dH) { if (s == null) { return false; } string path = clsGlobal.InstalledDirectory + @"\Config\sdoHeaderName.cfg"; if (!File.Exists(path)) { path = null; return false; } IniHelper helper = new IniHelper(path); List<string> keys = helper.GetKeys("General"); List<string> list2 = helper.GetKeys("TestStationInfo"); List<string> list3 = helper.GetKeys("TestParameters"); if (dH == null) { string str2 = "N/A"; if (keys != null) { foreach (string str3 in keys) { s.WriteLine(string.Format("{0}:{1}", str3, str2)); } } if (list2 != null) { s.WriteLine("Test Station Info:"); foreach (string str4 in list2) { s.WriteLine(string.Format("{0}:{1}", str4, str2)); } } if (list3 != null) { s.WriteLine("Test Parameters:"); foreach (string str5 in list3) { s.WriteLine(string.Format("{0}:{1}", str5, str2)); } } } else { string str6 = string.Empty; if (keys != null) { foreach (string str7 in keys) { if (dH.ContainsKey(str7)) { str6 = (string) dH[str7]; s.WriteLine(string.Format("{0}:{1}", str7, str6)); } } } if (list2 != null) { s.WriteLine("Test Station Info:"); foreach (string str8 in list2) { if (dH.ContainsKey(str8)) { str6 = (string) dH[str8]; if (str8.Contains("SW Version")) { s.WriteLine(string.Format("\tDUT {0}:{1}", str8, str6)); } else { s.WriteLine(string.Format("\t{0}:{1}", str8, str6)); } } } } if (list3 != null) { s.WriteLine("Test Parameters:"); foreach (string str9 in list3) { if (dH.ContainsKey(str9)) { str6 = (string) dH[str9]; s.WriteLine(string.Format("\t{0}:{1}", str9, str6)); } } } } path = null; if (keys != null) { keys.Clear(); keys = null; } if (list2 != null) { list2.Clear(); list2 = null; } if (list3 != null) { list3.Clear(); list3 = null; } return true; }
public frmFileConversion(ConversionType conversionType) { this.InitializeComponent(); IniHelper helper = new IniHelper(this.fileConversionIniPath); string str = string.Empty; this._conversionType = conversionType; switch (conversionType) { case ConversionType.GP2ToGPS: this._fileType = ".gpx"; break; case ConversionType.BinToGPS_GP2: this._fileType = ".bin"; break; case ConversionType.GPSToNMEA: case ConversionType.GPSToKML: this._fileType = ".gps"; break; case ConversionType.NMEAToGPS: this._fileType = ".nmea"; break; default: this._fileType = ".gpx"; break; } try { if (File.Exists(this.fileConversionIniPath)) { foreach (string str2 in helper.GetKeys("EMAIL")) { if (!str2.Contains("#")) { str = helper.GetIniFileString("EMAIL", str2, ""); if (str.Length != 0) { str = str.Replace(" ", "").TrimEnd(new char[] { '\n' }).TrimEnd(new char[] { '\r' }); ConfigurationManager.AppSettings[str2] = str; } } } str = helper.GetIniFileString("SETUP", "AVAILABLE_SCRIPTS", ""); if (str.Length != 0) { this.filesFullPathLists.Clear(); foreach (string str3 in str.Split(new char[] { ',' })) { if (str3.Length != 0) { this.addAvailableFiles(str3); } } } this.filesArray = this.filesFullPathLists.ToArray(); this.autoTestDirVal.Text = helper.GetIniFileString("SETUP", "SCRIPTS_DIR", ""); str = helper.GetIniFileString("SETUP", "SEND_EMAIL", ""); } } catch (Exception exception) { MessageBox.Show(exception.Message, "ERROR!"); } }
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 readConfigToHash(string configFilePath) { IniHelper helper = new IniHelper(configFilePath); List<string> sections = helper.GetSections(); List<string> list2 = new List<string>(); char[] trimChars = new char[] { '\n', '\r', '\t', '\0' }; foreach (string str in sections) { foreach (string str2 in helper.GetKeys(str)) { if (!str2.Contains("#")) { string str3 = helper.GetIniFileString(str, str2, "").TrimEnd(trimChars); if (!clsGlobal.AutomationParamsHash.ContainsKey(str2)) { if ((str2 != "BASE_TEST_LOG") && (str2 != "SIM_FILE")) { clsGlobal.AutomationParamsHash.Add(str2, str3.Replace(" ", "")); } else { clsGlobal.AutomationParamsHash.Add(str2, str3); } } } } } }