Ejemplo n.º 1
0
 public void CreatPcapFile()
 {
     genePcapFile = new GeneratePcapFile();
     FileName     = System.DateTime.Now.ToString("yyyy") + "." + System.DateTime.Now.ToString("MM") + "." + System.DateTime.Now.ToString("dd") + "  " + System.DateTime.Now.ToString("HH:mm");
     FileSavePath = SetFileSavePath();
     if (File.Exists(FileSavePath + "\\" + FileName + ".pcap"))
     {
         File.Delete(FileSavePath + "\\" + FileName + ".pcap");
         genePcapFile.CreatPcap(FileSavePath, FileName);
     }
     else
     {
         genePcapFile.CreatPcap(FileSavePath, FileName);
     }
 }
Ejemplo n.º 2
0
        public void CreatPcapFilePerDay(object o)
        {
            try
            {
                genePcapFile = new GeneratePcapFile();
                FileName     = System.DateTime.Now.ToString("yyyy") + "." + System.DateTime.Now.ToString("MM") + "." + System.DateTime.Now.ToString("dd") + "  " + System.DateTime.Now.ToString("HH:mm");
                FileSavePath = SetFileSavePath();
                genePcapFile.CreatPcap(FileSavePath, FileName);

                DateTime dt1 = DateTime.Parse(DateTime.Now.ToShortDateString() + " 23:59:59");
                DateTime dt2 = DateTime.Now;
                TimeSpan ts  = new TimeSpan();
                ts = dt1 - dt2;
                Int64 IntervalToTomorrow0 = Convert.ToInt64(ts.TotalMilliseconds + 1800000);
                CreatPcapPerDay.Change(IntervalToTomorrow0, IntervalToTomorrow0);
            }
            catch
            {
                MessageBox.Show("每天生成一个Pcap问题");
            }
        }