C #: ZXing Variation of the first number?

1

People I developed this bar code reader in C # using ZXing, it reads the barcode of an img and then it picks up the image number, moves the image to another folder and renames the image with the number of the barcode

            //Esse é o método pra ler a imagem
            Bitmap image;'


            image = (Bitmap)Bitmap.FromFile(recebe);

            LuminanceSource source;
            source = new BitmapLuminanceSource(image);
            BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
            Result result = new MultiFormatReader().decodeWithState(bitmap);

            //faz um condicional para ler o que existe dentro da matriz Barcode
            foreach (string code in result)
            {

                if (!Directory.Exists(nomePasta.ToString()))
                {
                    Directory.CreateDirectory(nomePasta.ToString());
                }
                else 
                { 

                }

                if (codigo == 0)
                {
                    codigo = Convert.ToInt32(0 + code);

                    File.Move(stringCaminho.ToString(), nomePasta.ToString() + code + ".bmp");
                }

                else if (codigo + 0 > Convert.ToInt32(0 + code))
                {
                    MessageBox.Show("Código de barras está errado! "+code);
                }

                dataGridView1.Rows.Add(code);
                //esta dando erro para fazer o Move da segunda referencia


                }


                }

The problem is that when he reads the bar code he always brings the first wrong number, and the others he brings back right, what can I do?

    
asked by anonymous 15.04.2015 / 21:02

0 answers