// Token: 0x06002FDA RID: 12250 RVA: 0x000B7630 File Offset: 0x000B5830 private static bool ValidateStd3AndAscii(string unicode, bool bUseStd3, bool bCheckAscii) { if (unicode.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "unicode"); } int num = -1; for (int i = 0; i < unicode.Length; i++) { if (unicode[i] <= '\u001f') { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequence", new object[] { i }), "unicode"); } if (bCheckAscii && unicode[i] >= '\u007f') { return(false); } if (IdnMapping.IsDot(unicode[i])) { if (i == num + 1) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "unicode"); } if (i - num > 64) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "Unicode"); } if (bUseStd3 && i > 0) { IdnMapping.ValidateStd3(unicode[i - 1], true); } num = i; } else if (bUseStd3) { IdnMapping.ValidateStd3(unicode[i], i == num + 1); } } if (num == -1 && unicode.Length > 63) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "unicode"); } if (unicode.Length > 255 - (IdnMapping.IsDot(unicode[unicode.Length - 1]) ? 0 : 1)) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadNameSize", new object[] { 255 - (IdnMapping.IsDot(unicode[unicode.Length - 1]) ? 0 : 1) }), "unicode"); } if (bUseStd3 && !IdnMapping.IsDot(unicode[unicode.Length - 1])) { IdnMapping.ValidateStd3(unicode[unicode.Length - 1], true); } return(true); }
private static bool ValidateStd3AndAscii(string unicode, bool bUseStd3, bool bCheckAscii) { if (unicode.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "unicode"); } int num1 = -1; for (int index = 0; index < unicode.Length; ++index) { if ((int)unicode[index] <= 31) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequence", (object)index), "unicode"); } if (bCheckAscii && (int)unicode[index] >= (int)sbyte.MaxValue) { return(false); } if (IdnMapping.IsDot(unicode[index])) { if (index == num1 + 1) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "unicode"); } if (index - num1 > 64) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "Unicode"); } if (bUseStd3 && index > 0) { IdnMapping.ValidateStd3(unicode[index - 1], true); } num1 = index; } else if (bUseStd3) { IdnMapping.ValidateStd3(unicode[index], index == num1 + 1); } } if (num1 == -1 && unicode.Length > 63) { throw new ArgumentException(Environment.GetResourceString("Argument_IdnBadLabelSize"), "unicode"); } int length = unicode.Length; int num2 = (int)byte.MaxValue; string str1 = unicode; int index1 = str1.Length - 1; int num3 = IdnMapping.IsDot(str1[index1]) ? 0 : 1; int num4 = num2 - num3; if (length > num4) { string key = "Argument_IdnBadNameSize"; object[] objArray = new object[1]; int index2 = 0; int num5 = (int)byte.MaxValue; string str2 = unicode; int index3 = str2.Length - 1; int num6 = IdnMapping.IsDot(str2[index3]) ? 0 : 1; // ISSUE: variable of a boxed type __Boxed <int> local = (ValueType)(num5 - num6); objArray[index2] = (object)local; throw new ArgumentException(Environment.GetResourceString(key, objArray), "unicode"); } if (bUseStd3) { string str2 = unicode; int index2 = str2.Length - 1; if (!IdnMapping.IsDot(str2[index2])) { string str3 = unicode; int index3 = str3.Length - 1; IdnMapping.ValidateStd3(str3[index3], true); } } return(true); }