Lease: implemented IComparable and added ':' as allowed char for hardware address parsing.

This commit is contained in:
Shreyas Zare
2019-06-15 18:06:27 +05:30
parent 95d7c7abd7
commit 834b35bdc7

View File

@@ -27,7 +27,7 @@ using TechnitiumLibrary.Net;
namespace DnsServerCore.Dhcp
{
public class Lease
public class Lease : IComparable<Lease>
{
#region variables
@@ -89,7 +89,7 @@ namespace DnsServerCore.Dhcp
private static byte[] ParseHardwareAddress(string hardwareAddress)
{
string[] parts = hardwareAddress.Split('-');
string[] parts = hardwareAddress.Split(new char[] { '-', ':' });
byte[] address = new byte[parts.Length];
for (int i = 0; i < parts.Length; i++)
@@ -140,6 +140,11 @@ namespace DnsServerCore.Dhcp
return _hostName + " [" + hardwareAddress + "]";
}
public int CompareTo(Lease other)
{
return _address.ConvertIpToNumber().CompareTo(other._address.ConvertIpToNumber());
}
#endregion
#region properties