Exemplo n.º 1
0
        private void Send()
        {
            var count = 0;
            var msg   = new CpCustom();

            for (var i = 0; i < packets.Count; ++i)
            {
                var data = packets[i];

                if (automaticStringLength && data.Type == DataType.String)
                {
                    msg.Write(data.Array.Length);
                }

                msg.Write(data.Array);
            }

            while (running)
            {
                count += msg.SendToAll();

                UpdateSendLog(count);

                Thread.Sleep(interval);
            }
        }
Exemplo n.º 2
0
        private void ButtonSend_Click(object sender, EventArgs e)
        {
            if (loop)
            {
                if (ButtonSend.Text == "Start")
                {
                    UpdateSendLog(0);
                    EnableSend();
                    StartSend();
                }
                else
                {
                    DisableSend();
                    StopSend();
                }
            }
            else
            {
                var msg = new CpCustom();

                for (var i = 0; i < packets.Count; ++i)
                {
                    var data = packets[i];

                    if (automaticStringLength && data.Type == DataType.String)
                    {
                        msg.Write(data.Array.Length);
                    }

                    msg.Write(data.Array);
                }

                var count = msg.SendToAll();

                UpdateSendLog(count);
            }
        }