LocalisedArgumentException(
    Localised< string > message,
    string              paramName
)
    : this( message, paramName, null )
{
}
LocalisedArgumentNullException(
    Localised< string > message,
    Exception           innerException
)
    : this( null, message, innerException )
{
}
LocalisedArgumentException(
    Localised< string > message,
    Exception           innerException
)
    : this( message, null, innerException )
{
}
LocalisedArgumentOutOfRangeException(
    string              paramName,
    Localised< string > message
)
    : this( paramName, null, message, null )
{
}
LocalisedArgumentNullException(
    string              paramName,
    Localised< string > message
)
    : this( paramName, message, null )
{
}
LocalisedArgumentOutOfRangeException(
    Localised< string > message,
    Exception           innerException
)
    : this( null, null, message, innerException )
{
}
Пример #7
0
ParseException(
    Localised< string > message,
    Token               token
)
    : this( message, token, null )
{
}
LocalisedInvalidOperationException(
    Localised< string > message,
    Exception           innerException
)
    : base( (string)message, innerException )
{
    this.message = message;
}
LocalisedArgumentOutOfRangeException(
    string              paramName,
    object              actualValue,
    Localised< string > message
)
    : this( paramName, actualValue, message, null )
{
}
LocalisedFormatException(
    Localised< string > message,
    Exception           innerException
)
    : base( (string)message, innerException )
{
    this.message = message;
}
LocalisedArgumentException(
    Localised< string > message,
    string              paramName,
    Exception           innerException
)
    : base( (string)message, paramName, innerException )
{
    this.message = message;
}
SayMessage(
    Localised< string > reference
)
{
    if( object.ReferenceEquals( reference, null ) )
        throw new LocalisedArgumentNullException( "reference" );
    return LocalisedString.Format(
        _S("{0} is null"),
        reference );
}
Пример #13
0
ParseException(
    Localised< string > message,
    Token               token,
    Exception           innerException
)
    : base(
        message ?? _S( "Parse error" ),
        innerException )
{
    NonNull.CheckParameter( token, "token" );
    this.Token = token;
}
LocalisedArgumentNullException(
    string              paramName,
    Localised< string > message,
    Exception           innerException
)
    // Have to use this constructor and override ParamName because there's no
    // base constructor that takes all 3 parameters (!)
    : base( (string)message, innerException )
{
    this.paramname = paramName;
    this.message = message;
}
Пример #15
0
Concat(
    Localised< string > a,
    Localised< string > b
)
{
    a = a ?? Localised.Create( "" );
    b = b ?? Localised.Create( "" );
    return Localised.Create(
        (uic,c) =>
            Maybe.Create(
                string.Concat(
                    a.In( uic, c ),
                    b.In( uic, c ) ) ) );
}
Пример #16
0
Format(
    Localised< string > format,
    params object[]     args
)
{
    if( format == null ) throw new ArgumentNullException( "format" );
    if( args == null ) throw new ArgumentNullException( "args" );

    return Localised.Create(
        (uic,c) =>
            Maybe.Create(
                string.Format(
                    c,
                    format.In( uic, c ),
                    args.Select( arg =>
                        arg is ILocalised
                            ? ((ILocalised)arg)
                                .AsLocalisedObject()
                                .In( uic, c )
                            : arg )
                        .ToArray() ) ) );
}
LocalisedArgumentException(
    Localised< string > message
)
    : this( message, null, null )
{
}
Пример #18
0
ExpectData(
    this Token          dis,
    Localised< string > description
)
{
    NonNull.CheckParameter( dis, "dis" );
    NonNull.CheckParameter( description, "description" );
    return
        dis
        .As< DataToken >()
        .Else( () => {
            throw new ParseException(
                LocalisedString.Format( "Expected {0}", description ),
                dis ); } )
        .Data;
}
LocalisedArgumentOutOfRangeException(
    string              paramName,
    object              actualValue,
    Localised< string > message,
    Exception           innerException
)
    // Have to use this constructor and override ParamName and ActualValue
    // because there's no base constructor that takes all 4 parameters (!)
    : base( (string)message, innerException )
{
    this.message = message;
    this.paramname = paramName;
    this.actualvalue = actualValue;
}
Пример #20
0
SayMessage(
    Localised< string > reference
)
{
    if( object.ReferenceEquals( reference, null ) )
        throw new LocalisedArgumentNullException( "reference" );
    return this.SayMessageFunc( reference );
}
LocalisedInvalidOperationException(
    Localised< string > message
)
    : this( message, null )
{
}
LocalisedFormatException(
    Localised< string > message
)
    : this( message, null )
{
}