Changeset 2602


Ignore:
Timestamp:
Feb 6, 2011, 12:41:11 AM (11 years ago)
Author:
Matthäus Wander
Message:

NetworkCapture:

  • some fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/NetworkCapture/NetworkCapture.cs

    r2538 r2602  
    2020using Cryptool.PluginBase.Miscellaneous;
    2121using System.Windows.Controls;
     22using PacketDotNet;
    2223using SharpPcap;
    2324using SharpPcap.WinPcap;
     
    2627{
    2728    [Author("Matthäus Wander", "wander@cryptool.org", "University of Duisburg-Essen", "http://www.vs.uni-due.de")]
    28     [PluginInfo(true, "Network Capture", "Capture data from a network device", null, "CrypWin/images/default.png")]
    29     public class NetworkCapture : IGenerator
     29    [PluginInfo(true, "Network Capture", "Capture data from a network device (requires WinPcap library)", null, "CrypWin/images/default.png")]
     30    public class NetworkCapture : IGeneratorMisc
    3031    {
    3132        #region Private Variables
     
    8687        public void Execute()
    8788        {
    88             if (devices.Count == 0)
     89            if (devices == null || devices.Count == 0)
    8990            {
    9091                GuiLogMessage("No device available. Is WinPcap installed?", NotificationLevel.Error);
     
    140141                writer.Close();
    141142            }
     143
     144            ProgressChanged(1, 1);
    142145        }
    143146
    144147        public void Initialize()
    145148        {
    146             this.devices =  WinPcapDeviceList.Instance;
    147             foreach(WinPcapDevice dev in devices)
     149            try
    148150            {
    149                 this.settings.Collection.Add(dev.Description);   
     151
     152                this.devices = WinPcapDeviceList.Instance;
     153                foreach (WinPcapDevice dev in devices)
     154                {
     155                    this.settings.Collection.Add(dev.Description);
     156                }
     157            }
     158            catch (PcapException e)
     159            {
     160                GuiLogMessage("No device available. Is WinPcap installed?", NotificationLevel.Error);
    150161            }
    151162        }
Note: See TracChangeset for help on using the changeset viewer.