private void button2_Click(object sender, EventArgs e) { if (!File.Exists(txt_LogPath.Text.Trim())) { return; } string curProtocol = rbt_DDC.Checked ? "DDC" : "NDC"; XDCUnity.MessageFormat = rbt_DDC.Checked ? new MessageFormat_DDC() as IMessageFormat : new MessageFormat_NDC() as IMessageFormat; string curHost = rbt_Server_1.Checked ? "Host_1" : "Host_2"; string opcIniFilePath = string.Empty; string iniFileName = "OperationCodeConfig.ini"; opcIniFilePath = Environment.CurrentDirectory + @"\Config\Server\" + curProtocol + "\\" + curHost + "\\" + iniFileName; ReadLogs(txt_LogPath.Text); foreach (KeyValuePair <string, OperationCodeObject> item in OperationDic) { richTextBox1.AppendText("[" + item.Key.Replace(" ", "_") + "]\r\n"); XDCUnity.WriteIniData(item.Key.Replace(" ", "_"), "Comment", "{Input Comment}", opcIniFilePath); richTextBox1.AppendText("Comment=" + "{ Input Comment}\r\n"); XDCUnity.WriteIniData(item.Key.Replace(" ", "_"), "FixedMsg", item.Value.ReplyMsg, opcIniFilePath); richTextBox1.AppendText("FixedMsg=" + item.Value.ReplyMsg + "\r\n"); if (!string.IsNullOrEmpty(item.Value.InteractiveMsg)) { XDCUnity.WriteIniData(item.Key.Replace(" ", "_"), "InteractiveReply", "1", opcIniFilePath); richTextBox1.AppendText("InteractiveReply= \r\n"); XDCUnity.WriteIniData(item.Key.Replace(" ", "_"), "FixedInterActiveMsg", item.Value.InteractiveMsg, opcIniFilePath); richTextBox1.AppendText("FixedInterActiveMsg=" + item.Value.InteractiveMsg + "\r\n"); } richTextBox1.AppendText("===========================\r\n"); } MessageBox.Show("Successed."); }
private void ProcessSetGroupBox(Control.ControlCollection artControls, string argSection, string argKeyAppendText) { CurrentIniPath = XDCUnity.CurrentPath + @"\Config\Server\" + ProtocolString + "\\" + CurrentHost + "\\CommonConfig.ini"; string flag = string.Empty; foreach (Control item in artControls) { flag = "1";; if (item.GetType().Name == "CheckBox") { if (((CheckBox)item).Checked) { flag = "1"; } else { flag = "0"; } XDCUnity.WriteIniData(argSection, ((CheckBox)item).Text + argKeyAppendText, flag, CurrentIniPath); } } }