Browse Source

Add starting position to Packet.CopyTo so you can copy the data into the destination at a specific offset

Matt Coburn 5 years ago
parent
commit
afb0b9ae0d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Source/Managed/ENet.cs

+ 2 - 2
Source/Managed/ENet.cs

@@ -380,7 +380,7 @@ namespace ENet {
 			nativePacket = Native.enet_packet_create_offset(data, (IntPtr)length, (IntPtr)offset, flags);
 		}
 
-		public void CopyTo(byte[] destination) {
+		public void CopyTo(byte[] destination, int startPos = 0) {
             if (destination == null)
                 throw new ArgumentNullException("destination");
             
@@ -391,7 +391,7 @@ namespace ENet {
                 return;
             }
 			
-            Marshal.Copy(Data, destination, 0, Length);
+            Marshal.Copy(Data, destination, startPos, Length);
 		}
 	}