/// <summary> /// Gets the addresses and values from and ArtDmx message. /// </summary> /// <param name="artNetMessage">The art net message.</param> /// <returns></returns> public static IEnumerable<AddressValuePair> GetAddressesAndValuesFromMessage(byte[] artNetMessage) { var pairs = new List<AddressValuePair>(); for (int i = 18; i < artNetMessage.Length; i++) { var value = artNetMessage[i]; if (value != 0) { var address = (short)(i - 17); var pair = new AddressValuePair(address, value); pairs.Add(pair); } } return pairs; }
/// <summary> /// Gets the addresses and values from and ArtDmx message. /// </summary> /// <param name="artNetMessage">The art net message.</param> /// <returns></returns> public static IEnumerable <AddressValuePair> GetAddressesAndValuesFromMessage(byte[] artNetMessage) { var pairs = new List <AddressValuePair>(); for (int i = 18; i < artNetMessage.Length; i++) { var value = artNetMessage[i]; if (value != 0) { var address = (short)(i - 17); var pair = new AddressValuePair(address, value); pairs.Add(pair); } } return(pairs); }
/// <summary> /// Sets the specified address value pair. /// </summary> /// <param name="pair">The pair.</param> public void Set(AddressValuePair pair) { Set(pair.Address, pair.Value); }
public void ArtDmxPackageCtorPairs0Elements() { // Arrange var pairs = new AddressValuePair[0]; // Act var actual = new ArtDmxPackage(pairs); var actualBytes = actual.GetBytes(); // Assert Assert.AreEqual(0, actual.Universe); Assert.AreEqual(0, actualBytes[18]); Assert.AreEqual(0, actualBytes[19]); }