Aspose.BarCode.Examples.CSharp.ManageAndOptimizeBarCodeRecognition.OptimizingBarCodeRecognitionProcess.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            try
            {                
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
                Stopwatch sw = new Stopwatch();

                // Start the stopwatch
                sw.Start();

                // Define the settings to use all of the processor cores, if not then how many to use.
                BarCodeReader.ProcessorSettings.UseAllCores = false;
                BarCodeReader.ProcessorSettings.UseOnlyThisCoresCount = 4;

                // Perform the BarCode recognition task Initialize the BarCodeReader object
                using (BarCodeReader reader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code128))
                {
                    while (reader.Read())
                    {
                        Console.WriteLine(" Code Text: " + reader.GetCodeText() + " Type: " + reader.GetCodeType());
                    }
                }

                // Stop the stopwatch
                sw.Stop();

                // Write the Elapsed time to console
                Console.WriteLine("Elapsed: " + sw.Elapsed);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
    }
OptimizingBarCodeRecognitionProcess