public static void Initialize(SharpPcap.CaptureDeviceList d) { DeviceList = d; // Select default device ActiveDeviceIndex = 0; }
private static void TestPCap() { // Just try enumerating interfaces, if this fails for any reason we assume // PCap is not properly installed. try { SharpPcap.CaptureDeviceList devices = SharpPcap.CaptureDeviceList.Instance; Configuration.HostRawEthernetInterfacesAvailable = true; } catch { Configuration.HostRawEthernetInterfacesAvailable = false; } }
private void GetDeviceList() { try { SharpPcap.CaptureDeviceList d = SharpPcap.CaptureDeviceList.Instance; NetMonitor.Initialize(d); } catch (DllNotFoundException) { _errOccured = true; MessageBox.Show("WinPcap is not installed on this computer. please install it." + Environment.NewLine + "You can download it from http://www.winpcap.org", "Missing Component...", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch { MessageBox.Show("An unknown error occured while loading components, please reinstall WhiteNet.", "Unknown Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); _errOccured = true; } }