Skip to content

Commit

Permalink
Fix WriteDmxValues with Delte throws OutOfRangeException
Browse files Browse the repository at this point in the history
Bump v0.0.24
  • Loading branch information
patrick-dmxc committed May 11, 2024
1 parent 37f4d04 commit 3eacda1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ArtNetSharp/ArtNetSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>0.0.23</Version>
<Version>0.0.24</Version>
<RepositoryUrl>https://github.com/DMXControl/ArtNetSharp</RepositoryUrl>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<PackageTags>RDM; ArtNet; E1.20; E1.33; E1.37-1; E1.37-2; E1.37-7</PackageTags>
Expand Down
15 changes: 12 additions & 3 deletions ArtNetSharp/Communication/AbstractInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -191,7 +192,7 @@ internal async void Update(byte[] data, ushort? startindex = null, ushort? count
try
{
if ((startindex + count) <= Data.Length)
Array.Copy(data, startindex.Value, Data, startindex.Value, count.Value);
Array.Copy(data, 0, Data, startindex.Value, count.Value);
else
Array.Copy(data, 0, Data, 0, Math.Min(data.Length, Data.Length));

Expand Down Expand Up @@ -519,12 +520,20 @@ public async Task SendArtSync()
if (EnableSync)
await sendArtSync();
}
private async Task sendArtSync()
private async Task sendArtSync(params IPv4Address[] addresses)
{
if (this.IsDisposing || this.IsDisposed || this.IsDeactivated)
return;
using ArtSync artSync = new ArtSync();
await TrySendBroadcastPacket(artSync);
if (addresses.Length == 0)
await TrySendBroadcastPacket(artSync);
else
{
var smalArray = addresses.Distinct();
var networkClients = ArtNetInstance.NetworkClients.ToList();
var broadcastAddresses = smalArray.Select(a => networkClients.FirstOrDefault(n => Tools.IsInSubnet(a, n.IPv4Mask, n.LocalIpAddress)).BroadcastIpAddress).Distinct().ToList(); ;
broadcastAddresses.ForEach(async (b) => await TrySendPacket(artSync, b));
}
}
#endregion

Expand Down

0 comments on commit 3eacda1

Please sign in to comment.