Skip to content

Commit

Permalink
Fix backward compatibility after lduchosal#214 (lduchosal#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-ress authored Aug 25, 2022
1 parent b38ec2b commit 1c9e6d3
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions src/System.Net.IPNetwork/IPNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,25 @@ public static IPNetwork Parse(IPAddress ipaddress, IPAddress netmask)
return ipnetwork;
}

/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
/// Start : 192.168.0.1
/// End : 192.168.0.254
/// Broadcast : 192.168.0.255
/// </summary>
/// <param name="network"></param>
/// <returns></returns>
public static IPNetwork Parse(string network)
{
IPNetwork.InternalParse(false, network, CidrGuess.ClassFull, true, out var ipnetwork);
return ipnetwork;
}

/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
Expand All @@ -325,12 +344,32 @@ public static IPNetwork Parse(IPAddress ipaddress, IPAddress netmask)
/// <param name="network"></param>
/// <param name="sanitanize"></param>
/// <returns></returns>
public static IPNetwork Parse(string network, bool sanitanize = true)
public static IPNetwork Parse(string network, bool sanitanize)
{
IPNetwork.InternalParse(false, network, CidrGuess.ClassFull, sanitanize, out var ipnetwork);
return ipnetwork;
}

/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
/// Start : 192.168.0.1
/// End : 192.168.0.254
/// Broadcast : 192.168.0.255
/// </summary>
/// <param name="network"></param>
/// <param name="cidrGuess"></param>
/// <returns></returns>
public static IPNetwork Parse(string network, ICidrGuess cidrGuess)
{
IPNetwork.InternalParse(false, network, cidrGuess, true, out var ipnetwork);
return ipnetwork;
}

/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
Expand All @@ -346,7 +385,7 @@ public static IPNetwork Parse(string network, bool sanitanize = true)
/// <param name="cidrGuess"></param>
/// <param name="sanitanize"></param>
/// <returns></returns>
public static IPNetwork Parse(string network, ICidrGuess cidrGuess, bool sanitanize = true)
public static IPNetwork Parse(string network, ICidrGuess cidrGuess, bool sanitanize)
{
IPNetwork.InternalParse(false, network, cidrGuess, sanitanize, out var ipnetwork);
return ipnetwork;
Expand Down

0 comments on commit 1c9e6d3

Please sign in to comment.