private void initApp() { if (!System.IO.File.Exists(str_cfgfile)) { ClassLib_RML.WriteValueToINI("Server", "Server1", "10.204.16.168:1667", str_cfgfile); ClassLib_RML.WriteValueToINI("User", "User1", "L10N02_Hisoft", str_cfgfile); ClassLib_RML.WriteValueToINI("Workspace", "Workspace1", "TM_ENG04", str_cfgfile); ClassLib_RML.WriteValueToINI("Password", "CurrentPWD", "Trend2018!", str_cfgfile); } var servers = ClassLib_RML.ReadKeysFromINI("Server", str_cfgfile); foreach (String server in servers) { this.comBox_Server.Items.Add(ClassLib_RML.ReadeValueFromINI("Server", server, str_cfgfile)); } var users = ClassLib_RML.ReadKeysFromINI("User", str_cfgfile); foreach (String user in users) { this.comBox_User.Items.Add(ClassLib_RML.ReadeValueFromINI("User", user, str_cfgfile)); } var workspaces = ClassLib_RML.ReadKeysFromINI("Workspace", str_cfgfile); foreach (String workspace in workspaces) { this.comBox_Workspace.Items.Add(ClassLib_RML.ReadeValueFromINI("Workspace", workspace, str_cfgfile)); } this.tb_Password.Text = ClassLib_RML.ReadeValueFromINI("Password", "CurrentPWD", str_cfgfile); }
private void initApp() { if (!File.Exists(str_cfgfile)) { ClassLib_RML.WriteValueToINI("StringList", "Str1", "en_US", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str2", "en-US", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str3", "MM/dd/yyyy", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str4", "MM-dd-yyyy", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str5", "yyyy/MM/dd", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str6", "yyyy-MM-dd", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str7", "%M/%D/%Y", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str8", "%M-%D-%Y", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str9", "%Y/%M/%D", str_cfgfile); ClassLib_RML.WriteValueToINI("StringList", "Str10", "%Y-%M-%D", str_cfgfile); } specStrs.Clear(); var strKeys = ClassLib_RML.ReadKeysFromINI("StringList", str_cfgfile); this.dataGridView_strList.Rows.Add(strKeys.Count); int rowcount = 0; foreach (String strKey in strKeys) { var str = ClassLib_RML.ReadeValueFromINI("StringList", strKey, str_cfgfile); this.dataGridView_strList.Rows[rowcount].Cells[0].Value = str; specStrs.Add(str); rowcount++; } }
private void btn_save_Click(object sender, EventArgs e) { int int_addCount = 0; String str_keyName = ""; Form_RemoveSentence.al_addSen.Clear(); File.Delete(Form_RemoveSentence.str_cfgfile); for (int idx = 0; idx < this.lb_addSen.Items.Count; idx++) { int_addCount++; if (int_addCount < 10) { str_keyName = "Sentence_0" + int_addCount.ToString(); } else { str_keyName = "Sentence_" + int_addCount.ToString(); } Form_RemoveSentence.al_addSen.Add(this.lb_addSen.Items[idx]); ClassLib_RML.WriteValueToINI("REMOVE_SENTENCES", str_keyName, "$$Rem$$" + this.lb_addSen.Items[idx].ToString() + "$$Rem$$", Form_RemoveSentence.str_cfgfile); } this.Close(); }
private void btn_updPassword_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this.tb_Password.Text) && !String.IsNullOrWhiteSpace(this.tb_Password.Text)) { ClassLib_RML.WriteValueToINI("Password", "CurrentPWD", this.tb_Password.Text, str_cfgfile); addRunInfo("Password updated successfully."); } else { this.tb_Password.Text = ClassLib_RML.ReadeValueFromINI("Password", "CurrentPWD", str_cfgfile); } }
private void btn_save_Click(object sender, EventArgs e) { specStrs.Clear(); foreach (DataGridViewRow row in this.dataGridView_strList.Rows) { if (!row.IsNewRow && row.Cells[0].Value != null) { var str = row.Cells[0].Value.ToString(); if (!String.IsNullOrEmpty(str) && !String.IsNullOrWhiteSpace(str)) { specStrs.Add(str); } } } if (specStrs.Count < 1) { MessageBox.Show("The String List can not be empty.\r\nThe default list will be used.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); initApp(); } else { File.Delete(str_cfgfile); int strCount = 0; foreach (var specStr in specStrs) { strCount++; ClassLib_RML.WriteValueToINI("StringList", "Str" + strCount.ToString(), specStr, str_cfgfile); } } this.btn_save.Enabled = false; if (!String.IsNullOrEmpty(this.tb_pathInput.Text) && !String.IsNullOrWhiteSpace(this.tb_pathInput.Text)) { this.btn_check.Enabled = true; } else { this.btn_check.Enabled = false; } }
private void btn_addServer_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this.comBox_Server.Text) && !String.IsNullOrWhiteSpace(this.comBox_Server.Text)) { if (!this.comBox_Server.Items.Contains(this.comBox_Server.Text)) { this.comBox_Server.Items.Add(this.comBox_Server.Text); ClassLib_RML.WriteValueToINI("Server", "Server" + this.comBox_Server.Items.Count.ToString(), this.comBox_Server.Text, str_cfgfile); addRunInfo("New server added successfully."); } else { MessageBox.Show("This server has existed in the list and no need to add again.", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { this.comBox_Server.SelectedIndex = 0; } }
private void btn_save_Click(object sender, EventArgs e) { ArrayList al_budTmp = ClassLib_RML.SplitString(this.tb_bundles.Text, "\r\n"); ArrayList al_fodTmp = ClassLib_RML.SplitString(this.tb_folders.Text, "\r\n"); if (al_budTmp.Count == al_fodTmp.Count) { Form_moveBundle.al_Bundles.Clear(); Form_moveBundle.al_Folders.Clear(); File.Delete(str_cfgPath); for (int idx = 0; idx < al_budTmp.Count; idx++) { String str_bTmp = al_budTmp[idx].ToString(); String str_fTmp = al_fodTmp[idx].ToString(); if (String.IsNullOrEmpty(str_bTmp) || String.IsNullOrWhiteSpace(str_bTmp)) { str_bTmp = "N/A"; } if (String.IsNullOrEmpty(str_fTmp) || String.IsNullOrWhiteSpace(str_fTmp)) { str_fTmp = "N/A"; } Form_moveBundle.al_Bundles.Add(str_bTmp); Form_moveBundle.al_Folders.Add(str_fTmp); ClassLib_RML.WriteValueToINI("BUNDLE" + idx.ToString(), "Bundle", str_bTmp, str_cfgPath); ClassLib_RML.WriteValueToINI("BUNDLE" + idx.ToString(), "Folder", str_fTmp, str_cfgPath); } this.Close(); } else { MessageBox.Show("The number of bundle is not same with folder's.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }