Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DecoderExceptionFallbackBuffer.cs
Go to the documentation of this file.
2
3namespace System.Text;
4
6{
7 public override int Remaining => 0;
8
9 public override bool Fallback(byte[] bytesUnknown, int index)
10 {
11 Throw(bytesUnknown, index);
12 return true;
13 }
14
15 public override char GetNextChar()
16 {
17 return '\0';
18 }
19
20 public override bool MovePrevious()
21 {
22 return false;
23 }
24
25 [DoesNotReturn]
26 private static void Throw(byte[] bytesUnknown, int index)
27 {
28 if (bytesUnknown == null)
29 {
30 bytesUnknown = Array.Empty<byte>();
31 }
32 StringBuilder stringBuilder = new StringBuilder(bytesUnknown.Length * 4);
33 for (int i = 0; i < bytesUnknown.Length && i < 20; i++)
34 {
35 StringBuilder stringBuilder2 = stringBuilder;
37 handler.AppendLiteral("[");
38 handler.AppendFormatted(bytesUnknown[i], "X2");
39 handler.AppendLiteral("]");
40 stringBuilder2.Append(ref handler);
41 }
42 if (bytesUnknown.Length > 20)
43 {
44 stringBuilder.Append(" ...");
45 }
46 throw new DecoderFallbackException(SR.Format(SR.Argument_InvalidCodePageBytesIndex, stringBuilder, index), bytesUnknown, index);
47 }
48}
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Argument_InvalidCodePageBytesIndex
Definition SR.cs:652
Definition SR.cs:7
override bool Fallback(byte[] bytesUnknown, int index)
static void Throw(byte[] bytesUnknown, int index)
StringBuilder Append(char value, int repeatCount)