Exemplo n.º 1
0
 private void ProcessCaptureDataButton_Click(object sender, EventArgs e)
 {
     ProcessCapturePackets pcp = new ProcessCapturePackets();
     ClientStatusToolStripStatusLabel.Text = "Loading capture packets into data store...";
     pcp.LoadPackets();
 }
Exemplo n.º 2
0
        private BindingList<PacketInterval> CreateBatchIntervals(string fileName)
        {
            bool success = false;

            BindingList<RawPacket> rawPackets = new BindingList<RawPacket>();
            BindingList<PacketInterval> intervalCounts = new BindingList<PacketInterval>();
            ProcessCapturePackets pcp = new ProcessCapturePackets();

            try
            {
                rawPackets = pcp.LoadPackets(fileName);
                if (rawPackets.Count > 0) { success = true; }
            }
            catch (Exception ex)
            {
                success = false;
                throw new Exception("BatchIntervalEngine: Error loading raw packet data for file [" + fileName + "]: " + ex.Message);
            }
            try
            {
                if (success)
                {
                    intervalCounts = pcp.CalculateIntervalCounts(rawPackets, _IntervalSize);
                }
            }
            catch (Exception ex)
            {
                success = false;
                throw new Exception("BatchIntervalEngine: Error calculating interval counts for file [" + fileName + "]: " + ex.Message);
            }

            // Load the batch intervals into the database
            if (success)
            {
                try
                {
                    success = pcp.SaveBatchIntervals(_DbConnectionString, intervalCounts);
                }
                catch (Exception ex)
                {
                    success = false;
                    throw new Exception("BatchIntervalEngine: Error saving batch interval counts: " + ex.Message);
                }
            }
            return intervalCounts;
        }