Applying patch from issue #66 by johan, uses FromBytes methods for LL* types to allow object reuse
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1527 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -113,6 +113,8 @@ namespace libsecondlife.Packets
|
||||
/// <summary>Array containing all the appended ACKs of this packet</summary>
|
||||
public uint[] AckList;
|
||||
|
||||
public abstract void FromBytes(byte[] bytes, ref int pos, ref int packetEnd);
|
||||
|
||||
/// <summary>
|
||||
/// Convert the AckList to a byte array, used for packet serializing
|
||||
/// </summary>
|
||||
@@ -226,6 +228,11 @@ namespace libsecondlife.Packets
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="packetEnd"></param>
|
||||
public LowHeader(byte[] bytes, ref int pos, ref int packetEnd)
|
||||
{
|
||||
FromBytes(bytes, ref pos, ref packetEnd);
|
||||
}
|
||||
|
||||
override public void FromBytes(byte[] bytes, ref int pos, ref int packetEnd)
|
||||
{
|
||||
if (bytes.Length < 10) { throw new MalformedDataException(); }
|
||||
Data = new byte[10];
|
||||
@@ -290,6 +297,11 @@ namespace libsecondlife.Packets
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="packetEnd"></param>
|
||||
public MediumHeader(byte[] bytes, ref int pos, ref int packetEnd)
|
||||
{
|
||||
FromBytes(bytes, ref pos, ref packetEnd);
|
||||
}
|
||||
|
||||
override public void FromBytes(byte[] bytes, ref int pos, ref int packetEnd)
|
||||
{
|
||||
if (bytes.Length < 8) { throw new MalformedDataException(); }
|
||||
Data = new byte[8];
|
||||
@@ -340,6 +352,11 @@ namespace libsecondlife.Packets
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="packetEnd"></param>
|
||||
public HighHeader(byte[] bytes, ref int pos, ref int packetEnd)
|
||||
{
|
||||
FromBytes(bytes, ref pos, ref packetEnd);
|
||||
}
|
||||
|
||||
override public void FromBytes(byte[] bytes, ref int pos, ref int packetEnd)
|
||||
{
|
||||
if (bytes.Length < 7) { throw new MalformedDataException(); }
|
||||
Data = new byte[7];
|
||||
|
||||
Reference in New Issue
Block a user