Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XsltException.cs
Go to the documentation of this file.
6
7namespace System.Xml.Xsl;
8
10[TypeForwardedFrom("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
12{
13 private readonly string _res;
14
15 private readonly string[] _args;
16
17 private readonly string _sourceUri;
18
19 private readonly int _lineNumber;
20
21 private readonly int _linePosition;
22
23 private readonly string _message;
24
25 public virtual string? SourceUri => _sourceUri;
26
27 public virtual int LineNumber => _lineNumber;
28
29 public virtual int LinePosition => _linePosition;
30
31 public override string Message => _message ?? base.Message;
32
34 : base(info, context)
35 {
36 _res = (string)info.GetValue("res", typeof(string));
37 _args = (string[])info.GetValue("args", typeof(string[]));
38 _sourceUri = (string)info.GetValue("sourceUri", typeof(string));
39 _lineNumber = (int)info.GetValue("lineNumber", typeof(int));
40 _linePosition = (int)info.GetValue("linePosition", typeof(int));
41 string text = null;
43 while (enumerator.MoveNext())
44 {
45 SerializationEntry current = enumerator.Current;
46 if (current.Name == "version")
47 {
48 text = (string)current.Value;
49 }
50 }
51 if (text == null)
52 {
54 }
55 else
56 {
57 _message = null;
58 }
59 }
60
62 {
63 base.GetObjectData(info, context);
64 info.AddValue("res", _res);
65 info.AddValue("args", _args);
66 info.AddValue("sourceUri", _sourceUri);
67 info.AddValue("lineNumber", _lineNumber);
68 info.AddValue("linePosition", _linePosition);
69 info.AddValue("version", "2.0");
70 }
71
74 {
75 }
76
77 public XsltException(string message)
78 : this(message, null)
79 {
80 }
81
82 public XsltException(string message, Exception? innerException)
83 : this(System.SR.Xml_UserException, new string[1] { message }, null, 0, 0, innerException)
84 {
85 }
86
87 internal static XsltException Create(string res, params string[] args)
88 {
89 return new XsltException(res, args, null, 0, 0, null);
90 }
91
92 internal static XsltException Create(string res, string[] args, Exception inner)
93 {
94 return new XsltException(res, args, null, 0, 0, inner);
95 }
96
97 internal XsltException(string res, string[] args, string sourceUri, int lineNumber, int linePosition, Exception inner)
98 : base(CreateMessage(res, args, sourceUri, lineNumber, linePosition), inner)
99 {
100 base.HResult = -2146231998;
101 _res = res;
103 _lineNumber = lineNumber;
104 _linePosition = linePosition;
105 }
106
107 private static string CreateMessage(string res, string[] args, string sourceUri, int lineNumber, int linePosition)
108 {
109 try
110 {
111 string text = FormatMessage(res, args);
112 if (res != System.SR.Xslt_CompileError && lineNumber != 0)
113 {
115 }
116 return text;
117 }
119 {
120 return "UNKNOWN(" + res + ")";
121 }
122 }
123
124 [return: NotNullIfNotNull("key")]
125 private static string FormatMessage(string key, params string[] args)
126 {
127 string text = key;
128 if (text != null && args != null)
129 {
130 text = string.Format(CultureInfo.InvariantCulture, text, args);
131 }
132 return text;
133 }
134}
static CultureInfo InvariantCulture
static string Xslt_CompileError
Definition SR.cs:2066
static string Xml_ErrorFilePosition
Definition SR.cs:20
Definition SR.cs:7
override void GetObjectData(SerializationInfo info, StreamingContext context)
XsltException(string message, Exception? innerException)
static string CreateMessage(string res, string[] args, string sourceUri, int lineNumber, int linePosition)
static XsltException Create(string res, string[] args, Exception inner)
XsltException(SerializationInfo info, StreamingContext context)
static string FormatMessage(string key, params string[] args)
static XsltException Create(string res, params string[] args)
XsltException(string res, string[] args, string sourceUri, int lineNumber, int linePosition, Exception inner)