示例#1
0
        internal virtual bool[] readFormatInformation()
        {
            bool[] modules = new bool[15];

            for (int i = 0; i <= 5; i++)
            {
                modules[i] = getElement(8, i);
            }

            modules[6] = getElement(8, 7);
            modules[7] = getElement(8, 8);
            modules[8] = getElement(7, 8);

            for (int i = 9; i <= 14; i++)
            {
                modules[i] = getElement(14 - i, 8);
            }

            int maskPattern = 0x5412;

            for (int i = 0; i <= 14; i++)
            {
                bool xorBit = false;
                if (((SystemUtils.URShift(maskPattern, i)) & 1) == 1)
                {
                    xorBit = true;
                }
                else
                {
                    xorBit = false;
                }

                if (modules[i] == xorBit)
                {
                    modules[i] = false;
                }
                else
                {
                    modules[i] = true;
                }
            }

            BCH15_5 corrector = new BCH15_5(modules);

            bool[] output            = corrector.correct();
            bool[] formatInformation = new bool[5];

            for (int i = 0; i < 5; i++)
            {
                formatInformation[i] = output[10 + i];
            }

            return(formatInformation);
        }
示例#2
0
        internal virtual bool[] readFormatInformation()
        {
            bool[] array = new bool[15];
            for (int i = 0; i <= 5; i++)
            {
                array[i] = getElement(8, i);
            }
            array[6] = getElement(8, 7);
            array[7] = getElement(8, 8);
            array[8] = getElement(7, 8);
            for (int i = 9; i <= 14; i++)
            {
                array[i] = getElement(14 - i, 8);
            }
            int number = 21522;

            for (int i = 0; i <= 14; i++)
            {
                bool flag = false;
                flag = (((SystemUtils.URShift(number, i) & 1) == 1) ? true : false);
                if (array[i] == flag)
                {
                    array[i] = false;
                }
                else
                {
                    array[i] = true;
                }
            }
            BCH15_5 bCH15_ = new BCH15_5(array);

            bool[] array2 = bCH15_.correct();
            bool[] array3 = new bool[5];
            for (int i = 0; i < 5; i++)
            {
                array3[i] = array2[10 + i];
            }
            return(array3);
        }