Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlExceptionHelper.cs
Go to the documentation of this file.
4using System.Text;
5
6namespace System.Xml;
7
8internal static class XmlExceptionHelper
9{
11 private static void ThrowXmlException(XmlDictionaryReader reader, string res)
12 {
13 ThrowXmlException(reader, res, null);
14 }
15
17 public static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1)
18 {
19 ThrowXmlException(reader, res, arg1, null);
20 }
21
23 private static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2)
24 {
25 ThrowXmlException(reader, res, arg1, arg2, null);
26 }
27
29 private static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2, string arg3)
30 {
31 string text = System.SR.Format(res, arg1, arg2, arg3);
33 {
34 text = text + " " + System.SR.Format(System.SR.XmlLineInfo, xmlLineInfo.LineNumber, xmlLineInfo.LinePosition);
35 }
37 }
38
41 {
42 string text = exception.Message;
44 {
45 text = text + " " + System.SR.Format(System.SR.XmlLineInfo, xmlLineInfo.LineNumber, xmlLineInfo.LinePosition);
46 }
48 }
49
50 private static string GetName(string prefix, string localName)
51 {
52 if (prefix.Length == 0)
53 {
54 return localName;
55 }
56 return prefix + ":" + localName;
57 }
58
59 private static string GetWhatWasFound(XmlDictionaryReader reader)
60 {
61 if (reader.EOF)
62 {
64 }
65 switch (reader.NodeType)
66 {
67 case XmlNodeType.Element:
69 case XmlNodeType.EndElement:
71 case XmlNodeType.Text:
72 case XmlNodeType.Whitespace:
73 case XmlNodeType.SignificantWhitespace:
74 return System.SR.Format(System.SR.XmlFoundText, reader.Value);
75 case XmlNodeType.Comment:
77 case XmlNodeType.CDATA:
78 return System.SR.Format(System.SR.XmlFoundCData, reader.Value);
79 default:
81 }
82 }
83
89
91 public static void ThrowStartElementExpected(XmlDictionaryReader reader, string name)
92 {
94 }
95
97 public static void ThrowStartElementExpected(XmlDictionaryReader reader, string localName, string ns)
98 {
100 }
101
107
113
115 public static void ThrowFullStartElementExpected(XmlDictionaryReader reader, string name)
116 {
118 }
119
121 public static void ThrowFullStartElementExpected(XmlDictionaryReader reader, string localName, string ns)
122 {
124 }
125
131
133 public static void ThrowEndElementExpected(XmlDictionaryReader reader, string localName, string ns)
134 {
135 ThrowXmlException(reader, System.SR.XmlEndElementExpected, localName, ns, GetWhatWasFound(reader));
136 }
137
143
149
151 public static void ThrowMaxDepthExceeded(XmlDictionaryReader reader, int maxDepth)
152 {
154 }
155
161
167
169 public static void ThrowUndefinedPrefix(XmlDictionaryReader reader, string prefix)
170 {
172 }
173
179
181 public static void ThrowInvalidXml(XmlDictionaryReader reader, byte b)
182 {
184 }
185
188 {
189 ThrowXmlException(reader, System.SR.XmlUnexpectedEndOfFile, ((XmlBaseReader)reader).GetOpenElements());
190 }
191
197
199 public static void ThrowTokenExpected(XmlDictionaryReader reader, string expected, char found)
200 {
202 }
203
205 public static void ThrowTokenExpected(XmlDictionaryReader reader, string expected, string found)
206 {
208 }
209
211 public static void ThrowInvalidCharRef(XmlDictionaryReader reader)
212 {
214 }
215
221
223 public static void ThrowDuplicateXmlnsAttribute(XmlDictionaryReader reader, string localName, string ns)
224 {
225 string text = ((localName.Length != 0) ? ("xmlns:" + localName) : "xmlns");
227 }
228
230 public static void ThrowDuplicateAttribute(XmlDictionaryReader reader, string prefix1, string prefix2, string localName, string ns)
231 {
232 ThrowXmlException(reader, System.SR.XmlDuplicateAttribute, GetName(prefix1, localName), GetName(prefix2, localName), ns);
233 }
234
237 {
239 }
240
242 public static void ThrowInvalidRootData(XmlDictionaryReader reader)
243 {
245 }
246
252
255 {
257 }
258
260 public static void ThrowConversionOverflow(XmlDictionaryReader reader, string value, string type)
261 {
263 }
264
270
276
282
288
293
298
303
308}
static CultureInfo InvariantCulture
static string XmlTokenExpected
Definition SR.cs:504
static string XmlEndElementExpected
Definition SR.cs:384
static string XmlLineInfo
Definition SR.cs:456
static string XmlDictionaryStringIDRange
Definition SR.cs:370
static string XmlDeclNotFirst
Definition SR.cs:368
static string XmlInvalidFormat
Definition SR.cs:430
static string XmlProcessingInstructionNotSupported
Definition SR.cs:488
static string XmlFullStartElementLocalNameNsExpected
Definition SR.cs:406
static string XmlFoundElement
Definition SR.cs:394
static string XmlInvalidConversion
Definition SR.cs:312
static string XmlInvalidConversionWithoutValue
Definition SR.cs:314
static string XmlStartElementLocalNameNsExpected
Definition SR.cs:498
static string XmlEmptyNamespaceRequiresNullPrefix
Definition SR.cs:378
static string XmlInvalidRootData
Definition SR.cs:440
static string XmlFullStartElementExpected
Definition SR.cs:404
static string XmlUnexpectedEndOfFile
Definition SR.cs:510
static string XmlFullStartElementNameExpected
Definition SR.cs:408
static string XmlUndefinedPrefix
Definition SR.cs:506
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlMultipleRootElements
Definition SR.cs:472
static string XmlBase64DataExpected
Definition SR.cs:354
static string XmlFoundText
Definition SR.cs:402
static string XmlDuplicateAttribute
Definition SR.cs:376
static string XmlStartElementNameExpected
Definition SR.cs:500
static string XmlFoundCData
Definition SR.cs:390
static string XmlFoundEndElement
Definition SR.cs:396
static string XmlFoundComment
Definition SR.cs:392
static string XmlMaxDepthExceeded
Definition SR.cs:464
static string XmlDictionaryStringIDUndefinedSession
Definition SR.cs:372
static string XmlInvalidXmlByte
Definition SR.cs:452
static string XmlConversionOverflow
Definition SR.cs:360
static string XmlMaxBytesPerReadExceeded
Definition SR.cs:462
static string XmlInvalidCharRef
Definition SR.cs:418
static string XmlUnexpectedEndElement
Definition SR.cs:508
static string XmlMaxStringContentLengthExceeded
Definition SR.cs:466
static string XmlStartElementExpected
Definition SR.cs:316
static string XmlFoundNodeType
Definition SR.cs:400
static string XmlMaxArrayLengthExceeded
Definition SR.cs:460
static string XmlTagMismatch
Definition SR.cs:502
static string XmlInvalidUTF8Bytes
Definition SR.cs:446
static string XmlFoundEndOfFile
Definition SR.cs:398
static string XmlDictionaryStringIDUndefinedStatic
Definition SR.cs:374
Definition SR.cs:7
static string GetString(XmlDictionaryString s)
static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2)
static void ThrowInvalidRootData(XmlDictionaryReader reader)
static void ThrowMaxStringContentLengthExceeded(XmlDictionaryReader reader, int maxStringContentLength)
static void ThrowStartElementExpected(XmlDictionaryReader reader, string localName, string ns)
static void ThrowXmlDictionaryStringIDOutOfRange(XmlDictionaryReader reader)
static void ThrowEndElementExpected(XmlDictionaryReader reader, string localName, string ns)
static void ThrowTokenExpected(XmlDictionaryReader reader, string expected, char found)
static void ThrowProcessingInstructionNotSupported(XmlDictionaryReader reader)
static void ThrowStartElementExpected(XmlDictionaryReader reader, string name)
static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1)
static void ThrowEmptyNamespace(XmlDictionaryReader reader)
static void ThrowMaxDepthExceeded(XmlDictionaryReader reader, int maxDepth)
static void ThrowUndefinedPrefix(XmlDictionaryReader reader, string prefix)
static void ThrowFullStartElementExpected(XmlDictionaryReader reader, string name)
static XmlException CreateConversionException(string value, string type, Exception exception)
static void ThrowUnexpectedEndOfFile(XmlDictionaryReader reader)
static void ThrowXmlException(XmlDictionaryReader reader, XmlException exception)
static void ThrowConversionOverflow(XmlDictionaryReader reader, string value, string type)
static void ThrowFullStartElementExpected(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns)
static void ThrowInvalidBinaryFormat(XmlDictionaryReader reader)
static void ThrowStartElementExpected(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns)
static void ThrowMultipleRootElements(XmlDictionaryReader reader)
static void ThrowTagMismatch(XmlDictionaryReader reader, string expectedPrefix, string expectedLocalName, string foundPrefix, string foundLocalName)
static void ThrowTokenExpected(XmlDictionaryReader reader, string expected, string found)
static string GetName(string prefix, string localName)
static void ThrowXmlDictionaryStringIDUndefinedStatic(XmlDictionaryReader reader, int key)
static void ThrowXmlDictionaryStringIDUndefinedSession(XmlDictionaryReader reader, int key)
static void ThrowFullStartElementExpected(XmlDictionaryReader reader, string localName, string ns)
static XmlException CreateEncodingException(string value, Exception exception)
static void ThrowDuplicateAttribute(XmlDictionaryReader reader, string prefix1, string prefix2, string localName, string ns)
static string GetWhatWasFound(XmlDictionaryReader reader)
static void ThrowDuplicateXmlnsAttribute(XmlDictionaryReader reader, string localName, string ns)
static void ThrowBase64DataExpected(XmlDictionaryReader reader)
static void ThrowMaxArrayLengthExceeded(XmlDictionaryReader reader, int maxArrayLength)
static XmlException CreateEncodingException(byte[] buffer, int offset, int count, Exception exception)
static void ThrowInvalidCharRef(XmlDictionaryReader reader)
static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2, string arg3)
static void ThrowDeclarationNotFirst(XmlDictionaryReader reader)
static void ThrowInvalidXml(XmlDictionaryReader reader, byte b)
static void ThrowFullStartElementExpected(XmlDictionaryReader reader)
static void ThrowUnexpectedEndElement(XmlDictionaryReader reader)
static void ThrowMaxBytesPerReadExceeded(XmlDictionaryReader reader, int maxBytesPerRead)
static void ThrowXmlException(XmlDictionaryReader reader, string res)
static void ThrowStartElementExpected(XmlDictionaryReader reader)
static XmlException CreateConversionException(string type, Exception exception)
XmlNodeType NodeType
Definition XmlReader.cs:62