Use more of the constants

This commit is contained in:
Tim Young 2020-12-07 12:09:11 -07:00
parent 2f63aacecd
commit 22597d0117

View File

@ -330,7 +330,10 @@ namespace EduNetworkBuilder
/// <summary> /// <summary>
/// If the IP address has not yet been assigned /// If the IP address has not yet been assigned
/// </summary> /// </summary>
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;
}
/// <summary> /// <summary>
/// If the IP address is the same as the broadcast address /// If the IP address is the same as the broadcast address
@ -358,7 +361,7 @@ namespace EduNetworkBuilder
/// </summary> /// </summary>
public bool IsLoopback() public bool IsLoopback()
{ {
if (GetIPString == "127.0.0.1") return true; if (GetIPString == NB.LoopbackIPString) return true;
return false; return false;
} }
@ -407,12 +410,12 @@ namespace EduNetworkBuilder
public NB_IPAddress BreakIPNetmaskZero() 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; return one;
} }
public NB_IPAddress BreakIPNetmask32() 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; return one;
} }
public NB_IPAddress BreakIPNetmaskRandom() public NB_IPAddress BreakIPNetmaskRandom()
@ -434,12 +437,12 @@ namespace EduNetworkBuilder
public NB_IPAddress BreakIPAddressZero() 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; return one;
} }
public NB_IPAddress BreakIPAddress32() 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; return one;
} }
public NB_IPAddress BreakIPAddressRandom() public NB_IPAddress BreakIPAddressRandom()