/// <summary> /// 保存本页面设置信息,存为txt文件 /// </summary> private void SaveSettings() { //协议 string ProtocolString = ""; Protocol = ProtocolString; for (int i = 0; i < SourceListBox1.Items.Count; i++) { if (SourceListBox1.GetItemChecked(i)) { string sourIPandPort = dic[SourceListBox1.Items[i].ToString()]; listSourIP.Add(sourIPandPort.Split(new char[] { '-' })[0]); listSourPort.Add(sourIPandPort.Split(new char[] { '-' })[1]); } } for (int i = 0; i < DestListBox2.Items.Count; i++) { if (DestListBox2.GetItemChecked(i)) { string destIPandPort = dic[SourceListBox1.Items[i].ToString()]; listDestIP.Add(destIPandPort.Split(new char[] { '-' })[0]); listDestPort.Add(destIPandPort.Split(new char[] { '-' })[1]); } } }
//查询 private void Button_Filter_Click(object sender, EventArgs e) { Clear(); DateTime startData = startDate.Value.Date; // dateTimePickerStart.Value.Date;//开始日期 DateTime endData = endDate.Value.Date; //终止日期 DateTime _startTime = startData + new TimeSpan(startHour.Value.Hour, startHour.Value.Minute, startHour.Value.Second); //开始时间 //startData + new TimeSpan(QueryFilterOptionForm._startTime.Hour, QueryFilterOptionForm._startTime.Minute, QueryFilterOptionForm._startTime.Second); ;//开始时间 DateTime _endTime = endData + new TimeSpan(endHour.Value.Hour, endHour.Value.Minute, endHour.Value.Second);; //终止时间 //endData + new TimeSpan(QueryFilterOptionForm._endTime.Hour, QueryFilterOptionForm._endTime.Minute, QueryFilterOptionForm._endTime.Second); ;//终止时间 string sourIP = string.Empty; for (int i = 0; i < SourceListBox1.Items.Count; i++) { if (SourceListBox1.GetItemChecked(i)) { sourIP = dic[SourceListBox1.Items[i].ToString()]; } } string destIP = string.Empty; for (int i = 0; i < DestListBox2.Items.Count; i++) { if (DestListBox2.GetItemChecked(i)) { destIP = dic[DestListBox2.Items[i].ToString()]; } } List <string> fileList = new List <string>(); fileList = GetFiles(_startTime, _endTime, sourIP, destIP); if (fileList == null || fileList.Count == 0) { MessageBox.Show("没有找到符合条件的文件!"); return; } else { foreach (string strFile in fileList) { //listView_Data.Items.Add(new ListViewItem(new string[] { ID, Capturetime.ToString("HH:mm:ss:fff"), Interval, Protocol, SourceIP, SourcePort, DestIP, DestPort, AllLength, MessageBodyLen, MessageBodyTxt, MessageBodyHex })); string[] tmp = strFile.Split(','); listView_Data.Items.Add(new ListViewItem(strFile.Split(','))); //画图 this.Chart_Offline.Series[0].Points.AddY(Convert.ToDouble(tmp[2])); this.Chart_Offline.Series[0].ChartType = SeriesChartType.Line; Chart_Offline.Series[0].BorderWidth = 3; Chart_Offline.Series[0].Color = Color.Blue; Update(); } } }
private void SaveToTxt() { FileStream fs = new FileStream("BackUps.txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(this.txtPcapLength.Text); sw.WriteLine("MB"); string Source = ""; string Dest = ""; for (int i = 0; i < SourceListBox1.Items.Count; i++) { if (SourceListBox1.GetItemChecked(i)) { Source += "#" + SourceListBox1.Items[i].ToString(); } } for (int i = 0; i < DestListBox2.Items.Count; i++) { if (DestListBox2.GetItemChecked(i)) { Dest += "#" + DestListBox2.Items[i].ToString(); } } sw.WriteLine(Source); sw.WriteLine(Dest); sw.WriteLine(MaxVOBCToZC * 1000); sw.WriteLine(MaxZCToVOBC * 1000); sw.WriteLine(MaxVOBCToCI * 1000); sw.WriteLine(MaxCIToVOBC * 1000); sw.WriteLine(MaxVOBCToATS * 1000); sw.WriteLine(MaxATSToVOBC * 1000); sw.Flush(); sw.Close(); fs.Close(); }
private void SaveSetting() { for (int i = 0; i < SourceListBox1.Items.Count; i++) { foreach (var item in IPList.ConfigProperties) { if (item.Name == SourceListBox1.Items[i].ToString()) { if (SourceListBox1.GetItemChecked(i)) { item.IsSourceChoose = true; } else { item.IsSourceChoose = false; } } } } for (int i = 0; i < DestListBox2.Items.Count; i++) { foreach (var item in IPList.ConfigProperties) { if (item.Name == DestListBox2.Items[i].ToString()) { if (DestListBox2.GetItemChecked(i)) { item.IsDestChoose = true; } else { item.IsDestChoose = false; } } } } }
private void SaveConfigToTxt() { FileStream fs = new FileStream("HistoryConfig.txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); if (checkBox__CBTC.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } sw.WriteLine(this.txtPcapLength.Text); sw.WriteLine("MB"); string Source = ""; string Dest = ""; for (int i = 0; i < SourceListBox1.Items.Count; i++) { if (SourceListBox1.GetItemChecked(i)) { Source += "#" + SourceListBox1.Items[i].ToString(); } } for (int i = 0; i < DestListBox2.Items.Count; i++) { if (DestListBox2.GetItemChecked(i)) { Dest += "#" + DestListBox2.Items[i].ToString(); } } sw.WriteLine(Source); sw.WriteLine(Dest); sw.WriteLine(MaxVOBCToZC * 1000); sw.WriteLine(MaxZCToVOBC * 1000); sw.WriteLine(MaxVOBCToCI * 1000); sw.WriteLine(MaxCIToVOBC * 1000); sw.WriteLine(MaxVOBCToATS * 1000); sw.WriteLine(MaxATSToVOBC * 1000); if (checkBox_Signal.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } sw.WriteLine(this.Lte_Length.Text); sw.WriteLine("MB"); sw.WriteLine(CheckBox_GTPv2.Checked? "true":"false"); sw.WriteLine(CheckBox_DIAMETER.Checked ? "true" : "false"); sw.WriteLine(CheckBox_S1AP.Checked ? "true" : "false"); sw.Flush(); sw.Close(); fs.Close(); }
////信号监测 //private void button_CBTC_OK_Click(object sender, EventArgs e) //{ // SaveSettings(); // this.Hide(); // checkBox__CBTC.CheckState = CheckState.Unchecked; // splitContainer1.Panel2.Enabled = true; //恢复 // if (listSourIP.Count != 0) // { // for (int iS = 0; iS <= listSourIP.Count() - 1; iS++) // { // SourceIP_Port += listSourIP[iS] + "-" + listSourPort[iS] + ";"; // } // } // //保存并显示目的IP和端口 // if (listDestIP.Count != 0) // { // for (int iD = 0; iD <= listDestIP.Count() - 1; iD++) // { // DestIP_Port += listDestIP[iD] + "-" + listDestPort[iD] + ";"; // } // } // maxIntervalVtoZ = textBox1.Text; // maxIntervalZtoV = textBox2.Text; // FileStream fs = new FileStream("a.txt", FileMode.Create, FileAccess.Write); // StreamWriter sw = new StreamWriter(fs); // //开始写入 // sw.WriteLine(Protocol); // sw.WriteLine(SourceIP_Port); // sw.WriteLine(DestIP_Port); // sw.WriteLine(maxIntervalVtoZ); // sw.WriteLine(maxIntervalZtoV); // //清空缓冲区 // sw.Flush(); // //关闭流 // sw.Close(); // fs.Close(); //} //private void button_CBTC_Cancel_Click(object sender, EventArgs e) //{ // // LoadSettings(); // this.Hide(); // checkBox__CBTC.CheckState = CheckState.Unchecked; // splitContainer1.Panel2.Enabled = true; //恢复 //} #endregion #region 信令监测 private void button_Signal_OK_Click(object sender, EventArgs e) { CheckBoxStatues_CBTC1 = checkBox__CBTC.Checked; CheckBoxStatues_Signal1 = checkBox_Signal.Checked; //协议 CheckBoxStatues_GTPv21 = CheckBoxStatues_GTPv2; CheckBoxStatues_DIAMETER1 = CheckBoxStatues_DIAMETER; CheckBoxStatues_S1AP1 = CheckBoxStatues_S1AP; #region //Edit By K for (int i = 0; i < SourceListBox1.Items.Count; i++) { if (SourceListBox1.GetItemChecked(i)) { Slb++; } } for (int j = 0; j < DestListBox2.Items.Count; j++) { if (DestListBox2.GetItemChecked(j)) { Dlb++; } } #endregion if ((CheckBoxStatues_CBTC1 && (Slb >= 1) && (Dlb >= 1)) || (!CheckBoxStatues_CBTC1 && CheckBoxStatues_Signal1)) { FilterState = true; } if (accept != null) { accept(this, EventArgs.Empty); //当窗体触发事件,传递自身引用 } //signal GetAlarmInterval(); SetPcapLength(); SetPcapLengthLte(); SaveSetting(); SaveToTxt(); this.Hide(); SaveConfigToTxt(); // CheckBoxStatues_CBTC = false; // CheckBoxStatues_Signal = false; //协议 CheckBoxStatues_GTPv21 = false; CheckBoxStatues_DIAMETER1 = false; CheckBoxStatues_S1AP1 = false; Slb = 0; Dlb = 0; //Alb = 0; }