public BindingList<RawPacket> LoadPackets(string fileName)
        {
            BindingList<RawPacket> packets = new BindingList<RawPacket>();

            try
            {
                using (var context = new PacketAnalysisEntity())
                {
                    var captureBatchId = (from b in context.CaptureBatches
                                          where b.FileName == fileName
                                          select b.CaptureBatchId).FirstOrDefault();

                    var capturePackets = (from c in context.CapturePackets
                                          where c.CaptureBatchId == captureBatchId
                                          select c).ToList();

                    foreach (var pkt in capturePackets)
                    {
                        RawPacket packet = new RawPacket();
                        packet.CapturePacketId = pkt.CapturePacketId;
                        //packet.FileName = pkt.FileName;
                        packet.CaptureBatchId = pkt.CaptureBatchId;
                        packet.PacketNumber = pkt.PacketNumber;
                        packet.TimeStamp = pkt.TimeStamp;
                        packet.Marked = pkt.Marked == true? CaptureState.Marked : CaptureState.Unmarked;
                        packets.Add(packet);
                    }
                }
                return packets;
            }
            catch (Exception ex)
            {
                throw new Exception("Error retrieving capture packet data for file [" + fileName + "]: " + ex.Message);
            }
        }
        public void ProcessPacketFile(string fileName)
        {
            BindingList<RawPacket> rawPackets = new BindingList<RawPacket>();
            BindingList<CapturePacket> capturePackets = new BindingList<CapturePacket>();

            try
            {
                ////using (var context = new PacketCaptureContext())
                //using (var context = new PacketAnalysisEntity())
                //{
                //var capturePackets = context.CapturePackets.ToList();
                //var batch = context.BatchIntervals.ToList();

                CaptureFileData cfd = new CaptureFileData();
                capturePackets = cfd.GetRawPacketData();

                //foreach (var pkt in capturePackets)
                //foreach (var pkt in context.CapturePackets)
                foreach (var pkt in capturePackets)
                {
                    RawPacket packet = new RawPacket();
                    packet.CapturePacketId = pkt.CapturePacketId;
                    //packet.FileName = pkt.FileName;
                    packet.PacketNumber = pkt.PacketNumber;
                    packet.TimeStamp = pkt.TimeStamp;
                    packet.Marked = pkt.Marked == true? CaptureState.Marked : CaptureState.Unmarked;
                    rawPackets.Add(packet);

                    _PacketCount = rawPackets.Count;
                }
                //}
                //_PacketCount = rawPackets.Count;
            }
            catch (Exception ex)
            {
                throw new Exception("Error processing packet file: " + ex.Message);
            }
        }
        public BindingList<RawPacket> LoadPackets()
        {
            BindingList<RawPacket> packets = new BindingList<RawPacket>();

            try
            {
                //using (var context = new PacketCaptureContext())
                using (var context = new PacketAnalysisEntity())
                {
                    //var capturePackets = context.CapturePackets.ToList();
                    //var batch = context.BatchIntervals.ToList();

                    //foreach (var pkt in capturePackets)
                    foreach (var pkt in context.CapturePackets)
                    {
                        RawPacket packet = new RawPacket();
                        packet.CapturePacketId = pkt.CapturePacketId;
                        //packet.FileName = pkt.FileName;
                        packet.PacketNumber = pkt.PacketNumber;
                        packet.TimeStamp = pkt.TimeStamp;
                        packet.Marked = pkt.Marked == true? CaptureState.Marked : CaptureState.Unmarked;
                        packets.Add(packet);
                    }
                }
                return packets;
            }
            catch (Exception ex)
            {
                throw new Exception ("Error retrieving capture packet data: " + ex.Message);
            }
        }