Exemplo n.º 1
0
        static void Main(string[] args)
        {
            globalStopwatch = new Stopwatch();
            globalStopwatch.Start();

            Thread.Sleep(5000);
            Console.CancelKeyPress +=
                new ConsoleCancelEventHandler((o, t) =>
            {
                captureMethod.Stop();       //Stop Capturing
            });

            captureMethod = new LocalCapture(bitmapBuffer);

            // Start Capture
            captureMethod.Start();

            // Start dispatch frames
            bitmapBuffer.StartDispatchToImageProcessBase();

            // arg[0]: Game type (String)
            // arg[1..n]: Name of outlet channels (String)
            FeatureExtractors arrivalEvents = FeatureExtractors.InitFeatureExtractor(
                (int)Enum.Parse(typeof(GameType), args[0]),
                args.Skip(1).ToArray()
                );

            // Do Cache Optimizer
            CacheOptimizer.Init();
            CacheOptimizer.ResetAllAffinity();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parse Argument to get the Capture Method
        /// </summary>
        /// <param name="args">Args from Main</param>

        /*static void ArgumentParser(string[] args)
         * {
         *  if (String.Compare(args[0], "Local", StringComparison.OrdinalIgnoreCase) == 0)
         *      captureMethod = new LocalCapture(bitmapBuffer); //Default: Local Capture
         *  else if (String.Compare(args[0], "CaptureCard", StringComparison.OrdinalIgnoreCase) == 0)
         *      captureMethod = new CardCapture(bitmapBuffer);  //Fetch Image From Capture Card
         *  else
         *  {
         *      // Unknown Argument
         *      Console.WriteLine();
         *      Console.WriteLine("Wrong Argument!");
         *      Console.WriteLine("Usage:");
         *      Console.WriteLine($"\t{Process.GetCurrentProcess().ProcessName} [ImageSource]");
         *      Console.WriteLine($"\t[ImageSource]: Local or CaptureCard");
         *      Console.WriteLine();
         *      // Force close the process
         *      Process.GetCurrentProcess().Kill();
         *  }
         * }*/
        static void Main(string[] args)
        {
            globalStopwatch = new Stopwatch();
            globalStopwatch.Start();

            Thread.Sleep(5000);
            Console.CancelKeyPress +=
                new ConsoleCancelEventHandler((o, t) =>
            {
                captureMethod.Stop();       //Stop Capturing
            });

            captureMethod = new LocalCapture(bitmapBuffer);

            // Check the Capture Method from args
            //if (args.Length == 0)
            //    captureMethod = new LocalCapture(bitmapBuffer); // Default: Local Capture
            //else
            //    ArgumentParser(args); // Parse Arguments

            //if (captureMethod == null)
            //    throw new Exception("Error! CaptureMethod is null!");

            // Start Capture
            captureMethod.Start();

            // Start dispatch frames
            bitmapBuffer.StartDispatchToImageProcessBase();

            FeatureExtractors arrivalEvents = FeatureExtractors.InitFeatureExtractor(
                (int)Enum.Parse(typeof(GameType), args[0]),
                args.Skip(1).ToArray()
                );

            // Do Cache Optimizer
            CacheOptimizer.Init();
            CacheOptimizer.ResetAllAffinity();
        }