Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XPathCompileException.cs
Go to the documentation of this file.
2using System.Text;
3
5
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
29
30 internal XPathCompileException(string resId, params string[] args)
31 : base(resId, args)
32 {
33 }
34
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
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 {
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;
85 if (num > 0)
86 {
87 stringBuilder.Append(" -->");
89 }
90 stringBuilder.Append("<-- ");
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 {
104 }
105 text += text2;
106 }
107 return text;
108 }
109}
static string NewLine
StringBuilder Append(char value, int repeatCount)
XPathCompileException(string queryString, int startChar, int endChar, string resId, params string[] args)
override void GetObjectData(SerializationInfo info, StreamingContext context)
XPathCompileException(SerializationInfo info, StreamingContext context)
static void AppendTrimmed(StringBuilder sb, string value, int startIndex, int count, TrimType trimType)
XPathCompileException(string resId, params string[] args)