/// <Summary>
/// Convert the IP address to the long type in decimal format
/// </Summary>
/// <Param name = "ip"> </param>
/// <Returns> </returns>
Public static long ToTen (string ip)
{
String [] arr;
Arr = Regex. Split (ip. Replace (".",","),",");
Long a = long. Parse (arr [0]. ToString ());
Long B = long. Parse (arr [1]. ToString ());
Long c = long. Parse (arr [2]. ToString ());
Long d = long. Parse (arr [3]. ToString ());
Long s = a * 256*256*256 + B * 256*256 + c * 256 + d;
Return s;
}
/// <Summary>
/// Convert a long-type IP address to an IP address.
/// </Summary>
/// <Param name = "ip"> </param>
/// <Returns> </returns>
Public static string toip (long IP)
{
Int A = (INT) (IP/16777216 );
Int B = (INT) (IP % 16777216)/65536 );
Int c = (INT) (IP % 16777216) % 65536)/256 );
Int d = (INT) (IP % 16777216) % 65536) % 256 );
String S = A. tostring () + "." + B. tostring () + "." + C. tostring () + "." + D. tostring ();
Return S;
}