using System; using System.Linq; using System.Net; namespace DhcpServer { public partial class DhcpPacket { public string ClientMacAddressHex => string.Join("-", ClientMacAddress.Select(p => p.ToString("X2"))); internal void LoadClientEntry(DhcpEntry entry) { if (entry == null) throw new ArgumentNullException(nameof(entry)); if (entry.IpAddress != null) YourIpAddress = IPAddress.Parse(entry.IpAddress); if (entry.SubNetMask != null) SubNetMask = IPAddress.Parse(entry.SubNetMask); if (entry.GateWay != null) Router = IPAddress.Parse(entry.GateWay); if (entry.DnsServer != null) DnsServer = IPAddress.Parse(entry.DnsServer); if (entry.TftpServer != null) { TftpServer = entry.TftpServer; NextServerIpAddress = IPAddress.Parse(entry.TftpServer); } if (entry.BootFileName != null) BootFileName = entry.BootFileName; } } }