From 22597d011733b3972ca9f7ed4080087890cbda00 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Mon, 7 Dec 2020 12:09:11 -0700 Subject: [PATCH] Use more of the constants --- EduNetworkBuilder/IPAddress.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/EduNetworkBuilder/IPAddress.cs b/EduNetworkBuilder/IPAddress.cs index 3c92bdd..9d0b1b7 100644 --- a/EduNetworkBuilder/IPAddress.cs +++ b/EduNetworkBuilder/IPAddress.cs @@ -330,7 +330,10 @@ namespace EduNetworkBuilder /// /// If the IP address has not yet been assigned /// - public bool IsUnassigned() { return Unset; } + public bool IsUnassigned() { + if (GetIPString == NB.ZeroIPString) return true; //Sometimes we use 0.0.0.0 as unset. + return Unset; + } /// /// If the IP address is the same as the broadcast address @@ -358,7 +361,7 @@ namespace EduNetworkBuilder /// public bool IsLoopback() { - if (GetIPString == "127.0.0.1") return true; + if (GetIPString == NB.LoopbackIPString) return true; return false; } @@ -407,12 +410,12 @@ namespace EduNetworkBuilder public NB_IPAddress BreakIPNetmaskZero() { - NB_IPAddress one = new NB_IPAddress(GetIPString, "0.0.0.0", myType); + NB_IPAddress one = new NB_IPAddress(GetIPString, NB.ZeroIPString, myType); //0.0.0.0 return one; } public NB_IPAddress BreakIPNetmask32() { - NB_IPAddress one = new NB_IPAddress(GetIPString, "255.255.255.255", myType); + NB_IPAddress one = new NB_IPAddress(GetIPString, NB.BroadcastIPString, myType); //255.255.255.0 return one; } public NB_IPAddress BreakIPNetmaskRandom() @@ -434,12 +437,12 @@ namespace EduNetworkBuilder public NB_IPAddress BreakIPAddressZero() { - NB_IPAddress one = new NB_IPAddress("0.0.0.0", GetIPString, myType); + NB_IPAddress one = new NB_IPAddress(NB.ZeroIPString, GetIPString, myType); return one; } public NB_IPAddress BreakIPAddress32() { - NB_IPAddress one = new NB_IPAddress("255.255.255.255", GetIPString, myType); + NB_IPAddress one = new NB_IPAddress(NB.BroadcastIPString, GetIPString, myType); return one; } public NB_IPAddress BreakIPAddressRandom()