From 0a45b48e23ec6e27de7265872f1c010f4eb83d0f Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 6 Feb 2021 18:13:33 +0530 Subject: [PATCH] code refactoring done. --- .../Dhcp/Options/ClasslessStaticRouteOption.cs | 14 ++++++++------ .../Dhcp/Options/DomainNameServerOption.cs | 8 ++++---- .../Dhcp/Options/NetBiosNameServerOption.cs | 8 ++++---- .../Options/NetworkTimeProtocolServersOption.cs | 8 ++++---- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/DnsServerCore/Dhcp/Options/ClasslessStaticRouteOption.cs b/DnsServerCore/Dhcp/Options/ClasslessStaticRouteOption.cs index 237a6102..e59fe1cf 100644 --- a/DnsServerCore/Dhcp/Options/ClasslessStaticRouteOption.cs +++ b/DnsServerCore/Dhcp/Options/ClasslessStaticRouteOption.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2019 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2021 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,13 +30,13 @@ namespace DnsServerCore.Dhcp.Options { #region variables - ICollection _routes; + IReadOnlyCollection _routes; #endregion #region constructor - public ClasslessStaticRouteOption(ICollection routes) + public ClasslessStaticRouteOption(IReadOnlyCollection routes) : base(DhcpOptionCode.ClasslessStaticRoute) { _routes = routes; @@ -55,12 +55,14 @@ namespace DnsServerCore.Dhcp.Options if (s.Length < 5) throw new InvalidDataException(); - _routes = new List(); + List routes = new List(); while (s.Position < s.Length) { - _routes.Add(new Route(s)); + routes.Add(new Route(s)); } + + _routes = routes; } protected override void WriteOptionValue(Stream s) @@ -73,7 +75,7 @@ namespace DnsServerCore.Dhcp.Options #region properties - public ICollection Routes + public IReadOnlyCollection Routes { get { return _routes; } } #endregion diff --git a/DnsServerCore/Dhcp/Options/DomainNameServerOption.cs b/DnsServerCore/Dhcp/Options/DomainNameServerOption.cs index f867ff7c..f10be67a 100644 --- a/DnsServerCore/Dhcp/Options/DomainNameServerOption.cs +++ b/DnsServerCore/Dhcp/Options/DomainNameServerOption.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2020 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2021 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,13 +28,13 @@ namespace DnsServerCore.Dhcp.Options { #region variables - ICollection _addresses; + IReadOnlyCollection _addresses; #endregion #region constructor - public DomainNameServerOption(ICollection addresses) + public DomainNameServerOption(IReadOnlyCollection addresses) : base(DhcpOptionCode.DomainNameServer) { _addresses = addresses; @@ -71,7 +71,7 @@ namespace DnsServerCore.Dhcp.Options #region properties - public ICollection Addresses + public IReadOnlyCollection Addresses { get { return _addresses; } } #endregion diff --git a/DnsServerCore/Dhcp/Options/NetBiosNameServerOption.cs b/DnsServerCore/Dhcp/Options/NetBiosNameServerOption.cs index 6e84efb2..26dbcf91 100644 --- a/DnsServerCore/Dhcp/Options/NetBiosNameServerOption.cs +++ b/DnsServerCore/Dhcp/Options/NetBiosNameServerOption.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2020 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2021 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,13 +28,13 @@ namespace DnsServerCore.Dhcp.Options { #region variables - ICollection _addresses; + IReadOnlyCollection _addresses; #endregion #region constructor - public NetBiosNameServerOption(ICollection addresses) + public NetBiosNameServerOption(IReadOnlyCollection addresses) : base(DhcpOptionCode.NetBiosOverTcpIpNameServer) { _addresses = addresses; @@ -71,7 +71,7 @@ namespace DnsServerCore.Dhcp.Options #region properties - public ICollection Addresses + public IReadOnlyCollection Addresses { get { return _addresses; } } #endregion diff --git a/DnsServerCore/Dhcp/Options/NetworkTimeProtocolServersOption.cs b/DnsServerCore/Dhcp/Options/NetworkTimeProtocolServersOption.cs index 71ce20b3..a122df79 100644 --- a/DnsServerCore/Dhcp/Options/NetworkTimeProtocolServersOption.cs +++ b/DnsServerCore/Dhcp/Options/NetworkTimeProtocolServersOption.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2020 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2021 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,13 +28,13 @@ namespace DnsServerCore.Dhcp.Options { #region variables - ICollection _addresses; + IReadOnlyCollection _addresses; #endregion #region constructor - public NetworkTimeProtocolServersOption(ICollection addresses) + public NetworkTimeProtocolServersOption(IReadOnlyCollection addresses) : base(DhcpOptionCode.NetworkTimeProtocolServers) { _addresses = addresses; @@ -71,7 +71,7 @@ namespace DnsServerCore.Dhcp.Options #region properties - public ICollection Addresses + public IReadOnlyCollection Addresses { get { return _addresses; } } #endregion