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:
John Hurliman
2007-12-19 18:46:06 +00:00
parent 3c3285f7f5
commit 0f29e30ce0
4 changed files with 17900 additions and 4512 deletions

View File

@@ -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];