public static unsafe void Dump(string fileName, PcapDataLink dataLink, int snapshotLength, IEnumerable <Packet> packets) { if (packets == null) { throw new ArgumentNullException("packets"); } pcap *pcapDescriptor = \u003CModule\u003E.pcap_open_dead(dataLink.Value, snapshotLength); if ((IntPtr)pcapDescriptor == IntPtr.Zero) { throw new InvalidOperationException("Unable to open open a dead capture"); } try { using (PacketDumpFile packetDumpFile = new PacketDumpFile(pcapDescriptor, fileName)) { foreach (Packet packet in packets) { packetDumpFile.Dump(packet); } } } finally { \u003CModule\u003E.pcap_close(pcapDescriptor); } }
public static void Dump(string fileName, DataLinkKind dataLink, int snapshotLength, IEnumerable <Packet> packets) { PcapDataLink dataLink1 = new PcapDataLink(dataLink); PacketDumpFile.Dump(fileName, dataLink1, snapshotLength, packets); }