194 {
195 if (unicode.Length == 0)
196 {
198 }
199 int num = -1;
200 for (
int i = 0;
i < unicode.Length;
i++)
201 {
202 if (unicode[i] <= '\u001f')
203 {
204 throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, i),
"unicode");
205 }
206 if (bCheckAscii && unicode[i] >= '\u007f')
207 {
208 return false;
209 }
210 if (
IsDot(unicode[i]))
211 {
212 if (i == num + 1)
213 {
215 }
216 if (i - num > 64)
217 {
219 }
220 if (bUseStd3 && i > 0)
221 {
223 }
225 }
226 else if (bUseStd3)
227 {
229 }
230 }
231 if (num == -1 && unicode.Length > 63)
232 {
234 }
235 if (unicode.Length > 255 - ((!
IsDot(unicode[^1])) ? 1 : 0))
236 {
237 throw new ArgumentException(SR.Format(SR.Argument_IdnBadNameSize, 255 - ((!
IsDot(unicode[^1])) ? 1 : 0)),
"unicode");
238 }
239 if (bUseStd3 && !
IsDot(unicode[^1]))
240 {
242 }
243 return true;
244 }
static bool IsDot(char c)
static void ValidateStd3(char c, bool bNextToDot)