Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
T61Encoding.cs
Go to the documentation of this file.
1using System.Text;
2
3namespace System.Formats.Asn1;
4
5internal sealed class T61Encoding : Encoding
6{
7 private static readonly Encoding s_utf8Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
8
9 private static readonly Encoding s_latin1Encoding = Encoding.GetEncoding("iso-8859-1");
10
11 public override int GetByteCount(char[] chars, int index, int count)
12 {
13 return s_utf8Encoding.GetByteCount(chars, index, count);
14 }
15
16 public unsafe override int GetByteCount(char* chars, int count)
17 {
18 return s_utf8Encoding.GetByteCount(chars, count);
19 }
20
21 public override int GetByteCount(string s)
22 {
23 return s_utf8Encoding.GetByteCount(s);
24 }
25
27 {
28 return s_utf8Encoding.GetByteCount(chars);
29 }
30
31 public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
32 {
34 }
35
36 public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
37 {
38 return s_utf8Encoding.GetBytes(chars, charCount, bytes, byteCount);
39 }
40
41 public override int GetCharCount(byte[] bytes, int index, int count)
42 {
43 try
44 {
45 return s_utf8Encoding.GetCharCount(bytes, index, count);
46 }
48 {
49 return s_latin1Encoding.GetCharCount(bytes, index, count);
50 }
51 }
52
53 public unsafe override int GetCharCount(byte* bytes, int count)
54 {
55 try
56 {
57 return s_utf8Encoding.GetCharCount(bytes, count);
58 }
60 {
61 return s_latin1Encoding.GetCharCount(bytes, count);
62 }
63 }
64
66 {
67 try
68 {
69 return s_utf8Encoding.GetCharCount(bytes);
70 }
72 {
73 return s_latin1Encoding.GetCharCount(bytes);
74 }
75 }
76
77 public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
78 {
79 try
80 {
82 }
84 {
86 }
87 }
88
89 public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
90 {
91 try
92 {
93 return s_utf8Encoding.GetChars(bytes, byteCount, chars, charCount);
94 }
96 {
98 }
99 }
100
101 public override int GetMaxByteCount(int charCount)
102 {
103 return s_utf8Encoding.GetMaxByteCount(charCount);
104 }
105
106 public override int GetMaxCharCount(int byteCount)
107 {
108 return byteCount;
109 }
110}
static readonly Encoding s_utf8Encoding
Definition T61Encoding.cs:7
override int GetByteCount(ReadOnlySpan< char > chars)
unsafe override int GetBytes(char *chars, int charCount, byte *bytes, int byteCount)
override int GetMaxCharCount(int byteCount)
override int GetMaxByteCount(int charCount)
unsafe override int GetByteCount(char *chars, int count)
override int GetByteCount(string s)
unsafe override int GetChars(byte *bytes, int byteCount, char *chars, int charCount)
override int GetCharCount(ReadOnlySpan< byte > bytes)
override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
override int GetCharCount(byte[] bytes, int index, int count)
unsafe override int GetCharCount(byte *bytes, int count)
override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
override int GetByteCount(char[] chars, int index, int count)
static readonly Encoding s_latin1Encoding
Definition T61Encoding.cs:9
static Encoding GetEncoding(int codepage)
Definition Encoding.cs:593