* Remove an unused BuildPacket function in _Packets_.cs

* Make all blocks inherit from the abstract base class PacketBlock

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2278 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2008-10-08 17:08:17 +00:00
parent 599605ea25
commit 2e4aa31e4a
3 changed files with 3021 additions and 3381 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2008, openmetaverse.org
* Copyright (c) 2008, openmetaverse.org
* All rights reserved.
*
* - Redistribution and use in source and binary forms, with or without
@@ -377,3 +377,31 @@ namespace OpenMetaverse.Packets
i += 7;
}
}
/// <summary>
/// A block of data in a packet. Packets are composed of one or more blocks,
/// each block containing one or more fields
/// </summary>
public abstract class PacketBlock
{
/// <summary>Current length of the data in this packet</summary>
public abstract int Length { get; }
/// <summary>
/// Create a block from a byte array
/// </summary>
/// <param name="bytes">Byte array containing the serialized block</param>
/// <param name="i">Starting position of the block in the byte array.
/// This will point to the data after the end of the block when the
/// call returns</param>
public abstract void FromBytes(byte[] bytes, ref int i);
/// <summary>
/// Serialize this block into a byte array
/// </summary>
/// <param name="bytes">Byte array to serialize this block into</param>
/// <param name="i">Starting position in the byte array to serialize to.
/// This will point to the position directly after the end of the
/// serialized block when the call returns</param>
public abstract void ToBytes(byte[] bytes, ref int i);
}