Beispiel #1
0
        static void Main(string[] args)
        {
            if (CheckParameters(args))
            {
                // start stop watch to measure execution time
                System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
                stopwatch.Start();

                LabelExtraction barcode = new LabelExtraction();

                if (args[1].Substring(args[1].Length - 1) != "\\")
                    args[1] = args[1] + "\\";

                Console.WriteLine("Label Extraction");
                Console.WriteLine("-------------------------");

                int numberOfLabelsFound = barcode.SaveLabels(args[1], new Bitmap(args[0]));

                stopwatch.Stop();
                TimeSpan timeElapsed = TimeSpan.FromMilliseconds(stopwatch.ElapsedMilliseconds);

                Console.WriteLine("Successfull!");
                Console.WriteLine("Found " + numberOfLabelsFound + " labels. Elapsed time: " + timeElapsed.ToString());

                // open the folder
                System.Diagnostics.Process.Start(args[1]);

                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Label Extraction");
                Console.WriteLine("-------------------------");
                Console.WriteLine("Usage:");
                Console.WriteLine("ExtractCodeBar.exe <source.img> <path to extract>");
                Console.ReadLine();
            }
        }