Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XslLoadException.cs
Go to the documentation of this file.
4
5namespace System.Xml.Xsl;
6
9{
11
12 public override string SourceUri
13 {
14 get
15 {
16 if (_lineInfo == null)
17 {
18 return null;
19 }
20 return _lineInfo.Uri;
21 }
22 }
23
24 public override int LineNumber
25 {
26 get
27 {
28 if (_lineInfo == null)
29 {
30 return 0;
31 }
32 return _lineInfo.Start.Line;
33 }
34 }
35
36 public override int LinePosition
37 {
38 get
39 {
40 if (_lineInfo == null)
41 {
42 return 0;
43 }
44 return _lineInfo.Start.Pos;
45 }
46 }
47
48 internal XslLoadException(string res, params string[] args)
49 : base(null, res, args)
50 {
51 }
52
53 internal XslLoadException(Exception inner, ISourceLineInfo lineInfo)
54 : base(inner, System.SR.Xslt_CompileError2, (string[])null)
55 {
56 SetSourceLineInfo(lineInfo);
57 }
58
60 : base(info, context)
61 {
62 if ((bool)info.GetValue("hasLineInfo", typeof(bool)))
63 {
64 string uriString = (string)info.GetValue("Uri", typeof(string));
65 int startLine = (int)info.GetValue("StartLine", typeof(int));
66 int startPos = (int)info.GetValue("StartPos", typeof(int));
67 int endLine = (int)info.GetValue("EndLine", typeof(int));
68 int endPos = (int)info.GetValue("EndPos", typeof(int));
70 }
71 }
72
74 : base(System.SR.Xml_UserException, error.ErrorText)
75 {
76 int line = error.Line;
77 int num = error.Column;
78 if (line == 0)
79 {
80 num = 0;
81 }
82 else if (num == 0)
83 {
84 num = 1;
85 }
86 SetSourceLineInfo(new SourceLineInfo(error.FileName, line, num, line, num));
87 }
88
89 internal void SetSourceLineInfo(ISourceLineInfo lineInfo)
90 {
91 _lineInfo = lineInfo;
92 }
93
95 {
96 base.GetObjectData(info, context);
97 info.AddValue("hasLineInfo", _lineInfo != null);
98 if (_lineInfo != null)
99 {
100 info.AddValue("Uri", _lineInfo.Uri, typeof(string));
101 info.AddValue("StartLine", _lineInfo.Start.Line, typeof(int));
102 info.AddValue("StartPos", _lineInfo.Start.Pos, typeof(int));
103 info.AddValue("EndLine", _lineInfo.End.Line, typeof(int));
104 info.AddValue("EndPos", _lineInfo.End.Pos, typeof(int));
105 }
106 }
107
108 private static string AppendLineInfoMessage(string message, ISourceLineInfo lineInfo)
109 {
110 if (lineInfo != null)
111 {
112 string fileName = SourceLineInfo.GetFileName(lineInfo.Uri);
114 if (text != null && text.Length > 0)
115 {
116 if (message.Length > 0 && !XmlCharType.IsWhiteSpace(message[message.Length - 1]))
117 {
118 message += " ";
119 }
120 message += text;
121 }
122 }
123 return message;
124 }
125
126 internal static string CreateMessage(ISourceLineInfo lineInfo, string res, params string[] args)
127 {
129 }
130
131 internal override string FormatDetailedMessage()
132 {
134 }
135}
static CultureInfo InvariantCulture
static string Xml_ErrorFilePosition
Definition SR.cs:20
Definition SR.cs:7
static bool IsWhiteSpace(char ch)
static string GetFileName(string uriString)
XslLoadException(CompilerError error)
XslLoadException(SerializationInfo info, StreamingContext context)
XslLoadException(string res, params string[] args)
XslLoadException(Exception inner, ISourceLineInfo lineInfo)
void SetSourceLineInfo(ISourceLineInfo lineInfo)
static string AppendLineInfoMessage(string message, ISourceLineInfo lineInfo)
static string CreateMessage(ISourceLineInfo lineInfo, string res, params string[] args)
override void GetObjectData(SerializationInfo info, StreamingContext context)
static string CreateMessage(string res, params string[] args)