@@ -10,7 +10,7 @@ namespace OXGaming.TibiaAPI.Network
1010 /// <remarks>
1111 /// This is useful for parsing, and creating, Tibia packets.
1212 /// </remarks>
13- public class NetworkMessage
13+ internal class NetworkMessage
1414 {
1515 /// <summary>
1616 /// The full length of a Tibia packet is stored in two bytes at the beginning of the packet.
@@ -23,23 +23,6 @@ public class NetworkMessage
2323
2424 private readonly byte [ ] _buffer = new byte [ MaxMessageSize ] ;
2525
26- /// <value>
27- /// Gets the message data from the underlying buffer.
28- /// </value>
29- /// <remarks>
30- /// Get this only when necessary as it creates a new byte array, copies the valid data from the
31- /// underlying buffer into it, then returns it.
32- /// </remarks>
33- public byte [ ] Data
34- {
35- get
36- {
37- var data = new byte [ Size ] ;
38- Array . Copy ( _buffer , data , Size ) ;
39- return data ;
40- }
41- }
42-
4326 /// <value>
4427 /// Gets the current position in the buffer.
4528 /// </value>
@@ -59,6 +42,20 @@ public byte[] GetBuffer()
5942 return _buffer ;
6043 }
6144
45+ /// <value>
46+ /// Gets the message data from the underlying buffer.
47+ /// </value>
48+ /// <remarks>
49+ /// Get this only when necessary as it creates a new byte array, copies the valid data from the
50+ /// underlying buffer into it, then returns it.
51+ /// </remarks>
52+ public byte [ ] GetData ( )
53+ {
54+ var data = new byte [ Size ] ;
55+ Array . Copy ( _buffer , data , Size ) ;
56+ return data ;
57+ }
58+
6259 /// <summary>
6360 /// Reads the specified number of bytes from the buffer into an array of bytes
6461 /// and advances the position by that number of bytes.
@@ -80,8 +77,8 @@ public byte[] ReadBytes(uint count)
8077 {
8178 if ( count == 0 )
8279 {
83- throw new ArgumentOutOfRangeException ( "[NetworkMessage.ReadBytes] " +
84- "'count' must be greater than 0." ) ;
80+ throw new ArgumentOutOfRangeException ( nameof ( count ) ,
81+ "[NetworkMessage.ReadBytes] 'count' must be greater than 0." ) ;
8582 }
8683
8784 if ( Position + count > _buffer . Length )
0 commit comments