Correct minor issues in NetTools.cs

This commit is contained in:
Starbeamrainbowlabs 2016-10-29 13:04:29 +01:00
parent 0e6967cd33
commit 41e2ab6396
1 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
@ -11,7 +10,7 @@ namespace SBRL.Utilities
/// <summary> /// <summary>
/// case-insensitively gets the IPv4 index of the network interface with the given name. /// case-insensitively gets the IPv4 index of the network interface with the given name.
/// </summary> /// </summary>
/// <param name="interfaceName">The interface name to search for.</param> /// <param name="targetInterfaceName">The interface name to search for.</param>
/// <returns>The IPv4 index of the network interface with the given name.</returns> /// <returns>The IPv4 index of the network interface with the given name.</returns>
public static int GetNetworkIndexByName4 (string targetInterfaceName) public static int GetNetworkIndexByName4 (string targetInterfaceName)
{ {
@ -48,6 +47,8 @@ namespace SBRL.Utilities
} }
} }
} }
throw new Exception($"Error: Can't find network interface with the ip {targetIP}.");
} }
public static int GetIPv4Index (this NetworkInterface nic) public static int GetIPv4Index (this NetworkInterface nic)