Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XPathCompileException.cs
Go to the documentation of this file.
1
using
System.Runtime.Serialization
;
2
using
System.Text
;
3
4
namespace
System.Xml.Xsl.XPath
;
5
6
[
Serializable
]
7
internal
sealed
class
XPathCompileException
:
XslLoadException
8
{
9
private
enum
TrimType
10
{
11
Left
,
12
Right
,
13
Middle
14
}
15
16
public
string
queryString
;
17
18
public
int
startChar
;
19
20
public
int
endChar
;
21
22
internal
XPathCompileException
(
string
queryString
,
int
startChar
,
int
endChar
,
string
resId
,
params
string
[]
args
)
23
:
base
(
resId
,
args
)
24
{
25
this.queryString
=
queryString
;
26
this.startChar
=
startChar
;
27
this.endChar
=
endChar
;
28
}
29
30
internal
XPathCompileException
(
string
resId
,
params
string
[]
args
)
31
:
base
(
resId
,
args
)
32
{
33
}
34
35
internal
XPathCompileException
(
SerializationInfo
info
,
StreamingContext
context)
36
:
base
(
info
, context)
37
{
38
queryString
= (
string
)
info
.GetValue(
"QueryString"
,
typeof
(
string
));
39
startChar
= (int)
info
.GetValue(
"StartChar"
,
typeof
(
int
));
40
endChar
= (int)
info
.GetValue(
"EndChar"
,
typeof
(
int
));
41
}
42
43
public
override
void
GetObjectData
(
SerializationInfo
info
,
StreamingContext
context)
44
{
45
base
.GetObjectData(
info
, context);
46
info
.AddValue(
"QueryString"
,
queryString
);
47
info
.AddValue(
"StartChar"
,
startChar
);
48
info
.AddValue(
"EndChar"
,
endChar
);
49
}
50
51
private
static
void
AppendTrimmed
(
StringBuilder
sb,
string
value
,
int
startIndex
,
int
count
,
TrimType
trimType
)
52
{
53
if
(
count
<= 32)
54
{
55
sb.
Append
(
value
,
startIndex
,
count
);
56
return
;
57
}
58
switch
(
trimType
)
59
{
60
case
TrimType
.Left:
61
sb.
Append
(
"..."
);
62
sb.
Append
(
value
,
startIndex
+
count
- 32, 32);
63
break
;
64
case
TrimType
.Right:
65
sb.
Append
(
value
,
startIndex
, 32);
66
sb.
Append
(
"..."
);
67
break
;
68
case
TrimType
.Middle:
69
sb.
Append
(
value
,
startIndex
, 16);
70
sb.
Append
(
"..."
);
71
sb.
Append
(
value
,
startIndex
+
count
- 16, 16);
72
break
;
73
}
74
}
75
76
internal
string
MarkOutError
()
77
{
78
if
(
queryString
==
null
||
queryString
.Trim(
' '
).Length == 0)
79
{
80
return
null
;
81
}
82
int
num =
endChar
-
startChar
;
83
StringBuilder
stringBuilder
=
new
StringBuilder
();
84
AppendTrimmed
(
stringBuilder
,
queryString
, 0,
startChar
,
TrimType
.Left);
85
if
(num > 0)
86
{
87
stringBuilder
.Append(
" -->"
);
88
AppendTrimmed
(
stringBuilder
,
queryString
,
startChar
, num,
TrimType
.Middle);
89
}
90
stringBuilder
.Append(
"<-- "
);
91
AppendTrimmed
(
stringBuilder
,
queryString
,
endChar
,
queryString
.Length -
endChar
,
TrimType
.Right);
92
return
stringBuilder
.ToString();
93
}
94
95
internal
override
string
FormatDetailedMessage
()
96
{
97
string
text
=
Message
;
98
string
text2
=
MarkOutError
();
99
if
(
text2
!=
null
&&
text2
.Length > 0)
100
{
101
if
(
text
.Length > 0)
102
{
103
text
+=
Environment
.
NewLine
;
104
}
105
text
+=
text2
;
106
}
107
return
text
;
108
}
109
}
System.Environment.NewLine
static string NewLine
Definition
Environment.cs:202
System.Environment
Definition
Environment.cs:15
System.Runtime.Serialization.SerializationInfo
Definition
SerializationInfo.cs:7
System.Text.StringBuilder.Append
StringBuilder Append(char value, int repeatCount)
Definition
StringBuilder.cs:744
System.Text.StringBuilder
Definition
StringBuilder.cs:14
System.Xml.Xsl.XPath.XPathCompileException.XPathCompileException
XPathCompileException(string queryString, int startChar, int endChar, string resId, params string[] args)
Definition
XPathCompileException.cs:22
System.Xml.Xsl.XPath.XPathCompileException.endChar
int endChar
Definition
XPathCompileException.cs:20
System.Xml.Xsl.XPath.XPathCompileException.GetObjectData
override void GetObjectData(SerializationInfo info, StreamingContext context)
Definition
XPathCompileException.cs:43
System.Xml.Xsl.XPath.XPathCompileException.XPathCompileException
XPathCompileException(SerializationInfo info, StreamingContext context)
Definition
XPathCompileException.cs:35
System.Xml.Xsl.XPath.XPathCompileException.AppendTrimmed
static void AppendTrimmed(StringBuilder sb, string value, int startIndex, int count, TrimType trimType)
Definition
XPathCompileException.cs:51
System.Xml.Xsl.XPath.XPathCompileException.TrimType
TrimType
Definition
XPathCompileException.cs:10
System.Xml.Xsl.XPath.XPathCompileException.TrimType.Right
@ Right
System.Xml.Xsl.XPath.XPathCompileException.TrimType.Left
@ Left
System.Xml.Xsl.XPath.XPathCompileException.TrimType.Middle
@ Middle
System.Xml.Xsl.XPath.XPathCompileException.queryString
string queryString
Definition
XPathCompileException.cs:16
System.Xml.Xsl.XPath.XPathCompileException.MarkOutError
string MarkOutError()
Definition
XPathCompileException.cs:76
System.Xml.Xsl.XPath.XPathCompileException.startChar
int startChar
Definition
XPathCompileException.cs:18
System.Xml.Xsl.XPath.XPathCompileException.XPathCompileException
XPathCompileException(string resId, params string[] args)
Definition
XPathCompileException.cs:30
System.Xml.Xsl.XPath.XPathCompileException.FormatDetailedMessage
override string FormatDetailedMessage()
Definition
XPathCompileException.cs:95
System.Xml.Xsl.XPath.XPathCompileException
Definition
XPathCompileException.cs:8
System.Xml.Xsl.XslLoadException
Definition
XslLoadException.cs:9
System.Xml.Xsl.XsltException.Message
override string Message
Definition
XsltException.cs:31
string
System.Data.IsolationLevel.Serializable
@ Serializable
System.Runtime.Serialization
Definition
SerializationGuard.cs:3
System.Text
Definition
ConsoleEncoding.cs:1
System.Xml.Xsl.XPath
Definition
IFocus.cs:3
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.ExceptionArgument.startIndex
@ startIndex
System.ExceptionArgument.text
@ text
System.ExceptionArgument.value
@ value
System.ExceptionArgument.info
@ info
System.ExceptionArgument.count
@ count
System.Runtime.Serialization.StreamingContext
Definition
StreamingContext.cs:6
source
System.Private.Xml
System.Xml.Xsl.XPath
XPathCompileException.cs
Generated by
1.10.0