예제 #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);
                    m_Clients.Add(cli);
                    cli.OnLogMessage += new LogMessageDelegate(cli_OnLogMessage);
                    cli.Start();
                }
                m_Parser.Start();
                btnStartSTop.Text = "Stop";
            }
            else
            {
                foreach (EmmaMysqlClient cli in m_Clients)
                {
                    cli.Stop();
                }
                m_Parser.Stop();
                btnStartSTop.Text = "Start";
            }
        }
예제 #2
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);
                    m_Clients.Add(cli);
                    cli.OnLogMessage += new LogMessageDelegate(cli_OnLogMessage);
                    cli.Start();
                }
                m_Parser.Start();
                btnStartSTop.Text = "Stop";
            }
            else
            {
                foreach (EmmaMysqlClient cli in m_Clients)
                {
                    cli.Stop();
                }
                m_Parser.Stop();
                btnStartSTop.Text = "Start";
            }
        }
예제 #3
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";
            }
        }
예제 #4
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;
            }

            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();
            foreach (EmmaMysqlClient.EmmaServer server in servers)
            {
                var client = new EmmaMysqlClient(server.Host, 3306, server.User, server.Pw, server.DB, Convert.ToInt32(txtCompID.Text));

                client.OnLogMessage += client_OnLogMessage;
                client.Start();
                m_clients.Add(client);
            }

            timer1_Tick(null, null);

            var format = cmbFormat.SelectedItem as FormatItem;


            if (format.Format == Format.Oecsv || format.Format == Format.Oecsvteam || format.Format == Format.Oscsv)
            {
                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;
            }
        }
예제 #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!File.Exists(txtEtimingMdb.Text))
            {
                MessageBox.Show(this, "Please select an existing etime.mdb", "Start eTime Monitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!File.Exists(txtSystemMdb.Text))
            {
                MessageBox.Show(this, "Please select an existing system.mdb", "Start eTime Monitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

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

            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();
            foreach (EmmaMysqlClient.EmmaServer server in servers)
            {
                EmmaMysqlClient client = new EmmaMysqlClient(server.host, 3306, server.user, server.pw, server.db, Convert.ToInt32(txtCompID.Text));

                client.OnLogMessage += new LogMessageDelegate(client_OnLogMessage);
                client.Start();
                m_Clients.Add(client);
            }

            string dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtEtimingMdb.Text + ";Persist Security Info=False";

            logit("DSN; " + dsn);
            OleDbConnection m_Connection = new OleDbConnection(dsn);

            pars = new EtimingParser(m_Connection, Convert.ToInt32(txtCompID.Text));

            pars.OnLogMessage +=
                delegate(string msg)
            {
                logit(msg);
            };

            pars.OnResult += new ResultDelegate(m_Parser_OnResult);
            logit("ready to run... starting EtimingParser");
            pars.Start();
        }
예제 #6
0
        public void Run()
        {
            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);
                m_Clients.Add(cli);
                cli.OnLogMessage += OnLogMessage;
                cli.Start();
            }
            m_Parser.Start();
        }
예제 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            m_client = new EmmaMysqlClient("52.16.131.75", 3006, "liveresultat", "web", "liveresultat", int.Parse(textBox1.Text));
            m_client.Start();
            m_client.OnLogMessage += M_client_OnLogMessage;

            List <Event> events = new List <Event>();

            foreach (var runner in m_client.GetAllRunners())
            {
                int      hour      = (int)(runner.StartTime / (100.0 * 60 * 60));
                int      minute    = (int)((runner.StartTime - hour * 60 * 60 * 100) / (100.0 * 60));
                int      second    = (int)((runner.StartTime - hour * 60 * 60 * 100 - minute * 60 * 100) / (100.0));
                DateTime startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hour, minute, second);

                if (startTime < m_StartTime)
                {
                    m_StartTime = startTime;
                }

                foreach (var splitTime in runner.SplitTimes)
                {
                    DateTime eventTime = startTime.AddSeconds(splitTime.Time / 100.0);
                    events.Add(new Event
                    {
                        occurs = eventTime,
                        Data   = new ResultStruct
                        {
                            ControlCode = splitTime.Control,
                            Time        = splitTime.Time,
                        },
                        runner       = runner,
                        RunnerStatus = 0
                    });
                }

                if (runner.Time > 0)
                {
                    DateTime eventTime = startTime.AddSeconds(runner.Time / 100.0);
                    events.Add(new Event
                    {
                        occurs = eventTime,
                        Data   = new ResultStruct
                        {
                            ControlCode = 1000,
                            Time        = runner.Time
                        },
                        runner       = runner,
                        RunnerStatus = runner.StageStatus
                    });
                }

                runner.ClearTimeAndSplits();

                eventsToSimulate    = events.OrderBy(x => x.occurs).ToList();
                listBox1.DataSource = eventsToSimulate.Take(20).ToList();
                lblTime.Text        = m_StartTime.ToString("HH:mm:ss");
            }

            m_client.SetCompetitionId(int.Parse(textBox2.Text));
        }
예제 #8
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;
            }

            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();
            foreach (EmmaMysqlClient.EmmaServer server in servers)
            {
                var client = new EmmaMysqlClient(server.Host, 3306, server.User, server.Pw, server.DB, Convert.ToInt32(txtCompID.Text));

                client.OnLogMessage += client_OnLogMessage;
                client.Start();
                m_clients.Add(client);
            }

            timer1_Tick(null, null);

            var format = cmbFormat.SelectedItem as FormatItem;

            if ( format.Format == Format.Oecsv || format.Format == Format.Oecsvteam || format.Format == Format.Oscsv)
            {
                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;
            }
        }
예제 #9
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;
            }

            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();
            foreach (EmmaMysqlClient.EmmaServer server in servers)
            {
                EmmaMysqlClient client = new EmmaMysqlClient(server.host, 3306, server.user, server.pw, server.db, Convert.ToInt32(txtCompID.Text));

                client.OnLogMessage += new LogMessageDelegate(client_OnLogMessage);
                client.Start();
                m_Clients.Add(client);
            }

            timer1_Tick(null, null);

            FormatItem format = cmbFormat.SelectedItem as FormatItem;


            if (format.Format == Format.OECSV || format.Format == Format.OECSVPAR || format.Format == Format.OECSVTEAM || format.Format == Format.OSCSV)
            {
                m_OSParser = new OSParser();
                m_OSParser.OnLogMessage +=
                    delegate(string msg)
                {
                    logit(msg);
                };

                m_OSParser.OnResult += new ResultDelegate(m_OSParser_OnResult);

                m_OEParser = new OEParser();
                m_OEParser.OnLogMessage +=
                    delegate(string msg)
                {
                    logit(msg);
                };

                m_OEParser.OnResult += new ResultDelegate(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;
            }
        }
예제 #10
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);
        }