示例#1
0
        private void btnStartSTop_Click(object sender, EventArgs e)
        {
            if (btnStartSTop.Text == "Start")
            {
                EmmaMysqlClient.EmmaServer[] servers = EmmaMysqlClient.GetServersFromConfig();

                foreach (EmmaMysqlClient.EmmaServer srv in servers)
                {
                    EmmaMysqlClient cli = new EmmaMysqlClient(srv.Host, 3309, srv.User, srv.Pw, srv.DB, m_CompetitionID, false, m_disableTotalCalculation);
                    m_Clients.Add(cli);
                    cli.OnLogMessage += new LogMessageDelegate(cli_OnLogMessage);
                    cli.Start();
                }
                m_Parser.Start();
                btnStartSTop.Text = "Stop";
#if _CASPARCG_
                casparForm = new CasparControlFrm();
                casparForm.Show();
                casparForm.SetEmmaClient(m_Clients[0]);
#endif
            }
            else
            {
                foreach (EmmaMysqlClient cli in m_Clients)
                {
                    cli.Stop();
                }
                m_Parser.Stop();
                btnStartSTop.Text = "Start";
            }
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(txtOEDirectory.Text))
            {
                MessageBox.Show(this, @"Please select an existing OE Export directory", @"Start OE Monitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (string.IsNullOrEmpty(txtCompID.Text))
            {
                MessageBox.Show(this, @"You must enter a competition-ID", @"Start OE Monitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            m_compid         = Convert.ToInt32(txtCompID.Text);
            m_parsedZeroTime = 0;
            listBox1.Items.Clear();
            m_clients.Clear();
            Logit("Reading servers from config (eventually resolving online)");
            Application.DoEvents();
            EmmaMysqlClient.EmmaServer[] servers = EmmaMysqlClient.GetServersFromConfig();
            Logit("Got servers from obasen...");
            Application.DoEvents();



            var format = cmbFormat.SelectedItem as FormatItem;

            bool useInternalIDAllocation = false;

            if (format.Format == Format.Oecsv || format.Format == Format.Oecsvteam || format.Format == Format.Oscsv)
            {
                if (!string.IsNullOrEmpty(txtZeroTime.Text))
                {
                    var rex = new Regex(@"(\d\d?):(\d\d):(\d\d)");
                    var m   = rex.Match(txtZeroTime.Text);
                    if (m.Success)
                    {
                        m_parsedZeroTime = int.Parse(m.Groups[1].Value) * 360000 + int.Parse(m.Groups[2].Value) * 6000 + int.Parse(m.Groups[3].Value) * 100;
                    }
                    else
                    {
                        Logit("WARN: Could not parse Zero-Time,skipping (Use format HH:MM:SS)");
                    }
                }

                m_osParser = new OSParser();
                m_osParser.OnLogMessage += Logit;

                m_osParser.OnResult += m_OSParser_OnResult;

                m_oeParser = new OEParser();
                m_oeParser.OnLogMessage += Logit;

                m_oeParser.OnResult += m_OSParser_OnResult;

                fsWatcherOS.Path   = txtOEDirectory.Text;
                fsWatcherOS.Filter = txtExtension.Text;
                fsWatcherOS.EnableRaisingEvents = true;
            }
            else if (format.Format == Format.Iofxml)
            {
                fileSystemWatcher1.Path                  = txtOEDirectory.Text;
                fileSystemWatcher1.Filter                = txtExtension.Text;
                fileSystemWatcher1.NotifyFilter          = NotifyFilters.LastWrite;
                fileSystemWatcher1.IncludeSubdirectories = false;
                fileSystemWatcher1.EnableRaisingEvents   = true;
                useInternalIDAllocation                  = true;
            }

            foreach (EmmaMysqlClient.EmmaServer server in servers)
            {
                var client = new EmmaMysqlClient(server.Host, 3306, server.User, server.Pw, server.DB, m_compid, useInternalIDAllocation);

                client.OnLogMessage += client_OnLogMessage;
                client.Start();
                m_clients.Add(client);
            }
#if _CASPARCG_
            casparForm = new LiveResults.CasparClient.CasparControlFrm();
            casparForm.Show();
            casparForm.SetEmmaClient(m_clients[0]);
#endif
            timer1_Tick(null, null);
        }