private void MonitorTask() { while (this._run) { try { if (this._last == null) { this._last = new NetworkStatus(); Thread.Sleep(this._waitInterval); } else { NetworkStatus networkStatus = new NetworkStatus(); if (this.NetworkInterfaceConnected != null && this._monitorNewConnections) { foreach (NetworkInterface current in networkStatus.Connected(this._last)) { OperationalStatus lastOperationalStatus = OperationalStatus.NotPresent; if (this._last.Contains(current.Id)) { lastOperationalStatus = this._last[current.Id].OperationalStatus; } this.NetworkInterfaceConnected(this, new NetworkStatusMonitor.StatusMonitorEventArgs { EventType = NetworkStatusMonitor.StatusMonitorEventType.Connected, Interface = current, LastOperationalStatus = lastOperationalStatus }); } } if (this.NetworkInterfaceDisconnected != null && this._monitorDisconnections) { foreach (NetworkInterface current2 in networkStatus.Disconnected(this._last)) { this.NetworkInterfaceDisconnected(this, new NetworkStatusMonitor.StatusMonitorEventArgs { EventType = NetworkStatusMonitor.StatusMonitorEventType.Disconnected, Interface = current2, LastOperationalStatus = OperationalStatus.Up }); } } if (this.NetworkInterfaceChanged != null && this._monitorAnyStatusChange) { foreach (NetworkInterface current3 in networkStatus.Changed(this._last)) { OperationalStatus lastOperationalStatus2 = OperationalStatus.NotPresent; if (this._last.Contains(current3.Id)) { lastOperationalStatus2 = this._last[current3.Id].OperationalStatus; } this.NetworkInterfaceChanged(this, new NetworkStatusMonitor.StatusMonitorEventArgs { EventType = NetworkStatusMonitor.StatusMonitorEventType.Changed, Interface = current3, LastOperationalStatus = lastOperationalStatus2 }); } } this._last = networkStatus; if (this._run) { Thread.Sleep(this._waitInterval); } object pulse = this._pulse; lock (pulse) { Monitor.PulseAll(this._pulse); } } } catch (Exception arg_218_0) { Console.WriteLine(arg_218_0.ToString()); Interlocked.Increment(ref this._exceptionCount); } } }