mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-03 07:15:34 +00:00
Lease: implemented IComparable and added ':' as allowed char for hardware address parsing.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user