Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryCountBase64()

static bool System.Security.Cryptography.PemEncoding.TryCountBase64 ( ReadOnlySpan< char > str,
out int base64Start,
out int base64End,
out int base64DecodedSize )
inlinestaticprivate

Definition at line 128 of file PemEncoding.cs.

129 {
130 base64Start = 0;
131 base64End = str.Length;
132 if (str.IsEmpty)
133 {
134 base64DecodedSize = 0;
135 return true;
136 }
137 int num = 0;
138 int num2 = 0;
139 for (int i = 0; i < str.Length; i++)
140 {
141 char c = str[i];
143 {
144 if (num == 0)
145 {
146 base64Start++;
147 }
148 else
149 {
150 base64End--;
151 }
152 continue;
153 }
154 base64End = str.Length;
155 if (c == '=')
156 {
157 num2++;
158 continue;
159 }
160 if (num2 == 0 && IsBase64Character(c))
161 {
162 num++;
163 continue;
164 }
165 base64DecodedSize = 0;
166 return false;
167 }
168 int num3 = num2 + num;
169 if (num2 > 2 || ((uint)num3 & 3u) != 0)
170 {
171 base64DecodedSize = 0;
172 return false;
173 }
174 base64DecodedSize = (num3 >> 2) * 3 - num2;
175 return true;
176 }

References System.Security.Cryptography.PemEncoding.IsBase64Character(), System.Security.Cryptography.PemEncoding.IsWhiteSpaceCharacter(), and System.str.

Referenced by System.Security.Cryptography.PemEncoding.TryFind().