Exemplo n.º 1
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;
            }
        }
Exemplo n.º 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;
            }

            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;
            }
        }
Exemplo n.º 3
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);
        }