Exemplo n.º 1
0
        internal static bool IsNormalized(string strInput, NormalizationForm normForm)
        {
            Normalization.EnsureInitialized(normForm);
            int num1 = 0;
            int num2 = (int)normForm;
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            int&   iError   = @num1;
            string lpString = strInput;
            int    length   = lpString.Length;
            bool   flag     = Normalization.nativeNormalizationIsNormalizedString((NormalizationForm)num2, iError, lpString, length);

            if (num1 <= 8)
            {
                if (num1 == 0)
                {
                    return(flag);
                }
                if (num1 == 8)
                {
                    throw new OutOfMemoryException(Environment.GetResourceString("Arg_OutOfMemoryException"));
                }
            }
            else if (num1 == 87 || num1 == 1113)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), "strInput");
            }
            throw new InvalidOperationException(Environment.GetResourceString("UnknownError_Num", (object)num1));
        }
        internal static bool IsNormalized(string strInput, NormalizationForm normForm)
        {
            Normalization.EnsureInitialized(normForm);
            int  num    = 0;
            bool result = Normalization.nativeNormalizationIsNormalizedString(normForm, ref num, strInput, strInput.Length);

            if (num <= 8)
            {
                if (num == 0)
                {
                    return(result);
                }
                if (num == 8)
                {
                    throw new OutOfMemoryException(Environment.GetResourceString("Arg_OutOfMemoryException"));
                }
            }
            else if (num == 87 || num == 1113)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), "strInput");
            }
            throw new InvalidOperationException(Environment.GetResourceString("UnknownError_Num", new object[]
            {
                num
            }));
        }
Exemplo n.º 3
0
        internal static string Normalize(string strInput, NormalizationForm normForm)
        {
            Normalization.EnsureInitialized(normForm);
            int num1 = 0;
            int num2 = (int)normForm;
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            int&   iError1      = @num1;
            string lpSrcString1 = strInput;
            int    length1      = lpSrcString1.Length;
            // ISSUE: variable of the null type
            __Null local       = null;
            int    cwDstLength = 0;
            int    length2     = Normalization.nativeNormalizationNormalizeString((NormalizationForm)num2, iError1, lpSrcString1, length1, (char[])local, cwDstLength);

            if (num1 != 0)
            {
                if (num1 == 87)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), "strInput");
                }
                if (num1 == 8)
                {
                    throw new OutOfMemoryException(Environment.GetResourceString("Arg_OutOfMemoryException"));
                }
                throw new InvalidOperationException(Environment.GetResourceString("UnknownError_Num", (object)num1));
            }
            if (length2 == 0)
            {
                return(string.Empty);
            }
            char[] chArray;
            do
            {
                chArray = new char[length2];
                int num3 = (int)normForm;
                // ISSUE: explicit reference operation
                // ISSUE: variable of a reference type
                int&   iError2      = @num1;
                string lpSrcString2 = strInput;
                int    length3      = lpSrcString2.Length;
                char[] lpDstString  = chArray;
                int    length4      = lpDstString.Length;
                length2 = Normalization.nativeNormalizationNormalizeString((NormalizationForm)num3, iError2, lpSrcString2, length3, lpDstString, length4);
                if (num1 != 0)
                {
                    if (num1 <= 87)
                    {
                        if (num1 != 8)
                        {
                            if (num1 == 87)
                            {
                                goto label_15;
                            }
                            else
                            {
                                goto label_17;
                            }
                        }
                        else
                        {
                            goto label_16;
                        }
                    }
                }
                else
                {
                    goto label_18;
                }
            }while (num1 == 122);
            if (num1 != 1113)
            {
                goto label_17;
            }
label_15:
            throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequence", (object)length2), "strInput");
label_16:
            throw new OutOfMemoryException(Environment.GetResourceString("Arg_OutOfMemoryException"));
label_17:
            throw new InvalidOperationException(Environment.GetResourceString("UnknownError_Num", (object)num1));
label_18:
            return(new string(chArray, 0, length2));
        }
        internal static string Normalize(string strInput, NormalizationForm normForm)
        {
            Normalization.EnsureInitialized(normForm);
            int num  = 0;
            int num2 = Normalization.nativeNormalizationNormalizeString(normForm, ref num, strInput, strInput.Length, null, 0);

            if (num != 0)
            {
                if (num == 87)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), "strInput");
                }
                if (num == 8)
                {
                    throw new OutOfMemoryException(Environment.GetResourceString("Arg_OutOfMemoryException"));
                }
                throw new InvalidOperationException(Environment.GetResourceString("UnknownError_Num", new object[]
                {
                    num
                }));
            }
            else
            {
                if (num2 == 0)
                {
                    return(string.Empty);
                }
                char[] array;
                for (;;)
                {
                    array = new char[num2];
                    num2  = Normalization.nativeNormalizationNormalizeString(normForm, ref num, strInput, strInput.Length, array, array.Length);
                    if (num == 0)
                    {
                        goto IL_103;
                    }
                    if (num <= 87)
                    {
                        break;
                    }
                    if (num != 122)
                    {
                        goto Block_9;
                    }
                }
                if (num == 8)
                {
                    throw new OutOfMemoryException(Environment.GetResourceString("Arg_OutOfMemoryException"));
                }
                if (num != 87)
                {
                    goto IL_E4;
                }
                goto IL_B0;
Block_9:
                if (num != 1113)
                {
                    goto IL_E4;
                }
IL_B0:
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequence", new object[]
                {
                    num2
                }), "strInput");
IL_E4:
                throw new InvalidOperationException(Environment.GetResourceString("UnknownError_Num", new object[]
                {
                    num
                }));
IL_103:
                return(new string(array, 0, num2));
            }
        }