Exemplo n.º 1
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (deviceComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select a video device first.");
                return;
            }
            try
            {
                // resize reference image based on current resolution
                levelSelectScreen = ImageLibrary.ChangeSize(levelSelectScreen720, resolution720, SelectedResolution);

                // resize rectangles based on current resolution
                levelCodeArea   = ImageLibrary.ChangeSize(levelCodeArea720p, resolution720, SelectedResolution);
                creatorNameArea = ImageLibrary.ChangeSize(creatorNameArea720, resolution720, SelectedResolution);
                levelTitleArea  = ImageLibrary.ChangeSize(levelTitleArea720, resolution720, SelectedResolution);

                SMMServer.port = Decimal.ToUInt16(numPort.Value);
                log.Info(String.Format("Start Web Server on http://localhost:{0}/", SMMServer.port));
                SMMServer.Start();

                processor              = new VideoProcessor(deviceComboBox.SelectedIndex, SelectedResolution);
                processor.BlackScreen += VideoProcessor_BlackScreen;
                processor.ClearScreen += VideoProcessor_ClearScreen;
                processor.NewFrame    += VideoProcessor_NewFrame;
                processor.Start();
                lockForm();
            }
            catch (Exception ex)
            {
                processException("Error starting video device", ex);
            }
        }
Exemplo n.º 2
0
 private void stopButton_Click(object sender, EventArgs e)
 {
     SMMServer.Stop();
     if (processor != null)
     {
         processor.Stop();
         processor.Dispose();
         processor = null;
     }
     BeginInvoke(new MethodInvoker(() => unlockForm()));
 }
Exemplo n.º 3
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (deviceComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select a video device first.");
                return;
            }
            try
            {
                SMMServer.port = decimal.ToUInt16(numPort.Value);
                log.Info(string.Format("Start Web Server on http://localhost:{0}/", SMMServer.port));
                SMMServer.Start();

                if (Properties.Settings.Default.WarpWorldEnabled)
                {
                    WarpWorld = new WarpWorldAPI(Properties.Settings.Default.WarpWorldUsername, Properties.Settings.Default.WarpWorldToken);
                }
                else
                {
                    WarpWorld = null;
                }
                processor = new VideoProcessor(deviceComboBox.SelectedIndex, SelectedResolution);

                processor.TemplateMatch += broadcastTemplateMatch;

                processor.TemplateMatch += previewMatch;
                processor.NewFrame      += previewNewFrame;


                processor.LevelScreen += Processor_LevelScreen;
                processor.ClearScreen += Processor_ClearScreen;

                processor.Exit     += clearJsonOnEvent;
                processor.Skip     += clearJsonOnEvent;
                processor.GameOver += clearJsonOnEvent;

                processor.ClearScreen += warpWorldCallback;
                processor.Exit        += warpWorldCallback;

                processor.TemplateMatch += statsCallback;
                processor.LevelScreen   += statsCallback;
                processor.ClearScreen   += statsCallback;

                processor.Start();
                lockForm();
            }
            catch (Exception ex)
            {
                processException("Error starting video device", ex);
            }
        }
Exemplo n.º 4
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (deviceComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select a video device first.");
                return;
            }
            try
            {
                templates.Clear();
                templates.AddRange(engTemplates);

                // Add language neutral templates if selected.
                if (langNeutralcheckBox.Checked)
                {
                    templates.AddRange(langNeutralTemplates);
                }

                // resize reference image based on current resolution
                levelDetailScreen = ImageLibrary.ChangeSize(levelSelectScreen720, resolution720, SelectedResolution);

                SMMServer.port = decimal.ToUInt16(numPort.Value);
                log.Info(string.Format("Start Web Server on http://localhost:{0}/", SMMServer.port));
                SMMServer.Start();

                if (Properties.Settings.Default.WarpWorldEnabled)
                {
                    WarpWorld = new WarpWorldAPI(Properties.Settings.Default.WarpWorldUsername, Properties.Settings.Default.WarpWorldToken);
                }
                else
                {
                    WarpWorld = null;
                }

                processor              = new VideoProcessor(deviceComboBox.SelectedIndex, SelectedResolution);
                processor.BlackScreen += VideoProcessor_BlackScreen;
                processor.ClearScreen += VideoProcessor_ClearScreen;
                processor.NewFrame    += VideoProcessor_NewFrame;
                processor.Start();
                lockForm();
            }
            catch (Exception ex)
            {
                processException("Error starting video device", ex);
            }
        }