public override void Validate( string value )
{
base.Validate( value );
IPAddress test;
if ( value.Length == 0 ) {
test = GetBlankValueSubstitute();
} else if ( !IPAddress.TryParse( value, out test ) ) {
throw new FormatException( "Value cannot be parsed as an IP Address." );
}
if ( NotAny && test.Equals( IPAddress.Any ) ) {
throw new FormatException( String.Format( "Value cannot be {0}", IPAddress.Any ) );
}
if ( NotNone && test.Equals( IPAddress.None ) ) {
throw new FormatException( String.Format( "Value cannot be {0}", IPAddress.None ) );
}
if ( NotLAN && test.IsLAN() ) {
throw new FormatException( "Value cannot be a LAN address." );
}
if ( NotLoopback && IPAddress.IsLoopback( test ) ) {
throw new FormatException( "Value cannot be a loopback address." );
}
}