void Communicator_DataReceived(object sender, UdpPacket packet) { if (PauseMode) { return; } var artNetPacket = new ArtNetPacket(packet); if (artNetPacket.IsValid) { if (artNetPacket.IsDMXPacket) { int universe = artNetPacket.Universe; int net = artNetPacket.Net; int subnet = artNetPacket.SubNet; if (Nodes.Count > 0) { foreach (ArtNetNode node in Nodes) { if (node.AddressValid(net, subnet, universe)) { for (int i = 0; i < 170; i++) { Color rgbColor = new Color(); Byte R = artNetPacket.RawData[18 + i * 3]; Byte G = artNetPacket.RawData[18 + i * 3 + 1]; Byte B = artNetPacket.RawData[18 + i * 3 + 2]; rgbColor = Color.FromArgb(R, G, B); (node.Ports[universe]).RgbData[i] = rgbColor; } } } } if (RecordMode) { RecorderDataReceived(this, artNetPacket); } } else { if (artNetPacket.IsPollPacket) { SendArtPollReply(); } } if (VerboseMode) { DebugDataReceived(this, artNetPacket); } } }
private void VerboseModeUpdateStatus(object sender, EventArgs e) { if (verboseToolStripMenuItem.Checked) { if (packet != null) { toolStripStatusLabel1.Text = packet.IsValid ? "PACKET VALID" : "PACKET INVALID"; toolStripStatusLabel2.Text = string.Format("COUNT [{0,10}]", packet.Index); if (lastPacket != null) { long fps = packet.Index - lastPacket.Index; toolStripStatusLabel3.Text = string.Format("PPS [{0,6}]", fps * 4); } darkStatusStrip.Refresh(); lastPacket = packet; } else { toolStripStatusLabel1.Text = "NO UDP STREAM"; } } }
void ArtNetManager_RecorderDataReceived(object sender, ArtNetPacket packet) { }
void ArtNetManager_DebugDataReceived(object sender, ArtNetPacket packet) { this.packet = packet; }