@@ -186,16 +186,16 @@ public DMXSendBag(byte[] data, PortAddress portAddress)
186186 PortAddress = portAddress ;
187187 }
188188
189- internal async void Update ( byte [ ] data , ushort ? startindex = null , ushort ? count = null )
189+ internal async void Update ( byte [ ] data , ushort ? destinationIndex = null , ushort ? count = null )
190190 {
191191 if ( IsDisposed || IsDisposing )
192192 return ;
193193
194194 await SemaphoreSlim ? . WaitAsync ( ) ;
195195 try
196196 {
197- if ( ( startindex + count ) <= Data . Length )
198- Array . Copy ( data , 0 , Data , startindex . Value , count . Value ) ;
197+ if ( ( destinationIndex + count ) <= Data . Length )
198+ Array . Copy ( data , 0 , Data , destinationIndex . Value , count . Value ) ;
199199 else
200200 Array . Copy ( data , 0 , Data , 0 , Math . Min ( data . Length , Data . Length ) ) ;
201201
@@ -1072,7 +1072,7 @@ public void RemovePortConfig(params PortConfig[] portConfigs)
10721072 }
10731073 }
10741074
1075- public void WriteDMXValues ( PortAddress portAddress , byte [ ] data , ushort ? startindex = null , ushort ? count = null )
1075+ public void WriteDMXValues ( PortAddress portAddress , byte [ ] data , ushort ? destinationIndex = null , ushort ? count = null )
10761076 {
10771077 if ( this . IsDisposing || this . IsDisposed )
10781078 return ;
@@ -1081,26 +1081,28 @@ public void WriteDMXValues(PortAddress portAddress, byte[] data, ushort? startin
10811081 throw new ArgumentOutOfRangeException ( ) ;
10821082
10831083 ushort length = ( ushort ) data . Length ;
1084+ if ( count is null )
1085+ count = length ;
10841086
1085- if ( startindex > length )
1086- throw new ArgumentOutOfRangeException ( ) ;
1087+ if ( count > length )
1088+ throw new ArgumentOutOfRangeException ( $ " { nameof ( count ) } has to be less then { nameof ( data ) } . { nameof ( data . Length ) } " ) ;
10871089
10881090
1089- if ( ( startindex + count ) > length )
1090- throw new ArgumentOutOfRangeException ( ) ;
1091+ if ( ( destinationIndex + count ) > 512 )
1092+ throw new ArgumentOutOfRangeException ( $ " { nameof ( destinationIndex ) } + { nameof ( count ) } has to be less then 512" ) ;
10911093
10921094 int _startIndex = 0 ;
10931095 int _count = length ;
1094- if ( startindex . HasValue )
1095- _startIndex = startindex . Value ;
1096+ if ( destinationIndex . HasValue )
1097+ _startIndex = destinationIndex . Value ;
10961098 if ( count . HasValue )
10971099 _count = Math . Min ( _count , count . Value ) ;
10981100
10991101
11001102 try
11011103 {
11021104 if ( sendDMXBuffer . TryGetValue ( portAddress , out DMXSendBag bag ) )
1103- bag . Update ( data , startindex , count ) ;
1105+ bag . Update ( data , destinationIndex , count ) ;
11041106 else
11051107 {
11061108 var newBag = new DMXSendBag ( data , portAddress ) ;
0 commit comments