tabification
This commit is contained in:
parent
0d0f6b62b6
commit
a90eb17e96
8 changed files with 108 additions and 108 deletions
|
|
@ -146,23 +146,23 @@ namespace Server
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static bool IPMatchCIDR( string cidr, IPAddress ip )
|
||||
{
|
||||
public static bool IPMatchCIDR( string cidr, IPAddress ip )
|
||||
{
|
||||
if ( ip == null || ip.AddressFamily == AddressFamily.InterNetworkV6 )
|
||||
return false; //Just worry about IPv4 for now
|
||||
|
||||
|
||||
/*
|
||||
string[] str = cidr.Split( '/' );
|
||||
string[] str = cidr.Split( '/' );
|
||||
|
||||
if ( str.Length != 2 )
|
||||
return false;
|
||||
if ( str.Length != 2 )
|
||||
return false;
|
||||
|
||||
/* **************************************************
|
||||
IPAddress cidrPrefix;
|
||||
IPAddress cidrPrefix;
|
||||
|
||||
if ( !IPAddress.TryParse( str[0], out cidrPrefix ) )
|
||||
return false;
|
||||
if ( !IPAddress.TryParse( str[0], out cidrPrefix ) )
|
||||
return false;
|
||||
* */
|
||||
|
||||
/*
|
||||
|
|
@ -180,7 +180,7 @@ namespace Server
|
|||
|
||||
uint cidrPrefix = OrderedAddressValue( bytes );
|
||||
|
||||
int cidrLength = Utility.ToInt32( str[1] );
|
||||
int cidrLength = Utility.ToInt32( str[1] );
|
||||
//The below solution is the fastest solution of the three
|
||||
|
||||
*/
|
||||
|
|
@ -273,19 +273,19 @@ namespace Server
|
|||
|
||||
uint cidrPrefix = OrderedAddressValue( bytes );
|
||||
|
||||
return IPMatchCIDR( cidrPrefix, ip, cidrLength );
|
||||
}
|
||||
return IPMatchCIDR( cidrPrefix, ip, cidrLength );
|
||||
}
|
||||
|
||||
public static bool IPMatchCIDR( IPAddress cidrPrefix, IPAddress ip, int cidrLength )
|
||||
{
|
||||
if ( cidrPrefix == null || ip == null || cidrPrefix.AddressFamily == AddressFamily.InterNetworkV6 ) //Ignore IPv6 for now
|
||||
return false;
|
||||
public static bool IPMatchCIDR( IPAddress cidrPrefix, IPAddress ip, int cidrLength )
|
||||
{
|
||||
if ( cidrPrefix == null || ip == null || cidrPrefix.AddressFamily == AddressFamily.InterNetworkV6 ) //Ignore IPv6 for now
|
||||
return false;
|
||||
|
||||
uint cidrValue = SwapUnsignedInt( (uint)GetLongAddressValue( cidrPrefix ) );
|
||||
uint ipValue = SwapUnsignedInt( (uint)GetLongAddressValue( ip ) );
|
||||
|
||||
return IPMatchCIDR( cidrValue, ipValue, cidrLength );
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IPMatchCIDR( uint cidrPrefixValue, IPAddress ip, int cidrLength )
|
||||
{
|
||||
|
|
@ -481,10 +481,10 @@ namespace Server
|
|||
public static bool InsensitiveStartsWith( string first, string second )
|
||||
{
|
||||
return Insensitive.StartsWith( first, second );
|
||||
}
|
||||
}
|
||||
|
||||
#region To[Something]
|
||||
public static bool ToBoolean( string value )
|
||||
#region To[Something]
|
||||
public static bool ToBoolean( string value )
|
||||
{
|
||||
bool b;
|
||||
bool.TryParse( value, out b );
|
||||
|
|
@ -518,11 +518,11 @@ namespace Server
|
|||
int.TryParse( value, out i );
|
||||
|
||||
return i;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get[Something]
|
||||
public static int GetXMLInt32( string intString, int defaultValue )
|
||||
#region Get[Something]
|
||||
public static int GetXMLInt32( string intString, int defaultValue )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -530,11 +530,11 @@ namespace Server
|
|||
}
|
||||
catch
|
||||
{
|
||||
int val;
|
||||
if ( int.TryParse( intString, out val ) )
|
||||
return val;
|
||||
int val;
|
||||
if ( int.TryParse( intString, out val ) )
|
||||
return val;
|
||||
|
||||
return defaultValue;
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -605,15 +605,15 @@ namespace Server
|
|||
#pragma warning disable 618
|
||||
return address.Address;
|
||||
#pragma warning restore 618
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static double RandomDouble()
|
||||
public static double RandomDouble()
|
||||
{
|
||||
return m_Random.NextDouble();
|
||||
}
|
||||
#region In[...]Range
|
||||
public static bool InRange( Point3D p1, Point3D p2, int range )
|
||||
}
|
||||
#region In[...]Range
|
||||
public static bool InRange( Point3D p1, Point3D p2, int range )
|
||||
{
|
||||
return ( p1.m_X >= (p2.m_X - range) )
|
||||
&& ( p1.m_X <= (p2.m_X + range) )
|
||||
|
|
@ -643,10 +643,10 @@ namespace Server
|
|||
&& ( p1.X <= (p2.X + 18) )
|
||||
&& ( p1.Y >= (p2.Y - 18) )
|
||||
&& ( p1.Y <= (p2.Y + 18) );
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
public static Direction GetDirection( IPoint2D from, IPoint2D to )
|
||||
#endregion
|
||||
public static Direction GetDirection( IPoint2D from, IPoint2D to )
|
||||
{
|
||||
int dx = to.X - from.X;
|
||||
int dy = to.Y - from.Y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue