| 1 |
// |
|---|
| 2 |
// Softec |
|---|
| 3 |
// |
|---|
| 4 |
// Contact: |
|---|
| 5 |
// |
|---|
| 6 |
// Designed by Denis Gervalle and Olivier Desaive |
|---|
| 7 |
// Written by Denis Gervalle |
|---|
| 8 |
// |
|---|
| 9 |
// Copyright 2004 by SOFTEC. All rights reserved. |
|---|
| 10 |
// |
|---|
| 11 |
|
|---|
| 12 |
using System; |
|---|
| 13 |
using System.Runtime.Serialization; |
|---|
| 14 |
using Softec; |
|---|
| 15 |
|
|---|
| 16 |
namespace Softec.AprSharp |
|---|
| 17 |
{ |
|---|
| 18 |
[Serializable] |
|---|
| 19 |
public class AprArgumentOutOfRangeException : AprArgumentException |
|---|
| 20 |
{ |
|---|
| 21 |
const int Result = unchecked ((int)0xA0651502); |
|---|
| 22 |
|
|---|
| 23 |
private object mActualValue; |
|---|
| 24 |
|
|---|
| 25 |
public AprArgumentOutOfRangeException() |
|---|
| 26 |
: base ( "Argument is out of range." ) |
|---|
| 27 |
{ |
|---|
| 28 |
HResult = Result; |
|---|
| 29 |
mActualValue = null; |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
public AprArgumentOutOfRangeException(string paramName) |
|---|
| 33 |
: base ( "Argument is out of range.", paramName ) |
|---|
| 34 |
{ |
|---|
| 35 |
HResult = Result; |
|---|
| 36 |
mActualValue = null; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
public AprArgumentOutOfRangeException(string paramName, string message) |
|---|
| 40 |
: base ( message, paramName ) |
|---|
| 41 |
{ |
|---|
| 42 |
HResult = Result; |
|---|
| 43 |
mActualValue = null; |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
public AprArgumentOutOfRangeException(string paramName, |
|---|
| 47 |
object actualValue, |
|---|
| 48 |
string message) |
|---|
| 49 |
: base ( message, paramName ) |
|---|
| 50 |
{ |
|---|
| 51 |
mActualValue = actualValue; |
|---|
| 52 |
HResult = Result; |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
public AprArgumentOutOfRangeException(string paramName, int apr_status) |
|---|
| 56 |
: base ( apr_status, paramName ) |
|---|
| 57 |
{ |
|---|
| 58 |
mActualValue = null; |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
public AprArgumentOutOfRangeException(string paramName, |
|---|
| 62 |
object actualValue, |
|---|
| 63 |
int apr_status) |
|---|
| 64 |
: base ( apr_status, paramName ) |
|---|
| 65 |
{ |
|---|
| 66 |
mActualValue = actualValue; |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
public AprArgumentOutOfRangeException(string paramName, |
|---|
| 70 |
int actualValue, |
|---|
| 71 |
int minval, int maxval) |
|---|
| 72 |
: base ( "Expect an integer value between " + minval |
|---|
| 73 |
+ " and " + maxval + ".", |
|---|
| 74 |
paramName ) |
|---|
| 75 |
{ |
|---|
| 76 |
mActualValue = (object)actualValue; |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|
| 79 |
public AprArgumentOutOfRangeException(SerializationInfo info, StreamingContext context) |
|---|
| 80 |
: base (info, context) |
|---|
| 81 |
{ |
|---|
| 82 |
mActualValue = info.GetString("ActualValue"); |
|---|
| 83 |
} |
|---|
| 84 |
|
|---|
| 85 |
public virtual object ActualValue |
|---|
| 86 |
{ |
|---|
| 87 |
get |
|---|
| 88 |
{ |
|---|
| 89 |
return mActualValue; |
|---|
| 90 |
} |
|---|
| 91 |
} |
|---|
| 92 |
|
|---|
| 93 |
public override string Message |
|---|
| 94 |
{ |
|---|
| 95 |
get |
|---|
| 96 |
{ |
|---|
| 97 |
string baseMessage = base.Message; |
|---|
| 98 |
if(mActualValue == null) |
|---|
| 99 |
return baseMessage; |
|---|
| 100 |
|
|---|
| 101 |
return( baseMessage + Environment.NewLine + mActualValue ); |
|---|
| 102 |
} |
|---|
| 103 |
} |
|---|
| 104 |
|
|---|
| 105 |
public override void GetObjectData(SerializationInfo info, StreamingContext context) |
|---|
| 106 |
{ |
|---|
| 107 |
base.GetObjectData(info,context); |
|---|
| 108 |
info.AddValue("ActualValue", mActualValue); |
|---|
| 109 |
} |
|---|
| 110 |
} |
|---|
| 111 |
} |
|---|