internal static int calcExactVersion(Point[] centers, int[] angle, int[] moduleSize, bool[][] image)
        {
            Point point;
            int   num2;

            bool[]  target = new bool[0x12];
            Point[] points = new Point[0x12];
            Axis    axis   = new Axis(angle, moduleSize[1])
            {
                Origin = centers[1]
            };
            int num = 0;

            while (num < 6)
            {
                for (num2 = 0; num2 < 3; num2++)
                {
                    point = axis.translate((int)(num2 - 7), (int)(num - 3));
                    target[num2 + (num * 3)] = image[point.X][point.Y];
                    points[num2 + (num * 3)] = point;
                }
                num++;
            }
            canvas.drawPoints(points, Color_Fields.RED);
            int num3 = 0;

            try
            {
                num3 = checkVersionInfo(target);
            }
            catch (InvalidVersionInfoException)
            {
                canvas.println("Version info error. now retry with other place one.");
                axis.Origin      = centers[2];
                axis.ModulePitch = moduleSize[2];
                for (num2 = 0; num2 < 6; num2++)
                {
                    for (num = 0; num < 3; num++)
                    {
                        point = axis.translate((int)(num2 - 3), (int)(num - 7));
                        target[num + (num2 * 3)] = image[point.X][point.Y];
                        points[num2 + (num * 3)] = point;
                    }
                }
                canvas.drawPoints(points, Color_Fields.RED);
                try
                {
                    num3 = checkVersionInfo(target);
                }
                catch (VersionInformationException exception2)
                {
                    throw exception2;
                }
            }
            return(num3);
        }
Esempio n. 2
0
        internal static int calcExactVersion(Point[] centers, int[] angle, int[] moduleSize, bool[][] image)
        {
            bool[]  versionInformation = new bool[18];
            Point[] points             = new Point[18];
            Point   target;
            Axis    axis = new Axis(angle, moduleSize[UR]);          //UR

            axis.Origin = centers[UR];

            for (int y = 0; y < 6; y++)
            {
                for (int x = 0; x < 3; x++)
                {
                    target = axis.translate(x - 7, y - 3);
                    versionInformation[x + y * 3] = image[target.X][target.Y];
                    points[x + y * 3]             = target;
                }
            }
            canvas.drawPoints(points, ThoughtWorks.QRCode.Codec.Util.Color_Fields.RED);

            int exactVersion = 0;

            try
            {
                exactVersion = checkVersionInfo(versionInformation);
            }
            catch (InvalidVersionInfoException e)
            {
                string.Format("{0}", e);
                canvas.println("Version info error. now retry with other place one.");
                axis.Origin      = centers[DL];
                axis.ModulePitch = moduleSize[DL];                 //DL

                for (int x = 0; x < 6; x++)
                {
                    for (int y = 0; y < 3; y++)
                    {
                        target = axis.translate(x - 3, y - 7);
                        versionInformation[y + x * 3] = image[target.X][target.Y];
                        points[x + y * 3]             = target;
                    }
                }
                canvas.drawPoints(points, ThoughtWorks.QRCode.Codec.Util.Color_Fields.RED);

                try
                {
                    exactVersion = checkVersionInfo(versionInformation);
                }
                catch (VersionInformationException e2)
                {
                    throw e2;
                }
            }
            return(exactVersion);
        }
Esempio n. 3
0
        internal static int calcExactVersion(Point[] centers, int[] angle, int[] moduleSize, bool[][] image)
        {
            bool[]  array  = new bool[18];
            Point[] array2 = new Point[18];
            Axis    axis   = new Axis(angle, moduleSize[1]);

            axis.Origin = centers[1];
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Point point = axis.translate(j - 7, i - 3);
                    array[j + i * 3]  = image[point.X][point.Y];
                    array2[j + i * 3] = point;
                }
            }
            canvas.drawPoints(array2, Color_Fields.RED);
            int num = 0;

            try
            {
                return(checkVersionInfo(array));
            }
            catch (InvalidVersionInfoException)
            {
                canvas.println("Version info error. now retry with other place one.");
                axis.Origin      = centers[2];
                axis.ModulePitch = moduleSize[2];
                for (int j = 0; j < 6; j++)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        Point point = axis.translate(j - 3, i - 7);
                        array[i + j * 3]  = image[point.X][point.Y];
                        array2[j + i * 3] = point;
                    }
                }
                canvas.drawPoints(array2, Color_Fields.RED);
                try
                {
                    return(checkVersionInfo(array));
                }
                catch (VersionInformationException ex)
                {
                    throw ex;
                }
            }
        }