1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Globalization {
using System;
using System.Runtime.Serialization;
using System.Threading;
using System.Diagnostics.Contracts;
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
public class CultureNotFoundException : ArgumentException, ISerializable
{
private string m_invalidCultureName; // unrecognized culture name
#if !FEATURE_CORECLR
private Nullable<int> m_invalidCultureId; // unrecognized culture Lcid
#endif //!FEATURE_CORECLR
public CultureNotFoundException()
: base(DefaultMessage)
{
}
public CultureNotFoundException(String message)
: base(message)
{
}
public CultureNotFoundException(String paramName, String message)
: base(message, paramName)
{
}
public CultureNotFoundException(String message, Exception innerException)
: base(message, innerException)
{
}
#if !FEATURE_CORECLR
public CultureNotFoundException(String paramName, int invalidCultureId, String message)
: base(message, paramName)
{
m_invalidCultureId = invalidCultureId;
}
public CultureNotFoundException(String message, int invalidCultureId, Exception innerException)
: base(message, innerException)
{
m_invalidCultureId = invalidCultureId;
}
#endif //!FEATURE_CORECLR
public CultureNotFoundException(String paramName, string invalidCultureName, String message)
: base(message, paramName)
{
m_invalidCultureName = invalidCultureName;
}
public CultureNotFoundException(String message, string invalidCultureName, Exception innerException)
: base(message, innerException)
{
m_invalidCultureName = invalidCultureName;
}
protected CultureNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) {
#if !FEATURE_CORECLR
m_invalidCultureId = (Nullable<int>) info.GetValue("InvalidCultureId", typeof(Nullable<int>));
#endif //!FEATURE_CORECLR
m_invalidCultureName = (string) info.GetValue("InvalidCultureName", typeof(string));
}
[System.Security.SecurityCritical] // auto-generated_required
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
if (info==null) {
throw new ArgumentNullException("info");
}
Contract.EndContractBlock();
base.GetObjectData(info, context);
Nullable<int> invalidCultureId = null;
#if !FEATURE_CORECLR
invalidCultureId = m_invalidCultureId;
#endif //!FEATURE_CORECLR
info.AddValue("InvalidCultureId", invalidCultureId, typeof(Nullable<int>));
info.AddValue("InvalidCultureName", m_invalidCultureName, typeof(string));
}
#if !FEATURE_CORECLR
public virtual Nullable<int> InvalidCultureId
{
get { return m_invalidCultureId; }
}
#endif //!FEATURE_CORECLR
public virtual string InvalidCultureName
{
get { return m_invalidCultureName; }
}
private static String DefaultMessage
{
get
{
return Environment.GetResourceString("Argument_CultureNotSupported");
}
}
private String FormatedInvalidCultureId
{
get
{
#if !FEATURE_CORECLR
if (InvalidCultureId != null)
{
return String.Format(CultureInfo.InvariantCulture,
"{0} (0x{0:x4})", (int)InvalidCultureId);
}
#endif //!FEATURE_CORECLR
return InvalidCultureName;
}
}
public override String Message
{
get
{
String s = base.Message;
if (
#if !FEATURE_CORECLR
m_invalidCultureId != null ||
#endif //!FEATURE_CORECLR
m_invalidCultureName != null)
{
String valueMessage = Environment.GetResourceString("Argument_CultureInvalidIdentifier", FormatedInvalidCultureId);
if (s == null)
return valueMessage;
return s + Environment.NewLine + valueMessage;
}
return s;
}
}
}
}
|