mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-03-24 07:48:46 +00:00
Compare commits
No commits in common. "d91e643de66336b48420f29ee18199704e189eee" and "725350e566b31285b61ddaefd70eceb694737dc6" have entirely different histories.
d91e643de6
...
725350e566
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Buffers.Binary;
|
using System.Linq;
|
||||||
|
|
||||||
namespace RGB.NET.Devices.DMX.E131;
|
namespace RGB.NET.Devices.DMX.E131;
|
||||||
|
|
||||||
@ -12,11 +12,13 @@ internal static class E131DataPacketExtension
|
|||||||
|
|
||||||
internal static void SetSequenceNumber(this byte[] data, byte sequenceNumber) => data[111] = sequenceNumber;
|
internal static void SetSequenceNumber(this byte[] data, byte sequenceNumber) => data[111] = sequenceNumber;
|
||||||
|
|
||||||
internal static void SetUniverse(this byte[] data, short universe) => BinaryPrimitives.TryWriteInt16BigEndian(data.AsSpan().Slice(113, 2), universe);
|
internal static void SetUniverse(this byte[] data, short universe) => Array.Copy(ToBigEndian(BitConverter.GetBytes(universe)), 0, data, 113, 2);
|
||||||
|
|
||||||
internal static void ClearColors(this byte[] data) => Array.Clear(data, 126, 512);
|
internal static void ClearColors(this byte[] data) => Array.Clear(data, 126, 512);
|
||||||
|
|
||||||
internal static void SetChannel(this byte[] data, int channel, byte value) => data[126 + channel] = value;
|
internal static void SetChannel(this byte[] data, int channel, byte value) => data[126 + channel] = value;
|
||||||
|
|
||||||
|
private static byte[] ToBigEndian(byte[] data) => BitConverter.IsLittleEndian ? data.Reverse().ToArray() : data;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user