* Added initial (untested) land searching support to DirectoryManager * Completely refactored Parcel.cs, moved land directory searching and abstracted out parcel information downloading. Updated to the new protocol * Added initial (untested) ParcelDownloader class to libsecondlife.Utilities * Removed dangerous exposed generic lists and parcel downloading state tracking from Region * Updated the Logout callback to the new protocol git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@859 52acb1d6-8a22-11de-b505-999d5b087335
76757 lines
2.9 MiB
76757 lines
2.9 MiB
/*
|
|
* Copyright (c) 2006, the libsecondlife development team
|
|
* All rights reserved.
|
|
*
|
|
* - Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
*
|
|
* - Redistributions of source code must retain the above copyright notice, this
|
|
* list of conditions and the following disclaimer.
|
|
* - Neither the name of the Second Life Reverse Engineering Team nor the names
|
|
* of its contributors may be used to endorse or promote products derived from
|
|
* this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
using System;
|
|
using System.Xml;
|
|
using System.Xml.Serialization;
|
|
using libsecondlife;
|
|
|
|
namespace libsecondlife.Packets
|
|
{
|
|
/// <summary>
|
|
/// Thrown when a packet could not be successfully deserialized
|
|
/// </summary>
|
|
public class MalformedDataException : ApplicationException
|
|
{
|
|
/// <summary>
|
|
/// Default constructor
|
|
/// </summary>
|
|
public MalformedDataException() { }
|
|
|
|
/// <summary>
|
|
/// Constructor that takes an additional error message
|
|
/// </summary>
|
|
/// <param name="Message">An error message to attach to this exception</param>
|
|
public MalformedDataException(string Message)
|
|
: base(Message)
|
|
{
|
|
this.Source = "Packet decoding";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// The Second Life header of a message template packet. Either 5, 6, or 8
|
|
/// bytes in length at the beginning of the packet, and encapsulates any
|
|
/// appended ACKs at the end of the packet as well
|
|
/// </summary>
|
|
[XmlInclude(typeof(LowHeader))]
|
|
[XmlInclude(typeof(MediumHeader))]
|
|
[XmlInclude(typeof(HighHeader))]
|
|
public abstract class Header
|
|
{
|
|
/// <summary>Raw header data, does not include appended ACKs</summary>
|
|
public byte[] Data;
|
|
/// <summary>Raw value of the flags byte</summary>
|
|
[XmlIgnore]
|
|
public byte Flags
|
|
{
|
|
get { return Data[0]; }
|
|
set { Data[0] = value; }
|
|
}
|
|
/// <summary>Reliable flag, whether this packet requires an ACK</summary>
|
|
[XmlIgnore]
|
|
public bool Reliable
|
|
{
|
|
get { return (Data[0] & Helpers.MSG_RELIABLE) != 0; }
|
|
set { if (value) { Data[0] |= (byte)Helpers.MSG_RELIABLE; } else { byte mask = (byte)Helpers.MSG_RELIABLE ^ 0xFF; Data[0] &= mask; } }
|
|
}
|
|
/// <summary>Resent flag, whether this same packet has already been
|
|
/// sent</summary>
|
|
[XmlIgnore]
|
|
public bool Resent
|
|
{
|
|
get { return (Data[0] & Helpers.MSG_RESENT) != 0; }
|
|
set { if (value) { Data[0] |= (byte)Helpers.MSG_RESENT; } else { byte mask = (byte)Helpers.MSG_RESENT ^ 0xFF; Data[0] &= mask; } }
|
|
}
|
|
/// <summary>Zerocoded flag, whether this packet is compressed with
|
|
/// zerocoding</summary>
|
|
[XmlIgnore]
|
|
public bool Zerocoded
|
|
{
|
|
get { return (Data[0] & Helpers.MSG_ZEROCODED) != 0; }
|
|
set { if (value) { Data[0] |= (byte)Helpers.MSG_ZEROCODED; } else { byte mask = (byte)Helpers.MSG_ZEROCODED ^ 0xFF; Data[0] &= mask; } }
|
|
}
|
|
/// <summary>Appended ACKs flag, whether this packet has ACKs appended
|
|
/// to the end</summary>
|
|
[XmlIgnore]
|
|
public bool AppendedAcks
|
|
{
|
|
get { return (Data[0] & Helpers.MSG_APPENDED_ACKS) != 0; }
|
|
set { if (value) { Data[0] |= (byte)Helpers.MSG_APPENDED_ACKS; } else { byte mask = (byte)Helpers.MSG_APPENDED_ACKS ^ 0xFF; Data[0] &= mask; } }
|
|
}
|
|
/// <summary>Packet sequence number, three bytes long</summary>
|
|
[XmlIgnore]
|
|
public uint Sequence
|
|
{
|
|
get { return (uint)((Data[1] << 16) + (Data[2] << 8) + Data[3]); }
|
|
set { Data[1] = (byte)(value >> 16); Data[2] = (byte)(value >> 8); Data[3] = (byte)(value % 256); }
|
|
}
|
|
/// <summary>Numeric ID number of this packet</summary>
|
|
[XmlIgnore]
|
|
public abstract ushort ID { get; set; }
|
|
/// <summary>Frequency classification of this packet, Low Medium or
|
|
/// High</summary>
|
|
[XmlIgnore]
|
|
public abstract PacketFrequency Frequency { get; }
|
|
/// <summary>Convert this header to a byte array, not including any
|
|
/// appended ACKs</summary>
|
|
public abstract void ToBytes(byte[] bytes, ref int i);
|
|
/// <summary>Array containing all the appended ACKs of this packet</summary>
|
|
public uint[] AckList;
|
|
|
|
/// <summary>
|
|
/// Convert the AckList to a byte array, used for packet serializing
|
|
/// </summary>
|
|
/// <param name="bytes">Reference to the target byte array</param>
|
|
/// <param name="i">Beginning position to start writing to in the byte
|
|
/// array, will be updated with the ending position of the ACK list</param>
|
|
public void AcksToBytes(byte[] bytes, ref int i)
|
|
{
|
|
foreach (uint ack in AckList)
|
|
{
|
|
bytes[i++] = (byte)((ack >> 24) % 256);
|
|
bytes[i++] = (byte)((ack >> 16) % 256);
|
|
bytes[i++] = (byte)((ack >> 8) % 256);
|
|
bytes[i++] = (byte)(ack % 256);
|
|
}
|
|
if (AckList.Length > 0) { bytes[i++] = (byte)AckList.Length; }
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="pos"></param>
|
|
/// <param name="packetEnd"></param>
|
|
/// <returns></returns>
|
|
public static Header BuildHeader(byte[] bytes, ref int pos, ref int packetEnd)
|
|
{
|
|
if (bytes[4] == 0xFF)
|
|
{
|
|
if (bytes[5] == 0xFF)
|
|
{
|
|
return new LowHeader(bytes, ref pos, ref packetEnd);
|
|
}
|
|
else
|
|
{
|
|
return new MediumHeader(bytes, ref pos, ref packetEnd);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return new HighHeader(bytes, ref pos, ref packetEnd);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="packetEnd"></param>
|
|
protected void CreateAckList(byte[] bytes, ref int packetEnd)
|
|
{
|
|
if (AppendedAcks)
|
|
{
|
|
try
|
|
{
|
|
int count = bytes[packetEnd--];
|
|
AckList = new uint[count];
|
|
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
AckList[i] = (uint)(
|
|
(bytes[(packetEnd - i * 4) - 3] << 24) |
|
|
(bytes[(packetEnd - i * 4) - 2] << 16) |
|
|
(bytes[(packetEnd - i * 4) - 1] << 8) |
|
|
(bytes[(packetEnd - i * 4) ]));
|
|
}
|
|
|
|
packetEnd -= (count * 4);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
AckList = new uint[0];
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AckList = new uint[0];
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class LowHeader : Header
|
|
{
|
|
/// <summary></summary>
|
|
public override ushort ID
|
|
{
|
|
get { return (ushort)((Data[6] << 8) + Data[7]); }
|
|
set { Data[6] = (byte)(value >> 8); Data[7] = (byte)(value % 256); }
|
|
}
|
|
/// <summary></summary>
|
|
public override PacketFrequency Frequency { get { return PacketFrequency.Low; } }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public LowHeader()
|
|
{
|
|
Data = new byte[8];
|
|
Data[4] = Data[5] = 0xFF;
|
|
AckList = new uint[0];
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="pos"></param>
|
|
/// <param name="packetEnd"></param>
|
|
public LowHeader(byte[] bytes, ref int pos, ref int packetEnd)
|
|
{
|
|
if (bytes.Length < 8) { throw new MalformedDataException(); }
|
|
Data = new byte[8];
|
|
Array.Copy(bytes, Data, 8);
|
|
|
|
if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0 && bytes[6] == 0)
|
|
{
|
|
if (bytes[7] == 1)
|
|
{
|
|
Data[7] = bytes[8];
|
|
}
|
|
else
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
pos = 8;
|
|
CreateAckList(bytes, ref packetEnd);
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="i"></param>
|
|
public override void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(Data, 0, bytes, i, 8);
|
|
i += 8;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class MediumHeader : Header
|
|
{
|
|
/// <summary></summary>
|
|
public override ushort ID
|
|
{
|
|
get { return (ushort)Data[5]; }
|
|
set { Data[5] = (byte)value; }
|
|
}
|
|
/// <summary></summary>
|
|
public override PacketFrequency Frequency { get { return PacketFrequency.Medium; } }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public MediumHeader()
|
|
{
|
|
Data = new byte[6];
|
|
Data[4] = 0xFF;
|
|
AckList = new uint[0];
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="pos"></param>
|
|
/// <param name="packetEnd"></param>
|
|
public MediumHeader(byte[] bytes, ref int pos, ref int packetEnd)
|
|
{
|
|
if (bytes.Length < 6) { throw new MalformedDataException(); }
|
|
Data = new byte[6];
|
|
Array.Copy(bytes, Data, 6);
|
|
pos = 6;
|
|
CreateAckList(bytes, ref packetEnd);
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="i"></param>
|
|
public override void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(Data, 0, bytes, i, 6);
|
|
i += 6;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class HighHeader : Header
|
|
{
|
|
/// <summary></summary>
|
|
public override ushort ID
|
|
{
|
|
get { return (ushort)Data[4]; }
|
|
set { Data[4] = (byte)value; }
|
|
}
|
|
/// <summary></summary>
|
|
public override PacketFrequency Frequency { get { return PacketFrequency.High; } }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public HighHeader()
|
|
{
|
|
Data = new byte[5];
|
|
AckList = new uint[0];
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="pos"></param>
|
|
/// <param name="packetEnd"></param>
|
|
public HighHeader(byte[] bytes, ref int pos, ref int packetEnd)
|
|
{
|
|
if (bytes.Length < 5) { throw new MalformedDataException(); }
|
|
Data = new byte[5];
|
|
Array.Copy(bytes, Data, 5);
|
|
pos = 5;
|
|
CreateAckList(bytes, ref packetEnd);
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="i"></param>
|
|
public override void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(Data, 0, bytes, i, 5);
|
|
i += 5;
|
|
}
|
|
}
|
|
|
|
public enum PacketType
|
|
{
|
|
/// <summary>A generic value, not an actual packet type</summary>
|
|
Default,
|
|
TestMessage,
|
|
UseCircuitCode,
|
|
LogControl,
|
|
LogMessages,
|
|
TelehubInfo,
|
|
EconomyDataRequest,
|
|
EconomyData,
|
|
AvatarPickerRequest,
|
|
AvatarPickerReply,
|
|
PlacesQuery,
|
|
PlacesReply,
|
|
DirFindQuery,
|
|
DirPlacesQuery,
|
|
DirPlacesReply,
|
|
DirPeopleReply,
|
|
DirEventsReply,
|
|
DirGroupsReply,
|
|
DirClassifiedQuery,
|
|
DirClassifiedReply,
|
|
AvatarClassifiedReply,
|
|
ClassifiedInfoRequest,
|
|
ClassifiedInfoReply,
|
|
ClassifiedInfoUpdate,
|
|
ClassifiedDelete,
|
|
ClassifiedGodDelete,
|
|
DirPicksQuery,
|
|
DirPicksReply,
|
|
DirLandQuery,
|
|
DirLandReply,
|
|
DirPopularQuery,
|
|
DirPopularReply,
|
|
ParcelInfoRequest,
|
|
ParcelInfoReply,
|
|
ParcelObjectOwnersRequest,
|
|
ParcelObjectOwnersReply,
|
|
GroupNoticesListRequest,
|
|
GroupNoticesListReply,
|
|
GroupNoticeRequest,
|
|
GroupNoticeDelete,
|
|
TeleportRequest,
|
|
TeleportLocationRequest,
|
|
TeleportLocal,
|
|
TeleportLandmarkRequest,
|
|
TeleportProgress,
|
|
TeleportFinish,
|
|
StartLure,
|
|
TeleportLureRequest,
|
|
TeleportCancel,
|
|
TeleportStart,
|
|
TeleportFailed,
|
|
LeaderBoardRequest,
|
|
LeaderBoardData,
|
|
Undo,
|
|
Redo,
|
|
UndoLand,
|
|
RedoLand,
|
|
AgentPause,
|
|
AgentResume,
|
|
ChatFromViewer,
|
|
AgentThrottle,
|
|
AgentFOV,
|
|
AgentHeightWidth,
|
|
AgentSetAppearance,
|
|
AgentQuit,
|
|
AgentQuitCopy,
|
|
ImageNotInDatabase,
|
|
RebakeAvatarTextures,
|
|
SetAlwaysRun,
|
|
ObjectDelete,
|
|
ObjectDuplicate,
|
|
ObjectDuplicateOnRay,
|
|
ObjectScale,
|
|
ObjectRotation,
|
|
ObjectFlagUpdate,
|
|
ObjectClickAction,
|
|
ObjectImage,
|
|
ObjectMaterial,
|
|
ObjectShape,
|
|
ObjectExtraParams,
|
|
ObjectOwner,
|
|
ObjectGroup,
|
|
ObjectBuy,
|
|
BuyObjectInventory,
|
|
DerezContainer,
|
|
ObjectPermissions,
|
|
ObjectSaleInfo,
|
|
ObjectName,
|
|
ObjectDescription,
|
|
ObjectCategory,
|
|
ObjectSelect,
|
|
ObjectDeselect,
|
|
ObjectAttach,
|
|
ObjectDetach,
|
|
ObjectDrop,
|
|
ObjectLink,
|
|
ObjectDelink,
|
|
ObjectHinge,
|
|
ObjectDehinge,
|
|
ObjectGrab,
|
|
ObjectGrabUpdate,
|
|
ObjectDeGrab,
|
|
ObjectSpinStart,
|
|
ObjectSpinUpdate,
|
|
ObjectSpinStop,
|
|
ObjectExportSelected,
|
|
ObjectImport,
|
|
ModifyLand,
|
|
VelocityInterpolateOn,
|
|
VelocityInterpolateOff,
|
|
StateSave,
|
|
ReportAutosaveCrash,
|
|
SimWideDeletes,
|
|
TrackAgent,
|
|
ViewerStats,
|
|
ScriptAnswerYes,
|
|
UserReport,
|
|
AlertMessage,
|
|
AgentAlertMessage,
|
|
MeanCollisionAlert,
|
|
ViewerFrozenMessage,
|
|
HealthMessage,
|
|
ChatFromSimulator,
|
|
SimStats,
|
|
RequestRegionInfo,
|
|
RegionInfo,
|
|
GodUpdateRegionInfo,
|
|
NearestLandingRegionUpdated,
|
|
RegionHandshake,
|
|
RegionHandshakeReply,
|
|
SimulatorViewerTimeMessage,
|
|
EnableSimulator,
|
|
DisableSimulator,
|
|
TransferRequest,
|
|
TransferInfo,
|
|
TransferAbort,
|
|
TransferPriority,
|
|
RequestXfer,
|
|
AbortXfer,
|
|
RequestAvatarInfo,
|
|
AvatarAppearance,
|
|
SetFollowCamProperties,
|
|
ClearFollowCamProperties,
|
|
RequestPayPrice,
|
|
PayPriceReply,
|
|
KickUser,
|
|
KickUserAck,
|
|
GodKickUser,
|
|
EjectUser,
|
|
FreezeUser,
|
|
AvatarPropertiesRequest,
|
|
AvatarPropertiesReply,
|
|
AvatarInterestsReply,
|
|
AvatarGroupsReply,
|
|
AvatarPropertiesUpdate,
|
|
AvatarInterestsUpdate,
|
|
AvatarStatisticsReply,
|
|
AvatarNotesReply,
|
|
AvatarNotesUpdate,
|
|
AvatarPicksReply,
|
|
EventInfoRequest,
|
|
EventInfoReply,
|
|
EventNotificationAddRequest,
|
|
EventNotificationRemoveRequest,
|
|
EventGodDelete,
|
|
PickInfoRequest,
|
|
PickInfoReply,
|
|
PickInfoUpdate,
|
|
PickDelete,
|
|
PickGodDelete,
|
|
ScriptQuestion,
|
|
ScriptControlChange,
|
|
ScriptDialog,
|
|
ScriptDialogReply,
|
|
ForceScriptControlRelease,
|
|
RevokePermissions,
|
|
LoadURL,
|
|
ScriptTeleportRequest,
|
|
ParcelOverlay,
|
|
ParcelPropertiesRequestByID,
|
|
ParcelPropertiesUpdate,
|
|
ParcelReturnObjects,
|
|
ParcelSetOtherCleanTime,
|
|
ParcelDisableObjects,
|
|
ParcelSelectObjects,
|
|
EstateCovenantRequest,
|
|
EstateCovenantReply,
|
|
ForceObjectSelect,
|
|
ParcelBuyPass,
|
|
ParcelDeedToGroup,
|
|
ParcelReclaim,
|
|
ParcelClaim,
|
|
ParcelJoin,
|
|
ParcelDivide,
|
|
ParcelRelease,
|
|
ParcelBuy,
|
|
ParcelGodForceOwner,
|
|
ParcelAccessListRequest,
|
|
ParcelAccessListReply,
|
|
ParcelAccessListUpdate,
|
|
ParcelDwellRequest,
|
|
ParcelDwellReply,
|
|
ParcelGodMarkAsContent,
|
|
ParcelGodReserveForNewbie,
|
|
ViewerStartAuction,
|
|
UUIDNameRequest,
|
|
UUIDNameReply,
|
|
UUIDGroupNameRequest,
|
|
UUIDGroupNameReply,
|
|
ChildAgentDying,
|
|
ChildAgentUnknown,
|
|
GetScriptRunning,
|
|
ScriptRunningReply,
|
|
SetScriptRunning,
|
|
ScriptReset,
|
|
CompleteAgentMovement,
|
|
AgentMovementComplete,
|
|
ConnectAgentToUserserver,
|
|
ConnectToUserserver,
|
|
LogoutRequest,
|
|
FinalizeLogout,
|
|
LogoutReply,
|
|
LogoutDemand,
|
|
ImprovedInstantMessage,
|
|
RetrieveInstantMessages,
|
|
DequeueInstantMessages,
|
|
FindAgent,
|
|
RequestGodlikePowers,
|
|
GrantGodlikePowers,
|
|
GodlikeMessage,
|
|
EstateOwnerMessage,
|
|
GenericMessage,
|
|
MuteListRequest,
|
|
UpdateMuteListEntry,
|
|
RemoveMuteListEntry,
|
|
CopyInventoryFromNotecard,
|
|
UpdateInventoryItem,
|
|
UpdateCreateInventoryItem,
|
|
MoveInventoryItem,
|
|
CopyInventoryItem,
|
|
RemoveInventoryItem,
|
|
ChangeInventoryItemFlags,
|
|
SaveAssetIntoInventory,
|
|
CreateInventoryFolder,
|
|
UpdateInventoryFolder,
|
|
MoveInventoryFolder,
|
|
RemoveInventoryFolder,
|
|
FetchInventoryDescendents,
|
|
InventoryDescendents,
|
|
FetchInventory,
|
|
FetchInventoryReply,
|
|
BulkUpdateInventory,
|
|
RequestInventoryAsset,
|
|
InventoryAssetResponse,
|
|
RemoveInventoryObjects,
|
|
PurgeInventoryDescendents,
|
|
UpdateTaskInventory,
|
|
RemoveTaskInventory,
|
|
MoveTaskInventory,
|
|
RequestTaskInventory,
|
|
ReplyTaskInventory,
|
|
DeRezObject,
|
|
DeRezAck,
|
|
RezObject,
|
|
RezObjectFromNotecard,
|
|
DeclineInventory,
|
|
RequestFriendship,
|
|
AcceptFriendship,
|
|
DeclineFriendship,
|
|
FormFriendship,
|
|
TerminateFriendship,
|
|
OfferCallingCard,
|
|
AcceptCallingCard,
|
|
DeclineCallingCard,
|
|
RezScript,
|
|
CreateInventoryItem,
|
|
CreateLandmarkForEvent,
|
|
RegionHandleRequest,
|
|
RegionIDAndHandleReply,
|
|
MoneyTransferRequest,
|
|
AdjustBalance,
|
|
MoneyBalanceRequest,
|
|
MoneyBalanceReply,
|
|
RoutedMoneyBalanceReply,
|
|
MoneyHistoryRequest,
|
|
MoneyHistoryReply,
|
|
MoneySummaryRequest,
|
|
MoneySummaryReply,
|
|
MoneyDetailsRequest,
|
|
MoneyDetailsReply,
|
|
MoneyTransactionsRequest,
|
|
MoneyTransactionsReply,
|
|
GestureRequest,
|
|
ActivateGestures,
|
|
DeactivateGestures,
|
|
MuteListUpdate,
|
|
UseCachedMuteList,
|
|
GrantUserRights,
|
|
ChangeUserRights,
|
|
OnlineNotification,
|
|
OfflineNotification,
|
|
SetStartLocationRequest,
|
|
AssetUploadRequest,
|
|
AssetUploadComplete,
|
|
ReputationAgentAssign,
|
|
ReputationIndividualRequest,
|
|
ReputationIndividualReply,
|
|
CreateGroupRequest,
|
|
CreateGroupReply,
|
|
UpdateGroupInfo,
|
|
GroupRoleChanges,
|
|
JoinGroupRequest,
|
|
JoinGroupReply,
|
|
EjectGroupMemberRequest,
|
|
EjectGroupMemberReply,
|
|
LeaveGroupRequest,
|
|
LeaveGroupReply,
|
|
InviteGroupRequest,
|
|
GroupProfileRequest,
|
|
GroupProfileReply,
|
|
GroupAccountSummaryRequest,
|
|
GroupAccountSummaryReply,
|
|
GroupAccountDetailsRequest,
|
|
GroupAccountDetailsReply,
|
|
GroupAccountTransactionsRequest,
|
|
GroupAccountTransactionsReply,
|
|
GroupActiveProposalsRequest,
|
|
GroupActiveProposalItemReply,
|
|
GroupVoteHistoryRequest,
|
|
GroupVoteHistoryItemReply,
|
|
StartGroupProposal,
|
|
GroupProposalBallot,
|
|
GroupMembersRequest,
|
|
GroupMembersReply,
|
|
ActivateGroup,
|
|
SetGroupContribution,
|
|
SetGroupAcceptNotices,
|
|
GroupRoleDataRequest,
|
|
GroupRoleDataReply,
|
|
GroupRoleMembersRequest,
|
|
GroupRoleMembersReply,
|
|
GroupTitlesRequest,
|
|
GroupTitlesReply,
|
|
GroupTitleUpdate,
|
|
GroupRoleUpdate,
|
|
LiveHelpGroupRequest,
|
|
LiveHelpGroupReply,
|
|
AgentWearablesRequest,
|
|
AgentWearablesUpdate,
|
|
AgentIsNowWearing,
|
|
AgentCachedTexture,
|
|
AgentCachedTextureResponse,
|
|
AgentDataUpdateRequest,
|
|
AgentDataUpdate,
|
|
GroupDataUpdate,
|
|
AgentGroupDataUpdate,
|
|
AgentDropGroup,
|
|
CreateTrustedCircuit,
|
|
DenyTrustedCircuit,
|
|
RequestTrustedCircuit,
|
|
RezSingleAttachmentFromInv,
|
|
RezMultipleAttachmentsFromInv,
|
|
DetachAttachmentIntoInv,
|
|
CreateNewOutfitAttachments,
|
|
UserInfoRequest,
|
|
UserInfoReply,
|
|
UpdateUserInfo,
|
|
GodExpungeUser,
|
|
StartParcelRemoveAck,
|
|
InitiateDownload,
|
|
SystemMessage,
|
|
MapLayerRequest,
|
|
MapLayerReply,
|
|
MapBlockRequest,
|
|
MapNameRequest,
|
|
MapBlockReply,
|
|
MapItemRequest,
|
|
MapItemReply,
|
|
SendPostcard,
|
|
ParcelMediaCommandMessage,
|
|
ParcelMediaUpdate,
|
|
LandStatRequest,
|
|
LandStatReply,
|
|
SecuredTemplateChecksumRequest,
|
|
PacketAck,
|
|
OpenCircuit,
|
|
CloseCircuit,
|
|
TemplateChecksumRequest,
|
|
TemplateChecksumReply,
|
|
ObjectAdd,
|
|
MultipleObjectUpdate,
|
|
RequestMultipleObjects,
|
|
ObjectPosition,
|
|
RequestObjectPropertiesFamily,
|
|
CoarseLocationUpdate,
|
|
CrossedRegion,
|
|
ConfirmEnableSimulator,
|
|
ObjectProperties,
|
|
ObjectPropertiesFamily,
|
|
ParcelPropertiesRequest,
|
|
GestureUpdate,
|
|
AttachedSound,
|
|
AttachedSoundGainChange,
|
|
AttachedSoundCutoffRadius,
|
|
PreloadSound,
|
|
ViewerEffect,
|
|
SetSunPhase,
|
|
StartPingCheck,
|
|
CompletePingCheck,
|
|
AgentUpdate,
|
|
AgentAnimation,
|
|
AgentRequestSit,
|
|
AgentSit,
|
|
RequestImage,
|
|
ImageData,
|
|
ImagePacket,
|
|
LayerData,
|
|
ObjectUpdate,
|
|
ObjectUpdateCompressed,
|
|
ObjectUpdateCached,
|
|
ImprovedTerseObjectUpdate,
|
|
KillObject,
|
|
AgentToNewRegion,
|
|
TransferPacket,
|
|
SendXferPacket,
|
|
ConfirmXferPacket,
|
|
AvatarAnimation,
|
|
AvatarSitResponse,
|
|
CameraConstraint,
|
|
ParcelProperties,
|
|
ChildAgentUpdate,
|
|
ChildAgentAlive,
|
|
ChildAgentPositionUpdate,
|
|
SoundTrigger,
|
|
}
|
|
|
|
[XmlInclude(typeof(TestMessagePacket))]
|
|
[XmlInclude(typeof(UseCircuitCodePacket))]
|
|
[XmlInclude(typeof(LogControlPacket))]
|
|
[XmlInclude(typeof(LogMessagesPacket))]
|
|
[XmlInclude(typeof(TelehubInfoPacket))]
|
|
[XmlInclude(typeof(EconomyDataRequestPacket))]
|
|
[XmlInclude(typeof(EconomyDataPacket))]
|
|
[XmlInclude(typeof(AvatarPickerRequestPacket))]
|
|
[XmlInclude(typeof(AvatarPickerReplyPacket))]
|
|
[XmlInclude(typeof(PlacesQueryPacket))]
|
|
[XmlInclude(typeof(PlacesReplyPacket))]
|
|
[XmlInclude(typeof(DirFindQueryPacket))]
|
|
[XmlInclude(typeof(DirPlacesQueryPacket))]
|
|
[XmlInclude(typeof(DirPlacesReplyPacket))]
|
|
[XmlInclude(typeof(DirPeopleReplyPacket))]
|
|
[XmlInclude(typeof(DirEventsReplyPacket))]
|
|
[XmlInclude(typeof(DirGroupsReplyPacket))]
|
|
[XmlInclude(typeof(DirClassifiedQueryPacket))]
|
|
[XmlInclude(typeof(DirClassifiedReplyPacket))]
|
|
[XmlInclude(typeof(AvatarClassifiedReplyPacket))]
|
|
[XmlInclude(typeof(ClassifiedInfoRequestPacket))]
|
|
[XmlInclude(typeof(ClassifiedInfoReplyPacket))]
|
|
[XmlInclude(typeof(ClassifiedInfoUpdatePacket))]
|
|
[XmlInclude(typeof(ClassifiedDeletePacket))]
|
|
[XmlInclude(typeof(ClassifiedGodDeletePacket))]
|
|
[XmlInclude(typeof(DirPicksQueryPacket))]
|
|
[XmlInclude(typeof(DirPicksReplyPacket))]
|
|
[XmlInclude(typeof(DirLandQueryPacket))]
|
|
[XmlInclude(typeof(DirLandReplyPacket))]
|
|
[XmlInclude(typeof(DirPopularQueryPacket))]
|
|
[XmlInclude(typeof(DirPopularReplyPacket))]
|
|
[XmlInclude(typeof(ParcelInfoRequestPacket))]
|
|
[XmlInclude(typeof(ParcelInfoReplyPacket))]
|
|
[XmlInclude(typeof(ParcelObjectOwnersRequestPacket))]
|
|
[XmlInclude(typeof(ParcelObjectOwnersReplyPacket))]
|
|
[XmlInclude(typeof(GroupNoticesListRequestPacket))]
|
|
[XmlInclude(typeof(GroupNoticesListReplyPacket))]
|
|
[XmlInclude(typeof(GroupNoticeRequestPacket))]
|
|
[XmlInclude(typeof(GroupNoticeDeletePacket))]
|
|
[XmlInclude(typeof(TeleportRequestPacket))]
|
|
[XmlInclude(typeof(TeleportLocationRequestPacket))]
|
|
[XmlInclude(typeof(TeleportLocalPacket))]
|
|
[XmlInclude(typeof(TeleportLandmarkRequestPacket))]
|
|
[XmlInclude(typeof(TeleportProgressPacket))]
|
|
[XmlInclude(typeof(TeleportFinishPacket))]
|
|
[XmlInclude(typeof(StartLurePacket))]
|
|
[XmlInclude(typeof(TeleportLureRequestPacket))]
|
|
[XmlInclude(typeof(TeleportCancelPacket))]
|
|
[XmlInclude(typeof(TeleportStartPacket))]
|
|
[XmlInclude(typeof(TeleportFailedPacket))]
|
|
[XmlInclude(typeof(LeaderBoardRequestPacket))]
|
|
[XmlInclude(typeof(LeaderBoardDataPacket))]
|
|
[XmlInclude(typeof(UndoPacket))]
|
|
[XmlInclude(typeof(RedoPacket))]
|
|
[XmlInclude(typeof(UndoLandPacket))]
|
|
[XmlInclude(typeof(RedoLandPacket))]
|
|
[XmlInclude(typeof(AgentPausePacket))]
|
|
[XmlInclude(typeof(AgentResumePacket))]
|
|
[XmlInclude(typeof(ChatFromViewerPacket))]
|
|
[XmlInclude(typeof(AgentThrottlePacket))]
|
|
[XmlInclude(typeof(AgentFOVPacket))]
|
|
[XmlInclude(typeof(AgentHeightWidthPacket))]
|
|
[XmlInclude(typeof(AgentSetAppearancePacket))]
|
|
[XmlInclude(typeof(AgentQuitPacket))]
|
|
[XmlInclude(typeof(AgentQuitCopyPacket))]
|
|
[XmlInclude(typeof(ImageNotInDatabasePacket))]
|
|
[XmlInclude(typeof(RebakeAvatarTexturesPacket))]
|
|
[XmlInclude(typeof(SetAlwaysRunPacket))]
|
|
[XmlInclude(typeof(ObjectDeletePacket))]
|
|
[XmlInclude(typeof(ObjectDuplicatePacket))]
|
|
[XmlInclude(typeof(ObjectDuplicateOnRayPacket))]
|
|
[XmlInclude(typeof(ObjectScalePacket))]
|
|
[XmlInclude(typeof(ObjectRotationPacket))]
|
|
[XmlInclude(typeof(ObjectFlagUpdatePacket))]
|
|
[XmlInclude(typeof(ObjectClickActionPacket))]
|
|
[XmlInclude(typeof(ObjectImagePacket))]
|
|
[XmlInclude(typeof(ObjectMaterialPacket))]
|
|
[XmlInclude(typeof(ObjectShapePacket))]
|
|
[XmlInclude(typeof(ObjectExtraParamsPacket))]
|
|
[XmlInclude(typeof(ObjectOwnerPacket))]
|
|
[XmlInclude(typeof(ObjectGroupPacket))]
|
|
[XmlInclude(typeof(ObjectBuyPacket))]
|
|
[XmlInclude(typeof(BuyObjectInventoryPacket))]
|
|
[XmlInclude(typeof(DerezContainerPacket))]
|
|
[XmlInclude(typeof(ObjectPermissionsPacket))]
|
|
[XmlInclude(typeof(ObjectSaleInfoPacket))]
|
|
[XmlInclude(typeof(ObjectNamePacket))]
|
|
[XmlInclude(typeof(ObjectDescriptionPacket))]
|
|
[XmlInclude(typeof(ObjectCategoryPacket))]
|
|
[XmlInclude(typeof(ObjectSelectPacket))]
|
|
[XmlInclude(typeof(ObjectDeselectPacket))]
|
|
[XmlInclude(typeof(ObjectAttachPacket))]
|
|
[XmlInclude(typeof(ObjectDetachPacket))]
|
|
[XmlInclude(typeof(ObjectDropPacket))]
|
|
[XmlInclude(typeof(ObjectLinkPacket))]
|
|
[XmlInclude(typeof(ObjectDelinkPacket))]
|
|
[XmlInclude(typeof(ObjectHingePacket))]
|
|
[XmlInclude(typeof(ObjectDehingePacket))]
|
|
[XmlInclude(typeof(ObjectGrabPacket))]
|
|
[XmlInclude(typeof(ObjectGrabUpdatePacket))]
|
|
[XmlInclude(typeof(ObjectDeGrabPacket))]
|
|
[XmlInclude(typeof(ObjectSpinStartPacket))]
|
|
[XmlInclude(typeof(ObjectSpinUpdatePacket))]
|
|
[XmlInclude(typeof(ObjectSpinStopPacket))]
|
|
[XmlInclude(typeof(ObjectExportSelectedPacket))]
|
|
[XmlInclude(typeof(ObjectImportPacket))]
|
|
[XmlInclude(typeof(ModifyLandPacket))]
|
|
[XmlInclude(typeof(VelocityInterpolateOnPacket))]
|
|
[XmlInclude(typeof(VelocityInterpolateOffPacket))]
|
|
[XmlInclude(typeof(StateSavePacket))]
|
|
[XmlInclude(typeof(ReportAutosaveCrashPacket))]
|
|
[XmlInclude(typeof(SimWideDeletesPacket))]
|
|
[XmlInclude(typeof(TrackAgentPacket))]
|
|
[XmlInclude(typeof(ViewerStatsPacket))]
|
|
[XmlInclude(typeof(ScriptAnswerYesPacket))]
|
|
[XmlInclude(typeof(UserReportPacket))]
|
|
[XmlInclude(typeof(AlertMessagePacket))]
|
|
[XmlInclude(typeof(AgentAlertMessagePacket))]
|
|
[XmlInclude(typeof(MeanCollisionAlertPacket))]
|
|
[XmlInclude(typeof(ViewerFrozenMessagePacket))]
|
|
[XmlInclude(typeof(HealthMessagePacket))]
|
|
[XmlInclude(typeof(ChatFromSimulatorPacket))]
|
|
[XmlInclude(typeof(SimStatsPacket))]
|
|
[XmlInclude(typeof(RequestRegionInfoPacket))]
|
|
[XmlInclude(typeof(RegionInfoPacket))]
|
|
[XmlInclude(typeof(GodUpdateRegionInfoPacket))]
|
|
[XmlInclude(typeof(NearestLandingRegionUpdatedPacket))]
|
|
[XmlInclude(typeof(RegionHandshakePacket))]
|
|
[XmlInclude(typeof(RegionHandshakeReplyPacket))]
|
|
[XmlInclude(typeof(SimulatorViewerTimeMessagePacket))]
|
|
[XmlInclude(typeof(EnableSimulatorPacket))]
|
|
[XmlInclude(typeof(DisableSimulatorPacket))]
|
|
[XmlInclude(typeof(TransferRequestPacket))]
|
|
[XmlInclude(typeof(TransferInfoPacket))]
|
|
[XmlInclude(typeof(TransferAbortPacket))]
|
|
[XmlInclude(typeof(TransferPriorityPacket))]
|
|
[XmlInclude(typeof(RequestXferPacket))]
|
|
[XmlInclude(typeof(AbortXferPacket))]
|
|
[XmlInclude(typeof(RequestAvatarInfoPacket))]
|
|
[XmlInclude(typeof(AvatarAppearancePacket))]
|
|
[XmlInclude(typeof(SetFollowCamPropertiesPacket))]
|
|
[XmlInclude(typeof(ClearFollowCamPropertiesPacket))]
|
|
[XmlInclude(typeof(RequestPayPricePacket))]
|
|
[XmlInclude(typeof(PayPriceReplyPacket))]
|
|
[XmlInclude(typeof(KickUserPacket))]
|
|
[XmlInclude(typeof(KickUserAckPacket))]
|
|
[XmlInclude(typeof(GodKickUserPacket))]
|
|
[XmlInclude(typeof(EjectUserPacket))]
|
|
[XmlInclude(typeof(FreezeUserPacket))]
|
|
[XmlInclude(typeof(AvatarPropertiesRequestPacket))]
|
|
[XmlInclude(typeof(AvatarPropertiesReplyPacket))]
|
|
[XmlInclude(typeof(AvatarInterestsReplyPacket))]
|
|
[XmlInclude(typeof(AvatarGroupsReplyPacket))]
|
|
[XmlInclude(typeof(AvatarPropertiesUpdatePacket))]
|
|
[XmlInclude(typeof(AvatarInterestsUpdatePacket))]
|
|
[XmlInclude(typeof(AvatarStatisticsReplyPacket))]
|
|
[XmlInclude(typeof(AvatarNotesReplyPacket))]
|
|
[XmlInclude(typeof(AvatarNotesUpdatePacket))]
|
|
[XmlInclude(typeof(AvatarPicksReplyPacket))]
|
|
[XmlInclude(typeof(EventInfoRequestPacket))]
|
|
[XmlInclude(typeof(EventInfoReplyPacket))]
|
|
[XmlInclude(typeof(EventNotificationAddRequestPacket))]
|
|
[XmlInclude(typeof(EventNotificationRemoveRequestPacket))]
|
|
[XmlInclude(typeof(EventGodDeletePacket))]
|
|
[XmlInclude(typeof(PickInfoRequestPacket))]
|
|
[XmlInclude(typeof(PickInfoReplyPacket))]
|
|
[XmlInclude(typeof(PickInfoUpdatePacket))]
|
|
[XmlInclude(typeof(PickDeletePacket))]
|
|
[XmlInclude(typeof(PickGodDeletePacket))]
|
|
[XmlInclude(typeof(ScriptQuestionPacket))]
|
|
[XmlInclude(typeof(ScriptControlChangePacket))]
|
|
[XmlInclude(typeof(ScriptDialogPacket))]
|
|
[XmlInclude(typeof(ScriptDialogReplyPacket))]
|
|
[XmlInclude(typeof(ForceScriptControlReleasePacket))]
|
|
[XmlInclude(typeof(RevokePermissionsPacket))]
|
|
[XmlInclude(typeof(LoadURLPacket))]
|
|
[XmlInclude(typeof(ScriptTeleportRequestPacket))]
|
|
[XmlInclude(typeof(ParcelOverlayPacket))]
|
|
[XmlInclude(typeof(ParcelPropertiesRequestByIDPacket))]
|
|
[XmlInclude(typeof(ParcelPropertiesUpdatePacket))]
|
|
[XmlInclude(typeof(ParcelReturnObjectsPacket))]
|
|
[XmlInclude(typeof(ParcelSetOtherCleanTimePacket))]
|
|
[XmlInclude(typeof(ParcelDisableObjectsPacket))]
|
|
[XmlInclude(typeof(ParcelSelectObjectsPacket))]
|
|
[XmlInclude(typeof(EstateCovenantRequestPacket))]
|
|
[XmlInclude(typeof(EstateCovenantReplyPacket))]
|
|
[XmlInclude(typeof(ForceObjectSelectPacket))]
|
|
[XmlInclude(typeof(ParcelBuyPassPacket))]
|
|
[XmlInclude(typeof(ParcelDeedToGroupPacket))]
|
|
[XmlInclude(typeof(ParcelReclaimPacket))]
|
|
[XmlInclude(typeof(ParcelClaimPacket))]
|
|
[XmlInclude(typeof(ParcelJoinPacket))]
|
|
[XmlInclude(typeof(ParcelDividePacket))]
|
|
[XmlInclude(typeof(ParcelReleasePacket))]
|
|
[XmlInclude(typeof(ParcelBuyPacket))]
|
|
[XmlInclude(typeof(ParcelGodForceOwnerPacket))]
|
|
[XmlInclude(typeof(ParcelAccessListRequestPacket))]
|
|
[XmlInclude(typeof(ParcelAccessListReplyPacket))]
|
|
[XmlInclude(typeof(ParcelAccessListUpdatePacket))]
|
|
[XmlInclude(typeof(ParcelDwellRequestPacket))]
|
|
[XmlInclude(typeof(ParcelDwellReplyPacket))]
|
|
[XmlInclude(typeof(ParcelGodMarkAsContentPacket))]
|
|
[XmlInclude(typeof(ParcelGodReserveForNewbiePacket))]
|
|
[XmlInclude(typeof(ViewerStartAuctionPacket))]
|
|
[XmlInclude(typeof(UUIDNameRequestPacket))]
|
|
[XmlInclude(typeof(UUIDNameReplyPacket))]
|
|
[XmlInclude(typeof(UUIDGroupNameRequestPacket))]
|
|
[XmlInclude(typeof(UUIDGroupNameReplyPacket))]
|
|
[XmlInclude(typeof(ChildAgentDyingPacket))]
|
|
[XmlInclude(typeof(ChildAgentUnknownPacket))]
|
|
[XmlInclude(typeof(GetScriptRunningPacket))]
|
|
[XmlInclude(typeof(ScriptRunningReplyPacket))]
|
|
[XmlInclude(typeof(SetScriptRunningPacket))]
|
|
[XmlInclude(typeof(ScriptResetPacket))]
|
|
[XmlInclude(typeof(CompleteAgentMovementPacket))]
|
|
[XmlInclude(typeof(AgentMovementCompletePacket))]
|
|
[XmlInclude(typeof(ConnectAgentToUserserverPacket))]
|
|
[XmlInclude(typeof(ConnectToUserserverPacket))]
|
|
[XmlInclude(typeof(LogoutRequestPacket))]
|
|
[XmlInclude(typeof(FinalizeLogoutPacket))]
|
|
[XmlInclude(typeof(LogoutReplyPacket))]
|
|
[XmlInclude(typeof(LogoutDemandPacket))]
|
|
[XmlInclude(typeof(ImprovedInstantMessagePacket))]
|
|
[XmlInclude(typeof(RetrieveInstantMessagesPacket))]
|
|
[XmlInclude(typeof(DequeueInstantMessagesPacket))]
|
|
[XmlInclude(typeof(FindAgentPacket))]
|
|
[XmlInclude(typeof(RequestGodlikePowersPacket))]
|
|
[XmlInclude(typeof(GrantGodlikePowersPacket))]
|
|
[XmlInclude(typeof(GodlikeMessagePacket))]
|
|
[XmlInclude(typeof(EstateOwnerMessagePacket))]
|
|
[XmlInclude(typeof(GenericMessagePacket))]
|
|
[XmlInclude(typeof(MuteListRequestPacket))]
|
|
[XmlInclude(typeof(UpdateMuteListEntryPacket))]
|
|
[XmlInclude(typeof(RemoveMuteListEntryPacket))]
|
|
[XmlInclude(typeof(CopyInventoryFromNotecardPacket))]
|
|
[XmlInclude(typeof(UpdateInventoryItemPacket))]
|
|
[XmlInclude(typeof(UpdateCreateInventoryItemPacket))]
|
|
[XmlInclude(typeof(MoveInventoryItemPacket))]
|
|
[XmlInclude(typeof(CopyInventoryItemPacket))]
|
|
[XmlInclude(typeof(RemoveInventoryItemPacket))]
|
|
[XmlInclude(typeof(ChangeInventoryItemFlagsPacket))]
|
|
[XmlInclude(typeof(SaveAssetIntoInventoryPacket))]
|
|
[XmlInclude(typeof(CreateInventoryFolderPacket))]
|
|
[XmlInclude(typeof(UpdateInventoryFolderPacket))]
|
|
[XmlInclude(typeof(MoveInventoryFolderPacket))]
|
|
[XmlInclude(typeof(RemoveInventoryFolderPacket))]
|
|
[XmlInclude(typeof(FetchInventoryDescendentsPacket))]
|
|
[XmlInclude(typeof(InventoryDescendentsPacket))]
|
|
[XmlInclude(typeof(FetchInventoryPacket))]
|
|
[XmlInclude(typeof(FetchInventoryReplyPacket))]
|
|
[XmlInclude(typeof(BulkUpdateInventoryPacket))]
|
|
[XmlInclude(typeof(RequestInventoryAssetPacket))]
|
|
[XmlInclude(typeof(InventoryAssetResponsePacket))]
|
|
[XmlInclude(typeof(RemoveInventoryObjectsPacket))]
|
|
[XmlInclude(typeof(PurgeInventoryDescendentsPacket))]
|
|
[XmlInclude(typeof(UpdateTaskInventoryPacket))]
|
|
[XmlInclude(typeof(RemoveTaskInventoryPacket))]
|
|
[XmlInclude(typeof(MoveTaskInventoryPacket))]
|
|
[XmlInclude(typeof(RequestTaskInventoryPacket))]
|
|
[XmlInclude(typeof(ReplyTaskInventoryPacket))]
|
|
[XmlInclude(typeof(DeRezObjectPacket))]
|
|
[XmlInclude(typeof(DeRezAckPacket))]
|
|
[XmlInclude(typeof(RezObjectPacket))]
|
|
[XmlInclude(typeof(RezObjectFromNotecardPacket))]
|
|
[XmlInclude(typeof(DeclineInventoryPacket))]
|
|
[XmlInclude(typeof(RequestFriendshipPacket))]
|
|
[XmlInclude(typeof(AcceptFriendshipPacket))]
|
|
[XmlInclude(typeof(DeclineFriendshipPacket))]
|
|
[XmlInclude(typeof(FormFriendshipPacket))]
|
|
[XmlInclude(typeof(TerminateFriendshipPacket))]
|
|
[XmlInclude(typeof(OfferCallingCardPacket))]
|
|
[XmlInclude(typeof(AcceptCallingCardPacket))]
|
|
[XmlInclude(typeof(DeclineCallingCardPacket))]
|
|
[XmlInclude(typeof(RezScriptPacket))]
|
|
[XmlInclude(typeof(CreateInventoryItemPacket))]
|
|
[XmlInclude(typeof(CreateLandmarkForEventPacket))]
|
|
[XmlInclude(typeof(RegionHandleRequestPacket))]
|
|
[XmlInclude(typeof(RegionIDAndHandleReplyPacket))]
|
|
[XmlInclude(typeof(MoneyTransferRequestPacket))]
|
|
[XmlInclude(typeof(AdjustBalancePacket))]
|
|
[XmlInclude(typeof(MoneyBalanceRequestPacket))]
|
|
[XmlInclude(typeof(MoneyBalanceReplyPacket))]
|
|
[XmlInclude(typeof(RoutedMoneyBalanceReplyPacket))]
|
|
[XmlInclude(typeof(MoneyHistoryRequestPacket))]
|
|
[XmlInclude(typeof(MoneyHistoryReplyPacket))]
|
|
[XmlInclude(typeof(MoneySummaryRequestPacket))]
|
|
[XmlInclude(typeof(MoneySummaryReplyPacket))]
|
|
[XmlInclude(typeof(MoneyDetailsRequestPacket))]
|
|
[XmlInclude(typeof(MoneyDetailsReplyPacket))]
|
|
[XmlInclude(typeof(MoneyTransactionsRequestPacket))]
|
|
[XmlInclude(typeof(MoneyTransactionsReplyPacket))]
|
|
[XmlInclude(typeof(GestureRequestPacket))]
|
|
[XmlInclude(typeof(ActivateGesturesPacket))]
|
|
[XmlInclude(typeof(DeactivateGesturesPacket))]
|
|
[XmlInclude(typeof(MuteListUpdatePacket))]
|
|
[XmlInclude(typeof(UseCachedMuteListPacket))]
|
|
[XmlInclude(typeof(GrantUserRightsPacket))]
|
|
[XmlInclude(typeof(ChangeUserRightsPacket))]
|
|
[XmlInclude(typeof(OnlineNotificationPacket))]
|
|
[XmlInclude(typeof(OfflineNotificationPacket))]
|
|
[XmlInclude(typeof(SetStartLocationRequestPacket))]
|
|
[XmlInclude(typeof(AssetUploadRequestPacket))]
|
|
[XmlInclude(typeof(AssetUploadCompletePacket))]
|
|
[XmlInclude(typeof(ReputationAgentAssignPacket))]
|
|
[XmlInclude(typeof(ReputationIndividualRequestPacket))]
|
|
[XmlInclude(typeof(ReputationIndividualReplyPacket))]
|
|
[XmlInclude(typeof(CreateGroupRequestPacket))]
|
|
[XmlInclude(typeof(CreateGroupReplyPacket))]
|
|
[XmlInclude(typeof(UpdateGroupInfoPacket))]
|
|
[XmlInclude(typeof(GroupRoleChangesPacket))]
|
|
[XmlInclude(typeof(JoinGroupRequestPacket))]
|
|
[XmlInclude(typeof(JoinGroupReplyPacket))]
|
|
[XmlInclude(typeof(EjectGroupMemberRequestPacket))]
|
|
[XmlInclude(typeof(EjectGroupMemberReplyPacket))]
|
|
[XmlInclude(typeof(LeaveGroupRequestPacket))]
|
|
[XmlInclude(typeof(LeaveGroupReplyPacket))]
|
|
[XmlInclude(typeof(InviteGroupRequestPacket))]
|
|
[XmlInclude(typeof(GroupProfileRequestPacket))]
|
|
[XmlInclude(typeof(GroupProfileReplyPacket))]
|
|
[XmlInclude(typeof(GroupAccountSummaryRequestPacket))]
|
|
[XmlInclude(typeof(GroupAccountSummaryReplyPacket))]
|
|
[XmlInclude(typeof(GroupAccountDetailsRequestPacket))]
|
|
[XmlInclude(typeof(GroupAccountDetailsReplyPacket))]
|
|
[XmlInclude(typeof(GroupAccountTransactionsRequestPacket))]
|
|
[XmlInclude(typeof(GroupAccountTransactionsReplyPacket))]
|
|
[XmlInclude(typeof(GroupActiveProposalsRequestPacket))]
|
|
[XmlInclude(typeof(GroupActiveProposalItemReplyPacket))]
|
|
[XmlInclude(typeof(GroupVoteHistoryRequestPacket))]
|
|
[XmlInclude(typeof(GroupVoteHistoryItemReplyPacket))]
|
|
[XmlInclude(typeof(StartGroupProposalPacket))]
|
|
[XmlInclude(typeof(GroupProposalBallotPacket))]
|
|
[XmlInclude(typeof(GroupMembersRequestPacket))]
|
|
[XmlInclude(typeof(GroupMembersReplyPacket))]
|
|
[XmlInclude(typeof(ActivateGroupPacket))]
|
|
[XmlInclude(typeof(SetGroupContributionPacket))]
|
|
[XmlInclude(typeof(SetGroupAcceptNoticesPacket))]
|
|
[XmlInclude(typeof(GroupRoleDataRequestPacket))]
|
|
[XmlInclude(typeof(GroupRoleDataReplyPacket))]
|
|
[XmlInclude(typeof(GroupRoleMembersRequestPacket))]
|
|
[XmlInclude(typeof(GroupRoleMembersReplyPacket))]
|
|
[XmlInclude(typeof(GroupTitlesRequestPacket))]
|
|
[XmlInclude(typeof(GroupTitlesReplyPacket))]
|
|
[XmlInclude(typeof(GroupTitleUpdatePacket))]
|
|
[XmlInclude(typeof(GroupRoleUpdatePacket))]
|
|
[XmlInclude(typeof(LiveHelpGroupRequestPacket))]
|
|
[XmlInclude(typeof(LiveHelpGroupReplyPacket))]
|
|
[XmlInclude(typeof(AgentWearablesRequestPacket))]
|
|
[XmlInclude(typeof(AgentWearablesUpdatePacket))]
|
|
[XmlInclude(typeof(AgentIsNowWearingPacket))]
|
|
[XmlInclude(typeof(AgentCachedTexturePacket))]
|
|
[XmlInclude(typeof(AgentCachedTextureResponsePacket))]
|
|
[XmlInclude(typeof(AgentDataUpdateRequestPacket))]
|
|
[XmlInclude(typeof(AgentDataUpdatePacket))]
|
|
[XmlInclude(typeof(GroupDataUpdatePacket))]
|
|
[XmlInclude(typeof(AgentGroupDataUpdatePacket))]
|
|
[XmlInclude(typeof(AgentDropGroupPacket))]
|
|
[XmlInclude(typeof(CreateTrustedCircuitPacket))]
|
|
[XmlInclude(typeof(DenyTrustedCircuitPacket))]
|
|
[XmlInclude(typeof(RequestTrustedCircuitPacket))]
|
|
[XmlInclude(typeof(RezSingleAttachmentFromInvPacket))]
|
|
[XmlInclude(typeof(RezMultipleAttachmentsFromInvPacket))]
|
|
[XmlInclude(typeof(DetachAttachmentIntoInvPacket))]
|
|
[XmlInclude(typeof(CreateNewOutfitAttachmentsPacket))]
|
|
[XmlInclude(typeof(UserInfoRequestPacket))]
|
|
[XmlInclude(typeof(UserInfoReplyPacket))]
|
|
[XmlInclude(typeof(UpdateUserInfoPacket))]
|
|
[XmlInclude(typeof(GodExpungeUserPacket))]
|
|
[XmlInclude(typeof(StartParcelRemoveAckPacket))]
|
|
[XmlInclude(typeof(InitiateDownloadPacket))]
|
|
[XmlInclude(typeof(SystemMessagePacket))]
|
|
[XmlInclude(typeof(MapLayerRequestPacket))]
|
|
[XmlInclude(typeof(MapLayerReplyPacket))]
|
|
[XmlInclude(typeof(MapBlockRequestPacket))]
|
|
[XmlInclude(typeof(MapNameRequestPacket))]
|
|
[XmlInclude(typeof(MapBlockReplyPacket))]
|
|
[XmlInclude(typeof(MapItemRequestPacket))]
|
|
[XmlInclude(typeof(MapItemReplyPacket))]
|
|
[XmlInclude(typeof(SendPostcardPacket))]
|
|
[XmlInclude(typeof(ParcelMediaCommandMessagePacket))]
|
|
[XmlInclude(typeof(ParcelMediaUpdatePacket))]
|
|
[XmlInclude(typeof(LandStatRequestPacket))]
|
|
[XmlInclude(typeof(LandStatReplyPacket))]
|
|
[XmlInclude(typeof(SecuredTemplateChecksumRequestPacket))]
|
|
[XmlInclude(typeof(PacketAckPacket))]
|
|
[XmlInclude(typeof(OpenCircuitPacket))]
|
|
[XmlInclude(typeof(CloseCircuitPacket))]
|
|
[XmlInclude(typeof(TemplateChecksumRequestPacket))]
|
|
[XmlInclude(typeof(TemplateChecksumReplyPacket))]
|
|
[XmlInclude(typeof(ObjectAddPacket))]
|
|
[XmlInclude(typeof(MultipleObjectUpdatePacket))]
|
|
[XmlInclude(typeof(RequestMultipleObjectsPacket))]
|
|
[XmlInclude(typeof(ObjectPositionPacket))]
|
|
[XmlInclude(typeof(RequestObjectPropertiesFamilyPacket))]
|
|
[XmlInclude(typeof(CoarseLocationUpdatePacket))]
|
|
[XmlInclude(typeof(CrossedRegionPacket))]
|
|
[XmlInclude(typeof(ConfirmEnableSimulatorPacket))]
|
|
[XmlInclude(typeof(ObjectPropertiesPacket))]
|
|
[XmlInclude(typeof(ObjectPropertiesFamilyPacket))]
|
|
[XmlInclude(typeof(ParcelPropertiesRequestPacket))]
|
|
[XmlInclude(typeof(GestureUpdatePacket))]
|
|
[XmlInclude(typeof(AttachedSoundPacket))]
|
|
[XmlInclude(typeof(AttachedSoundGainChangePacket))]
|
|
[XmlInclude(typeof(AttachedSoundCutoffRadiusPacket))]
|
|
[XmlInclude(typeof(PreloadSoundPacket))]
|
|
[XmlInclude(typeof(ViewerEffectPacket))]
|
|
[XmlInclude(typeof(SetSunPhasePacket))]
|
|
[XmlInclude(typeof(StartPingCheckPacket))]
|
|
[XmlInclude(typeof(CompletePingCheckPacket))]
|
|
[XmlInclude(typeof(AgentUpdatePacket))]
|
|
[XmlInclude(typeof(AgentAnimationPacket))]
|
|
[XmlInclude(typeof(AgentRequestSitPacket))]
|
|
[XmlInclude(typeof(AgentSitPacket))]
|
|
[XmlInclude(typeof(RequestImagePacket))]
|
|
[XmlInclude(typeof(ImageDataPacket))]
|
|
[XmlInclude(typeof(ImagePacketPacket))]
|
|
[XmlInclude(typeof(LayerDataPacket))]
|
|
[XmlInclude(typeof(ObjectUpdatePacket))]
|
|
[XmlInclude(typeof(ObjectUpdateCompressedPacket))]
|
|
[XmlInclude(typeof(ObjectUpdateCachedPacket))]
|
|
[XmlInclude(typeof(ImprovedTerseObjectUpdatePacket))]
|
|
[XmlInclude(typeof(KillObjectPacket))]
|
|
[XmlInclude(typeof(AgentToNewRegionPacket))]
|
|
[XmlInclude(typeof(TransferPacketPacket))]
|
|
[XmlInclude(typeof(SendXferPacketPacket))]
|
|
[XmlInclude(typeof(ConfirmXferPacketPacket))]
|
|
[XmlInclude(typeof(AvatarAnimationPacket))]
|
|
[XmlInclude(typeof(AvatarSitResponsePacket))]
|
|
[XmlInclude(typeof(CameraConstraintPacket))]
|
|
[XmlInclude(typeof(ParcelPropertiesPacket))]
|
|
[XmlInclude(typeof(ChildAgentUpdatePacket))]
|
|
[XmlInclude(typeof(ChildAgentAlivePacket))]
|
|
[XmlInclude(typeof(ChildAgentPositionUpdatePacket))]
|
|
[XmlInclude(typeof(SoundTriggerPacket))]
|
|
public abstract class Packet
|
|
{
|
|
public abstract Header Header { get; set; }
|
|
public abstract PacketType Type { get; }
|
|
public int TickCount;
|
|
|
|
public abstract byte[] ToBytes();
|
|
|
|
public void ToXml(XmlWriter xmlWriter)
|
|
{
|
|
XmlSerializer serializer = new XmlSerializer(typeof(Packet));
|
|
serializer.Serialize(xmlWriter, this);
|
|
}
|
|
public static PacketType GetType(ushort id, PacketFrequency frequency)
|
|
{
|
|
switch (frequency)
|
|
{
|
|
case PacketFrequency.Low:
|
|
switch (id)
|
|
{
|
|
case 1: return PacketType.TestMessage;
|
|
case 3: return PacketType.UseCircuitCode;
|
|
case 4: return PacketType.LogControl;
|
|
case 6: return PacketType.LogMessages;
|
|
case 16: return PacketType.TelehubInfo;
|
|
case 36: return PacketType.EconomyDataRequest;
|
|
case 37: return PacketType.EconomyData;
|
|
case 38: return PacketType.AvatarPickerRequest;
|
|
case 40: return PacketType.AvatarPickerReply;
|
|
case 41: return PacketType.PlacesQuery;
|
|
case 42: return PacketType.PlacesReply;
|
|
case 43: return PacketType.DirFindQuery;
|
|
case 45: return PacketType.DirPlacesQuery;
|
|
case 47: return PacketType.DirPlacesReply;
|
|
case 48: return PacketType.DirPeopleReply;
|
|
case 49: return PacketType.DirEventsReply;
|
|
case 50: return PacketType.DirGroupsReply;
|
|
case 51: return PacketType.DirClassifiedQuery;
|
|
case 53: return PacketType.DirClassifiedReply;
|
|
case 54: return PacketType.AvatarClassifiedReply;
|
|
case 55: return PacketType.ClassifiedInfoRequest;
|
|
case 56: return PacketType.ClassifiedInfoReply;
|
|
case 57: return PacketType.ClassifiedInfoUpdate;
|
|
case 58: return PacketType.ClassifiedDelete;
|
|
case 59: return PacketType.ClassifiedGodDelete;
|
|
case 60: return PacketType.DirPicksQuery;
|
|
case 62: return PacketType.DirPicksReply;
|
|
case 63: return PacketType.DirLandQuery;
|
|
case 65: return PacketType.DirLandReply;
|
|
case 66: return PacketType.DirPopularQuery;
|
|
case 68: return PacketType.DirPopularReply;
|
|
case 69: return PacketType.ParcelInfoRequest;
|
|
case 70: return PacketType.ParcelInfoReply;
|
|
case 71: return PacketType.ParcelObjectOwnersRequest;
|
|
case 74: return PacketType.ParcelObjectOwnersReply;
|
|
case 75: return PacketType.GroupNoticesListRequest;
|
|
case 76: return PacketType.GroupNoticesListReply;
|
|
case 77: return PacketType.GroupNoticeRequest;
|
|
case 79: return PacketType.GroupNoticeDelete;
|
|
case 80: return PacketType.TeleportRequest;
|
|
case 81: return PacketType.TeleportLocationRequest;
|
|
case 82: return PacketType.TeleportLocal;
|
|
case 83: return PacketType.TeleportLandmarkRequest;
|
|
case 84: return PacketType.TeleportProgress;
|
|
case 89: return PacketType.TeleportFinish;
|
|
case 90: return PacketType.StartLure;
|
|
case 91: return PacketType.TeleportLureRequest;
|
|
case 92: return PacketType.TeleportCancel;
|
|
case 94: return PacketType.TeleportStart;
|
|
case 95: return PacketType.TeleportFailed;
|
|
case 96: return PacketType.LeaderBoardRequest;
|
|
case 97: return PacketType.LeaderBoardData;
|
|
case 98: return PacketType.Undo;
|
|
case 99: return PacketType.Redo;
|
|
case 100: return PacketType.UndoLand;
|
|
case 101: return PacketType.RedoLand;
|
|
case 102: return PacketType.AgentPause;
|
|
case 103: return PacketType.AgentResume;
|
|
case 104: return PacketType.ChatFromViewer;
|
|
case 105: return PacketType.AgentThrottle;
|
|
case 106: return PacketType.AgentFOV;
|
|
case 107: return PacketType.AgentHeightWidth;
|
|
case 108: return PacketType.AgentSetAppearance;
|
|
case 109: return PacketType.AgentQuit;
|
|
case 110: return PacketType.AgentQuitCopy;
|
|
case 111: return PacketType.ImageNotInDatabase;
|
|
case 112: return PacketType.RebakeAvatarTextures;
|
|
case 113: return PacketType.SetAlwaysRun;
|
|
case 114: return PacketType.ObjectDelete;
|
|
case 115: return PacketType.ObjectDuplicate;
|
|
case 116: return PacketType.ObjectDuplicateOnRay;
|
|
case 117: return PacketType.ObjectScale;
|
|
case 118: return PacketType.ObjectRotation;
|
|
case 119: return PacketType.ObjectFlagUpdate;
|
|
case 120: return PacketType.ObjectClickAction;
|
|
case 121: return PacketType.ObjectImage;
|
|
case 122: return PacketType.ObjectMaterial;
|
|
case 123: return PacketType.ObjectShape;
|
|
case 124: return PacketType.ObjectExtraParams;
|
|
case 125: return PacketType.ObjectOwner;
|
|
case 126: return PacketType.ObjectGroup;
|
|
case 127: return PacketType.ObjectBuy;
|
|
case 128: return PacketType.BuyObjectInventory;
|
|
case 129: return PacketType.DerezContainer;
|
|
case 130: return PacketType.ObjectPermissions;
|
|
case 131: return PacketType.ObjectSaleInfo;
|
|
case 132: return PacketType.ObjectName;
|
|
case 133: return PacketType.ObjectDescription;
|
|
case 134: return PacketType.ObjectCategory;
|
|
case 135: return PacketType.ObjectSelect;
|
|
case 136: return PacketType.ObjectDeselect;
|
|
case 137: return PacketType.ObjectAttach;
|
|
case 138: return PacketType.ObjectDetach;
|
|
case 139: return PacketType.ObjectDrop;
|
|
case 140: return PacketType.ObjectLink;
|
|
case 141: return PacketType.ObjectDelink;
|
|
case 142: return PacketType.ObjectHinge;
|
|
case 143: return PacketType.ObjectDehinge;
|
|
case 144: return PacketType.ObjectGrab;
|
|
case 145: return PacketType.ObjectGrabUpdate;
|
|
case 146: return PacketType.ObjectDeGrab;
|
|
case 147: return PacketType.ObjectSpinStart;
|
|
case 148: return PacketType.ObjectSpinUpdate;
|
|
case 149: return PacketType.ObjectSpinStop;
|
|
case 150: return PacketType.ObjectExportSelected;
|
|
case 151: return PacketType.ObjectImport;
|
|
case 152: return PacketType.ModifyLand;
|
|
case 153: return PacketType.VelocityInterpolateOn;
|
|
case 154: return PacketType.VelocityInterpolateOff;
|
|
case 155: return PacketType.StateSave;
|
|
case 156: return PacketType.ReportAutosaveCrash;
|
|
case 157: return PacketType.SimWideDeletes;
|
|
case 158: return PacketType.TrackAgent;
|
|
case 159: return PacketType.ViewerStats;
|
|
case 160: return PacketType.ScriptAnswerYes;
|
|
case 161: return PacketType.UserReport;
|
|
case 162: return PacketType.AlertMessage;
|
|
case 163: return PacketType.AgentAlertMessage;
|
|
case 164: return PacketType.MeanCollisionAlert;
|
|
case 165: return PacketType.ViewerFrozenMessage;
|
|
case 166: return PacketType.HealthMessage;
|
|
case 167: return PacketType.ChatFromSimulator;
|
|
case 168: return PacketType.SimStats;
|
|
case 169: return PacketType.RequestRegionInfo;
|
|
case 170: return PacketType.RegionInfo;
|
|
case 171: return PacketType.GodUpdateRegionInfo;
|
|
case 174: return PacketType.NearestLandingRegionUpdated;
|
|
case 176: return PacketType.RegionHandshake;
|
|
case 177: return PacketType.RegionHandshakeReply;
|
|
case 178: return PacketType.SimulatorViewerTimeMessage;
|
|
case 179: return PacketType.EnableSimulator;
|
|
case 180: return PacketType.DisableSimulator;
|
|
case 181: return PacketType.TransferRequest;
|
|
case 182: return PacketType.TransferInfo;
|
|
case 183: return PacketType.TransferAbort;
|
|
case 184: return PacketType.TransferPriority;
|
|
case 185: return PacketType.RequestXfer;
|
|
case 186: return PacketType.AbortXfer;
|
|
case 187: return PacketType.RequestAvatarInfo;
|
|
case 188: return PacketType.AvatarAppearance;
|
|
case 189: return PacketType.SetFollowCamProperties;
|
|
case 190: return PacketType.ClearFollowCamProperties;
|
|
case 191: return PacketType.RequestPayPrice;
|
|
case 192: return PacketType.PayPriceReply;
|
|
case 193: return PacketType.KickUser;
|
|
case 194: return PacketType.KickUserAck;
|
|
case 195: return PacketType.GodKickUser;
|
|
case 197: return PacketType.EjectUser;
|
|
case 198: return PacketType.FreezeUser;
|
|
case 199: return PacketType.AvatarPropertiesRequest;
|
|
case 201: return PacketType.AvatarPropertiesReply;
|
|
case 202: return PacketType.AvatarInterestsReply;
|
|
case 203: return PacketType.AvatarGroupsReply;
|
|
case 204: return PacketType.AvatarPropertiesUpdate;
|
|
case 205: return PacketType.AvatarInterestsUpdate;
|
|
case 206: return PacketType.AvatarStatisticsReply;
|
|
case 207: return PacketType.AvatarNotesReply;
|
|
case 208: return PacketType.AvatarNotesUpdate;
|
|
case 209: return PacketType.AvatarPicksReply;
|
|
case 210: return PacketType.EventInfoRequest;
|
|
case 211: return PacketType.EventInfoReply;
|
|
case 212: return PacketType.EventNotificationAddRequest;
|
|
case 213: return PacketType.EventNotificationRemoveRequest;
|
|
case 214: return PacketType.EventGodDelete;
|
|
case 215: return PacketType.PickInfoRequest;
|
|
case 216: return PacketType.PickInfoReply;
|
|
case 217: return PacketType.PickInfoUpdate;
|
|
case 218: return PacketType.PickDelete;
|
|
case 219: return PacketType.PickGodDelete;
|
|
case 220: return PacketType.ScriptQuestion;
|
|
case 221: return PacketType.ScriptControlChange;
|
|
case 222: return PacketType.ScriptDialog;
|
|
case 223: return PacketType.ScriptDialogReply;
|
|
case 224: return PacketType.ForceScriptControlRelease;
|
|
case 225: return PacketType.RevokePermissions;
|
|
case 226: return PacketType.LoadURL;
|
|
case 227: return PacketType.ScriptTeleportRequest;
|
|
case 228: return PacketType.ParcelOverlay;
|
|
case 229: return PacketType.ParcelPropertiesRequestByID;
|
|
case 230: return PacketType.ParcelPropertiesUpdate;
|
|
case 231: return PacketType.ParcelReturnObjects;
|
|
case 232: return PacketType.ParcelSetOtherCleanTime;
|
|
case 233: return PacketType.ParcelDisableObjects;
|
|
case 234: return PacketType.ParcelSelectObjects;
|
|
case 235: return PacketType.EstateCovenantRequest;
|
|
case 236: return PacketType.EstateCovenantReply;
|
|
case 237: return PacketType.ForceObjectSelect;
|
|
case 238: return PacketType.ParcelBuyPass;
|
|
case 239: return PacketType.ParcelDeedToGroup;
|
|
case 240: return PacketType.ParcelReclaim;
|
|
case 241: return PacketType.ParcelClaim;
|
|
case 242: return PacketType.ParcelJoin;
|
|
case 243: return PacketType.ParcelDivide;
|
|
case 244: return PacketType.ParcelRelease;
|
|
case 245: return PacketType.ParcelBuy;
|
|
case 246: return PacketType.ParcelGodForceOwner;
|
|
case 247: return PacketType.ParcelAccessListRequest;
|
|
case 248: return PacketType.ParcelAccessListReply;
|
|
case 249: return PacketType.ParcelAccessListUpdate;
|
|
case 250: return PacketType.ParcelDwellRequest;
|
|
case 251: return PacketType.ParcelDwellReply;
|
|
case 259: return PacketType.ParcelGodMarkAsContent;
|
|
case 260: return PacketType.ParcelGodReserveForNewbie;
|
|
case 261: return PacketType.ViewerStartAuction;
|
|
case 268: return PacketType.UUIDNameRequest;
|
|
case 269: return PacketType.UUIDNameReply;
|
|
case 270: return PacketType.UUIDGroupNameRequest;
|
|
case 271: return PacketType.UUIDGroupNameReply;
|
|
case 273: return PacketType.ChildAgentDying;
|
|
case 274: return PacketType.ChildAgentUnknown;
|
|
case 276: return PacketType.GetScriptRunning;
|
|
case 277: return PacketType.ScriptRunningReply;
|
|
case 278: return PacketType.SetScriptRunning;
|
|
case 279: return PacketType.ScriptReset;
|
|
case 282: return PacketType.CompleteAgentMovement;
|
|
case 283: return PacketType.AgentMovementComplete;
|
|
case 285: return PacketType.ConnectAgentToUserserver;
|
|
case 286: return PacketType.ConnectToUserserver;
|
|
case 288: return PacketType.LogoutRequest;
|
|
case 289: return PacketType.FinalizeLogout;
|
|
case 290: return PacketType.LogoutReply;
|
|
case 291: return PacketType.LogoutDemand;
|
|
case 292: return PacketType.ImprovedInstantMessage;
|
|
case 293: return PacketType.RetrieveInstantMessages;
|
|
case 294: return PacketType.DequeueInstantMessages;
|
|
case 295: return PacketType.FindAgent;
|
|
case 296: return PacketType.RequestGodlikePowers;
|
|
case 297: return PacketType.GrantGodlikePowers;
|
|
case 298: return PacketType.GodlikeMessage;
|
|
case 299: return PacketType.EstateOwnerMessage;
|
|
case 300: return PacketType.GenericMessage;
|
|
case 301: return PacketType.MuteListRequest;
|
|
case 302: return PacketType.UpdateMuteListEntry;
|
|
case 303: return PacketType.RemoveMuteListEntry;
|
|
case 304: return PacketType.CopyInventoryFromNotecard;
|
|
case 305: return PacketType.UpdateInventoryItem;
|
|
case 306: return PacketType.UpdateCreateInventoryItem;
|
|
case 307: return PacketType.MoveInventoryItem;
|
|
case 308: return PacketType.CopyInventoryItem;
|
|
case 309: return PacketType.RemoveInventoryItem;
|
|
case 310: return PacketType.ChangeInventoryItemFlags;
|
|
case 311: return PacketType.SaveAssetIntoInventory;
|
|
case 312: return PacketType.CreateInventoryFolder;
|
|
case 313: return PacketType.UpdateInventoryFolder;
|
|
case 314: return PacketType.MoveInventoryFolder;
|
|
case 315: return PacketType.RemoveInventoryFolder;
|
|
case 316: return PacketType.FetchInventoryDescendents;
|
|
case 317: return PacketType.InventoryDescendents;
|
|
case 318: return PacketType.FetchInventory;
|
|
case 319: return PacketType.FetchInventoryReply;
|
|
case 320: return PacketType.BulkUpdateInventory;
|
|
case 321: return PacketType.RequestInventoryAsset;
|
|
case 322: return PacketType.InventoryAssetResponse;
|
|
case 323: return PacketType.RemoveInventoryObjects;
|
|
case 324: return PacketType.PurgeInventoryDescendents;
|
|
case 325: return PacketType.UpdateTaskInventory;
|
|
case 326: return PacketType.RemoveTaskInventory;
|
|
case 327: return PacketType.MoveTaskInventory;
|
|
case 328: return PacketType.RequestTaskInventory;
|
|
case 329: return PacketType.ReplyTaskInventory;
|
|
case 330: return PacketType.DeRezObject;
|
|
case 331: return PacketType.DeRezAck;
|
|
case 332: return PacketType.RezObject;
|
|
case 333: return PacketType.RezObjectFromNotecard;
|
|
case 334: return PacketType.DeclineInventory;
|
|
case 337: return PacketType.RequestFriendship;
|
|
case 338: return PacketType.AcceptFriendship;
|
|
case 339: return PacketType.DeclineFriendship;
|
|
case 340: return PacketType.FormFriendship;
|
|
case 341: return PacketType.TerminateFriendship;
|
|
case 342: return PacketType.OfferCallingCard;
|
|
case 343: return PacketType.AcceptCallingCard;
|
|
case 344: return PacketType.DeclineCallingCard;
|
|
case 345: return PacketType.RezScript;
|
|
case 346: return PacketType.CreateInventoryItem;
|
|
case 347: return PacketType.CreateLandmarkForEvent;
|
|
case 350: return PacketType.RegionHandleRequest;
|
|
case 351: return PacketType.RegionIDAndHandleReply;
|
|
case 352: return PacketType.MoneyTransferRequest;
|
|
case 355: return PacketType.AdjustBalance;
|
|
case 356: return PacketType.MoneyBalanceRequest;
|
|
case 357: return PacketType.MoneyBalanceReply;
|
|
case 358: return PacketType.RoutedMoneyBalanceReply;
|
|
case 359: return PacketType.MoneyHistoryRequest;
|
|
case 360: return PacketType.MoneyHistoryReply;
|
|
case 361: return PacketType.MoneySummaryRequest;
|
|
case 362: return PacketType.MoneySummaryReply;
|
|
case 363: return PacketType.MoneyDetailsRequest;
|
|
case 364: return PacketType.MoneyDetailsReply;
|
|
case 365: return PacketType.MoneyTransactionsRequest;
|
|
case 366: return PacketType.MoneyTransactionsReply;
|
|
case 367: return PacketType.GestureRequest;
|
|
case 368: return PacketType.ActivateGestures;
|
|
case 369: return PacketType.DeactivateGestures;
|
|
case 370: return PacketType.MuteListUpdate;
|
|
case 371: return PacketType.UseCachedMuteList;
|
|
case 372: return PacketType.GrantUserRights;
|
|
case 373: return PacketType.ChangeUserRights;
|
|
case 374: return PacketType.OnlineNotification;
|
|
case 375: return PacketType.OfflineNotification;
|
|
case 376: return PacketType.SetStartLocationRequest;
|
|
case 386: return PacketType.AssetUploadRequest;
|
|
case 387: return PacketType.AssetUploadComplete;
|
|
case 388: return PacketType.ReputationAgentAssign;
|
|
case 389: return PacketType.ReputationIndividualRequest;
|
|
case 390: return PacketType.ReputationIndividualReply;
|
|
case 395: return PacketType.CreateGroupRequest;
|
|
case 396: return PacketType.CreateGroupReply;
|
|
case 397: return PacketType.UpdateGroupInfo;
|
|
case 398: return PacketType.GroupRoleChanges;
|
|
case 399: return PacketType.JoinGroupRequest;
|
|
case 400: return PacketType.JoinGroupReply;
|
|
case 401: return PacketType.EjectGroupMemberRequest;
|
|
case 402: return PacketType.EjectGroupMemberReply;
|
|
case 403: return PacketType.LeaveGroupRequest;
|
|
case 404: return PacketType.LeaveGroupReply;
|
|
case 405: return PacketType.InviteGroupRequest;
|
|
case 407: return PacketType.GroupProfileRequest;
|
|
case 408: return PacketType.GroupProfileReply;
|
|
case 409: return PacketType.GroupAccountSummaryRequest;
|
|
case 410: return PacketType.GroupAccountSummaryReply;
|
|
case 411: return PacketType.GroupAccountDetailsRequest;
|
|
case 412: return PacketType.GroupAccountDetailsReply;
|
|
case 413: return PacketType.GroupAccountTransactionsRequest;
|
|
case 414: return PacketType.GroupAccountTransactionsReply;
|
|
case 415: return PacketType.GroupActiveProposalsRequest;
|
|
case 416: return PacketType.GroupActiveProposalItemReply;
|
|
case 417: return PacketType.GroupVoteHistoryRequest;
|
|
case 418: return PacketType.GroupVoteHistoryItemReply;
|
|
case 419: return PacketType.StartGroupProposal;
|
|
case 420: return PacketType.GroupProposalBallot;
|
|
case 422: return PacketType.GroupMembersRequest;
|
|
case 423: return PacketType.GroupMembersReply;
|
|
case 424: return PacketType.ActivateGroup;
|
|
case 425: return PacketType.SetGroupContribution;
|
|
case 426: return PacketType.SetGroupAcceptNotices;
|
|
case 427: return PacketType.GroupRoleDataRequest;
|
|
case 428: return PacketType.GroupRoleDataReply;
|
|
case 429: return PacketType.GroupRoleMembersRequest;
|
|
case 430: return PacketType.GroupRoleMembersReply;
|
|
case 431: return PacketType.GroupTitlesRequest;
|
|
case 432: return PacketType.GroupTitlesReply;
|
|
case 433: return PacketType.GroupTitleUpdate;
|
|
case 434: return PacketType.GroupRoleUpdate;
|
|
case 435: return PacketType.LiveHelpGroupRequest;
|
|
case 436: return PacketType.LiveHelpGroupReply;
|
|
case 437: return PacketType.AgentWearablesRequest;
|
|
case 438: return PacketType.AgentWearablesUpdate;
|
|
case 439: return PacketType.AgentIsNowWearing;
|
|
case 440: return PacketType.AgentCachedTexture;
|
|
case 441: return PacketType.AgentCachedTextureResponse;
|
|
case 442: return PacketType.AgentDataUpdateRequest;
|
|
case 443: return PacketType.AgentDataUpdate;
|
|
case 444: return PacketType.GroupDataUpdate;
|
|
case 445: return PacketType.AgentGroupDataUpdate;
|
|
case 446: return PacketType.AgentDropGroup;
|
|
case 448: return PacketType.CreateTrustedCircuit;
|
|
case 449: return PacketType.DenyTrustedCircuit;
|
|
case 450: return PacketType.RequestTrustedCircuit;
|
|
case 451: return PacketType.RezSingleAttachmentFromInv;
|
|
case 452: return PacketType.RezMultipleAttachmentsFromInv;
|
|
case 453: return PacketType.DetachAttachmentIntoInv;
|
|
case 454: return PacketType.CreateNewOutfitAttachments;
|
|
case 455: return PacketType.UserInfoRequest;
|
|
case 456: return PacketType.UserInfoReply;
|
|
case 457: return PacketType.UpdateUserInfo;
|
|
case 458: return PacketType.GodExpungeUser;
|
|
case 466: return PacketType.StartParcelRemoveAck;
|
|
case 468: return PacketType.InitiateDownload;
|
|
case 469: return PacketType.SystemMessage;
|
|
case 470: return PacketType.MapLayerRequest;
|
|
case 471: return PacketType.MapLayerReply;
|
|
case 472: return PacketType.MapBlockRequest;
|
|
case 473: return PacketType.MapNameRequest;
|
|
case 474: return PacketType.MapBlockReply;
|
|
case 475: return PacketType.MapItemRequest;
|
|
case 476: return PacketType.MapItemReply;
|
|
case 477: return PacketType.SendPostcard;
|
|
case 486: return PacketType.ParcelMediaCommandMessage;
|
|
case 487: return PacketType.ParcelMediaUpdate;
|
|
case 488: return PacketType.LandStatRequest;
|
|
case 489: return PacketType.LandStatReply;
|
|
case 65530: return PacketType.SecuredTemplateChecksumRequest;
|
|
case 65531: return PacketType.PacketAck;
|
|
case 65532: return PacketType.OpenCircuit;
|
|
case 65533: return PacketType.CloseCircuit;
|
|
case 65534: return PacketType.TemplateChecksumRequest;
|
|
case 65535: return PacketType.TemplateChecksumReply;
|
|
}
|
|
break;
|
|
case PacketFrequency.Medium:
|
|
switch (id)
|
|
{
|
|
case 2: return PacketType.ObjectAdd;
|
|
case 3: return PacketType.MultipleObjectUpdate;
|
|
case 4: return PacketType.RequestMultipleObjects;
|
|
case 5: return PacketType.ObjectPosition;
|
|
case 6: return PacketType.RequestObjectPropertiesFamily;
|
|
case 7: return PacketType.CoarseLocationUpdate;
|
|
case 8: return PacketType.CrossedRegion;
|
|
case 9: return PacketType.ConfirmEnableSimulator;
|
|
case 10: return PacketType.ObjectProperties;
|
|
case 11: return PacketType.ObjectPropertiesFamily;
|
|
case 12: return PacketType.ParcelPropertiesRequest;
|
|
case 14: return PacketType.GestureUpdate;
|
|
case 15: return PacketType.AttachedSound;
|
|
case 16: return PacketType.AttachedSoundGainChange;
|
|
case 17: return PacketType.AttachedSoundCutoffRadius;
|
|
case 18: return PacketType.PreloadSound;
|
|
case 20: return PacketType.ViewerEffect;
|
|
case 21: return PacketType.SetSunPhase;
|
|
}
|
|
break;
|
|
case PacketFrequency.High:
|
|
switch (id)
|
|
{
|
|
case 1: return PacketType.StartPingCheck;
|
|
case 2: return PacketType.CompletePingCheck;
|
|
case 4: return PacketType.AgentUpdate;
|
|
case 5: return PacketType.AgentAnimation;
|
|
case 6: return PacketType.AgentRequestSit;
|
|
case 7: return PacketType.AgentSit;
|
|
case 8: return PacketType.RequestImage;
|
|
case 9: return PacketType.ImageData;
|
|
case 10: return PacketType.ImagePacket;
|
|
case 11: return PacketType.LayerData;
|
|
case 12: return PacketType.ObjectUpdate;
|
|
case 13: return PacketType.ObjectUpdateCompressed;
|
|
case 14: return PacketType.ObjectUpdateCached;
|
|
case 15: return PacketType.ImprovedTerseObjectUpdate;
|
|
case 16: return PacketType.KillObject;
|
|
case 17: return PacketType.AgentToNewRegion;
|
|
case 18: return PacketType.TransferPacket;
|
|
case 19: return PacketType.SendXferPacket;
|
|
case 20: return PacketType.ConfirmXferPacket;
|
|
case 21: return PacketType.AvatarAnimation;
|
|
case 22: return PacketType.AvatarSitResponse;
|
|
case 23: return PacketType.CameraConstraint;
|
|
case 24: return PacketType.ParcelProperties;
|
|
case 26: return PacketType.ChildAgentUpdate;
|
|
case 27: return PacketType.ChildAgentAlive;
|
|
case 28: return PacketType.ChildAgentPositionUpdate;
|
|
case 31: return PacketType.SoundTrigger;
|
|
}
|
|
break;
|
|
}
|
|
|
|
return PacketType.Default;
|
|
}
|
|
|
|
public static Packet BuildPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer)
|
|
{
|
|
ushort id;
|
|
int i = 0;
|
|
Header header = Header.BuildHeader(bytes, ref i, ref packetEnd);
|
|
if (header.Zerocoded)
|
|
{
|
|
packetEnd = Helpers.ZeroDecode(bytes, packetEnd + 1, zeroBuffer) - 1;
|
|
bytes = zeroBuffer;
|
|
}
|
|
|
|
if (bytes[4] == 0xFF)
|
|
{
|
|
if (bytes[5] == 0xFF)
|
|
{
|
|
id = (ushort)((bytes[6] << 8) + bytes[7]);
|
|
switch (id)
|
|
{
|
|
case 1: return new TestMessagePacket(header, bytes, ref i);
|
|
case 3: return new UseCircuitCodePacket(header, bytes, ref i);
|
|
case 4: return new LogControlPacket(header, bytes, ref i);
|
|
case 6: return new LogMessagesPacket(header, bytes, ref i);
|
|
case 16: return new TelehubInfoPacket(header, bytes, ref i);
|
|
case 36: return new EconomyDataRequestPacket(header, bytes, ref i);
|
|
case 37: return new EconomyDataPacket(header, bytes, ref i);
|
|
case 38: return new AvatarPickerRequestPacket(header, bytes, ref i);
|
|
case 40: return new AvatarPickerReplyPacket(header, bytes, ref i);
|
|
case 41: return new PlacesQueryPacket(header, bytes, ref i);
|
|
case 42: return new PlacesReplyPacket(header, bytes, ref i);
|
|
case 43: return new DirFindQueryPacket(header, bytes, ref i);
|
|
case 45: return new DirPlacesQueryPacket(header, bytes, ref i);
|
|
case 47: return new DirPlacesReplyPacket(header, bytes, ref i);
|
|
case 48: return new DirPeopleReplyPacket(header, bytes, ref i);
|
|
case 49: return new DirEventsReplyPacket(header, bytes, ref i);
|
|
case 50: return new DirGroupsReplyPacket(header, bytes, ref i);
|
|
case 51: return new DirClassifiedQueryPacket(header, bytes, ref i);
|
|
case 53: return new DirClassifiedReplyPacket(header, bytes, ref i);
|
|
case 54: return new AvatarClassifiedReplyPacket(header, bytes, ref i);
|
|
case 55: return new ClassifiedInfoRequestPacket(header, bytes, ref i);
|
|
case 56: return new ClassifiedInfoReplyPacket(header, bytes, ref i);
|
|
case 57: return new ClassifiedInfoUpdatePacket(header, bytes, ref i);
|
|
case 58: return new ClassifiedDeletePacket(header, bytes, ref i);
|
|
case 59: return new ClassifiedGodDeletePacket(header, bytes, ref i);
|
|
case 60: return new DirPicksQueryPacket(header, bytes, ref i);
|
|
case 62: return new DirPicksReplyPacket(header, bytes, ref i);
|
|
case 63: return new DirLandQueryPacket(header, bytes, ref i);
|
|
case 65: return new DirLandReplyPacket(header, bytes, ref i);
|
|
case 66: return new DirPopularQueryPacket(header, bytes, ref i);
|
|
case 68: return new DirPopularReplyPacket(header, bytes, ref i);
|
|
case 69: return new ParcelInfoRequestPacket(header, bytes, ref i);
|
|
case 70: return new ParcelInfoReplyPacket(header, bytes, ref i);
|
|
case 71: return new ParcelObjectOwnersRequestPacket(header, bytes, ref i);
|
|
case 74: return new ParcelObjectOwnersReplyPacket(header, bytes, ref i);
|
|
case 75: return new GroupNoticesListRequestPacket(header, bytes, ref i);
|
|
case 76: return new GroupNoticesListReplyPacket(header, bytes, ref i);
|
|
case 77: return new GroupNoticeRequestPacket(header, bytes, ref i);
|
|
case 79: return new GroupNoticeDeletePacket(header, bytes, ref i);
|
|
case 80: return new TeleportRequestPacket(header, bytes, ref i);
|
|
case 81: return new TeleportLocationRequestPacket(header, bytes, ref i);
|
|
case 82: return new TeleportLocalPacket(header, bytes, ref i);
|
|
case 83: return new TeleportLandmarkRequestPacket(header, bytes, ref i);
|
|
case 84: return new TeleportProgressPacket(header, bytes, ref i);
|
|
case 89: return new TeleportFinishPacket(header, bytes, ref i);
|
|
case 90: return new StartLurePacket(header, bytes, ref i);
|
|
case 91: return new TeleportLureRequestPacket(header, bytes, ref i);
|
|
case 92: return new TeleportCancelPacket(header, bytes, ref i);
|
|
case 94: return new TeleportStartPacket(header, bytes, ref i);
|
|
case 95: return new TeleportFailedPacket(header, bytes, ref i);
|
|
case 96: return new LeaderBoardRequestPacket(header, bytes, ref i);
|
|
case 97: return new LeaderBoardDataPacket(header, bytes, ref i);
|
|
case 98: return new UndoPacket(header, bytes, ref i);
|
|
case 99: return new RedoPacket(header, bytes, ref i);
|
|
case 100: return new UndoLandPacket(header, bytes, ref i);
|
|
case 101: return new RedoLandPacket(header, bytes, ref i);
|
|
case 102: return new AgentPausePacket(header, bytes, ref i);
|
|
case 103: return new AgentResumePacket(header, bytes, ref i);
|
|
case 104: return new ChatFromViewerPacket(header, bytes, ref i);
|
|
case 105: return new AgentThrottlePacket(header, bytes, ref i);
|
|
case 106: return new AgentFOVPacket(header, bytes, ref i);
|
|
case 107: return new AgentHeightWidthPacket(header, bytes, ref i);
|
|
case 108: return new AgentSetAppearancePacket(header, bytes, ref i);
|
|
case 109: return new AgentQuitPacket(header, bytes, ref i);
|
|
case 110: return new AgentQuitCopyPacket(header, bytes, ref i);
|
|
case 111: return new ImageNotInDatabasePacket(header, bytes, ref i);
|
|
case 112: return new RebakeAvatarTexturesPacket(header, bytes, ref i);
|
|
case 113: return new SetAlwaysRunPacket(header, bytes, ref i);
|
|
case 114: return new ObjectDeletePacket(header, bytes, ref i);
|
|
case 115: return new ObjectDuplicatePacket(header, bytes, ref i);
|
|
case 116: return new ObjectDuplicateOnRayPacket(header, bytes, ref i);
|
|
case 117: return new ObjectScalePacket(header, bytes, ref i);
|
|
case 118: return new ObjectRotationPacket(header, bytes, ref i);
|
|
case 119: return new ObjectFlagUpdatePacket(header, bytes, ref i);
|
|
case 120: return new ObjectClickActionPacket(header, bytes, ref i);
|
|
case 121: return new ObjectImagePacket(header, bytes, ref i);
|
|
case 122: return new ObjectMaterialPacket(header, bytes, ref i);
|
|
case 123: return new ObjectShapePacket(header, bytes, ref i);
|
|
case 124: return new ObjectExtraParamsPacket(header, bytes, ref i);
|
|
case 125: return new ObjectOwnerPacket(header, bytes, ref i);
|
|
case 126: return new ObjectGroupPacket(header, bytes, ref i);
|
|
case 127: return new ObjectBuyPacket(header, bytes, ref i);
|
|
case 128: return new BuyObjectInventoryPacket(header, bytes, ref i);
|
|
case 129: return new DerezContainerPacket(header, bytes, ref i);
|
|
case 130: return new ObjectPermissionsPacket(header, bytes, ref i);
|
|
case 131: return new ObjectSaleInfoPacket(header, bytes, ref i);
|
|
case 132: return new ObjectNamePacket(header, bytes, ref i);
|
|
case 133: return new ObjectDescriptionPacket(header, bytes, ref i);
|
|
case 134: return new ObjectCategoryPacket(header, bytes, ref i);
|
|
case 135: return new ObjectSelectPacket(header, bytes, ref i);
|
|
case 136: return new ObjectDeselectPacket(header, bytes, ref i);
|
|
case 137: return new ObjectAttachPacket(header, bytes, ref i);
|
|
case 138: return new ObjectDetachPacket(header, bytes, ref i);
|
|
case 139: return new ObjectDropPacket(header, bytes, ref i);
|
|
case 140: return new ObjectLinkPacket(header, bytes, ref i);
|
|
case 141: return new ObjectDelinkPacket(header, bytes, ref i);
|
|
case 142: return new ObjectHingePacket(header, bytes, ref i);
|
|
case 143: return new ObjectDehingePacket(header, bytes, ref i);
|
|
case 144: return new ObjectGrabPacket(header, bytes, ref i);
|
|
case 145: return new ObjectGrabUpdatePacket(header, bytes, ref i);
|
|
case 146: return new ObjectDeGrabPacket(header, bytes, ref i);
|
|
case 147: return new ObjectSpinStartPacket(header, bytes, ref i);
|
|
case 148: return new ObjectSpinUpdatePacket(header, bytes, ref i);
|
|
case 149: return new ObjectSpinStopPacket(header, bytes, ref i);
|
|
case 150: return new ObjectExportSelectedPacket(header, bytes, ref i);
|
|
case 151: return new ObjectImportPacket(header, bytes, ref i);
|
|
case 152: return new ModifyLandPacket(header, bytes, ref i);
|
|
case 153: return new VelocityInterpolateOnPacket(header, bytes, ref i);
|
|
case 154: return new VelocityInterpolateOffPacket(header, bytes, ref i);
|
|
case 155: return new StateSavePacket(header, bytes, ref i);
|
|
case 156: return new ReportAutosaveCrashPacket(header, bytes, ref i);
|
|
case 157: return new SimWideDeletesPacket(header, bytes, ref i);
|
|
case 158: return new TrackAgentPacket(header, bytes, ref i);
|
|
case 159: return new ViewerStatsPacket(header, bytes, ref i);
|
|
case 160: return new ScriptAnswerYesPacket(header, bytes, ref i);
|
|
case 161: return new UserReportPacket(header, bytes, ref i);
|
|
case 162: return new AlertMessagePacket(header, bytes, ref i);
|
|
case 163: return new AgentAlertMessagePacket(header, bytes, ref i);
|
|
case 164: return new MeanCollisionAlertPacket(header, bytes, ref i);
|
|
case 165: return new ViewerFrozenMessagePacket(header, bytes, ref i);
|
|
case 166: return new HealthMessagePacket(header, bytes, ref i);
|
|
case 167: return new ChatFromSimulatorPacket(header, bytes, ref i);
|
|
case 168: return new SimStatsPacket(header, bytes, ref i);
|
|
case 169: return new RequestRegionInfoPacket(header, bytes, ref i);
|
|
case 170: return new RegionInfoPacket(header, bytes, ref i);
|
|
case 171: return new GodUpdateRegionInfoPacket(header, bytes, ref i);
|
|
case 174: return new NearestLandingRegionUpdatedPacket(header, bytes, ref i);
|
|
case 176: return new RegionHandshakePacket(header, bytes, ref i);
|
|
case 177: return new RegionHandshakeReplyPacket(header, bytes, ref i);
|
|
case 178: return new SimulatorViewerTimeMessagePacket(header, bytes, ref i);
|
|
case 179: return new EnableSimulatorPacket(header, bytes, ref i);
|
|
case 180: return new DisableSimulatorPacket(header, bytes, ref i);
|
|
case 181: return new TransferRequestPacket(header, bytes, ref i);
|
|
case 182: return new TransferInfoPacket(header, bytes, ref i);
|
|
case 183: return new TransferAbortPacket(header, bytes, ref i);
|
|
case 184: return new TransferPriorityPacket(header, bytes, ref i);
|
|
case 185: return new RequestXferPacket(header, bytes, ref i);
|
|
case 186: return new AbortXferPacket(header, bytes, ref i);
|
|
case 187: return new RequestAvatarInfoPacket(header, bytes, ref i);
|
|
case 188: return new AvatarAppearancePacket(header, bytes, ref i);
|
|
case 189: return new SetFollowCamPropertiesPacket(header, bytes, ref i);
|
|
case 190: return new ClearFollowCamPropertiesPacket(header, bytes, ref i);
|
|
case 191: return new RequestPayPricePacket(header, bytes, ref i);
|
|
case 192: return new PayPriceReplyPacket(header, bytes, ref i);
|
|
case 193: return new KickUserPacket(header, bytes, ref i);
|
|
case 194: return new KickUserAckPacket(header, bytes, ref i);
|
|
case 195: return new GodKickUserPacket(header, bytes, ref i);
|
|
case 197: return new EjectUserPacket(header, bytes, ref i);
|
|
case 198: return new FreezeUserPacket(header, bytes, ref i);
|
|
case 199: return new AvatarPropertiesRequestPacket(header, bytes, ref i);
|
|
case 201: return new AvatarPropertiesReplyPacket(header, bytes, ref i);
|
|
case 202: return new AvatarInterestsReplyPacket(header, bytes, ref i);
|
|
case 203: return new AvatarGroupsReplyPacket(header, bytes, ref i);
|
|
case 204: return new AvatarPropertiesUpdatePacket(header, bytes, ref i);
|
|
case 205: return new AvatarInterestsUpdatePacket(header, bytes, ref i);
|
|
case 206: return new AvatarStatisticsReplyPacket(header, bytes, ref i);
|
|
case 207: return new AvatarNotesReplyPacket(header, bytes, ref i);
|
|
case 208: return new AvatarNotesUpdatePacket(header, bytes, ref i);
|
|
case 209: return new AvatarPicksReplyPacket(header, bytes, ref i);
|
|
case 210: return new EventInfoRequestPacket(header, bytes, ref i);
|
|
case 211: return new EventInfoReplyPacket(header, bytes, ref i);
|
|
case 212: return new EventNotificationAddRequestPacket(header, bytes, ref i);
|
|
case 213: return new EventNotificationRemoveRequestPacket(header, bytes, ref i);
|
|
case 214: return new EventGodDeletePacket(header, bytes, ref i);
|
|
case 215: return new PickInfoRequestPacket(header, bytes, ref i);
|
|
case 216: return new PickInfoReplyPacket(header, bytes, ref i);
|
|
case 217: return new PickInfoUpdatePacket(header, bytes, ref i);
|
|
case 218: return new PickDeletePacket(header, bytes, ref i);
|
|
case 219: return new PickGodDeletePacket(header, bytes, ref i);
|
|
case 220: return new ScriptQuestionPacket(header, bytes, ref i);
|
|
case 221: return new ScriptControlChangePacket(header, bytes, ref i);
|
|
case 222: return new ScriptDialogPacket(header, bytes, ref i);
|
|
case 223: return new ScriptDialogReplyPacket(header, bytes, ref i);
|
|
case 224: return new ForceScriptControlReleasePacket(header, bytes, ref i);
|
|
case 225: return new RevokePermissionsPacket(header, bytes, ref i);
|
|
case 226: return new LoadURLPacket(header, bytes, ref i);
|
|
case 227: return new ScriptTeleportRequestPacket(header, bytes, ref i);
|
|
case 228: return new ParcelOverlayPacket(header, bytes, ref i);
|
|
case 229: return new ParcelPropertiesRequestByIDPacket(header, bytes, ref i);
|
|
case 230: return new ParcelPropertiesUpdatePacket(header, bytes, ref i);
|
|
case 231: return new ParcelReturnObjectsPacket(header, bytes, ref i);
|
|
case 232: return new ParcelSetOtherCleanTimePacket(header, bytes, ref i);
|
|
case 233: return new ParcelDisableObjectsPacket(header, bytes, ref i);
|
|
case 234: return new ParcelSelectObjectsPacket(header, bytes, ref i);
|
|
case 235: return new EstateCovenantRequestPacket(header, bytes, ref i);
|
|
case 236: return new EstateCovenantReplyPacket(header, bytes, ref i);
|
|
case 237: return new ForceObjectSelectPacket(header, bytes, ref i);
|
|
case 238: return new ParcelBuyPassPacket(header, bytes, ref i);
|
|
case 239: return new ParcelDeedToGroupPacket(header, bytes, ref i);
|
|
case 240: return new ParcelReclaimPacket(header, bytes, ref i);
|
|
case 241: return new ParcelClaimPacket(header, bytes, ref i);
|
|
case 242: return new ParcelJoinPacket(header, bytes, ref i);
|
|
case 243: return new ParcelDividePacket(header, bytes, ref i);
|
|
case 244: return new ParcelReleasePacket(header, bytes, ref i);
|
|
case 245: return new ParcelBuyPacket(header, bytes, ref i);
|
|
case 246: return new ParcelGodForceOwnerPacket(header, bytes, ref i);
|
|
case 247: return new ParcelAccessListRequestPacket(header, bytes, ref i);
|
|
case 248: return new ParcelAccessListReplyPacket(header, bytes, ref i);
|
|
case 249: return new ParcelAccessListUpdatePacket(header, bytes, ref i);
|
|
case 250: return new ParcelDwellRequestPacket(header, bytes, ref i);
|
|
case 251: return new ParcelDwellReplyPacket(header, bytes, ref i);
|
|
case 259: return new ParcelGodMarkAsContentPacket(header, bytes, ref i);
|
|
case 260: return new ParcelGodReserveForNewbiePacket(header, bytes, ref i);
|
|
case 261: return new ViewerStartAuctionPacket(header, bytes, ref i);
|
|
case 268: return new UUIDNameRequestPacket(header, bytes, ref i);
|
|
case 269: return new UUIDNameReplyPacket(header, bytes, ref i);
|
|
case 270: return new UUIDGroupNameRequestPacket(header, bytes, ref i);
|
|
case 271: return new UUIDGroupNameReplyPacket(header, bytes, ref i);
|
|
case 273: return new ChildAgentDyingPacket(header, bytes, ref i);
|
|
case 274: return new ChildAgentUnknownPacket(header, bytes, ref i);
|
|
case 276: return new GetScriptRunningPacket(header, bytes, ref i);
|
|
case 277: return new ScriptRunningReplyPacket(header, bytes, ref i);
|
|
case 278: return new SetScriptRunningPacket(header, bytes, ref i);
|
|
case 279: return new ScriptResetPacket(header, bytes, ref i);
|
|
case 282: return new CompleteAgentMovementPacket(header, bytes, ref i);
|
|
case 283: return new AgentMovementCompletePacket(header, bytes, ref i);
|
|
case 285: return new ConnectAgentToUserserverPacket(header, bytes, ref i);
|
|
case 286: return new ConnectToUserserverPacket(header, bytes, ref i);
|
|
case 288: return new LogoutRequestPacket(header, bytes, ref i);
|
|
case 289: return new FinalizeLogoutPacket(header, bytes, ref i);
|
|
case 290: return new LogoutReplyPacket(header, bytes, ref i);
|
|
case 291: return new LogoutDemandPacket(header, bytes, ref i);
|
|
case 292: return new ImprovedInstantMessagePacket(header, bytes, ref i);
|
|
case 293: return new RetrieveInstantMessagesPacket(header, bytes, ref i);
|
|
case 294: return new DequeueInstantMessagesPacket(header, bytes, ref i);
|
|
case 295: return new FindAgentPacket(header, bytes, ref i);
|
|
case 296: return new RequestGodlikePowersPacket(header, bytes, ref i);
|
|
case 297: return new GrantGodlikePowersPacket(header, bytes, ref i);
|
|
case 298: return new GodlikeMessagePacket(header, bytes, ref i);
|
|
case 299: return new EstateOwnerMessagePacket(header, bytes, ref i);
|
|
case 300: return new GenericMessagePacket(header, bytes, ref i);
|
|
case 301: return new MuteListRequestPacket(header, bytes, ref i);
|
|
case 302: return new UpdateMuteListEntryPacket(header, bytes, ref i);
|
|
case 303: return new RemoveMuteListEntryPacket(header, bytes, ref i);
|
|
case 304: return new CopyInventoryFromNotecardPacket(header, bytes, ref i);
|
|
case 305: return new UpdateInventoryItemPacket(header, bytes, ref i);
|
|
case 306: return new UpdateCreateInventoryItemPacket(header, bytes, ref i);
|
|
case 307: return new MoveInventoryItemPacket(header, bytes, ref i);
|
|
case 308: return new CopyInventoryItemPacket(header, bytes, ref i);
|
|
case 309: return new RemoveInventoryItemPacket(header, bytes, ref i);
|
|
case 310: return new ChangeInventoryItemFlagsPacket(header, bytes, ref i);
|
|
case 311: return new SaveAssetIntoInventoryPacket(header, bytes, ref i);
|
|
case 312: return new CreateInventoryFolderPacket(header, bytes, ref i);
|
|
case 313: return new UpdateInventoryFolderPacket(header, bytes, ref i);
|
|
case 314: return new MoveInventoryFolderPacket(header, bytes, ref i);
|
|
case 315: return new RemoveInventoryFolderPacket(header, bytes, ref i);
|
|
case 316: return new FetchInventoryDescendentsPacket(header, bytes, ref i);
|
|
case 317: return new InventoryDescendentsPacket(header, bytes, ref i);
|
|
case 318: return new FetchInventoryPacket(header, bytes, ref i);
|
|
case 319: return new FetchInventoryReplyPacket(header, bytes, ref i);
|
|
case 320: return new BulkUpdateInventoryPacket(header, bytes, ref i);
|
|
case 321: return new RequestInventoryAssetPacket(header, bytes, ref i);
|
|
case 322: return new InventoryAssetResponsePacket(header, bytes, ref i);
|
|
case 323: return new RemoveInventoryObjectsPacket(header, bytes, ref i);
|
|
case 324: return new PurgeInventoryDescendentsPacket(header, bytes, ref i);
|
|
case 325: return new UpdateTaskInventoryPacket(header, bytes, ref i);
|
|
case 326: return new RemoveTaskInventoryPacket(header, bytes, ref i);
|
|
case 327: return new MoveTaskInventoryPacket(header, bytes, ref i);
|
|
case 328: return new RequestTaskInventoryPacket(header, bytes, ref i);
|
|
case 329: return new ReplyTaskInventoryPacket(header, bytes, ref i);
|
|
case 330: return new DeRezObjectPacket(header, bytes, ref i);
|
|
case 331: return new DeRezAckPacket(header, bytes, ref i);
|
|
case 332: return new RezObjectPacket(header, bytes, ref i);
|
|
case 333: return new RezObjectFromNotecardPacket(header, bytes, ref i);
|
|
case 334: return new DeclineInventoryPacket(header, bytes, ref i);
|
|
case 337: return new RequestFriendshipPacket(header, bytes, ref i);
|
|
case 338: return new AcceptFriendshipPacket(header, bytes, ref i);
|
|
case 339: return new DeclineFriendshipPacket(header, bytes, ref i);
|
|
case 340: return new FormFriendshipPacket(header, bytes, ref i);
|
|
case 341: return new TerminateFriendshipPacket(header, bytes, ref i);
|
|
case 342: return new OfferCallingCardPacket(header, bytes, ref i);
|
|
case 343: return new AcceptCallingCardPacket(header, bytes, ref i);
|
|
case 344: return new DeclineCallingCardPacket(header, bytes, ref i);
|
|
case 345: return new RezScriptPacket(header, bytes, ref i);
|
|
case 346: return new CreateInventoryItemPacket(header, bytes, ref i);
|
|
case 347: return new CreateLandmarkForEventPacket(header, bytes, ref i);
|
|
case 350: return new RegionHandleRequestPacket(header, bytes, ref i);
|
|
case 351: return new RegionIDAndHandleReplyPacket(header, bytes, ref i);
|
|
case 352: return new MoneyTransferRequestPacket(header, bytes, ref i);
|
|
case 355: return new AdjustBalancePacket(header, bytes, ref i);
|
|
case 356: return new MoneyBalanceRequestPacket(header, bytes, ref i);
|
|
case 357: return new MoneyBalanceReplyPacket(header, bytes, ref i);
|
|
case 358: return new RoutedMoneyBalanceReplyPacket(header, bytes, ref i);
|
|
case 359: return new MoneyHistoryRequestPacket(header, bytes, ref i);
|
|
case 360: return new MoneyHistoryReplyPacket(header, bytes, ref i);
|
|
case 361: return new MoneySummaryRequestPacket(header, bytes, ref i);
|
|
case 362: return new MoneySummaryReplyPacket(header, bytes, ref i);
|
|
case 363: return new MoneyDetailsRequestPacket(header, bytes, ref i);
|
|
case 364: return new MoneyDetailsReplyPacket(header, bytes, ref i);
|
|
case 365: return new MoneyTransactionsRequestPacket(header, bytes, ref i);
|
|
case 366: return new MoneyTransactionsReplyPacket(header, bytes, ref i);
|
|
case 367: return new GestureRequestPacket(header, bytes, ref i);
|
|
case 368: return new ActivateGesturesPacket(header, bytes, ref i);
|
|
case 369: return new DeactivateGesturesPacket(header, bytes, ref i);
|
|
case 370: return new MuteListUpdatePacket(header, bytes, ref i);
|
|
case 371: return new UseCachedMuteListPacket(header, bytes, ref i);
|
|
case 372: return new GrantUserRightsPacket(header, bytes, ref i);
|
|
case 373: return new ChangeUserRightsPacket(header, bytes, ref i);
|
|
case 374: return new OnlineNotificationPacket(header, bytes, ref i);
|
|
case 375: return new OfflineNotificationPacket(header, bytes, ref i);
|
|
case 376: return new SetStartLocationRequestPacket(header, bytes, ref i);
|
|
case 386: return new AssetUploadRequestPacket(header, bytes, ref i);
|
|
case 387: return new AssetUploadCompletePacket(header, bytes, ref i);
|
|
case 388: return new ReputationAgentAssignPacket(header, bytes, ref i);
|
|
case 389: return new ReputationIndividualRequestPacket(header, bytes, ref i);
|
|
case 390: return new ReputationIndividualReplyPacket(header, bytes, ref i);
|
|
case 395: return new CreateGroupRequestPacket(header, bytes, ref i);
|
|
case 396: return new CreateGroupReplyPacket(header, bytes, ref i);
|
|
case 397: return new UpdateGroupInfoPacket(header, bytes, ref i);
|
|
case 398: return new GroupRoleChangesPacket(header, bytes, ref i);
|
|
case 399: return new JoinGroupRequestPacket(header, bytes, ref i);
|
|
case 400: return new JoinGroupReplyPacket(header, bytes, ref i);
|
|
case 401: return new EjectGroupMemberRequestPacket(header, bytes, ref i);
|
|
case 402: return new EjectGroupMemberReplyPacket(header, bytes, ref i);
|
|
case 403: return new LeaveGroupRequestPacket(header, bytes, ref i);
|
|
case 404: return new LeaveGroupReplyPacket(header, bytes, ref i);
|
|
case 405: return new InviteGroupRequestPacket(header, bytes, ref i);
|
|
case 407: return new GroupProfileRequestPacket(header, bytes, ref i);
|
|
case 408: return new GroupProfileReplyPacket(header, bytes, ref i);
|
|
case 409: return new GroupAccountSummaryRequestPacket(header, bytes, ref i);
|
|
case 410: return new GroupAccountSummaryReplyPacket(header, bytes, ref i);
|
|
case 411: return new GroupAccountDetailsRequestPacket(header, bytes, ref i);
|
|
case 412: return new GroupAccountDetailsReplyPacket(header, bytes, ref i);
|
|
case 413: return new GroupAccountTransactionsRequestPacket(header, bytes, ref i);
|
|
case 414: return new GroupAccountTransactionsReplyPacket(header, bytes, ref i);
|
|
case 415: return new GroupActiveProposalsRequestPacket(header, bytes, ref i);
|
|
case 416: return new GroupActiveProposalItemReplyPacket(header, bytes, ref i);
|
|
case 417: return new GroupVoteHistoryRequestPacket(header, bytes, ref i);
|
|
case 418: return new GroupVoteHistoryItemReplyPacket(header, bytes, ref i);
|
|
case 419: return new StartGroupProposalPacket(header, bytes, ref i);
|
|
case 420: return new GroupProposalBallotPacket(header, bytes, ref i);
|
|
case 422: return new GroupMembersRequestPacket(header, bytes, ref i);
|
|
case 423: return new GroupMembersReplyPacket(header, bytes, ref i);
|
|
case 424: return new ActivateGroupPacket(header, bytes, ref i);
|
|
case 425: return new SetGroupContributionPacket(header, bytes, ref i);
|
|
case 426: return new SetGroupAcceptNoticesPacket(header, bytes, ref i);
|
|
case 427: return new GroupRoleDataRequestPacket(header, bytes, ref i);
|
|
case 428: return new GroupRoleDataReplyPacket(header, bytes, ref i);
|
|
case 429: return new GroupRoleMembersRequestPacket(header, bytes, ref i);
|
|
case 430: return new GroupRoleMembersReplyPacket(header, bytes, ref i);
|
|
case 431: return new GroupTitlesRequestPacket(header, bytes, ref i);
|
|
case 432: return new GroupTitlesReplyPacket(header, bytes, ref i);
|
|
case 433: return new GroupTitleUpdatePacket(header, bytes, ref i);
|
|
case 434: return new GroupRoleUpdatePacket(header, bytes, ref i);
|
|
case 435: return new LiveHelpGroupRequestPacket(header, bytes, ref i);
|
|
case 436: return new LiveHelpGroupReplyPacket(header, bytes, ref i);
|
|
case 437: return new AgentWearablesRequestPacket(header, bytes, ref i);
|
|
case 438: return new AgentWearablesUpdatePacket(header, bytes, ref i);
|
|
case 439: return new AgentIsNowWearingPacket(header, bytes, ref i);
|
|
case 440: return new AgentCachedTexturePacket(header, bytes, ref i);
|
|
case 441: return new AgentCachedTextureResponsePacket(header, bytes, ref i);
|
|
case 442: return new AgentDataUpdateRequestPacket(header, bytes, ref i);
|
|
case 443: return new AgentDataUpdatePacket(header, bytes, ref i);
|
|
case 444: return new GroupDataUpdatePacket(header, bytes, ref i);
|
|
case 445: return new AgentGroupDataUpdatePacket(header, bytes, ref i);
|
|
case 446: return new AgentDropGroupPacket(header, bytes, ref i);
|
|
case 448: return new CreateTrustedCircuitPacket(header, bytes, ref i);
|
|
case 449: return new DenyTrustedCircuitPacket(header, bytes, ref i);
|
|
case 450: return new RequestTrustedCircuitPacket(header, bytes, ref i);
|
|
case 451: return new RezSingleAttachmentFromInvPacket(header, bytes, ref i);
|
|
case 452: return new RezMultipleAttachmentsFromInvPacket(header, bytes, ref i);
|
|
case 453: return new DetachAttachmentIntoInvPacket(header, bytes, ref i);
|
|
case 454: return new CreateNewOutfitAttachmentsPacket(header, bytes, ref i);
|
|
case 455: return new UserInfoRequestPacket(header, bytes, ref i);
|
|
case 456: return new UserInfoReplyPacket(header, bytes, ref i);
|
|
case 457: return new UpdateUserInfoPacket(header, bytes, ref i);
|
|
case 458: return new GodExpungeUserPacket(header, bytes, ref i);
|
|
case 466: return new StartParcelRemoveAckPacket(header, bytes, ref i);
|
|
case 468: return new InitiateDownloadPacket(header, bytes, ref i);
|
|
case 469: return new SystemMessagePacket(header, bytes, ref i);
|
|
case 470: return new MapLayerRequestPacket(header, bytes, ref i);
|
|
case 471: return new MapLayerReplyPacket(header, bytes, ref i);
|
|
case 472: return new MapBlockRequestPacket(header, bytes, ref i);
|
|
case 473: return new MapNameRequestPacket(header, bytes, ref i);
|
|
case 474: return new MapBlockReplyPacket(header, bytes, ref i);
|
|
case 475: return new MapItemRequestPacket(header, bytes, ref i);
|
|
case 476: return new MapItemReplyPacket(header, bytes, ref i);
|
|
case 477: return new SendPostcardPacket(header, bytes, ref i);
|
|
case 486: return new ParcelMediaCommandMessagePacket(header, bytes, ref i);
|
|
case 487: return new ParcelMediaUpdatePacket(header, bytes, ref i);
|
|
case 488: return new LandStatRequestPacket(header, bytes, ref i);
|
|
case 489: return new LandStatReplyPacket(header, bytes, ref i);
|
|
case 65530: return new SecuredTemplateChecksumRequestPacket(header, bytes, ref i);
|
|
case 65531: return new PacketAckPacket(header, bytes, ref i);
|
|
case 65532: return new OpenCircuitPacket(header, bytes, ref i);
|
|
case 65533: return new CloseCircuitPacket(header, bytes, ref i);
|
|
case 65534: return new TemplateChecksumRequestPacket(header, bytes, ref i);
|
|
case 65535: return new TemplateChecksumReplyPacket(header, bytes, ref i);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
id = (ushort)bytes[5];
|
|
switch (id)
|
|
{
|
|
case 2: return new ObjectAddPacket(header, bytes, ref i);
|
|
case 3: return new MultipleObjectUpdatePacket(header, bytes, ref i);
|
|
case 4: return new RequestMultipleObjectsPacket(header, bytes, ref i);
|
|
case 5: return new ObjectPositionPacket(header, bytes, ref i);
|
|
case 6: return new RequestObjectPropertiesFamilyPacket(header, bytes, ref i);
|
|
case 7: return new CoarseLocationUpdatePacket(header, bytes, ref i);
|
|
case 8: return new CrossedRegionPacket(header, bytes, ref i);
|
|
case 9: return new ConfirmEnableSimulatorPacket(header, bytes, ref i);
|
|
case 10: return new ObjectPropertiesPacket(header, bytes, ref i);
|
|
case 11: return new ObjectPropertiesFamilyPacket(header, bytes, ref i);
|
|
case 12: return new ParcelPropertiesRequestPacket(header, bytes, ref i);
|
|
case 14: return new GestureUpdatePacket(header, bytes, ref i);
|
|
case 15: return new AttachedSoundPacket(header, bytes, ref i);
|
|
case 16: return new AttachedSoundGainChangePacket(header, bytes, ref i);
|
|
case 17: return new AttachedSoundCutoffRadiusPacket(header, bytes, ref i);
|
|
case 18: return new PreloadSoundPacket(header, bytes, ref i);
|
|
case 20: return new ViewerEffectPacket(header, bytes, ref i);
|
|
case 21: return new SetSunPhasePacket(header, bytes, ref i);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
id = (ushort)bytes[4];
|
|
switch (id)
|
|
{
|
|
case 1: return new StartPingCheckPacket(header, bytes, ref i);
|
|
case 2: return new CompletePingCheckPacket(header, bytes, ref i);
|
|
case 4: return new AgentUpdatePacket(header, bytes, ref i);
|
|
case 5: return new AgentAnimationPacket(header, bytes, ref i);
|
|
case 6: return new AgentRequestSitPacket(header, bytes, ref i);
|
|
case 7: return new AgentSitPacket(header, bytes, ref i);
|
|
case 8: return new RequestImagePacket(header, bytes, ref i);
|
|
case 9: return new ImageDataPacket(header, bytes, ref i);
|
|
case 10: return new ImagePacketPacket(header, bytes, ref i);
|
|
case 11: return new LayerDataPacket(header, bytes, ref i);
|
|
case 12: return new ObjectUpdatePacket(header, bytes, ref i);
|
|
case 13: return new ObjectUpdateCompressedPacket(header, bytes, ref i);
|
|
case 14: return new ObjectUpdateCachedPacket(header, bytes, ref i);
|
|
case 15: return new ImprovedTerseObjectUpdatePacket(header, bytes, ref i);
|
|
case 16: return new KillObjectPacket(header, bytes, ref i);
|
|
case 17: return new AgentToNewRegionPacket(header, bytes, ref i);
|
|
case 18: return new TransferPacketPacket(header, bytes, ref i);
|
|
case 19: return new SendXferPacketPacket(header, bytes, ref i);
|
|
case 20: return new ConfirmXferPacketPacket(header, bytes, ref i);
|
|
case 21: return new AvatarAnimationPacket(header, bytes, ref i);
|
|
case 22: return new AvatarSitResponsePacket(header, bytes, ref i);
|
|
case 23: return new CameraConstraintPacket(header, bytes, ref i);
|
|
case 24: return new ParcelPropertiesPacket(header, bytes, ref i);
|
|
case 26: return new ChildAgentUpdatePacket(header, bytes, ref i);
|
|
case 27: return new ChildAgentAlivePacket(header, bytes, ref i);
|
|
case 28: return new ChildAgentPositionUpdatePacket(header, bytes, ref i);
|
|
case 31: return new SoundTriggerPacket(header, bytes, ref i);
|
|
}
|
|
}
|
|
|
|
throw new MalformedDataException("Unknown packet ID");
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TestMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("testmessage_testblock1")]
|
|
public class TestBlock1Block
|
|
{
|
|
public uint Test1;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public TestBlock1Block() { }
|
|
public TestBlock1Block(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Test1 = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Test1 % 256);
|
|
bytes[i++] = (byte)((Test1 >> 8) % 256);
|
|
bytes[i++] = (byte)((Test1 >> 16) % 256);
|
|
bytes[i++] = (byte)((Test1 >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TestBlock1 --" + Environment.NewLine;
|
|
output += "Test1: " + Test1.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("testmessage_neighborblock")]
|
|
public class NeighborBlockBlock
|
|
{
|
|
public uint Test0;
|
|
public uint Test1;
|
|
public uint Test2;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public NeighborBlockBlock() { }
|
|
public NeighborBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Test0 = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Test1 = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Test2 = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Test0 % 256);
|
|
bytes[i++] = (byte)((Test0 >> 8) % 256);
|
|
bytes[i++] = (byte)((Test0 >> 16) % 256);
|
|
bytes[i++] = (byte)((Test0 >> 24) % 256);
|
|
bytes[i++] = (byte)(Test1 % 256);
|
|
bytes[i++] = (byte)((Test1 >> 8) % 256);
|
|
bytes[i++] = (byte)((Test1 >> 16) % 256);
|
|
bytes[i++] = (byte)((Test1 >> 24) % 256);
|
|
bytes[i++] = (byte)(Test2 % 256);
|
|
bytes[i++] = (byte)((Test2 >> 8) % 256);
|
|
bytes[i++] = (byte)((Test2 >> 16) % 256);
|
|
bytes[i++] = (byte)((Test2 >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- NeighborBlock --" + Environment.NewLine;
|
|
output += "Test0: " + Test0.ToString() + "" + Environment.NewLine;
|
|
output += "Test1: " + Test1.ToString() + "" + Environment.NewLine;
|
|
output += "Test2: " + Test2.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TestMessage; } }
|
|
public TestBlock1Block TestBlock1;
|
|
public NeighborBlockBlock[] NeighborBlock;
|
|
|
|
public TestMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 1;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TestBlock1 = new TestBlock1Block();
|
|
NeighborBlock = new NeighborBlockBlock[4];
|
|
}
|
|
|
|
public TestMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TestBlock1 = new TestBlock1Block(bytes, ref i);
|
|
NeighborBlock = new NeighborBlockBlock[4];
|
|
for (int j = 0; j < 4; j++)
|
|
{ NeighborBlock[j] = new NeighborBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public TestMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TestBlock1 = new TestBlock1Block(bytes, ref i);
|
|
NeighborBlock = new NeighborBlockBlock[4];
|
|
for (int j = 0; j < 4; j++)
|
|
{ NeighborBlock[j] = new NeighborBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TestBlock1.Length;;
|
|
for (int j = 0; j < 4; j++) { length += NeighborBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TestBlock1.ToBytes(bytes, ref i);
|
|
for (int j = 0; j < 4; j++) { NeighborBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TestMessage ---" + Environment.NewLine;
|
|
output += TestBlock1.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < 4; j++)
|
|
{
|
|
output += NeighborBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UseCircuitCodePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("usecircuitcode_circuitcode")]
|
|
public class CircuitCodeBlock
|
|
{
|
|
public LLUUID ID;
|
|
public LLUUID SessionID;
|
|
public uint Code;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public CircuitCodeBlock() { }
|
|
public CircuitCodeBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Code = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Code % 256);
|
|
bytes[i++] = (byte)((Code >> 8) % 256);
|
|
bytes[i++] = (byte)((Code >> 16) % 256);
|
|
bytes[i++] = (byte)((Code >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- CircuitCode --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Code: " + Code.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UseCircuitCode; } }
|
|
public CircuitCodeBlock CircuitCode;
|
|
|
|
public UseCircuitCodePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 3;
|
|
Header.Reliable = true;
|
|
CircuitCode = new CircuitCodeBlock();
|
|
}
|
|
|
|
public UseCircuitCodePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
CircuitCode = new CircuitCodeBlock(bytes, ref i);
|
|
}
|
|
|
|
public UseCircuitCodePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
CircuitCode = new CircuitCodeBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += CircuitCode.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
CircuitCode.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UseCircuitCode ---" + Environment.NewLine;
|
|
output += CircuitCode.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LogControlPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("logcontrol_options")]
|
|
public class OptionsBlock
|
|
{
|
|
public uint Mask;
|
|
public bool Time;
|
|
public bool RemoteInfos;
|
|
public bool Location;
|
|
public byte Level;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public OptionsBlock() { }
|
|
public OptionsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Mask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Time = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RemoteInfos = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Location = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Level = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Mask % 256);
|
|
bytes[i++] = (byte)((Mask >> 8) % 256);
|
|
bytes[i++] = (byte)((Mask >> 16) % 256);
|
|
bytes[i++] = (byte)((Mask >> 24) % 256);
|
|
bytes[i++] = (byte)((Time) ? 1 : 0);
|
|
bytes[i++] = (byte)((RemoteInfos) ? 1 : 0);
|
|
bytes[i++] = (byte)((Location) ? 1 : 0);
|
|
bytes[i++] = Level;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Options --" + Environment.NewLine;
|
|
output += "Mask: " + Mask.ToString() + "" + Environment.NewLine;
|
|
output += "Time: " + Time.ToString() + "" + Environment.NewLine;
|
|
output += "RemoteInfos: " + RemoteInfos.ToString() + "" + Environment.NewLine;
|
|
output += "Location: " + Location.ToString() + "" + Environment.NewLine;
|
|
output += "Level: " + Level.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LogControl; } }
|
|
public OptionsBlock Options;
|
|
|
|
public LogControlPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 4;
|
|
Header.Reliable = true;
|
|
Options = new OptionsBlock();
|
|
}
|
|
|
|
public LogControlPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Options = new OptionsBlock(bytes, ref i);
|
|
}
|
|
|
|
public LogControlPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Options = new OptionsBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Options.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Options.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LogControl ---" + Environment.NewLine;
|
|
output += Options.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LogMessagesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("logmessages_options")]
|
|
public class OptionsBlock
|
|
{
|
|
public bool Enable;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public OptionsBlock() { }
|
|
public OptionsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Enable = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Enable) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Options --" + Environment.NewLine;
|
|
output += "Enable: " + Enable.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LogMessages; } }
|
|
public OptionsBlock Options;
|
|
|
|
public LogMessagesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 6;
|
|
Header.Reliable = true;
|
|
Options = new OptionsBlock();
|
|
}
|
|
|
|
public LogMessagesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Options = new OptionsBlock(bytes, ref i);
|
|
}
|
|
|
|
public LogMessagesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Options = new OptionsBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Options.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Options.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LogMessages ---" + Environment.NewLine;
|
|
output += Options.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TelehubInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("telehubinfo_telehubblock")]
|
|
public class TelehubBlockBlock
|
|
{
|
|
private byte[] _objectname;
|
|
public byte[] ObjectName
|
|
{
|
|
get { return _objectname; }
|
|
set
|
|
{
|
|
if (value == null) { _objectname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectname = new byte[value.Length]; Array.Copy(value, _objectname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ObjectID;
|
|
public LLVector3 TelehubPos;
|
|
public LLQuaternion TelehubRot;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 40;
|
|
if (ObjectName != null) { length += 1 + ObjectName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public TelehubBlockBlock() { }
|
|
public TelehubBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_objectname = new byte[length];
|
|
Array.Copy(bytes, i, _objectname, 0, length); i += length;
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
TelehubPos = new LLVector3(bytes, i); i += 12;
|
|
TelehubRot = new LLQuaternion(bytes, i, true); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectName.Length;
|
|
Array.Copy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length;
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(TelehubPos.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(TelehubRot.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TelehubBlock --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectName, "ObjectName") + "" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "TelehubPos: " + TelehubPos.ToString() + "" + Environment.NewLine;
|
|
output += "TelehubRot: " + TelehubRot.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("telehubinfo_spawnpointblock")]
|
|
public class SpawnPointBlockBlock
|
|
{
|
|
public LLVector3 SpawnPointPos;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public SpawnPointBlockBlock() { }
|
|
public SpawnPointBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SpawnPointPos = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(SpawnPointPos.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- SpawnPointBlock --" + Environment.NewLine;
|
|
output += "SpawnPointPos: " + SpawnPointPos.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TelehubInfo; } }
|
|
public TelehubBlockBlock TelehubBlock;
|
|
public SpawnPointBlockBlock[] SpawnPointBlock;
|
|
|
|
public TelehubInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 16;
|
|
Header.Reliable = true;
|
|
TelehubBlock = new TelehubBlockBlock();
|
|
SpawnPointBlock = new SpawnPointBlockBlock[0];
|
|
}
|
|
|
|
public TelehubInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TelehubBlock = new TelehubBlockBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
SpawnPointBlock = new SpawnPointBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ SpawnPointBlock[j] = new SpawnPointBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public TelehubInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TelehubBlock = new TelehubBlockBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
SpawnPointBlock = new SpawnPointBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ SpawnPointBlock[j] = new SpawnPointBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TelehubBlock.Length;;
|
|
length++;
|
|
for (int j = 0; j < SpawnPointBlock.Length; j++) { length += SpawnPointBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TelehubBlock.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)SpawnPointBlock.Length;
|
|
for (int j = 0; j < SpawnPointBlock.Length; j++) { SpawnPointBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TelehubInfo ---" + Environment.NewLine;
|
|
output += TelehubBlock.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < SpawnPointBlock.Length; j++)
|
|
{
|
|
output += SpawnPointBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EconomyDataRequestPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EconomyDataRequest; } }
|
|
|
|
public EconomyDataRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 36;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public EconomyDataRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public EconomyDataRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EconomyDataRequest ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EconomyDataPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("economydata_info")]
|
|
public class InfoBlock
|
|
{
|
|
public float PriceParcelClaimFactor;
|
|
public int ObjectCapacity;
|
|
public float EnergyEfficiency;
|
|
public int ObjectCount;
|
|
public float TeleportPriceExponent;
|
|
public int PriceGroupCreate;
|
|
public float PriceObjectRent;
|
|
public int PricePublicObjectDelete;
|
|
public int PriceEnergyUnit;
|
|
public int TeleportMinPrice;
|
|
public int PricePublicObjectDecay;
|
|
public int PriceObjectClaim;
|
|
public int PriceParcelClaim;
|
|
public float PriceObjectScaleFactor;
|
|
public int PriceRentLight;
|
|
public int PriceParcelRent;
|
|
public int PriceUpload;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 68;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
PriceParcelClaimFactor = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ObjectCapacity = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
EnergyEfficiency = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ObjectCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TeleportPriceExponent = BitConverter.ToSingle(bytes, i); i += 4;
|
|
PriceGroupCreate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
PriceObjectRent = BitConverter.ToSingle(bytes, i); i += 4;
|
|
PricePublicObjectDelete = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PriceEnergyUnit = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TeleportMinPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PricePublicObjectDecay = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PriceObjectClaim = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PriceParcelClaim = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
PriceObjectScaleFactor = BitConverter.ToSingle(bytes, i); i += 4;
|
|
PriceRentLight = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PriceParcelRent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PriceUpload = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(PriceParcelClaimFactor);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(ObjectCapacity % 256);
|
|
bytes[i++] = (byte)((ObjectCapacity >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectCapacity >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectCapacity >> 24) % 256);
|
|
ba = BitConverter.GetBytes(EnergyEfficiency);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(ObjectCount % 256);
|
|
bytes[i++] = (byte)((ObjectCount >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectCount >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectCount >> 24) % 256);
|
|
ba = BitConverter.GetBytes(TeleportPriceExponent);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(PriceGroupCreate % 256);
|
|
bytes[i++] = (byte)((PriceGroupCreate >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceGroupCreate >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceGroupCreate >> 24) % 256);
|
|
ba = BitConverter.GetBytes(PriceObjectRent);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(PricePublicObjectDelete % 256);
|
|
bytes[i++] = (byte)((PricePublicObjectDelete >> 8) % 256);
|
|
bytes[i++] = (byte)((PricePublicObjectDelete >> 16) % 256);
|
|
bytes[i++] = (byte)((PricePublicObjectDelete >> 24) % 256);
|
|
bytes[i++] = (byte)(PriceEnergyUnit % 256);
|
|
bytes[i++] = (byte)((PriceEnergyUnit >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceEnergyUnit >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceEnergyUnit >> 24) % 256);
|
|
bytes[i++] = (byte)(TeleportMinPrice % 256);
|
|
bytes[i++] = (byte)((TeleportMinPrice >> 8) % 256);
|
|
bytes[i++] = (byte)((TeleportMinPrice >> 16) % 256);
|
|
bytes[i++] = (byte)((TeleportMinPrice >> 24) % 256);
|
|
bytes[i++] = (byte)(PricePublicObjectDecay % 256);
|
|
bytes[i++] = (byte)((PricePublicObjectDecay >> 8) % 256);
|
|
bytes[i++] = (byte)((PricePublicObjectDecay >> 16) % 256);
|
|
bytes[i++] = (byte)((PricePublicObjectDecay >> 24) % 256);
|
|
bytes[i++] = (byte)(PriceObjectClaim % 256);
|
|
bytes[i++] = (byte)((PriceObjectClaim >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceObjectClaim >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceObjectClaim >> 24) % 256);
|
|
bytes[i++] = (byte)(PriceParcelClaim % 256);
|
|
bytes[i++] = (byte)((PriceParcelClaim >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceParcelClaim >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceParcelClaim >> 24) % 256);
|
|
ba = BitConverter.GetBytes(PriceObjectScaleFactor);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(PriceRentLight % 256);
|
|
bytes[i++] = (byte)((PriceRentLight >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceRentLight >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceRentLight >> 24) % 256);
|
|
bytes[i++] = (byte)(PriceParcelRent % 256);
|
|
bytes[i++] = (byte)((PriceParcelRent >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceParcelRent >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceParcelRent >> 24) % 256);
|
|
bytes[i++] = (byte)(PriceUpload % 256);
|
|
bytes[i++] = (byte)((PriceUpload >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceUpload >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceUpload >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "PriceParcelClaimFactor: " + PriceParcelClaimFactor.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectCapacity: " + ObjectCapacity.ToString() + "" + Environment.NewLine;
|
|
output += "EnergyEfficiency: " + EnergyEfficiency.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectCount: " + ObjectCount.ToString() + "" + Environment.NewLine;
|
|
output += "TeleportPriceExponent: " + TeleportPriceExponent.ToString() + "" + Environment.NewLine;
|
|
output += "PriceGroupCreate: " + PriceGroupCreate.ToString() + "" + Environment.NewLine;
|
|
output += "PriceObjectRent: " + PriceObjectRent.ToString() + "" + Environment.NewLine;
|
|
output += "PricePublicObjectDelete: " + PricePublicObjectDelete.ToString() + "" + Environment.NewLine;
|
|
output += "PriceEnergyUnit: " + PriceEnergyUnit.ToString() + "" + Environment.NewLine;
|
|
output += "TeleportMinPrice: " + TeleportMinPrice.ToString() + "" + Environment.NewLine;
|
|
output += "PricePublicObjectDecay: " + PricePublicObjectDecay.ToString() + "" + Environment.NewLine;
|
|
output += "PriceObjectClaim: " + PriceObjectClaim.ToString() + "" + Environment.NewLine;
|
|
output += "PriceParcelClaim: " + PriceParcelClaim.ToString() + "" + Environment.NewLine;
|
|
output += "PriceObjectScaleFactor: " + PriceObjectScaleFactor.ToString() + "" + Environment.NewLine;
|
|
output += "PriceRentLight: " + PriceRentLight.ToString() + "" + Environment.NewLine;
|
|
output += "PriceParcelRent: " + PriceParcelRent.ToString() + "" + Environment.NewLine;
|
|
output += "PriceUpload: " + PriceUpload.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EconomyData; } }
|
|
public InfoBlock Info;
|
|
|
|
public EconomyDataPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 37;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public EconomyDataPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public EconomyDataPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EconomyData ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarPickerRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarpickerrequest_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarpickerrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarPickerRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarPickerRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 38;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarPickerRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarPickerRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarPickerRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarPickerReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarpickerreply_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _lastname;
|
|
public byte[] LastName
|
|
{
|
|
get { return _lastname; }
|
|
set
|
|
{
|
|
if (value == null) { _lastname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _lastname = new byte[value.Length]; Array.Copy(value, _lastname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _firstname;
|
|
public byte[] FirstName
|
|
{
|
|
get { return _firstname; }
|
|
set
|
|
{
|
|
if (value == null) { _firstname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _firstname = new byte[value.Length]; Array.Copy(value, _firstname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID AvatarID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (LastName != null) { length += 1 + LastName.Length; }
|
|
if (FirstName != null) { length += 1 + FirstName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_lastname = new byte[length];
|
|
Array.Copy(bytes, i, _lastname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_firstname = new byte[length];
|
|
Array.Copy(bytes, i, _firstname, 0, length); i += length;
|
|
AvatarID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LastName.Length;
|
|
Array.Copy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length;
|
|
if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FirstName.Length;
|
|
Array.Copy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length;
|
|
if(AvatarID == null) { Console.WriteLine("Warning: AvatarID is null, in " + this.GetType()); }
|
|
Array.Copy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LastName, "LastName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FirstName, "FirstName") + "" + Environment.NewLine;
|
|
output += "AvatarID: " + AvatarID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarpickerreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarPickerReply; } }
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarPickerReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 40;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarPickerReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarPickerReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarPickerReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PlacesQueryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("placesquery_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public sbyte Category;
|
|
public uint QueryFlags;
|
|
private byte[] _querytext;
|
|
public byte[] QueryText
|
|
{
|
|
get { return _querytext; }
|
|
set
|
|
{
|
|
if (value == null) { _querytext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _querytext = new byte[value.Length]; Array.Copy(value, _querytext, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 5;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
if (QueryText != null) { length += 1 + QueryText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
Category = (sbyte)bytes[i++];
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_querytext = new byte[length];
|
|
Array.Copy(bytes, i, _querytext, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)Category;
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)QueryText.Length;
|
|
Array.Copy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(QueryText, "QueryText") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("placesquery_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("placesquery_transactiondata")]
|
|
public class TransactionDataBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionDataBlock() { }
|
|
public TransactionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionData --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PlacesQuery; } }
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
public TransactionDataBlock TransactionData;
|
|
|
|
public PlacesQueryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 41;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
TransactionData = new TransactionDataBlock();
|
|
}
|
|
|
|
public PlacesQueryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PlacesQueryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length; length += TransactionData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
TransactionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PlacesQuery ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += TransactionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PlacesReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("placesreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public int BillableArea;
|
|
public int ActualArea;
|
|
public float GlobalX;
|
|
public float GlobalY;
|
|
public float GlobalZ;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID OwnerID;
|
|
public LLUUID SnapshotID;
|
|
public byte Flags;
|
|
public int Price;
|
|
public float Dwell;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 61;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 1 + Desc.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
BillableArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ActualArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
GlobalX = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
GlobalY = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
GlobalZ = BitConverter.ToSingle(bytes, i); i += 4;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (byte)bytes[i++];
|
|
Price = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Dwell = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)(BillableArea % 256);
|
|
bytes[i++] = (byte)((BillableArea >> 8) % 256);
|
|
bytes[i++] = (byte)((BillableArea >> 16) % 256);
|
|
bytes[i++] = (byte)((BillableArea >> 24) % 256);
|
|
bytes[i++] = (byte)(ActualArea % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 8) % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 16) % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 24) % 256);
|
|
ba = BitConverter.GetBytes(GlobalX);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(GlobalY);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(GlobalZ);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Desc.Length;
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Flags;
|
|
bytes[i++] = (byte)(Price % 256);
|
|
bytes[i++] = (byte)((Price >> 8) % 256);
|
|
bytes[i++] = (byte)((Price >> 16) % 256);
|
|
bytes[i++] = (byte)((Price >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Dwell);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "BillableArea: " + BillableArea.ToString() + "" + Environment.NewLine;
|
|
output += "ActualArea: " + ActualArea.ToString() + "" + Environment.NewLine;
|
|
output += "GlobalX: " + GlobalX.ToString() + "" + Environment.NewLine;
|
|
output += "GlobalY: " + GlobalY.ToString() + "" + Environment.NewLine;
|
|
output += "GlobalZ: " + GlobalZ.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "Price: " + Price.ToString() + "" + Environment.NewLine;
|
|
output += "Dwell: " + Dwell.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("placesreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("placesreply_transactiondata")]
|
|
public class TransactionDataBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionDataBlock() { }
|
|
public TransactionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionData --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PlacesReply; } }
|
|
public QueryDataBlock[] QueryData;
|
|
public AgentDataBlock AgentData;
|
|
public TransactionDataBlock TransactionData;
|
|
|
|
public PlacesReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 42;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
TransactionData = new TransactionDataBlock();
|
|
}
|
|
|
|
public PlacesReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryData = new QueryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryData[j] = new QueryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PlacesReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryData = new QueryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryData[j] = new QueryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += TransactionData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryData.Length; j++) { length += QueryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryData.Length;
|
|
for (int j = 0; j < QueryData.Length; j++) { QueryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
TransactionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PlacesReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryData.Length; j++)
|
|
{
|
|
output += QueryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += TransactionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirFindQueryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirfindquery_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
public uint QueryFlags;
|
|
public int QueryStart;
|
|
private byte[] _querytext;
|
|
public byte[] QueryText
|
|
{
|
|
get { return _querytext; }
|
|
set
|
|
{
|
|
if (value == null) { _querytext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _querytext = new byte[value.Length]; Array.Copy(value, _querytext, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (QueryText != null) { length += 1 + QueryText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_querytext = new byte[length];
|
|
Array.Copy(bytes, i, _querytext, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(QueryStart % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 24) % 256);
|
|
if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)QueryText.Length;
|
|
Array.Copy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output += "QueryStart: " + QueryStart.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(QueryText, "QueryText") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirfindquery_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirFindQuery; } }
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirFindQueryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 43;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirFindQueryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirFindQueryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirFindQuery ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirPlacesQueryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirplacesquery_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID QueryID;
|
|
public sbyte Category;
|
|
public uint QueryFlags;
|
|
public int QueryStart;
|
|
private byte[] _querytext;
|
|
public byte[] QueryText
|
|
{
|
|
get { return _querytext; }
|
|
set
|
|
{
|
|
if (value == null) { _querytext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _querytext = new byte[value.Length]; Array.Copy(value, _querytext, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 25;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
if (QueryText != null) { length += 1 + QueryText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
Category = (sbyte)bytes[i++];
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_querytext = new byte[length];
|
|
Array.Copy(bytes, i, _querytext, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)Category;
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(QueryStart % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 24) % 256);
|
|
if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)QueryText.Length;
|
|
Array.Copy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output += "QueryStart: " + QueryStart.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(QueryText, "QueryText") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirplacesquery_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirPlacesQuery; } }
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirPlacesQueryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 45;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirPlacesQueryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirPlacesQueryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirPlacesQuery ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirPlacesReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirplacesreply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
public bool ReservedNewbie;
|
|
public bool ForSale;
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public bool Auction;
|
|
public float Dwell;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 23;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ReservedNewbie = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ForSale = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
Auction = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Dwell = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)((ReservedNewbie) ? 1 : 0);
|
|
bytes[i++] = (byte)((ForSale) ? 1 : 0);
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)((Auction) ? 1 : 0);
|
|
ba = BitConverter.GetBytes(Dwell);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "" + Environment.NewLine;
|
|
output += "ForSale: " + ForSale.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Auction: " + Auction.ToString() + "" + Environment.NewLine;
|
|
output += "Dwell: " + Dwell.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirplacesreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirplacesreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirPlacesReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock[] QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirPlacesReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 47;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirPlacesReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
QueryData = new QueryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryData[j] = new QueryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirPlacesReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
QueryData = new QueryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryData[j] = new QueryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < QueryData.Length; j++) { length += QueryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
bytes[i++] = (byte)QueryData.Length;
|
|
for (int j = 0; j < QueryData.Length; j++) { QueryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirPlacesReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
for (int j = 0; j < QueryData.Length; j++)
|
|
{
|
|
output += QueryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirPeopleReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirpeoplereply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
private byte[] _lastname;
|
|
public byte[] LastName
|
|
{
|
|
get { return _lastname; }
|
|
set
|
|
{
|
|
if (value == null) { _lastname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _lastname = new byte[value.Length]; Array.Copy(value, _lastname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _firstname;
|
|
public byte[] FirstName
|
|
{
|
|
get { return _firstname; }
|
|
set
|
|
{
|
|
if (value == null) { _firstname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _firstname = new byte[value.Length]; Array.Copy(value, _firstname, value.Length); }
|
|
}
|
|
}
|
|
public bool Online;
|
|
public int Reputation;
|
|
private byte[] _group;
|
|
public byte[] Group
|
|
{
|
|
get { return _group; }
|
|
set
|
|
{
|
|
if (value == null) { _group = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _group = new byte[value.Length]; Array.Copy(value, _group, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 21;
|
|
if (LastName != null) { length += 1 + LastName.Length; }
|
|
if (FirstName != null) { length += 1 + FirstName.Length; }
|
|
if (Group != null) { length += 1 + Group.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_lastname = new byte[length];
|
|
Array.Copy(bytes, i, _lastname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_firstname = new byte[length];
|
|
Array.Copy(bytes, i, _firstname, 0, length); i += length;
|
|
Online = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Reputation = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_group = new byte[length];
|
|
Array.Copy(bytes, i, _group, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LastName.Length;
|
|
Array.Copy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length;
|
|
if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FirstName.Length;
|
|
Array.Copy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length;
|
|
bytes[i++] = (byte)((Online) ? 1 : 0);
|
|
bytes[i++] = (byte)(Reputation % 256);
|
|
bytes[i++] = (byte)((Reputation >> 8) % 256);
|
|
bytes[i++] = (byte)((Reputation >> 16) % 256);
|
|
bytes[i++] = (byte)((Reputation >> 24) % 256);
|
|
if(Group == null) { Console.WriteLine("Warning: Group is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Group.Length;
|
|
Array.Copy(Group, 0, bytes, i, Group.Length); i += Group.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LastName, "LastName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FirstName, "FirstName") + "" + Environment.NewLine;
|
|
output += "Online: " + Online.ToString() + "" + Environment.NewLine;
|
|
output += "Reputation: " + Reputation.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Group, "Group") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpeoplereply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpeoplereply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirPeopleReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirPeopleReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 48;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirPeopleReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirPeopleReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirPeopleReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirEventsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("direventsreply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _date;
|
|
public byte[] Date
|
|
{
|
|
get { return _date; }
|
|
set
|
|
{
|
|
if (value == null) { _date = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _date = new byte[value.Length]; Array.Copy(value, _date, value.Length); }
|
|
}
|
|
}
|
|
public uint EventID;
|
|
public LLUUID OwnerID;
|
|
public uint EventFlags;
|
|
public uint UnixTime;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Date != null) { length += 1 + Date.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_date = new byte[length];
|
|
Array.Copy(bytes, i, _date, 0, length); i += length;
|
|
EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
EventFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
UnixTime = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Date == null) { Console.WriteLine("Warning: Date is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Date.Length;
|
|
Array.Copy(Date, 0, bytes, i, Date.Length); i += Date.Length;
|
|
bytes[i++] = (byte)(EventID % 256);
|
|
bytes[i++] = (byte)((EventID >> 8) % 256);
|
|
bytes[i++] = (byte)((EventID >> 16) % 256);
|
|
bytes[i++] = (byte)((EventID >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EventFlags % 256);
|
|
bytes[i++] = (byte)((EventFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((EventFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((EventFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(UnixTime % 256);
|
|
bytes[i++] = (byte)((UnixTime >> 8) % 256);
|
|
bytes[i++] = (byte)((UnixTime >> 16) % 256);
|
|
bytes[i++] = (byte)((UnixTime >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Date, "Date") + "" + Environment.NewLine;
|
|
output += "EventID: " + EventID.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "EventFlags: " + EventFlags.ToString() + "" + Environment.NewLine;
|
|
output += "UnixTime: " + UnixTime.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("direventsreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("direventsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirEventsReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirEventsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 49;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirEventsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirEventsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirEventsReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirGroupsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirgroupsreply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
public int Members;
|
|
public LLUUID GroupID;
|
|
public int MembershipFee;
|
|
public bool OpenEnrollment;
|
|
private byte[] _groupname;
|
|
public byte[] GroupName
|
|
{
|
|
get { return _groupname; }
|
|
set
|
|
{
|
|
if (value == null) { _groupname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _groupname = new byte[value.Length]; Array.Copy(value, _groupname, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 25;
|
|
if (GroupName != null) { length += 1 + GroupName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Members = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
MembershipFee = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OpenEnrollment = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_groupname = new byte[length];
|
|
Array.Copy(bytes, i, _groupname, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Members % 256);
|
|
bytes[i++] = (byte)((Members >> 8) % 256);
|
|
bytes[i++] = (byte)((Members >> 16) % 256);
|
|
bytes[i++] = (byte)((Members >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MembershipFee % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 8) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 16) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 24) % 256);
|
|
bytes[i++] = (byte)((OpenEnrollment) ? 1 : 0);
|
|
if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupName.Length;
|
|
Array.Copy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += "Members: " + Members.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "MembershipFee: " + MembershipFee.ToString() + "" + Environment.NewLine;
|
|
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupName, "GroupName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirgroupsreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirgroupsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirGroupsReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirGroupsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 50;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirGroupsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirGroupsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirGroupsReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirClassifiedQueryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirclassifiedquery_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
public uint Category;
|
|
public uint QueryFlags;
|
|
public int QueryStart;
|
|
private byte[] _querytext;
|
|
public byte[] QueryText
|
|
{
|
|
get { return _querytext; }
|
|
set
|
|
{
|
|
if (value == null) { _querytext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _querytext = new byte[value.Length]; Array.Copy(value, _querytext, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (QueryText != null) { length += 1 + QueryText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_querytext = new byte[length];
|
|
Array.Copy(bytes, i, _querytext, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Category % 256);
|
|
bytes[i++] = (byte)((Category >> 8) % 256);
|
|
bytes[i++] = (byte)((Category >> 16) % 256);
|
|
bytes[i++] = (byte)((Category >> 24) % 256);
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(QueryStart % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 24) % 256);
|
|
if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)QueryText.Length;
|
|
Array.Copy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output += "QueryStart: " + QueryStart.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(QueryText, "QueryText") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirclassifiedquery_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirClassifiedQuery; } }
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirClassifiedQueryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 51;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirClassifiedQueryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirClassifiedQueryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirClassifiedQuery ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirClassifiedReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirclassifiedreply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
public byte ClassifiedFlags;
|
|
public uint CreationDate;
|
|
public LLUUID ClassifiedID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public int PriceForListing;
|
|
public uint ExpirationDate;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 29;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ClassifiedFlags = (byte)bytes[i++];
|
|
CreationDate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ClassifiedID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
PriceForListing = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ExpirationDate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ClassifiedFlags;
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
if(ClassifiedID == null) { Console.WriteLine("Warning: ClassifiedID is null, in " + this.GetType()); }
|
|
Array.Copy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(PriceForListing % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 24) % 256);
|
|
bytes[i++] = (byte)(ExpirationDate % 256);
|
|
bytes[i++] = (byte)((ExpirationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((ExpirationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((ExpirationDate >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += "ClassifiedFlags: " + ClassifiedFlags.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "ClassifiedID: " + ClassifiedID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "PriceForListing: " + PriceForListing.ToString() + "" + Environment.NewLine;
|
|
output += "ExpirationDate: " + ExpirationDate.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirclassifiedreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirclassifiedreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirClassifiedReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirClassifiedReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 53;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirClassifiedReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirClassifiedReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirClassifiedReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarClassifiedReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarclassifiedreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ClassifiedID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ClassifiedID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ClassifiedID == null) { Console.WriteLine("Warning: ClassifiedID is null, in " + this.GetType()); }
|
|
Array.Copy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ClassifiedID: " + ClassifiedID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarclassifiedreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID TargetID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarClassifiedReply; } }
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarClassifiedReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 54;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarClassifiedReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarClassifiedReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarClassifiedReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ClassifiedInfoRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("classifiedinforequest_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ClassifiedID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ClassifiedID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ClassifiedID == null) { Console.WriteLine("Warning: ClassifiedID is null, in " + this.GetType()); }
|
|
Array.Copy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ClassifiedID: " + ClassifiedID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("classifiedinforequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ClassifiedInfoRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ClassifiedInfoRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 55;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ClassifiedInfoRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ClassifiedInfoRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ClassifiedInfoRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ClassifiedInfoReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("classifiedinforeply_data")]
|
|
public class DataBlock
|
|
{
|
|
public byte ClassifiedFlags;
|
|
public uint CreationDate;
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ClassifiedID;
|
|
public LLVector3d PosGlobal;
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _parcelname;
|
|
public byte[] ParcelName
|
|
{
|
|
get { return _parcelname; }
|
|
set
|
|
{
|
|
if (value == null) { _parcelname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _parcelname = new byte[value.Length]; Array.Copy(value, _parcelname, value.Length); }
|
|
}
|
|
}
|
|
public uint Category;
|
|
public LLUUID CreatorID;
|
|
public LLUUID SnapshotID;
|
|
public int PriceForListing;
|
|
public uint ExpirationDate;
|
|
public uint ParentEstate;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 109;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 2 + Desc.Length; }
|
|
if (ParcelName != null) { length += 1 + ParcelName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ClassifiedFlags = (byte)bytes[i++];
|
|
CreationDate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
ClassifiedID = new LLUUID(bytes, i); i += 16;
|
|
PosGlobal = new LLVector3d(bytes, i); i += 24;
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_parcelname = new byte[length];
|
|
Array.Copy(bytes, i, _parcelname, 0, length); i += length;
|
|
Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
PriceForListing = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ExpirationDate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParentEstate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ClassifiedFlags;
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
if(ClassifiedID == null) { Console.WriteLine("Warning: ClassifiedID is null, in " + this.GetType()); }
|
|
Array.Copy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24;
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Desc.Length % 256);
|
|
bytes[i++] = (byte)((Desc.Length >> 8) % 256);
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
if(ParcelName == null) { Console.WriteLine("Warning: ParcelName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ParcelName.Length;
|
|
Array.Copy(ParcelName, 0, bytes, i, ParcelName.Length); i += ParcelName.Length;
|
|
bytes[i++] = (byte)(Category % 256);
|
|
bytes[i++] = (byte)((Category >> 8) % 256);
|
|
bytes[i++] = (byte)((Category >> 16) % 256);
|
|
bytes[i++] = (byte)((Category >> 24) % 256);
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(PriceForListing % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 24) % 256);
|
|
bytes[i++] = (byte)(ExpirationDate % 256);
|
|
bytes[i++] = (byte)((ExpirationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((ExpirationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((ExpirationDate >> 24) % 256);
|
|
bytes[i++] = (byte)(ParentEstate % 256);
|
|
bytes[i++] = (byte)((ParentEstate >> 8) % 256);
|
|
bytes[i++] = (byte)((ParentEstate >> 16) % 256);
|
|
bytes[i++] = (byte)((ParentEstate >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ClassifiedFlags: " + ClassifiedFlags.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "ClassifiedID: " + ClassifiedID.ToString() + "" + Environment.NewLine;
|
|
output += "PosGlobal: " + PosGlobal.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ParcelName, "ParcelName") + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "PriceForListing: " + PriceForListing.ToString() + "" + Environment.NewLine;
|
|
output += "ExpirationDate: " + ExpirationDate.ToString() + "" + Environment.NewLine;
|
|
output += "ParentEstate: " + ParentEstate.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("classifiedinforeply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ClassifiedInfoReply; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ClassifiedInfoReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 56;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ClassifiedInfoReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ClassifiedInfoReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ClassifiedInfoReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ClassifiedInfoUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("classifiedinfoupdate_data")]
|
|
public class DataBlock
|
|
{
|
|
public byte ClassifiedFlags;
|
|
public LLUUID ClassifiedID;
|
|
public LLVector3d PosGlobal;
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
public uint Category;
|
|
public LLUUID SnapshotID;
|
|
public int PriceForListing;
|
|
public uint ParentEstate;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 85;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 2 + Desc.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ClassifiedFlags = (byte)bytes[i++];
|
|
ClassifiedID = new LLUUID(bytes, i); i += 16;
|
|
PosGlobal = new LLVector3d(bytes, i); i += 24;
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
PriceForListing = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParentEstate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ClassifiedFlags;
|
|
if(ClassifiedID == null) { Console.WriteLine("Warning: ClassifiedID is null, in " + this.GetType()); }
|
|
Array.Copy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24;
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Desc.Length % 256);
|
|
bytes[i++] = (byte)((Desc.Length >> 8) % 256);
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
bytes[i++] = (byte)(Category % 256);
|
|
bytes[i++] = (byte)((Category >> 8) % 256);
|
|
bytes[i++] = (byte)((Category >> 16) % 256);
|
|
bytes[i++] = (byte)((Category >> 24) % 256);
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(PriceForListing % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 8) % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 16) % 256);
|
|
bytes[i++] = (byte)((PriceForListing >> 24) % 256);
|
|
bytes[i++] = (byte)(ParentEstate % 256);
|
|
bytes[i++] = (byte)((ParentEstate >> 8) % 256);
|
|
bytes[i++] = (byte)((ParentEstate >> 16) % 256);
|
|
bytes[i++] = (byte)((ParentEstate >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ClassifiedFlags: " + ClassifiedFlags.ToString() + "" + Environment.NewLine;
|
|
output += "ClassifiedID: " + ClassifiedID.ToString() + "" + Environment.NewLine;
|
|
output += "PosGlobal: " + PosGlobal.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "PriceForListing: " + PriceForListing.ToString() + "" + Environment.NewLine;
|
|
output += "ParentEstate: " + ParentEstate.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("classifiedinfoupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ClassifiedInfoUpdate; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ClassifiedInfoUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 57;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ClassifiedInfoUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ClassifiedInfoUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ClassifiedInfoUpdate ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ClassifiedDeletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("classifieddelete_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ClassifiedID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ClassifiedID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ClassifiedID == null) { Console.WriteLine("Warning: ClassifiedID is null, in " + this.GetType()); }
|
|
Array.Copy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ClassifiedID: " + ClassifiedID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("classifieddelete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ClassifiedDelete; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ClassifiedDeletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 58;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ClassifiedDeletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ClassifiedDeletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ClassifiedDelete ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ClassifiedGodDeletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("classifiedgoddelete_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ClassifiedID;
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ClassifiedID = new LLUUID(bytes, i); i += 16;
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ClassifiedID == null) { Console.WriteLine("Warning: ClassifiedID is null, in " + this.GetType()); }
|
|
Array.Copy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ClassifiedID: " + ClassifiedID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("classifiedgoddelete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ClassifiedGodDelete; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ClassifiedGodDeletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 59;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ClassifiedGodDeletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ClassifiedGodDeletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ClassifiedGodDelete ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirPicksQueryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirpicksquery_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
public uint QueryFlags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpicksquery_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirPicksQuery; } }
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirPicksQueryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 60;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirPicksQueryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirPicksQueryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirPicksQuery ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirPicksReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirpicksreply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
public bool Enabled;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID PickID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 17;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
PickID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Enabled) ? 1 : 0);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(PickID == null) { Console.WriteLine("Warning: PickID is null, in " + this.GetType()); }
|
|
Array.Copy(PickID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += "Enabled: " + Enabled.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "PickID: " + PickID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpicksreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpicksreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirPicksReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirPicksReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 62;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirPicksReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirPicksReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirPicksReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirLandQueryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirlandquery_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public uint SearchType;
|
|
public int Area;
|
|
public LLUUID QueryID;
|
|
public uint QueryFlags;
|
|
public int Price;
|
|
public int QueryStart;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SearchType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Area = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Price = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SearchType % 256);
|
|
bytes[i++] = (byte)((SearchType >> 8) % 256);
|
|
bytes[i++] = (byte)((SearchType >> 16) % 256);
|
|
bytes[i++] = (byte)((SearchType >> 24) % 256);
|
|
bytes[i++] = (byte)(Area % 256);
|
|
bytes[i++] = (byte)((Area >> 8) % 256);
|
|
bytes[i++] = (byte)((Area >> 16) % 256);
|
|
bytes[i++] = (byte)((Area >> 24) % 256);
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(Price % 256);
|
|
bytes[i++] = (byte)((Price >> 8) % 256);
|
|
bytes[i++] = (byte)((Price >> 16) % 256);
|
|
bytes[i++] = (byte)((Price >> 24) % 256);
|
|
bytes[i++] = (byte)(QueryStart % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "SearchType: " + SearchType.ToString() + "" + Environment.NewLine;
|
|
output += "Area: " + Area.ToString() + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output += "Price: " + Price.ToString() + "" + Environment.NewLine;
|
|
output += "QueryStart: " + QueryStart.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirlandquery_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirLandQuery; } }
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirLandQueryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 63;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirLandQueryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirLandQueryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirLandQuery ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirLandReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirlandreply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
public bool ReservedNewbie;
|
|
public int ActualArea;
|
|
public bool ForSale;
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public bool Auction;
|
|
public int SalePrice;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 27;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ReservedNewbie = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ActualArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ForSale = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
Auction = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((ReservedNewbie) ? 1 : 0);
|
|
bytes[i++] = (byte)(ActualArea % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 8) % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 16) % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 24) % 256);
|
|
bytes[i++] = (byte)((ForSale) ? 1 : 0);
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)((Auction) ? 1 : 0);
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "" + Environment.NewLine;
|
|
output += "ActualArea: " + ActualArea.ToString() + "" + Environment.NewLine;
|
|
output += "ForSale: " + ForSale.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Auction: " + Auction.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirlandreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirlandreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirLandReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirLandReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 65;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirLandReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirLandReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirLandReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirPopularQueryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirpopularquery_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
public uint QueryFlags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpopularquery_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirPopularQuery; } }
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirPopularQueryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 66;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirPopularQueryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirPopularQueryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirPopularQuery ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DirPopularReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("dirpopularreply_queryreplies")]
|
|
public class QueryRepliesBlock
|
|
{
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public float Dwell;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 20;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryRepliesBlock() { }
|
|
public QueryRepliesBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Dwell = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
ba = BitConverter.GetBytes(Dwell);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryReplies --" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Dwell: " + Dwell.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpopularreply_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("dirpopularreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DirPopularReply; } }
|
|
public QueryRepliesBlock[] QueryReplies;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DirPopularReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 68;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
QueryReplies = new QueryRepliesBlock[0];
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DirPopularReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DirPopularReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
QueryReplies = new QueryRepliesBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); }
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)QueryReplies.Length;
|
|
for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); }
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DirPopularReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < QueryReplies.Length; j++)
|
|
{
|
|
output += QueryReplies[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelInfoRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelinforequest_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ParcelID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelinforequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelInfoRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelInfoRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 69;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelInfoRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelInfoRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelInfoRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelInfoReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelinforeply_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public int BillableArea;
|
|
public int ActualArea;
|
|
public float GlobalX;
|
|
public float GlobalY;
|
|
public float GlobalZ;
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID SnapshotID;
|
|
public byte Flags;
|
|
public int AuctionID;
|
|
public float Dwell;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 81;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 1 + Desc.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
BillableArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ActualArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
GlobalX = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
GlobalY = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
GlobalZ = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (byte)bytes[i++];
|
|
AuctionID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Dwell = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)(BillableArea % 256);
|
|
bytes[i++] = (byte)((BillableArea >> 8) % 256);
|
|
bytes[i++] = (byte)((BillableArea >> 16) % 256);
|
|
bytes[i++] = (byte)((BillableArea >> 24) % 256);
|
|
bytes[i++] = (byte)(ActualArea % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 8) % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 16) % 256);
|
|
bytes[i++] = (byte)((ActualArea >> 24) % 256);
|
|
ba = BitConverter.GetBytes(GlobalX);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(GlobalY);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(GlobalZ);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Desc.Length;
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Flags;
|
|
bytes[i++] = (byte)(AuctionID % 256);
|
|
bytes[i++] = (byte)((AuctionID >> 8) % 256);
|
|
bytes[i++] = (byte)((AuctionID >> 16) % 256);
|
|
bytes[i++] = (byte)((AuctionID >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Dwell);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "BillableArea: " + BillableArea.ToString() + "" + Environment.NewLine;
|
|
output += "ActualArea: " + ActualArea.ToString() + "" + Environment.NewLine;
|
|
output += "GlobalX: " + GlobalX.ToString() + "" + Environment.NewLine;
|
|
output += "GlobalY: " + GlobalY.ToString() + "" + Environment.NewLine;
|
|
output += "GlobalZ: " + GlobalZ.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "AuctionID: " + AuctionID.ToString() + "" + Environment.NewLine;
|
|
output += "Dwell: " + Dwell.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelinforeply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelInfoReply; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelInfoReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 70;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelInfoReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelInfoReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelInfoReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelObjectOwnersRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelobjectownersrequest_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelobjectownersrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelObjectOwnersRequest; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelObjectOwnersRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 71;
|
|
Header.Reliable = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelObjectOwnersRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelObjectOwnersRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelObjectOwnersRequest ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelObjectOwnersReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelobjectownersreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public bool OnlineStatus;
|
|
public bool IsGroupOwned;
|
|
public LLUUID OwnerID;
|
|
public int Count;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 22;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
OnlineStatus = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
Count = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((OnlineStatus) ? 1 : 0);
|
|
bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Count % 256);
|
|
bytes[i++] = (byte)((Count >> 8) % 256);
|
|
bytes[i++] = (byte)((Count >> 16) % 256);
|
|
bytes[i++] = (byte)((Count >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "OnlineStatus: " + OnlineStatus.ToString() + "" + Environment.NewLine;
|
|
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "Count: " + Count.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelObjectOwnersReply; } }
|
|
public DataBlock[] Data;
|
|
|
|
public ParcelObjectOwnersReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 74;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock[0];
|
|
}
|
|
|
|
public ParcelObjectOwnersReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ParcelObjectOwnersReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelObjectOwnersReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupNoticesListRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupnoticeslistrequest_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupnoticeslistrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupNoticesListRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupNoticesListRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 75;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupNoticesListRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupNoticesListRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupNoticesListRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupNoticesListReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupnoticeslistreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public uint Timestamp;
|
|
private byte[] _subject;
|
|
public byte[] Subject
|
|
{
|
|
get { return _subject; }
|
|
set
|
|
{
|
|
if (value == null) { _subject = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _subject = new byte[value.Length]; Array.Copy(value, _subject, value.Length); }
|
|
}
|
|
}
|
|
public bool HasAttachment;
|
|
public LLUUID NoticeID;
|
|
private byte[] _fromname;
|
|
public byte[] FromName
|
|
{
|
|
get { return _fromname; }
|
|
set
|
|
{
|
|
if (value == null) { _fromname = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _fromname = new byte[value.Length]; Array.Copy(value, _fromname, value.Length); }
|
|
}
|
|
}
|
|
public byte AssetType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 22;
|
|
if (Subject != null) { length += 2 + Subject.Length; }
|
|
if (FromName != null) { length += 2 + FromName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_subject = new byte[length];
|
|
Array.Copy(bytes, i, _subject, 0, length); i += length;
|
|
HasAttachment = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
NoticeID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_fromname = new byte[length];
|
|
Array.Copy(bytes, i, _fromname, 0, length); i += length;
|
|
AssetType = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Timestamp % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 8) % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 16) % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 24) % 256);
|
|
if(Subject == null) { Console.WriteLine("Warning: Subject is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Subject.Length % 256);
|
|
bytes[i++] = (byte)((Subject.Length >> 8) % 256);
|
|
Array.Copy(Subject, 0, bytes, i, Subject.Length); i += Subject.Length;
|
|
bytes[i++] = (byte)((HasAttachment) ? 1 : 0);
|
|
if(NoticeID == null) { Console.WriteLine("Warning: NoticeID is null, in " + this.GetType()); }
|
|
Array.Copy(NoticeID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FromName == null) { Console.WriteLine("Warning: FromName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(FromName.Length % 256);
|
|
bytes[i++] = (byte)((FromName.Length >> 8) % 256);
|
|
Array.Copy(FromName, 0, bytes, i, FromName.Length); i += FromName.Length;
|
|
bytes[i++] = AssetType;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "Timestamp: " + Timestamp.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Subject, "Subject") + "" + Environment.NewLine;
|
|
output += "HasAttachment: " + HasAttachment.ToString() + "" + Environment.NewLine;
|
|
output += "NoticeID: " + NoticeID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FromName, "FromName") + "" + Environment.NewLine;
|
|
output += "AssetType: " + AssetType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupnoticeslistreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupNoticesListReply; } }
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupNoticesListReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 76;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupNoticesListReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupNoticesListReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupNoticesListReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupNoticeRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupnoticerequest_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID GroupNoticeID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupNoticeID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupNoticeID == null) { Console.WriteLine("Warning: GroupNoticeID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupNoticeID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "GroupNoticeID: " + GroupNoticeID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupnoticerequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupNoticeRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupNoticeRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 77;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupNoticeRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupNoticeRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupNoticeRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupNoticeDeletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupnoticedelete_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID GroupNoticeID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupNoticeID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupNoticeID == null) { Console.WriteLine("Warning: GroupNoticeID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupNoticeID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "GroupNoticeID: " + GroupNoticeID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupnoticedelete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupNoticeDelete; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupNoticeDeletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 79;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupNoticeDeletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupNoticeDeletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupNoticeDelete ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportrequest_info")]
|
|
public class InfoBlock
|
|
{
|
|
public LLUUID RegionID;
|
|
public LLVector3 LookAt;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 40;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RegionID = new LLUUID(bytes, i); i += 16;
|
|
LookAt = new LLVector3(bytes, i); i += 12;
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
|
|
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "RegionID: " + RegionID.ToString() + "" + Environment.NewLine;
|
|
output += "LookAt: " + LookAt.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("teleportrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportRequest; } }
|
|
public InfoBlock Info;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public TeleportRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 80;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public TeleportRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportRequest ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportLocationRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportlocationrequest_info")]
|
|
public class InfoBlock
|
|
{
|
|
public ulong RegionHandle;
|
|
public LLVector3 LookAt;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
LookAt = new LLVector3(bytes, i); i += 12;
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output += "LookAt: " + LookAt.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("teleportlocationrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportLocationRequest; } }
|
|
public InfoBlock Info;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public TeleportLocationRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 81;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public TeleportLocationRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportLocationRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportLocationRequest ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportLocalPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportlocal_info")]
|
|
public class InfoBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public uint LocationID;
|
|
public LLVector3 LookAt;
|
|
public uint TeleportFlags;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
LocationID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LookAt = new LLVector3(bytes, i); i += 12;
|
|
TeleportFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(LocationID % 256);
|
|
bytes[i++] = (byte)((LocationID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocationID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocationID >> 24) % 256);
|
|
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)(TeleportFlags % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 24) % 256);
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "LocationID: " + LocationID.ToString() + "" + Environment.NewLine;
|
|
output += "LookAt: " + LookAt.ToString() + "" + Environment.NewLine;
|
|
output += "TeleportFlags: " + TeleportFlags.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportLocal; } }
|
|
public InfoBlock Info;
|
|
|
|
public TeleportLocalPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 82;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public TeleportLocalPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportLocalPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportLocal ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportLandmarkRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportlandmarkrequest_info")]
|
|
public class InfoBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID LandmarkID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
LandmarkID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(LandmarkID == null) { Console.WriteLine("Warning: LandmarkID is null, in " + this.GetType()); }
|
|
Array.Copy(LandmarkID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "LandmarkID: " + LandmarkID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportLandmarkRequest; } }
|
|
public InfoBlock Info;
|
|
|
|
public TeleportLandmarkRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 83;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public TeleportLandmarkRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportLandmarkRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportLandmarkRequest ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportProgressPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportprogress_info")]
|
|
public class InfoBlock
|
|
{
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public uint TeleportFlags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Message != null) { length += 1 + Message.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
TeleportFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Message.Length;
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
bytes[i++] = (byte)(TeleportFlags % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "TeleportFlags: " + TeleportFlags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("teleportprogress_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportProgress; } }
|
|
public InfoBlock Info;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public TeleportProgressPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 84;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public TeleportProgressPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportProgressPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportProgress ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportFinishPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportfinish_info")]
|
|
public class InfoBlock
|
|
{
|
|
private byte[] _seedcapability;
|
|
public byte[] SeedCapability
|
|
{
|
|
get { return _seedcapability; }
|
|
set
|
|
{
|
|
if (value == null) { _seedcapability = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _seedcapability = new byte[value.Length]; Array.Copy(value, _seedcapability, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID AgentID;
|
|
public ushort SimPort;
|
|
public ulong RegionHandle;
|
|
public uint LocationID;
|
|
public byte SimAccess;
|
|
public uint SimIP;
|
|
public uint TeleportFlags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 39;
|
|
if (SeedCapability != null) { length += 2 + SeedCapability.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_seedcapability = new byte[length];
|
|
Array.Copy(bytes, i, _seedcapability, 0, length); i += length;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SimPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
LocationID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SimAccess = (byte)bytes[i++];
|
|
SimIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TeleportFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(SeedCapability == null) { Console.WriteLine("Warning: SeedCapability is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(SeedCapability.Length % 256);
|
|
bytes[i++] = (byte)((SeedCapability.Length >> 8) % 256);
|
|
Array.Copy(SeedCapability, 0, bytes, i, SeedCapability.Length); i += SeedCapability.Length;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((SimPort >> 8) % 256);
|
|
bytes[i++] = (byte)(SimPort % 256);
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
bytes[i++] = (byte)(LocationID % 256);
|
|
bytes[i++] = (byte)((LocationID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocationID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocationID >> 24) % 256);
|
|
bytes[i++] = SimAccess;
|
|
bytes[i++] = (byte)(SimIP % 256);
|
|
bytes[i++] = (byte)((SimIP >> 8) % 256);
|
|
bytes[i++] = (byte)((SimIP >> 16) % 256);
|
|
bytes[i++] = (byte)((SimIP >> 24) % 256);
|
|
bytes[i++] = (byte)(TeleportFlags % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SeedCapability, "SeedCapability") + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SimPort: " + SimPort.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output += "LocationID: " + LocationID.ToString() + "" + Environment.NewLine;
|
|
output += "SimAccess: " + SimAccess.ToString() + "" + Environment.NewLine;
|
|
output += "SimIP: " + SimIP.ToString() + "" + Environment.NewLine;
|
|
output += "TeleportFlags: " + TeleportFlags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportFinish; } }
|
|
public InfoBlock Info;
|
|
|
|
public TeleportFinishPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 89;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public TeleportFinishPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportFinishPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportFinish ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class StartLurePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("startlure_info")]
|
|
public class InfoBlock
|
|
{
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public byte LureType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 1;
|
|
if (Message != null) { length += 1 + Message.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
LureType = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Message.Length;
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
bytes[i++] = LureType;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "LureType: " + LureType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("startlure_targetdata")]
|
|
public class TargetDataBlock
|
|
{
|
|
public LLUUID TargetID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TargetDataBlock() { }
|
|
public TargetDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TargetData --" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("startlure_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.StartLure; } }
|
|
public InfoBlock Info;
|
|
public TargetDataBlock[] TargetData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public StartLurePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 90;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
TargetData = new TargetDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public StartLurePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
TargetData = new TargetDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ TargetData[j] = new TargetDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public StartLurePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
TargetData = new TargetDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ TargetData[j] = new TargetDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < TargetData.Length; j++) { length += TargetData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)TargetData.Length;
|
|
for (int j = 0; j < TargetData.Length; j++) { TargetData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- StartLure ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < TargetData.Length; j++)
|
|
{
|
|
output += TargetData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportLureRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportlurerequest_info")]
|
|
public class InfoBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID LureID;
|
|
public uint TeleportFlags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 52;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
LureID = new LLUUID(bytes, i); i += 16;
|
|
TeleportFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(LureID == null) { Console.WriteLine("Warning: LureID is null, in " + this.GetType()); }
|
|
Array.Copy(LureID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(TeleportFlags % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "LureID: " + LureID.ToString() + "" + Environment.NewLine;
|
|
output += "TeleportFlags: " + TeleportFlags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportLureRequest; } }
|
|
public InfoBlock Info;
|
|
|
|
public TeleportLureRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 91;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public TeleportLureRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportLureRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportLureRequest ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportCancelPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportcancel_info")]
|
|
public class InfoBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportCancel; } }
|
|
public InfoBlock Info;
|
|
|
|
public TeleportCancelPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 92;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public TeleportCancelPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportCancelPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportCancel ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportStartPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportstart_info")]
|
|
public class InfoBlock
|
|
{
|
|
public uint TeleportFlags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TeleportFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TeleportFlags % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((TeleportFlags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "TeleportFlags: " + TeleportFlags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportStart; } }
|
|
public InfoBlock Info;
|
|
|
|
public TeleportStartPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 94;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public TeleportStartPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportStartPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportStart ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TeleportFailedPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("teleportfailed_info")]
|
|
public class InfoBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
private byte[] _reason;
|
|
public byte[] Reason
|
|
{
|
|
get { return _reason; }
|
|
set
|
|
{
|
|
if (value == null) { _reason = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _reason = new byte[value.Length]; Array.Copy(value, _reason, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Reason != null) { length += 1 + Reason.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_reason = new byte[length];
|
|
Array.Copy(bytes, i, _reason, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Reason == null) { Console.WriteLine("Warning: Reason is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Reason.Length;
|
|
Array.Copy(Reason, 0, bytes, i, Reason.Length); i += Reason.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Reason, "Reason") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TeleportFailed; } }
|
|
public InfoBlock Info;
|
|
|
|
public TeleportFailedPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 95;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
}
|
|
|
|
public TeleportFailedPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TeleportFailedPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Info.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TeleportFailed ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LeaderBoardRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("leaderboardrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public int Type;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Type % 256);
|
|
bytes[i++] = (byte)((Type >> 8) % 256);
|
|
bytes[i++] = (byte)((Type >> 16) % 256);
|
|
bytes[i++] = (byte)((Type >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LeaderBoardRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public LeaderBoardRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 96;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public LeaderBoardRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LeaderBoardRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LeaderBoardRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LeaderBoardDataPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("leaderboarddata_boarddata")]
|
|
public class BoardDataBlock
|
|
{
|
|
private byte[] _timestring;
|
|
public byte[] TimeString
|
|
{
|
|
get { return _timestring; }
|
|
set
|
|
{
|
|
if (value == null) { _timestring = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _timestring = new byte[value.Length]; Array.Copy(value, _timestring, value.Length); }
|
|
}
|
|
}
|
|
public int MaxPlace;
|
|
public int MinPlace;
|
|
public int Type;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 12;
|
|
if (TimeString != null) { length += 1 + TimeString.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public BoardDataBlock() { }
|
|
public BoardDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_timestring = new byte[length];
|
|
Array.Copy(bytes, i, _timestring, 0, length); i += length;
|
|
MaxPlace = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MinPlace = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TimeString == null) { Console.WriteLine("Warning: TimeString is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TimeString.Length;
|
|
Array.Copy(TimeString, 0, bytes, i, TimeString.Length); i += TimeString.Length;
|
|
bytes[i++] = (byte)(MaxPlace % 256);
|
|
bytes[i++] = (byte)((MaxPlace >> 8) % 256);
|
|
bytes[i++] = (byte)((MaxPlace >> 16) % 256);
|
|
bytes[i++] = (byte)((MaxPlace >> 24) % 256);
|
|
bytes[i++] = (byte)(MinPlace % 256);
|
|
bytes[i++] = (byte)((MinPlace >> 8) % 256);
|
|
bytes[i++] = (byte)((MinPlace >> 16) % 256);
|
|
bytes[i++] = (byte)((MinPlace >> 24) % 256);
|
|
bytes[i++] = (byte)(Type % 256);
|
|
bytes[i++] = (byte)((Type >> 8) % 256);
|
|
bytes[i++] = (byte)((Type >> 16) % 256);
|
|
bytes[i++] = (byte)((Type >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- BoardData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TimeString, "TimeString") + "" + Environment.NewLine;
|
|
output += "MaxPlace: " + MaxPlace.ToString() + "" + Environment.NewLine;
|
|
output += "MinPlace: " + MinPlace.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("leaderboarddata_entry")]
|
|
public class EntryBlock
|
|
{
|
|
public LLUUID ID;
|
|
public byte[] Name;
|
|
public int Sequence;
|
|
public int Place;
|
|
public int Score;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 60;
|
|
}
|
|
}
|
|
|
|
public EntryBlock() { }
|
|
public EntryBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
Name = new byte[32];
|
|
Array.Copy(bytes, i, Name, 0, 32); i += 32;
|
|
Sequence = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Place = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Score = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(Name, 0, bytes, i, 32);i += 32;
|
|
bytes[i++] = (byte)(Sequence % 256);
|
|
bytes[i++] = (byte)((Sequence >> 8) % 256);
|
|
bytes[i++] = (byte)((Sequence >> 16) % 256);
|
|
bytes[i++] = (byte)((Sequence >> 24) % 256);
|
|
bytes[i++] = (byte)(Place % 256);
|
|
bytes[i++] = (byte)((Place >> 8) % 256);
|
|
bytes[i++] = (byte)((Place >> 16) % 256);
|
|
bytes[i++] = (byte)((Place >> 24) % 256);
|
|
bytes[i++] = (byte)(Score % 256);
|
|
bytes[i++] = (byte)((Score >> 8) % 256);
|
|
bytes[i++] = (byte)((Score >> 16) % 256);
|
|
bytes[i++] = (byte)((Score >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Entry --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Sequence: " + Sequence.ToString() + "" + Environment.NewLine;
|
|
output += "Place: " + Place.ToString() + "" + Environment.NewLine;
|
|
output += "Score: " + Score.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("leaderboarddata_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LeaderBoardData; } }
|
|
public BoardDataBlock BoardData;
|
|
public EntryBlock[] Entry;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public LeaderBoardDataPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 97;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
BoardData = new BoardDataBlock();
|
|
Entry = new EntryBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public LeaderBoardDataPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
BoardData = new BoardDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
Entry = new EntryBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Entry[j] = new EntryBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LeaderBoardDataPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
BoardData = new BoardDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
Entry = new EntryBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Entry[j] = new EntryBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += BoardData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Entry.Length; j++) { length += Entry[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
BoardData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Entry.Length;
|
|
for (int j = 0; j < Entry.Length; j++) { Entry[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LeaderBoardData ---" + Environment.NewLine;
|
|
output += BoardData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < Entry.Length; j++)
|
|
{
|
|
output += Entry[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UndoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("undo_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("undo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.Undo; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UndoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 98;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UndoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UndoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- Undo ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RedoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("redo_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("redo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.Redo; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RedoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 99;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RedoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RedoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- Redo ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UndoLandPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("undoland_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UndoLand; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UndoLandPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 100;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UndoLandPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UndoLandPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UndoLand ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RedoLandPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("redoland_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RedoLand; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RedoLandPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 101;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RedoLandPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RedoLandPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RedoLand ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentPausePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentpause_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint SerialNum;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SerialNum % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 8) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 16) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "SerialNum: " + SerialNum.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentPause; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentPausePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 102;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentPausePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentPausePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentPause ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentResumePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentresume_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint SerialNum;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SerialNum % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 8) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 16) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "SerialNum: " + SerialNum.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentResume; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentResumePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 103;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentResumePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentResumePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentResume ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChatFromViewerPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("chatfromviewer_chatdata")]
|
|
public class ChatDataBlock
|
|
{
|
|
public int Channel;
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public byte Type;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 5;
|
|
if (Message != null) { length += 2 + Message.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ChatDataBlock() { }
|
|
public ChatDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Channel = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
Type = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Channel % 256);
|
|
bytes[i++] = (byte)((Channel >> 8) % 256);
|
|
bytes[i++] = (byte)((Channel >> 16) % 256);
|
|
bytes[i++] = (byte)((Channel >> 24) % 256);
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Message.Length % 256);
|
|
bytes[i++] = (byte)((Message.Length >> 8) % 256);
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
bytes[i++] = Type;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ChatData --" + Environment.NewLine;
|
|
output += "Channel: " + Channel.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("chatfromviewer_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChatFromViewer; } }
|
|
public ChatDataBlock ChatData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ChatFromViewerPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 104;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ChatData = new ChatDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ChatFromViewerPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ChatData = new ChatDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChatFromViewerPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ChatData = new ChatDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ChatData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ChatData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChatFromViewer ---" + Environment.NewLine;
|
|
output += ChatData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentThrottlePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentthrottle_throttle")]
|
|
public class ThrottleBlock
|
|
{
|
|
public uint GenCounter;
|
|
private byte[] _throttles;
|
|
public byte[] Throttles
|
|
{
|
|
get { return _throttles; }
|
|
set
|
|
{
|
|
if (value == null) { _throttles = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _throttles = new byte[value.Length]; Array.Copy(value, _throttles, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Throttles != null) { length += 1 + Throttles.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ThrottleBlock() { }
|
|
public ThrottleBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GenCounter = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_throttles = new byte[length];
|
|
Array.Copy(bytes, i, _throttles, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(GenCounter % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 8) % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 16) % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 24) % 256);
|
|
if(Throttles == null) { Console.WriteLine("Warning: Throttles is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Throttles.Length;
|
|
Array.Copy(Throttles, 0, bytes, i, Throttles.Length); i += Throttles.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Throttle --" + Environment.NewLine;
|
|
output += "GenCounter: " + GenCounter.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Throttles, "Throttles") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentthrottle_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public uint CircuitCode;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(CircuitCode % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "CircuitCode: " + CircuitCode.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentThrottle; } }
|
|
public ThrottleBlock Throttle;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentThrottlePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 105;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Throttle = new ThrottleBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentThrottlePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Throttle = new ThrottleBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentThrottlePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Throttle = new ThrottleBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Throttle.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Throttle.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentThrottle ---" + Environment.NewLine;
|
|
output += Throttle.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentFOVPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentfov_fovblock")]
|
|
public class FOVBlockBlock
|
|
{
|
|
public uint GenCounter;
|
|
public float VerticalAngle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public FOVBlockBlock() { }
|
|
public FOVBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GenCounter = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
VerticalAngle = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(GenCounter % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 8) % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 16) % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 24) % 256);
|
|
ba = BitConverter.GetBytes(VerticalAngle);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FOVBlock --" + Environment.NewLine;
|
|
output += "GenCounter: " + GenCounter.ToString() + "" + Environment.NewLine;
|
|
output += "VerticalAngle: " + VerticalAngle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentfov_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public uint CircuitCode;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(CircuitCode % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "CircuitCode: " + CircuitCode.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentFOV; } }
|
|
public FOVBlockBlock FOVBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentFOVPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 106;
|
|
Header.Reliable = true;
|
|
FOVBlock = new FOVBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentFOVPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
FOVBlock = new FOVBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentFOVPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
FOVBlock = new FOVBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += FOVBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
FOVBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentFOV ---" + Environment.NewLine;
|
|
output += FOVBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentHeightWidthPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentheightwidth_heightwidthblock")]
|
|
public class HeightWidthBlockBlock
|
|
{
|
|
public uint GenCounter;
|
|
public ushort Height;
|
|
public ushort Width;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public HeightWidthBlockBlock() { }
|
|
public HeightWidthBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GenCounter = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Height = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
Width = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(GenCounter % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 8) % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 16) % 256);
|
|
bytes[i++] = (byte)((GenCounter >> 24) % 256);
|
|
bytes[i++] = (byte)(Height % 256);
|
|
bytes[i++] = (byte)((Height >> 8) % 256);
|
|
bytes[i++] = (byte)(Width % 256);
|
|
bytes[i++] = (byte)((Width >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HeightWidthBlock --" + Environment.NewLine;
|
|
output += "GenCounter: " + GenCounter.ToString() + "" + Environment.NewLine;
|
|
output += "Height: " + Height.ToString() + "" + Environment.NewLine;
|
|
output += "Width: " + Width.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentheightwidth_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public uint CircuitCode;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(CircuitCode % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "CircuitCode: " + CircuitCode.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentHeightWidth; } }
|
|
public HeightWidthBlockBlock HeightWidthBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentHeightWidthPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 107;
|
|
Header.Reliable = true;
|
|
HeightWidthBlock = new HeightWidthBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentHeightWidthPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
HeightWidthBlock = new HeightWidthBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentHeightWidthPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
HeightWidthBlock = new HeightWidthBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += HeightWidthBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
HeightWidthBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentHeightWidth ---" + Environment.NewLine;
|
|
output += HeightWidthBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentSetAppearancePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentsetappearance_visualparam")]
|
|
public class VisualParamBlock
|
|
{
|
|
public byte ParamValue;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public VisualParamBlock() { }
|
|
public VisualParamBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ParamValue = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ParamValue;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- VisualParam --" + Environment.NewLine;
|
|
output += "ParamValue: " + ParamValue.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentsetappearance_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
private byte[] _textureentry;
|
|
public byte[] TextureEntry
|
|
{
|
|
get { return _textureentry; }
|
|
set
|
|
{
|
|
if (value == null) { _textureentry = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _textureentry = new byte[value.Length]; Array.Copy(value, _textureentry, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (TextureEntry != null) { length += 2 + TextureEntry.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_textureentry = new byte[length];
|
|
Array.Copy(bytes, i, _textureentry, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TextureEntry == null) { Console.WriteLine("Warning: TextureEntry is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(TextureEntry.Length % 256);
|
|
bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
|
|
Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentsetappearance_wearabledata")]
|
|
public class WearableDataBlock
|
|
{
|
|
public byte TextureIndex;
|
|
public LLUUID CacheID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public WearableDataBlock() { }
|
|
public WearableDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TextureIndex = (byte)bytes[i++];
|
|
CacheID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = TextureIndex;
|
|
if(CacheID == null) { Console.WriteLine("Warning: CacheID is null, in " + this.GetType()); }
|
|
Array.Copy(CacheID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- WearableData --" + Environment.NewLine;
|
|
output += "TextureIndex: " + TextureIndex.ToString() + "" + Environment.NewLine;
|
|
output += "CacheID: " + CacheID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentsetappearance_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint SerialNum;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLVector3 Size;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Size = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SerialNum % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 8) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 16) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(Size.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "SerialNum: " + SerialNum.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Size: " + Size.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentSetAppearance; } }
|
|
public VisualParamBlock[] VisualParam;
|
|
public ObjectDataBlock ObjectData;
|
|
public WearableDataBlock[] WearableData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentSetAppearancePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 108;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
VisualParam = new VisualParamBlock[0];
|
|
ObjectData = new ObjectDataBlock();
|
|
WearableData = new WearableDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentSetAppearancePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
VisualParam = new VisualParamBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VisualParam[j] = new VisualParamBlock(bytes, ref i); }
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentSetAppearancePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
VisualParam = new VisualParamBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VisualParam[j] = new VisualParamBlock(bytes, ref i); }
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < VisualParam.Length; j++) { length += VisualParam[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)VisualParam.Length;
|
|
for (int j = 0; j < VisualParam.Length; j++) { VisualParam[j].ToBytes(bytes, ref i); }
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)WearableData.Length;
|
|
for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentSetAppearance ---" + Environment.NewLine;
|
|
for (int j = 0; j < VisualParam.Length; j++)
|
|
{
|
|
output += VisualParam[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < WearableData.Length; j++)
|
|
{
|
|
output += WearableData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentQuitPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentquit_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentQuit; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentQuitPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 109;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentQuitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentQuitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentQuit ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentQuitCopyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentquitcopy_fuseblock")]
|
|
public class FuseBlockBlock
|
|
{
|
|
public uint ViewerCircuitCode;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public FuseBlockBlock() { }
|
|
public FuseBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ViewerCircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ViewerCircuitCode % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FuseBlock --" + Environment.NewLine;
|
|
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentquitcopy_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentQuitCopy; } }
|
|
public FuseBlockBlock FuseBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentQuitCopyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 110;
|
|
Header.Reliable = true;
|
|
FuseBlock = new FuseBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentQuitCopyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
FuseBlock = new FuseBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentQuitCopyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
FuseBlock = new FuseBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += FuseBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
FuseBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentQuitCopy ---" + Environment.NewLine;
|
|
output += FuseBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ImageNotInDatabasePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("imagenotindatabase_imageid")]
|
|
public class ImageIDBlock
|
|
{
|
|
public LLUUID ID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ImageIDBlock() { }
|
|
public ImageIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ImageID --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ImageNotInDatabase; } }
|
|
public ImageIDBlock ImageID;
|
|
|
|
public ImageNotInDatabasePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 111;
|
|
Header.Reliable = true;
|
|
ImageID = new ImageIDBlock();
|
|
}
|
|
|
|
public ImageNotInDatabasePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ImageID = new ImageIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public ImageNotInDatabasePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ImageID = new ImageIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ImageID.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ImageID.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ImageNotInDatabase ---" + Environment.NewLine;
|
|
output += ImageID.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RebakeAvatarTexturesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("rebakeavatartextures_texturedata")]
|
|
public class TextureDataBlock
|
|
{
|
|
public LLUUID TextureID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TextureDataBlock() { }
|
|
public TextureDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TextureID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TextureID == null) { Console.WriteLine("Warning: TextureID is null, in " + this.GetType()); }
|
|
Array.Copy(TextureID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TextureData --" + Environment.NewLine;
|
|
output += "TextureID: " + TextureID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RebakeAvatarTextures; } }
|
|
public TextureDataBlock TextureData;
|
|
|
|
public RebakeAvatarTexturesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 112;
|
|
Header.Reliable = true;
|
|
TextureData = new TextureDataBlock();
|
|
}
|
|
|
|
public RebakeAvatarTexturesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TextureData = new TextureDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RebakeAvatarTexturesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TextureData = new TextureDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TextureData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TextureData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RebakeAvatarTextures ---" + Environment.NewLine;
|
|
output += TextureData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SetAlwaysRunPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("setalwaysrun_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool AlwaysRun;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
AlwaysRun = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AlwaysRun) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "AlwaysRun: " + AlwaysRun.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SetAlwaysRun; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SetAlwaysRunPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 113;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SetAlwaysRunPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SetAlwaysRunPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SetAlwaysRun ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDeletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdelete_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdelete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool Force;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Force = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Force) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Force: " + Force.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDelete; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDeletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 114;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDeletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDeletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDelete ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDuplicatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectduplicate_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectduplicate_shareddata")]
|
|
public class SharedDataBlock
|
|
{
|
|
public uint DuplicateFlags;
|
|
public LLVector3 Offset;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public SharedDataBlock() { }
|
|
public SharedDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
DuplicateFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Offset = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(DuplicateFlags % 256);
|
|
bytes[i++] = (byte)((DuplicateFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((DuplicateFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((DuplicateFlags >> 24) % 256);
|
|
Array.Copy(Offset.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- SharedData --" + Environment.NewLine;
|
|
output += "DuplicateFlags: " + DuplicateFlags.ToString() + "" + Environment.NewLine;
|
|
output += "Offset: " + Offset.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectduplicate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDuplicate; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public SharedDataBlock SharedData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDuplicatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 115;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
SharedData = new SharedDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDuplicatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
SharedData = new SharedDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDuplicatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
SharedData = new SharedDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += SharedData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
SharedData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDuplicate ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += SharedData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDuplicateOnRayPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectduplicateonray_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectduplicateonray_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public uint DuplicateFlags;
|
|
public bool CopyRotates;
|
|
public LLUUID SessionID;
|
|
public LLVector3 RayStart;
|
|
public LLUUID GroupID;
|
|
public bool RayEndIsIntersection;
|
|
public LLVector3 RayEnd;
|
|
public bool BypassRaycast;
|
|
public bool CopyCenters;
|
|
public LLUUID RayTargetID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 96;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
DuplicateFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CopyRotates = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
RayStart = new LLVector3(bytes, i); i += 12;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
RayEndIsIntersection = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RayEnd = new LLVector3(bytes, i); i += 12;
|
|
BypassRaycast = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CopyCenters = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RayTargetID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(DuplicateFlags % 256);
|
|
bytes[i++] = (byte)((DuplicateFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((DuplicateFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((DuplicateFlags >> 24) % 256);
|
|
bytes[i++] = (byte)((CopyRotates) ? 1 : 0);
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0);
|
|
Array.Copy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)((BypassRaycast) ? 1 : 0);
|
|
bytes[i++] = (byte)((CopyCenters) ? 1 : 0);
|
|
if(RayTargetID == null) { Console.WriteLine("Warning: RayTargetID is null, in " + this.GetType()); }
|
|
Array.Copy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "DuplicateFlags: " + DuplicateFlags.ToString() + "" + Environment.NewLine;
|
|
output += "CopyRotates: " + CopyRotates.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "RayStart: " + RayStart.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "" + Environment.NewLine;
|
|
output += "RayEnd: " + RayEnd.ToString() + "" + Environment.NewLine;
|
|
output += "BypassRaycast: " + BypassRaycast.ToString() + "" + Environment.NewLine;
|
|
output += "CopyCenters: " + CopyCenters.ToString() + "" + Environment.NewLine;
|
|
output += "RayTargetID: " + RayTargetID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDuplicateOnRay; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDuplicateOnRayPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 116;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDuplicateOnRayPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDuplicateOnRayPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDuplicateOnRay ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectScalePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectscale_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
public LLVector3 Scale;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Scale = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += "Scale: " + Scale.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectscale_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectScale; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectScalePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 117;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectScalePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectScalePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectScale ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectRotationPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectrotation_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
public LLQuaternion Rotation;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Rotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += "Rotation: " + Rotation.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectrotation_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectRotation; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectRotationPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 118;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectRotationPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectRotationPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectRotation ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectFlagUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectflagupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool IsTemporary;
|
|
public uint ObjectLocalID;
|
|
public bool UsePhysics;
|
|
public bool CastsShadows;
|
|
public bool IsPhantom;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 40;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
IsTemporary = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
UsePhysics = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CastsShadows = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
IsPhantom = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((IsTemporary) ? 1 : 0);
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
bytes[i++] = (byte)((UsePhysics) ? 1 : 0);
|
|
bytes[i++] = (byte)((CastsShadows) ? 1 : 0);
|
|
bytes[i++] = (byte)((IsPhantom) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "IsTemporary: " + IsTemporary.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += "UsePhysics: " + UsePhysics.ToString() + "" + Environment.NewLine;
|
|
output += "CastsShadows: " + CastsShadows.ToString() + "" + Environment.NewLine;
|
|
output += "IsPhantom: " + IsPhantom.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectFlagUpdate; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectFlagUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 119;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectFlagUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectFlagUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectFlagUpdate ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectClickActionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectclickaction_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public byte ClickAction;
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 5;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ClickAction = (byte)bytes[i++];
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ClickAction;
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ClickAction: " + ClickAction.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectclickaction_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectClickAction; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectClickActionPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 120;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectClickActionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectClickActionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectClickAction ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectImagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectimage_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
private byte[] _mediaurl;
|
|
public byte[] MediaURL
|
|
{
|
|
get { return _mediaurl; }
|
|
set
|
|
{
|
|
if (value == null) { _mediaurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _mediaurl = new byte[value.Length]; Array.Copy(value, _mediaurl, value.Length); }
|
|
}
|
|
}
|
|
public uint ObjectLocalID;
|
|
private byte[] _textureentry;
|
|
public byte[] TextureEntry
|
|
{
|
|
get { return _textureentry; }
|
|
set
|
|
{
|
|
if (value == null) { _textureentry = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _textureentry = new byte[value.Length]; Array.Copy(value, _textureentry, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (MediaURL != null) { length += 1 + MediaURL.Length; }
|
|
if (TextureEntry != null) { length += 2 + TextureEntry.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_mediaurl = new byte[length];
|
|
Array.Copy(bytes, i, _mediaurl, 0, length); i += length;
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_textureentry = new byte[length];
|
|
Array.Copy(bytes, i, _textureentry, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MediaURL.Length;
|
|
Array.Copy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length;
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
if(TextureEntry == null) { Console.WriteLine("Warning: TextureEntry is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(TextureEntry.Length % 256);
|
|
bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
|
|
Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MediaURL, "MediaURL") + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectimage_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectImage; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectImagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 121;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectImagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectImagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectImage ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectMaterialPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectmaterial_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public byte Material;
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 5;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Material = (byte)bytes[i++];
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = Material;
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "Material: " + Material.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectmaterial_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectMaterial; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectMaterialPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 122;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectMaterialPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectMaterialPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectMaterial ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectShapePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectshape_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public sbyte PathTwistBegin;
|
|
public byte PathEnd;
|
|
public byte ProfileBegin;
|
|
public sbyte PathRadiusOffset;
|
|
public sbyte PathSkew;
|
|
public byte ProfileCurve;
|
|
public byte PathScaleX;
|
|
public byte PathScaleY;
|
|
public uint ObjectLocalID;
|
|
public byte PathShearX;
|
|
public byte PathShearY;
|
|
public sbyte PathTaperX;
|
|
public sbyte PathTaperY;
|
|
public byte ProfileEnd;
|
|
public byte PathBegin;
|
|
public byte PathCurve;
|
|
public sbyte PathTwist;
|
|
public byte ProfileHollow;
|
|
public byte PathRevolutions;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 22;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PathTwistBegin = (sbyte)bytes[i++];
|
|
PathEnd = (byte)bytes[i++];
|
|
ProfileBegin = (byte)bytes[i++];
|
|
PathRadiusOffset = (sbyte)bytes[i++];
|
|
PathSkew = (sbyte)bytes[i++];
|
|
ProfileCurve = (byte)bytes[i++];
|
|
PathScaleX = (byte)bytes[i++];
|
|
PathScaleY = (byte)bytes[i++];
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PathShearX = (byte)bytes[i++];
|
|
PathShearY = (byte)bytes[i++];
|
|
PathTaperX = (sbyte)bytes[i++];
|
|
PathTaperY = (sbyte)bytes[i++];
|
|
ProfileEnd = (byte)bytes[i++];
|
|
PathBegin = (byte)bytes[i++];
|
|
PathCurve = (byte)bytes[i++];
|
|
PathTwist = (sbyte)bytes[i++];
|
|
ProfileHollow = (byte)bytes[i++];
|
|
PathRevolutions = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)PathTwistBegin;
|
|
bytes[i++] = PathEnd;
|
|
bytes[i++] = ProfileBegin;
|
|
bytes[i++] = (byte)PathRadiusOffset;
|
|
bytes[i++] = (byte)PathSkew;
|
|
bytes[i++] = ProfileCurve;
|
|
bytes[i++] = PathScaleX;
|
|
bytes[i++] = PathScaleY;
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
bytes[i++] = PathShearX;
|
|
bytes[i++] = PathShearY;
|
|
bytes[i++] = (byte)PathTaperX;
|
|
bytes[i++] = (byte)PathTaperY;
|
|
bytes[i++] = ProfileEnd;
|
|
bytes[i++] = PathBegin;
|
|
bytes[i++] = PathCurve;
|
|
bytes[i++] = (byte)PathTwist;
|
|
bytes[i++] = ProfileHollow;
|
|
bytes[i++] = PathRevolutions;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "PathTwistBegin: " + PathTwistBegin.ToString() + "" + Environment.NewLine;
|
|
output += "PathEnd: " + PathEnd.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileBegin: " + ProfileBegin.ToString() + "" + Environment.NewLine;
|
|
output += "PathRadiusOffset: " + PathRadiusOffset.ToString() + "" + Environment.NewLine;
|
|
output += "PathSkew: " + PathSkew.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileCurve: " + ProfileCurve.ToString() + "" + Environment.NewLine;
|
|
output += "PathScaleX: " + PathScaleX.ToString() + "" + Environment.NewLine;
|
|
output += "PathScaleY: " + PathScaleY.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += "PathShearX: " + PathShearX.ToString() + "" + Environment.NewLine;
|
|
output += "PathShearY: " + PathShearY.ToString() + "" + Environment.NewLine;
|
|
output += "PathTaperX: " + PathTaperX.ToString() + "" + Environment.NewLine;
|
|
output += "PathTaperY: " + PathTaperY.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileEnd: " + ProfileEnd.ToString() + "" + Environment.NewLine;
|
|
output += "PathBegin: " + PathBegin.ToString() + "" + Environment.NewLine;
|
|
output += "PathCurve: " + PathCurve.ToString() + "" + Environment.NewLine;
|
|
output += "PathTwist: " + PathTwist.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileHollow: " + ProfileHollow.ToString() + "" + Environment.NewLine;
|
|
output += "PathRevolutions: " + PathRevolutions.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectshape_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectShape; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectShapePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 123;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectShapePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectShapePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectShape ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectExtraParamsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectextraparams_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public bool ParamInUse;
|
|
public uint ObjectLocalID;
|
|
private byte[] _paramdata;
|
|
public byte[] ParamData
|
|
{
|
|
get { return _paramdata; }
|
|
set
|
|
{
|
|
if (value == null) { _paramdata = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _paramdata = new byte[value.Length]; Array.Copy(value, _paramdata, value.Length); }
|
|
}
|
|
}
|
|
public uint ParamSize;
|
|
public ushort ParamType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 11;
|
|
if (ParamData != null) { length += 1 + ParamData.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ParamInUse = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_paramdata = new byte[length];
|
|
Array.Copy(bytes, i, _paramdata, 0, length); i += length;
|
|
ParamSize = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParamType = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((ParamInUse) ? 1 : 0);
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
if(ParamData == null) { Console.WriteLine("Warning: ParamData is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ParamData.Length;
|
|
Array.Copy(ParamData, 0, bytes, i, ParamData.Length); i += ParamData.Length;
|
|
bytes[i++] = (byte)(ParamSize % 256);
|
|
bytes[i++] = (byte)((ParamSize >> 8) % 256);
|
|
bytes[i++] = (byte)((ParamSize >> 16) % 256);
|
|
bytes[i++] = (byte)((ParamSize >> 24) % 256);
|
|
bytes[i++] = (byte)(ParamType % 256);
|
|
bytes[i++] = (byte)((ParamType >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ParamInUse: " + ParamInUse.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ParamData, "ParamData") + "" + Environment.NewLine;
|
|
output += "ParamSize: " + ParamSize.ToString() + "" + Environment.NewLine;
|
|
output += "ParamType: " + ParamType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectextraparams_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectExtraParams; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectExtraParamsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 124;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectExtraParamsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectExtraParamsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectExtraParams ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectOwnerPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectowner_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectowner_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectowner_headerdata")]
|
|
public class HeaderDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
public LLUUID OwnerID;
|
|
public bool Override;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public HeaderDataBlock() { }
|
|
public HeaderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
Override = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Override) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HeaderData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "Override: " + Override.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectOwner; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
public HeaderDataBlock HeaderData;
|
|
|
|
public ObjectOwnerPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 125;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
HeaderData = new HeaderDataBlock();
|
|
}
|
|
|
|
public ObjectOwnerPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectOwnerPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += HeaderData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
HeaderData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectOwner ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += HeaderData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectGroupPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectgroup_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectgroup_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectGroup; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectGroupPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 126;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectGroupPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectGroupPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectGroup ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectBuyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectbuy_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public byte SaleType;
|
|
public int SalePrice;
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 9;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SaleType = (byte)bytes[i++];
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectbuy_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
public LLUUID CategoryID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 64;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
CategoryID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CategoryID == null) { Console.WriteLine("Warning: CategoryID is null, in " + this.GetType()); }
|
|
Array.Copy(CategoryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "CategoryID: " + CategoryID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectBuy; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectBuyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 127;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectBuyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectBuyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectBuy ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class BuyObjectInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("buyobjectinventory_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("buyobjectinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.BuyObjectInventory; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public BuyObjectInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 128;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public BuyObjectInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public BuyObjectInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- BuyObjectInventory ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DerezContainerPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("derezcontainer_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public bool Delete;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
Delete = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Delete) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Delete: " + Delete.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DerezContainer; } }
|
|
public DataBlock Data;
|
|
|
|
public DerezContainerPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 129;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
}
|
|
|
|
public DerezContainerPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DerezContainerPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DerezContainer ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectPermissionsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectpermissions_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public byte Set;
|
|
public uint Mask;
|
|
public uint ObjectLocalID;
|
|
public byte Field;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 10;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Set = (byte)bytes[i++];
|
|
Mask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Field = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = Set;
|
|
bytes[i++] = (byte)(Mask % 256);
|
|
bytes[i++] = (byte)((Mask >> 8) % 256);
|
|
bytes[i++] = (byte)((Mask >> 16) % 256);
|
|
bytes[i++] = (byte)((Mask >> 24) % 256);
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
bytes[i++] = Field;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "Set: " + Set.ToString() + "" + Environment.NewLine;
|
|
output += "Mask: " + Mask.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += "Field: " + Field.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectpermissions_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectpermissions_headerdata")]
|
|
public class HeaderDataBlock
|
|
{
|
|
public bool Override;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public HeaderDataBlock() { }
|
|
public HeaderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Override = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Override) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HeaderData --" + Environment.NewLine;
|
|
output += "Override: " + Override.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectPermissions; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
public HeaderDataBlock HeaderData;
|
|
|
|
public ObjectPermissionsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 130;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
HeaderData = new HeaderDataBlock();
|
|
}
|
|
|
|
public ObjectPermissionsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectPermissionsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += HeaderData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
HeaderData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectPermissions ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += HeaderData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectSaleInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectsaleinfo_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint LocalID;
|
|
public byte SaleType;
|
|
public int SalePrice;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 9;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectsaleinfo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectSaleInfo; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectSaleInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 131;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectSaleInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectSaleInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectSaleInfo ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectNamePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectname_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint LocalID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectname_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectName; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectNamePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 132;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectNamePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectNamePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectName ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDescriptionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdescription_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint LocalID;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdescription_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDescription; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDescriptionPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 133;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDescriptionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDescriptionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDescription ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectCategoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectcategory_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint LocalID;
|
|
public uint Category;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(Category % 256);
|
|
bytes[i++] = (byte)((Category >> 8) % 256);
|
|
bytes[i++] = (byte)((Category >> 16) % 256);
|
|
bytes[i++] = (byte)((Category >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectcategory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectCategory; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectCategoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 134;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectCategoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectCategoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectCategory ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectSelectPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectselect_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectselect_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectSelect; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectSelectPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 135;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectSelectPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectSelectPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectSelect ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDeselectPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdeselect_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdeselect_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDeselect; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDeselectPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 136;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDeselectPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDeselectPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDeselect ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectAttachPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectattach_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
public LLQuaternion Rotation;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Rotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += "Rotation: " + Rotation.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectattach_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public byte AttachmentPoint;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AttachmentPoint = (byte)bytes[i++];
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = AttachmentPoint;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AttachmentPoint: " + AttachmentPoint.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectAttach; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectAttachPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 137;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectAttachPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectAttachPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectAttach ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDetachPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdetach_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdetach_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDetach; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDetachPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 138;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDetachPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDetachPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDetach ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDropPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdrop_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdrop_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDrop; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDropPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 139;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDropPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDropPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDrop ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectLinkPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectlink_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectlink_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectLink; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectLinkPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 140;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectLinkPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectLinkPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectLink ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDelinkPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdelink_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdelink_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDelink; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDelinkPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 141;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDelinkPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDelinkPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDelink ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectHingePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objecthinge_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objecthinge_jointtype")]
|
|
public class JointTypeBlock
|
|
{
|
|
public byte Type;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public JointTypeBlock() { }
|
|
public JointTypeBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Type = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = Type;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- JointType --" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objecthinge_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectHinge; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public JointTypeBlock JointType;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectHingePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 142;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
JointType = new JointTypeBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectHingePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
JointType = new JointTypeBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectHingePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
JointType = new JointTypeBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += JointType.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
JointType.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectHinge ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += JointType.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDehingePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdehinge_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdehinge_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDehinge; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDehingePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 143;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDehingePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDehingePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDehinge ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectGrabPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectgrab_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLVector3 GrabOffset;
|
|
public uint LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GrabOffset = new LLVector3(bytes, i); i += 12;
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(GrabOffset.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "GrabOffset: " + GrabOffset.ToString() + "" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectgrab_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectGrab; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectGrabPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 144;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectGrabPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectGrabPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectGrab ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectGrabUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectgrabupdate_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint TimeSinceLast;
|
|
public LLUUID ObjectID;
|
|
public LLVector3 GrabOffsetInitial;
|
|
public LLVector3 GrabPosition;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 44;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TimeSinceLast = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
GrabOffsetInitial = new LLVector3(bytes, i); i += 12;
|
|
GrabPosition = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TimeSinceLast % 256);
|
|
bytes[i++] = (byte)((TimeSinceLast >> 8) % 256);
|
|
bytes[i++] = (byte)((TimeSinceLast >> 16) % 256);
|
|
bytes[i++] = (byte)((TimeSinceLast >> 24) % 256);
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(GrabOffsetInitial.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(GrabPosition.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "TimeSinceLast: " + TimeSinceLast.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "GrabOffsetInitial: " + GrabOffsetInitial.ToString() + "" + Environment.NewLine;
|
|
output += "GrabPosition: " + GrabPosition.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectgrabupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectGrabUpdate; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectGrabUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 145;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectGrabUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectGrabUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectGrabUpdate ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectDeGrabPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectdegrab_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectdegrab_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectDeGrab; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectDeGrabPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 146;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectDeGrabPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectDeGrabPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectDeGrab ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectSpinStartPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectspinstart_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectspinstart_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectSpinStart; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectSpinStartPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 147;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectSpinStartPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectSpinStartPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectSpinStart ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectSpinUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectspinupdate_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLQuaternion Rotation;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 28;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
Rotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Rotation: " + Rotation.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectspinupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectSpinUpdate; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectSpinUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 148;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectSpinUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectSpinUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectSpinUpdate ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectSpinStopPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectspinstop_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectspinstop_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectSpinStop; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectSpinStopPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 149;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectSpinStopPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectSpinStopPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectSpinStop ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectExportSelectedPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectexportselected_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectexportselected_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID RequestID;
|
|
public short VolumeDetail;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 34;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
VolumeDetail = (short)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(VolumeDetail % 256);
|
|
bytes[i++] = (byte)((VolumeDetail >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "VolumeDetail: " + VolumeDetail.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectExportSelected; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectExportSelectedPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 150;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectExportSelectedPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectExportSelectedPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectExportSelected ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectImportPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectimport_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectimport_assetdata")]
|
|
public class AssetDataBlock
|
|
{
|
|
private byte[] _objectname;
|
|
public byte[] ObjectName
|
|
{
|
|
get { return _objectname; }
|
|
set
|
|
{
|
|
if (value == null) { _objectname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectname = new byte[value.Length]; Array.Copy(value, _objectname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID FileID;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (ObjectName != null) { length += 1 + ObjectName.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AssetDataBlock() { }
|
|
public AssetDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_objectname = new byte[length];
|
|
Array.Copy(bytes, i, _objectname, 0, length); i += length;
|
|
FileID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectName.Length;
|
|
Array.Copy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length;
|
|
if(FileID == null) { Console.WriteLine("Warning: FileID is null, in " + this.GetType()); }
|
|
Array.Copy(FileID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AssetData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectName, "ObjectName") + "" + Environment.NewLine;
|
|
output += "FileID: " + FileID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectImport; } }
|
|
public AgentDataBlock AgentData;
|
|
public AssetDataBlock AssetData;
|
|
|
|
public ObjectImportPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 151;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
AssetData = new AssetDataBlock();
|
|
}
|
|
|
|
public ObjectImportPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
AssetData = new AssetDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectImportPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
AssetData = new AssetDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += AssetData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
AssetData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectImport ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += AssetData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ModifyLandPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("modifyland_modifyblock")]
|
|
public class ModifyBlockBlock
|
|
{
|
|
public byte BrushSize;
|
|
public float Seconds;
|
|
public float Height;
|
|
public byte Action;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 10;
|
|
}
|
|
}
|
|
|
|
public ModifyBlockBlock() { }
|
|
public ModifyBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
BrushSize = (byte)bytes[i++];
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Seconds = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Height = BitConverter.ToSingle(bytes, i); i += 4;
|
|
Action = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = BrushSize;
|
|
ba = BitConverter.GetBytes(Seconds);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(Height);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = Action;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ModifyBlock --" + Environment.NewLine;
|
|
output += "BrushSize: " + BrushSize.ToString() + "" + Environment.NewLine;
|
|
output += "Seconds: " + Seconds.ToString() + "" + Environment.NewLine;
|
|
output += "Height: " + Height.ToString() + "" + Environment.NewLine;
|
|
output += "Action: " + Action.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("modifyland_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public float East;
|
|
public float West;
|
|
public float North;
|
|
public float South;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
East = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
West = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
North = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
South = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
ba = BitConverter.GetBytes(East);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(West);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(North);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(South);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "East: " + East.ToString() + "" + Environment.NewLine;
|
|
output += "West: " + West.ToString() + "" + Environment.NewLine;
|
|
output += "North: " + North.ToString() + "" + Environment.NewLine;
|
|
output += "South: " + South.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("modifyland_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ModifyLand; } }
|
|
public ModifyBlockBlock ModifyBlock;
|
|
public ParcelDataBlock[] ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ModifyLandPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 152;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ModifyBlock = new ModifyBlockBlock();
|
|
ParcelData = new ParcelDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ModifyLandPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ModifyBlock = new ModifyBlockBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParcelData = new ParcelDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ModifyLandPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ModifyBlock = new ModifyBlockBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParcelData = new ParcelDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ModifyBlock.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ParcelData.Length; j++) { length += ParcelData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ModifyBlock.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ParcelData.Length;
|
|
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ModifyLand ---" + Environment.NewLine;
|
|
output += ModifyBlock.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ParcelData.Length; j++)
|
|
{
|
|
output += ParcelData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class VelocityInterpolateOnPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("velocityinterpolateon_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.VelocityInterpolateOn; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public VelocityInterpolateOnPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 153;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public VelocityInterpolateOnPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public VelocityInterpolateOnPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- VelocityInterpolateOn ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class VelocityInterpolateOffPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("velocityinterpolateoff_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.VelocityInterpolateOff; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public VelocityInterpolateOffPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 154;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public VelocityInterpolateOffPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public VelocityInterpolateOffPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- VelocityInterpolateOff ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class StateSavePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("statesave_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
private byte[] _filename;
|
|
public byte[] Filename
|
|
{
|
|
get { return _filename; }
|
|
set
|
|
{
|
|
if (value == null) { _filename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _filename = new byte[value.Length]; Array.Copy(value, _filename, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Filename != null) { length += 1 + Filename.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_filename = new byte[length];
|
|
Array.Copy(bytes, i, _filename, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Filename == null) { Console.WriteLine("Warning: Filename is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Filename.Length;
|
|
Array.Copy(Filename, 0, bytes, i, Filename.Length); i += Filename.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Filename, "Filename") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("statesave_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.StateSave; } }
|
|
public DataBlockBlock DataBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public StateSavePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 155;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public StateSavePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public StateSavePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- StateSave ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ReportAutosaveCrashPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("reportautosavecrash_autosavedata")]
|
|
public class AutosaveDataBlock
|
|
{
|
|
public int PID;
|
|
public int Status;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public AutosaveDataBlock() { }
|
|
public AutosaveDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Status = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(PID % 256);
|
|
bytes[i++] = (byte)((PID >> 8) % 256);
|
|
bytes[i++] = (byte)((PID >> 16) % 256);
|
|
bytes[i++] = (byte)((PID >> 24) % 256);
|
|
bytes[i++] = (byte)(Status % 256);
|
|
bytes[i++] = (byte)((Status >> 8) % 256);
|
|
bytes[i++] = (byte)((Status >> 16) % 256);
|
|
bytes[i++] = (byte)((Status >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AutosaveData --" + Environment.NewLine;
|
|
output += "PID: " + PID.ToString() + "" + Environment.NewLine;
|
|
output += "Status: " + Status.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ReportAutosaveCrash; } }
|
|
public AutosaveDataBlock AutosaveData;
|
|
|
|
public ReportAutosaveCrashPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 156;
|
|
Header.Reliable = true;
|
|
AutosaveData = new AutosaveDataBlock();
|
|
}
|
|
|
|
public ReportAutosaveCrashPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AutosaveData = new AutosaveDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ReportAutosaveCrashPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AutosaveData = new AutosaveDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AutosaveData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AutosaveData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ReportAutosaveCrash ---" + Environment.NewLine;
|
|
output += AutosaveData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SimWideDeletesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("simwidedeletes_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID TargetID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("simwidedeletes_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SimWideDeletes; } }
|
|
public DataBlockBlock DataBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SimWideDeletesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 157;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SimWideDeletesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SimWideDeletesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SimWideDeletes ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TrackAgentPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("trackagent_targetdata")]
|
|
public class TargetDataBlock
|
|
{
|
|
public LLUUID PreyID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TargetDataBlock() { }
|
|
public TargetDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PreyID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(PreyID == null) { Console.WriteLine("Warning: PreyID is null, in " + this.GetType()); }
|
|
Array.Copy(PreyID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TargetData --" + Environment.NewLine;
|
|
output += "PreyID: " + PreyID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("trackagent_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TrackAgent; } }
|
|
public TargetDataBlock TargetData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public TrackAgentPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 158;
|
|
Header.Reliable = true;
|
|
TargetData = new TargetDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public TrackAgentPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TargetData = new TargetDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public TrackAgentPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TargetData = new TargetDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TargetData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TargetData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TrackAgent ---" + Environment.NewLine;
|
|
output += TargetData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ViewerStatsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("viewerstats_downloadtotals")]
|
|
public class DownloadTotalsBlock
|
|
{
|
|
public uint Objects;
|
|
public uint Textures;
|
|
public uint World;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public DownloadTotalsBlock() { }
|
|
public DownloadTotalsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Objects = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Textures = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
World = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Objects % 256);
|
|
bytes[i++] = (byte)((Objects >> 8) % 256);
|
|
bytes[i++] = (byte)((Objects >> 16) % 256);
|
|
bytes[i++] = (byte)((Objects >> 24) % 256);
|
|
bytes[i++] = (byte)(Textures % 256);
|
|
bytes[i++] = (byte)((Textures >> 8) % 256);
|
|
bytes[i++] = (byte)((Textures >> 16) % 256);
|
|
bytes[i++] = (byte)((Textures >> 24) % 256);
|
|
bytes[i++] = (byte)(World % 256);
|
|
bytes[i++] = (byte)((World >> 8) % 256);
|
|
bytes[i++] = (byte)((World >> 16) % 256);
|
|
bytes[i++] = (byte)((World >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DownloadTotals --" + Environment.NewLine;
|
|
output += "Objects: " + Objects.ToString() + "" + Environment.NewLine;
|
|
output += "Textures: " + Textures.ToString() + "" + Environment.NewLine;
|
|
output += "World: " + World.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("viewerstats_miscstats")]
|
|
public class MiscStatsBlock
|
|
{
|
|
public uint Type;
|
|
public double Value;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public MiscStatsBlock() { }
|
|
public MiscStatsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Type = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8);
|
|
Value = BitConverter.ToDouble(bytes, i); i += 8;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(Type % 256);
|
|
bytes[i++] = (byte)((Type >> 8) % 256);
|
|
bytes[i++] = (byte)((Type >> 16) % 256);
|
|
bytes[i++] = (byte)((Type >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Value);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); }
|
|
Array.Copy(ba, 0, bytes, i, 8); i += 8;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MiscStats --" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "Value: " + Value.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("viewerstats_netstats")]
|
|
public class NetStatsBlock
|
|
{
|
|
public uint Packets;
|
|
public uint Savings;
|
|
public uint Compressed;
|
|
public uint Bytes;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public NetStatsBlock() { }
|
|
public NetStatsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Packets = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Savings = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Compressed = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Bytes = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Packets % 256);
|
|
bytes[i++] = (byte)((Packets >> 8) % 256);
|
|
bytes[i++] = (byte)((Packets >> 16) % 256);
|
|
bytes[i++] = (byte)((Packets >> 24) % 256);
|
|
bytes[i++] = (byte)(Savings % 256);
|
|
bytes[i++] = (byte)((Savings >> 8) % 256);
|
|
bytes[i++] = (byte)((Savings >> 16) % 256);
|
|
bytes[i++] = (byte)((Savings >> 24) % 256);
|
|
bytes[i++] = (byte)(Compressed % 256);
|
|
bytes[i++] = (byte)((Compressed >> 8) % 256);
|
|
bytes[i++] = (byte)((Compressed >> 16) % 256);
|
|
bytes[i++] = (byte)((Compressed >> 24) % 256);
|
|
bytes[i++] = (byte)(Bytes % 256);
|
|
bytes[i++] = (byte)((Bytes >> 8) % 256);
|
|
bytes[i++] = (byte)((Bytes >> 16) % 256);
|
|
bytes[i++] = (byte)((Bytes >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- NetStats --" + Environment.NewLine;
|
|
output += "Packets: " + Packets.ToString() + "" + Environment.NewLine;
|
|
output += "Savings: " + Savings.ToString() + "" + Environment.NewLine;
|
|
output += "Compressed: " + Compressed.ToString() + "" + Environment.NewLine;
|
|
output += "Bytes: " + Bytes.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("viewerstats_failstats")]
|
|
public class FailStatsBlock
|
|
{
|
|
public uint FailedResends;
|
|
public uint Invalid;
|
|
public uint SendPacket;
|
|
public uint Dropped;
|
|
public uint OffCircuit;
|
|
public uint Resent;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public FailStatsBlock() { }
|
|
public FailStatsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
FailedResends = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Invalid = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SendPacket = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Dropped = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OffCircuit = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Resent = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(FailedResends % 256);
|
|
bytes[i++] = (byte)((FailedResends >> 8) % 256);
|
|
bytes[i++] = (byte)((FailedResends >> 16) % 256);
|
|
bytes[i++] = (byte)((FailedResends >> 24) % 256);
|
|
bytes[i++] = (byte)(Invalid % 256);
|
|
bytes[i++] = (byte)((Invalid >> 8) % 256);
|
|
bytes[i++] = (byte)((Invalid >> 16) % 256);
|
|
bytes[i++] = (byte)((Invalid >> 24) % 256);
|
|
bytes[i++] = (byte)(SendPacket % 256);
|
|
bytes[i++] = (byte)((SendPacket >> 8) % 256);
|
|
bytes[i++] = (byte)((SendPacket >> 16) % 256);
|
|
bytes[i++] = (byte)((SendPacket >> 24) % 256);
|
|
bytes[i++] = (byte)(Dropped % 256);
|
|
bytes[i++] = (byte)((Dropped >> 8) % 256);
|
|
bytes[i++] = (byte)((Dropped >> 16) % 256);
|
|
bytes[i++] = (byte)((Dropped >> 24) % 256);
|
|
bytes[i++] = (byte)(OffCircuit % 256);
|
|
bytes[i++] = (byte)((OffCircuit >> 8) % 256);
|
|
bytes[i++] = (byte)((OffCircuit >> 16) % 256);
|
|
bytes[i++] = (byte)((OffCircuit >> 24) % 256);
|
|
bytes[i++] = (byte)(Resent % 256);
|
|
bytes[i++] = (byte)((Resent >> 8) % 256);
|
|
bytes[i++] = (byte)((Resent >> 16) % 256);
|
|
bytes[i++] = (byte)((Resent >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FailStats --" + Environment.NewLine;
|
|
output += "FailedResends: " + FailedResends.ToString() + "" + Environment.NewLine;
|
|
output += "Invalid: " + Invalid.ToString() + "" + Environment.NewLine;
|
|
output += "SendPacket: " + SendPacket.ToString() + "" + Environment.NewLine;
|
|
output += "Dropped: " + Dropped.ToString() + "" + Environment.NewLine;
|
|
output += "OffCircuit: " + OffCircuit.ToString() + "" + Environment.NewLine;
|
|
output += "Resent: " + Resent.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("viewerstats_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint IP;
|
|
public byte AgentsInView;
|
|
public float FPS;
|
|
public LLUUID AgentID;
|
|
public int RegionsVisited;
|
|
public LLUUID SessionID;
|
|
public float Ping;
|
|
public float RunTime;
|
|
public double MetersTraveled;
|
|
public float SimFPS;
|
|
private byte[] _syscpu;
|
|
public byte[] SysCPU
|
|
{
|
|
get { return _syscpu; }
|
|
set
|
|
{
|
|
if (value == null) { _syscpu = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _syscpu = new byte[value.Length]; Array.Copy(value, _syscpu, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _sysgpu;
|
|
public byte[] SysGPU
|
|
{
|
|
get { return _sysgpu; }
|
|
set
|
|
{
|
|
if (value == null) { _sysgpu = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _sysgpu = new byte[value.Length]; Array.Copy(value, _sysgpu, value.Length); }
|
|
}
|
|
}
|
|
public uint SysRAM;
|
|
public uint StartTime;
|
|
private byte[] _sysos;
|
|
public byte[] SysOS
|
|
{
|
|
get { return _sysos; }
|
|
set
|
|
{
|
|
if (value == null) { _sysos = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _sysos = new byte[value.Length]; Array.Copy(value, _sysos, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 73;
|
|
if (SysCPU != null) { length += 1 + SysCPU.Length; }
|
|
if (SysGPU != null) { length += 1 + SysGPU.Length; }
|
|
if (SysOS != null) { length += 1 + SysOS.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentsInView = (byte)bytes[i++];
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
FPS = BitConverter.ToSingle(bytes, i); i += 4;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
RegionsVisited = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Ping = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
RunTime = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8);
|
|
MetersTraveled = BitConverter.ToDouble(bytes, i); i += 8;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
SimFPS = BitConverter.ToSingle(bytes, i); i += 4;
|
|
length = (ushort)bytes[i++];
|
|
_syscpu = new byte[length];
|
|
Array.Copy(bytes, i, _syscpu, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_sysgpu = new byte[length];
|
|
Array.Copy(bytes, i, _sysgpu, 0, length); i += length;
|
|
SysRAM = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
StartTime = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_sysos = new byte[length];
|
|
Array.Copy(bytes, i, _sysos, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(IP % 256);
|
|
bytes[i++] = (byte)((IP >> 8) % 256);
|
|
bytes[i++] = (byte)((IP >> 16) % 256);
|
|
bytes[i++] = (byte)((IP >> 24) % 256);
|
|
bytes[i++] = AgentsInView;
|
|
ba = BitConverter.GetBytes(FPS);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(RegionsVisited % 256);
|
|
bytes[i++] = (byte)((RegionsVisited >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionsVisited >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionsVisited >> 24) % 256);
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Ping);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(RunTime);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(MetersTraveled);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); }
|
|
Array.Copy(ba, 0, bytes, i, 8); i += 8;
|
|
ba = BitConverter.GetBytes(SimFPS);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(SysCPU == null) { Console.WriteLine("Warning: SysCPU is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SysCPU.Length;
|
|
Array.Copy(SysCPU, 0, bytes, i, SysCPU.Length); i += SysCPU.Length;
|
|
if(SysGPU == null) { Console.WriteLine("Warning: SysGPU is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SysGPU.Length;
|
|
Array.Copy(SysGPU, 0, bytes, i, SysGPU.Length); i += SysGPU.Length;
|
|
bytes[i++] = (byte)(SysRAM % 256);
|
|
bytes[i++] = (byte)((SysRAM >> 8) % 256);
|
|
bytes[i++] = (byte)((SysRAM >> 16) % 256);
|
|
bytes[i++] = (byte)((SysRAM >> 24) % 256);
|
|
bytes[i++] = (byte)(StartTime % 256);
|
|
bytes[i++] = (byte)((StartTime >> 8) % 256);
|
|
bytes[i++] = (byte)((StartTime >> 16) % 256);
|
|
bytes[i++] = (byte)((StartTime >> 24) % 256);
|
|
if(SysOS == null) { Console.WriteLine("Warning: SysOS is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SysOS.Length;
|
|
Array.Copy(SysOS, 0, bytes, i, SysOS.Length); i += SysOS.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "IP: " + IP.ToString() + "" + Environment.NewLine;
|
|
output += "AgentsInView: " + AgentsInView.ToString() + "" + Environment.NewLine;
|
|
output += "FPS: " + FPS.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "RegionsVisited: " + RegionsVisited.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Ping: " + Ping.ToString() + "" + Environment.NewLine;
|
|
output += "RunTime: " + RunTime.ToString() + "" + Environment.NewLine;
|
|
output += "MetersTraveled: " + MetersTraveled.ToString() + "" + Environment.NewLine;
|
|
output += "SimFPS: " + SimFPS.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SysCPU, "SysCPU") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SysGPU, "SysGPU") + "" + Environment.NewLine;
|
|
output += "SysRAM: " + SysRAM.ToString() + "" + Environment.NewLine;
|
|
output += "StartTime: " + StartTime.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SysOS, "SysOS") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ViewerStats; } }
|
|
public DownloadTotalsBlock DownloadTotals;
|
|
public MiscStatsBlock[] MiscStats;
|
|
public NetStatsBlock[] NetStats;
|
|
public FailStatsBlock FailStats;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ViewerStatsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 159;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
DownloadTotals = new DownloadTotalsBlock();
|
|
MiscStats = new MiscStatsBlock[0];
|
|
NetStats = new NetStatsBlock[2];
|
|
FailStats = new FailStatsBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ViewerStatsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DownloadTotals = new DownloadTotalsBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
MiscStats = new MiscStatsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MiscStats[j] = new MiscStatsBlock(bytes, ref i); }
|
|
NetStats = new NetStatsBlock[2];
|
|
for (int j = 0; j < 2; j++)
|
|
{ NetStats[j] = new NetStatsBlock(bytes, ref i); }
|
|
FailStats = new FailStatsBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ViewerStatsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DownloadTotals = new DownloadTotalsBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
MiscStats = new MiscStatsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MiscStats[j] = new MiscStatsBlock(bytes, ref i); }
|
|
NetStats = new NetStatsBlock[2];
|
|
for (int j = 0; j < 2; j++)
|
|
{ NetStats[j] = new NetStatsBlock(bytes, ref i); }
|
|
FailStats = new FailStatsBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DownloadTotals.Length; length += FailStats.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < MiscStats.Length; j++) { length += MiscStats[j].Length; }
|
|
for (int j = 0; j < 2; j++) { length += NetStats[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DownloadTotals.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)MiscStats.Length;
|
|
for (int j = 0; j < MiscStats.Length; j++) { MiscStats[j].ToBytes(bytes, ref i); }
|
|
for (int j = 0; j < 2; j++) { NetStats[j].ToBytes(bytes, ref i); }
|
|
FailStats.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ViewerStats ---" + Environment.NewLine;
|
|
output += DownloadTotals.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < MiscStats.Length; j++)
|
|
{
|
|
output += MiscStats[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
for (int j = 0; j < 2; j++)
|
|
{
|
|
output += NetStats[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += FailStats.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptAnswerYesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptansweryes_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID TaskID;
|
|
public LLUUID ItemID;
|
|
public int Questions;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TaskID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
Questions = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TaskID == null) { Console.WriteLine("Warning: TaskID is null, in " + this.GetType()); }
|
|
Array.Copy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Questions % 256);
|
|
bytes[i++] = (byte)((Questions >> 8) % 256);
|
|
bytes[i++] = (byte)((Questions >> 16) % 256);
|
|
bytes[i++] = (byte)((Questions >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "TaskID: " + TaskID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "Questions: " + Questions.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("scriptansweryes_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptAnswerYes; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ScriptAnswerYesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 160;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ScriptAnswerYesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ScriptAnswerYesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptAnswerYes ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UserReportPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("userreport_reportdata")]
|
|
public class ReportDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
private byte[] _details;
|
|
public byte[] Details
|
|
{
|
|
get { return _details; }
|
|
set
|
|
{
|
|
if (value == null) { _details = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _details = new byte[value.Length]; Array.Copy(value, _details, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _versionstring;
|
|
public byte[] VersionString
|
|
{
|
|
get { return _versionstring; }
|
|
set
|
|
{
|
|
if (value == null) { _versionstring = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _versionstring = new byte[value.Length]; Array.Copy(value, _versionstring, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID AbuseRegionID;
|
|
public byte CheckFlags;
|
|
public byte Category;
|
|
private byte[] _summary;
|
|
public byte[] Summary
|
|
{
|
|
get { return _summary; }
|
|
set
|
|
{
|
|
if (value == null) { _summary = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _summary = new byte[value.Length]; Array.Copy(value, _summary, value.Length); }
|
|
}
|
|
}
|
|
public byte ReportType;
|
|
public LLUUID AbuserID;
|
|
private byte[] _abuseregionname;
|
|
public byte[] AbuseRegionName
|
|
{
|
|
get { return _abuseregionname; }
|
|
set
|
|
{
|
|
if (value == null) { _abuseregionname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _abuseregionname = new byte[value.Length]; Array.Copy(value, _abuseregionname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ScreenshotID;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 79;
|
|
if (Details != null) { length += 2 + Details.Length; }
|
|
if (VersionString != null) { length += 1 + VersionString.Length; }
|
|
if (Summary != null) { length += 1 + Summary.Length; }
|
|
if (AbuseRegionName != null) { length += 1 + AbuseRegionName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ReportDataBlock() { }
|
|
public ReportDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_details = new byte[length];
|
|
Array.Copy(bytes, i, _details, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_versionstring = new byte[length];
|
|
Array.Copy(bytes, i, _versionstring, 0, length); i += length;
|
|
AbuseRegionID = new LLUUID(bytes, i); i += 16;
|
|
CheckFlags = (byte)bytes[i++];
|
|
Category = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_summary = new byte[length];
|
|
Array.Copy(bytes, i, _summary, 0, length); i += length;
|
|
ReportType = (byte)bytes[i++];
|
|
AbuserID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_abuseregionname = new byte[length];
|
|
Array.Copy(bytes, i, _abuseregionname, 0, length); i += length;
|
|
ScreenshotID = new LLUUID(bytes, i); i += 16;
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Details == null) { Console.WriteLine("Warning: Details is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Details.Length % 256);
|
|
bytes[i++] = (byte)((Details.Length >> 8) % 256);
|
|
Array.Copy(Details, 0, bytes, i, Details.Length); i += Details.Length;
|
|
if(VersionString == null) { Console.WriteLine("Warning: VersionString is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)VersionString.Length;
|
|
Array.Copy(VersionString, 0, bytes, i, VersionString.Length); i += VersionString.Length;
|
|
if(AbuseRegionID == null) { Console.WriteLine("Warning: AbuseRegionID is null, in " + this.GetType()); }
|
|
Array.Copy(AbuseRegionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = CheckFlags;
|
|
bytes[i++] = Category;
|
|
if(Summary == null) { Console.WriteLine("Warning: Summary is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Summary.Length;
|
|
Array.Copy(Summary, 0, bytes, i, Summary.Length); i += Summary.Length;
|
|
bytes[i++] = ReportType;
|
|
if(AbuserID == null) { Console.WriteLine("Warning: AbuserID is null, in " + this.GetType()); }
|
|
Array.Copy(AbuserID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AbuseRegionName == null) { Console.WriteLine("Warning: AbuseRegionName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)AbuseRegionName.Length;
|
|
Array.Copy(AbuseRegionName, 0, bytes, i, AbuseRegionName.Length); i += AbuseRegionName.Length;
|
|
if(ScreenshotID == null) { Console.WriteLine("Warning: ScreenshotID is null, in " + this.GetType()); }
|
|
Array.Copy(ScreenshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReportData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Details, "Details") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(VersionString, "VersionString") + "" + Environment.NewLine;
|
|
output += "AbuseRegionID: " + AbuseRegionID.ToString() + "" + Environment.NewLine;
|
|
output += "CheckFlags: " + CheckFlags.ToString() + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Summary, "Summary") + "" + Environment.NewLine;
|
|
output += "ReportType: " + ReportType.ToString() + "" + Environment.NewLine;
|
|
output += "AbuserID: " + AbuserID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(AbuseRegionName, "AbuseRegionName") + "" + Environment.NewLine;
|
|
output += "ScreenshotID: " + ScreenshotID.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("userreport_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UserReport; } }
|
|
public ReportDataBlock ReportData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UserReportPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 161;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ReportData = new ReportDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UserReportPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ReportData = new ReportDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UserReportPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ReportData = new ReportDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ReportData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ReportData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UserReport ---" + Environment.NewLine;
|
|
output += ReportData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AlertMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("alertmessage_alertdata")]
|
|
public class AlertDataBlock
|
|
{
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Message != null) { length += 1 + Message.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AlertDataBlock() { }
|
|
public AlertDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Message.Length;
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AlertData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AlertMessage; } }
|
|
public AlertDataBlock AlertData;
|
|
|
|
public AlertMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 162;
|
|
Header.Reliable = true;
|
|
AlertData = new AlertDataBlock();
|
|
}
|
|
|
|
public AlertMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AlertData = new AlertDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AlertMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AlertData = new AlertDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AlertData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AlertData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AlertMessage ---" + Environment.NewLine;
|
|
output += AlertData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentAlertMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentalertmessage_alertdata")]
|
|
public class AlertDataBlock
|
|
{
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public bool Modal;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 1;
|
|
if (Message != null) { length += 1 + Message.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AlertDataBlock() { }
|
|
public AlertDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
Modal = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Message.Length;
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
bytes[i++] = (byte)((Modal) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AlertData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "Modal: " + Modal.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentalertmessage_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentAlertMessage; } }
|
|
public AlertDataBlock AlertData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentAlertMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 163;
|
|
Header.Reliable = true;
|
|
AlertData = new AlertDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentAlertMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AlertData = new AlertDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentAlertMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AlertData = new AlertDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AlertData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AlertData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentAlertMessage ---" + Environment.NewLine;
|
|
output += AlertData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MeanCollisionAlertPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("meancollisionalert_meancollision")]
|
|
public class MeanCollisionBlock
|
|
{
|
|
public float Mag;
|
|
public uint Time;
|
|
public LLUUID Perp;
|
|
public byte Type;
|
|
public LLUUID Victim;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 41;
|
|
}
|
|
}
|
|
|
|
public MeanCollisionBlock() { }
|
|
public MeanCollisionBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Mag = BitConverter.ToSingle(bytes, i); i += 4;
|
|
Time = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Perp = new LLUUID(bytes, i); i += 16;
|
|
Type = (byte)bytes[i++];
|
|
Victim = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(Mag);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(Time % 256);
|
|
bytes[i++] = (byte)((Time >> 8) % 256);
|
|
bytes[i++] = (byte)((Time >> 16) % 256);
|
|
bytes[i++] = (byte)((Time >> 24) % 256);
|
|
if(Perp == null) { Console.WriteLine("Warning: Perp is null, in " + this.GetType()); }
|
|
Array.Copy(Perp.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Type;
|
|
if(Victim == null) { Console.WriteLine("Warning: Victim is null, in " + this.GetType()); }
|
|
Array.Copy(Victim.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MeanCollision --" + Environment.NewLine;
|
|
output += "Mag: " + Mag.ToString() + "" + Environment.NewLine;
|
|
output += "Time: " + Time.ToString() + "" + Environment.NewLine;
|
|
output += "Perp: " + Perp.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "Victim: " + Victim.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MeanCollisionAlert; } }
|
|
public MeanCollisionBlock[] MeanCollision;
|
|
|
|
public MeanCollisionAlertPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 164;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MeanCollision = new MeanCollisionBlock[0];
|
|
}
|
|
|
|
public MeanCollisionAlertPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
MeanCollision = new MeanCollisionBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MeanCollision[j] = new MeanCollisionBlock(bytes, ref i); }
|
|
}
|
|
|
|
public MeanCollisionAlertPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
MeanCollision = new MeanCollisionBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MeanCollision[j] = new MeanCollisionBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < MeanCollision.Length; j++) { length += MeanCollision[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)MeanCollision.Length;
|
|
for (int j = 0; j < MeanCollision.Length; j++) { MeanCollision[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MeanCollisionAlert ---" + Environment.NewLine;
|
|
for (int j = 0; j < MeanCollision.Length; j++)
|
|
{
|
|
output += MeanCollision[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ViewerFrozenMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("viewerfrozenmessage_frozendata")]
|
|
public class FrozenDataBlock
|
|
{
|
|
public bool Data;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public FrozenDataBlock() { }
|
|
public FrozenDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Data = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Data) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FrozenData --" + Environment.NewLine;
|
|
output += "Data: " + Data.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ViewerFrozenMessage; } }
|
|
public FrozenDataBlock FrozenData;
|
|
|
|
public ViewerFrozenMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 165;
|
|
Header.Reliable = true;
|
|
FrozenData = new FrozenDataBlock();
|
|
}
|
|
|
|
public ViewerFrozenMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
FrozenData = new FrozenDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ViewerFrozenMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
FrozenData = new FrozenDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += FrozenData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
FrozenData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ViewerFrozenMessage ---" + Environment.NewLine;
|
|
output += FrozenData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class HealthMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("healthmessage_healthdata")]
|
|
public class HealthDataBlock
|
|
{
|
|
public float Health;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public HealthDataBlock() { }
|
|
public HealthDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Health = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(Health);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HealthData --" + Environment.NewLine;
|
|
output += "Health: " + Health.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.HealthMessage; } }
|
|
public HealthDataBlock HealthData;
|
|
|
|
public HealthMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 166;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
HealthData = new HealthDataBlock();
|
|
}
|
|
|
|
public HealthMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
HealthData = new HealthDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public HealthMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
HealthData = new HealthDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += HealthData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
HealthData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- HealthMessage ---" + Environment.NewLine;
|
|
output += HealthData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChatFromSimulatorPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("chatfromsimulator_chatdata")]
|
|
public class ChatDataBlock
|
|
{
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public byte Audible;
|
|
public byte ChatType;
|
|
public LLUUID OwnerID;
|
|
private byte[] _fromname;
|
|
public byte[] FromName
|
|
{
|
|
get { return _fromname; }
|
|
set
|
|
{
|
|
if (value == null) { _fromname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _fromname = new byte[value.Length]; Array.Copy(value, _fromname, value.Length); }
|
|
}
|
|
}
|
|
public byte SourceType;
|
|
public LLUUID SourceID;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 47;
|
|
if (Message != null) { length += 2 + Message.Length; }
|
|
if (FromName != null) { length += 1 + FromName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ChatDataBlock() { }
|
|
public ChatDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
Audible = (byte)bytes[i++];
|
|
ChatType = (byte)bytes[i++];
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_fromname = new byte[length];
|
|
Array.Copy(bytes, i, _fromname, 0, length); i += length;
|
|
SourceType = (byte)bytes[i++];
|
|
SourceID = new LLUUID(bytes, i); i += 16;
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Message.Length % 256);
|
|
bytes[i++] = (byte)((Message.Length >> 8) % 256);
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
bytes[i++] = Audible;
|
|
bytes[i++] = ChatType;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FromName == null) { Console.WriteLine("Warning: FromName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FromName.Length;
|
|
Array.Copy(FromName, 0, bytes, i, FromName.Length); i += FromName.Length;
|
|
bytes[i++] = SourceType;
|
|
if(SourceID == null) { Console.WriteLine("Warning: SourceID is null, in " + this.GetType()); }
|
|
Array.Copy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ChatData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "Audible: " + Audible.ToString() + "" + Environment.NewLine;
|
|
output += "ChatType: " + ChatType.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FromName, "FromName") + "" + Environment.NewLine;
|
|
output += "SourceType: " + SourceType.ToString() + "" + Environment.NewLine;
|
|
output += "SourceID: " + SourceID.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChatFromSimulator; } }
|
|
public ChatDataBlock ChatData;
|
|
|
|
public ChatFromSimulatorPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 167;
|
|
Header.Reliable = true;
|
|
ChatData = new ChatDataBlock();
|
|
}
|
|
|
|
public ChatFromSimulatorPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ChatData = new ChatDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChatFromSimulatorPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ChatData = new ChatDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ChatData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ChatData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChatFromSimulator ---" + Environment.NewLine;
|
|
output += ChatData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SimStatsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("simstats_stat")]
|
|
public class StatBlock
|
|
{
|
|
public float StatValue;
|
|
public uint StatID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public StatBlock() { }
|
|
public StatBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
StatValue = BitConverter.ToSingle(bytes, i); i += 4;
|
|
StatID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(StatValue);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(StatID % 256);
|
|
bytes[i++] = (byte)((StatID >> 8) % 256);
|
|
bytes[i++] = (byte)((StatID >> 16) % 256);
|
|
bytes[i++] = (byte)((StatID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Stat --" + Environment.NewLine;
|
|
output += "StatValue: " + StatValue.ToString() + "" + Environment.NewLine;
|
|
output += "StatID: " + StatID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("simstats_region")]
|
|
public class RegionBlock
|
|
{
|
|
public uint RegionX;
|
|
public uint RegionY;
|
|
public uint RegionFlags;
|
|
public uint ObjectCapacity;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public RegionBlock() { }
|
|
public RegionBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RegionX = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionY = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectCapacity = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RegionX % 256);
|
|
bytes[i++] = (byte)((RegionX >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionX >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionX >> 24) % 256);
|
|
bytes[i++] = (byte)(RegionY % 256);
|
|
bytes[i++] = (byte)((RegionY >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionY >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionY >> 24) % 256);
|
|
bytes[i++] = (byte)(RegionFlags % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(ObjectCapacity % 256);
|
|
bytes[i++] = (byte)((ObjectCapacity >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectCapacity >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectCapacity >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Region --" + Environment.NewLine;
|
|
output += "RegionX: " + RegionX.ToString() + "" + Environment.NewLine;
|
|
output += "RegionY: " + RegionY.ToString() + "" + Environment.NewLine;
|
|
output += "RegionFlags: " + RegionFlags.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectCapacity: " + ObjectCapacity.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SimStats; } }
|
|
public StatBlock[] Stat;
|
|
public RegionBlock Region;
|
|
|
|
public SimStatsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 168;
|
|
Header.Reliable = true;
|
|
Stat = new StatBlock[0];
|
|
Region = new RegionBlock();
|
|
}
|
|
|
|
public SimStatsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Stat = new StatBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Stat[j] = new StatBlock(bytes, ref i); }
|
|
Region = new RegionBlock(bytes, ref i);
|
|
}
|
|
|
|
public SimStatsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Stat = new StatBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Stat[j] = new StatBlock(bytes, ref i); }
|
|
Region = new RegionBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Region.Length;;
|
|
length++;
|
|
for (int j = 0; j < Stat.Length; j++) { length += Stat[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Stat.Length;
|
|
for (int j = 0; j < Stat.Length; j++) { Stat[j].ToBytes(bytes, ref i); }
|
|
Region.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SimStats ---" + Environment.NewLine;
|
|
for (int j = 0; j < Stat.Length; j++)
|
|
{
|
|
output += Stat[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += Region.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestRegionInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestregioninfo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestRegionInfo; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RequestRegionInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 169;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RequestRegionInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestRegionInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestRegionInfo ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RegionInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("regioninfo_regioninfo")]
|
|
public class RegionInfoBlock
|
|
{
|
|
public float BillableFactor;
|
|
public float ObjectBonusFactor;
|
|
public int RedirectGridX;
|
|
public int RedirectGridY;
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public int PricePerMeter;
|
|
public uint RegionFlags;
|
|
public float WaterHeight;
|
|
public bool UseEstateSun;
|
|
public float SunHour;
|
|
public byte MaxAgents;
|
|
public byte SimAccess;
|
|
public float TerrainLowerLimit;
|
|
public uint ParentEstateID;
|
|
public float TerrainRaiseLimit;
|
|
public uint EstateID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 51;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public RegionInfoBlock() { }
|
|
public RegionInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
BillableFactor = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
ObjectBonusFactor = BitConverter.ToSingle(bytes, i); i += 4;
|
|
RedirectGridX = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RedirectGridY = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
PricePerMeter = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
WaterHeight = BitConverter.ToSingle(bytes, i); i += 4;
|
|
UseEstateSun = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
SunHour = BitConverter.ToSingle(bytes, i); i += 4;
|
|
MaxAgents = (byte)bytes[i++];
|
|
SimAccess = (byte)bytes[i++];
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainLowerLimit = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ParentEstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainRaiseLimit = BitConverter.ToSingle(bytes, i); i += 4;
|
|
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(BillableFactor);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(ObjectBonusFactor);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(RedirectGridX % 256);
|
|
bytes[i++] = (byte)((RedirectGridX >> 8) % 256);
|
|
bytes[i++] = (byte)((RedirectGridX >> 16) % 256);
|
|
bytes[i++] = (byte)((RedirectGridX >> 24) % 256);
|
|
bytes[i++] = (byte)(RedirectGridY % 256);
|
|
bytes[i++] = (byte)((RedirectGridY >> 8) % 256);
|
|
bytes[i++] = (byte)((RedirectGridY >> 16) % 256);
|
|
bytes[i++] = (byte)((RedirectGridY >> 24) % 256);
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)(PricePerMeter % 256);
|
|
bytes[i++] = (byte)((PricePerMeter >> 8) % 256);
|
|
bytes[i++] = (byte)((PricePerMeter >> 16) % 256);
|
|
bytes[i++] = (byte)((PricePerMeter >> 24) % 256);
|
|
bytes[i++] = (byte)(RegionFlags % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 24) % 256);
|
|
ba = BitConverter.GetBytes(WaterHeight);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)((UseEstateSun) ? 1 : 0);
|
|
ba = BitConverter.GetBytes(SunHour);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = MaxAgents;
|
|
bytes[i++] = SimAccess;
|
|
ba = BitConverter.GetBytes(TerrainLowerLimit);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(ParentEstateID % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 24) % 256);
|
|
ba = BitConverter.GetBytes(TerrainRaiseLimit);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(EstateID % 256);
|
|
bytes[i++] = (byte)((EstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionInfo --" + Environment.NewLine;
|
|
output += "BillableFactor: " + BillableFactor.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectBonusFactor: " + ObjectBonusFactor.ToString() + "" + Environment.NewLine;
|
|
output += "RedirectGridX: " + RedirectGridX.ToString() + "" + Environment.NewLine;
|
|
output += "RedirectGridY: " + RedirectGridY.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "PricePerMeter: " + PricePerMeter.ToString() + "" + Environment.NewLine;
|
|
output += "RegionFlags: " + RegionFlags.ToString() + "" + Environment.NewLine;
|
|
output += "WaterHeight: " + WaterHeight.ToString() + "" + Environment.NewLine;
|
|
output += "UseEstateSun: " + UseEstateSun.ToString() + "" + Environment.NewLine;
|
|
output += "SunHour: " + SunHour.ToString() + "" + Environment.NewLine;
|
|
output += "MaxAgents: " + MaxAgents.ToString() + "" + Environment.NewLine;
|
|
output += "SimAccess: " + SimAccess.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainLowerLimit: " + TerrainLowerLimit.ToString() + "" + Environment.NewLine;
|
|
output += "ParentEstateID: " + ParentEstateID.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainRaiseLimit: " + TerrainRaiseLimit.ToString() + "" + Environment.NewLine;
|
|
output += "EstateID: " + EstateID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("regioninfo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RegionInfo; } }
|
|
public RegionInfoBlock RegionInfo;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RegionInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 170;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
RegionInfo = new RegionInfoBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RegionInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RegionInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RegionInfo.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RegionInfo.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RegionInfo ---" + Environment.NewLine;
|
|
output += RegionInfo.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GodUpdateRegionInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("godupdateregioninfo_regioninfo")]
|
|
public class RegionInfoBlock
|
|
{
|
|
public float BillableFactor;
|
|
public int RedirectGridX;
|
|
public int RedirectGridY;
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public int PricePerMeter;
|
|
public uint RegionFlags;
|
|
public uint ParentEstateID;
|
|
public uint EstateID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public RegionInfoBlock() { }
|
|
public RegionInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
BillableFactor = BitConverter.ToSingle(bytes, i); i += 4;
|
|
RedirectGridX = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RedirectGridY = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
PricePerMeter = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParentEstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(BillableFactor);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(RedirectGridX % 256);
|
|
bytes[i++] = (byte)((RedirectGridX >> 8) % 256);
|
|
bytes[i++] = (byte)((RedirectGridX >> 16) % 256);
|
|
bytes[i++] = (byte)((RedirectGridX >> 24) % 256);
|
|
bytes[i++] = (byte)(RedirectGridY % 256);
|
|
bytes[i++] = (byte)((RedirectGridY >> 8) % 256);
|
|
bytes[i++] = (byte)((RedirectGridY >> 16) % 256);
|
|
bytes[i++] = (byte)((RedirectGridY >> 24) % 256);
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)(PricePerMeter % 256);
|
|
bytes[i++] = (byte)((PricePerMeter >> 8) % 256);
|
|
bytes[i++] = (byte)((PricePerMeter >> 16) % 256);
|
|
bytes[i++] = (byte)((PricePerMeter >> 24) % 256);
|
|
bytes[i++] = (byte)(RegionFlags % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(ParentEstateID % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 24) % 256);
|
|
bytes[i++] = (byte)(EstateID % 256);
|
|
bytes[i++] = (byte)((EstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionInfo --" + Environment.NewLine;
|
|
output += "BillableFactor: " + BillableFactor.ToString() + "" + Environment.NewLine;
|
|
output += "RedirectGridX: " + RedirectGridX.ToString() + "" + Environment.NewLine;
|
|
output += "RedirectGridY: " + RedirectGridY.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "PricePerMeter: " + PricePerMeter.ToString() + "" + Environment.NewLine;
|
|
output += "RegionFlags: " + RegionFlags.ToString() + "" + Environment.NewLine;
|
|
output += "ParentEstateID: " + ParentEstateID.ToString() + "" + Environment.NewLine;
|
|
output += "EstateID: " + EstateID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("godupdateregioninfo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GodUpdateRegionInfo; } }
|
|
public RegionInfoBlock RegionInfo;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GodUpdateRegionInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 171;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
RegionInfo = new RegionInfoBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GodUpdateRegionInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GodUpdateRegionInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RegionInfo.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RegionInfo.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GodUpdateRegionInfo ---" + Environment.NewLine;
|
|
output += RegionInfo.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class NearestLandingRegionUpdatedPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("nearestlandingregionupdated_regiondata")]
|
|
public class RegionDataBlock
|
|
{
|
|
public ulong RegionHandle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public RegionDataBlock() { }
|
|
public RegionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionData --" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.NearestLandingRegionUpdated; } }
|
|
public RegionDataBlock RegionData;
|
|
|
|
public NearestLandingRegionUpdatedPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 174;
|
|
Header.Reliable = true;
|
|
RegionData = new RegionDataBlock();
|
|
}
|
|
|
|
public NearestLandingRegionUpdatedPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public NearestLandingRegionUpdatedPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RegionData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RegionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- NearestLandingRegionUpdated ---" + Environment.NewLine;
|
|
output += RegionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RegionHandshakePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("regionhandshake_regioninfo")]
|
|
public class RegionInfoBlock
|
|
{
|
|
public float BillableFactor;
|
|
public float TerrainHeightRange00;
|
|
public float TerrainHeightRange01;
|
|
public float TerrainHeightRange10;
|
|
public float TerrainHeightRange11;
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public uint RegionFlags;
|
|
public float TerrainStartHeight00;
|
|
public float TerrainStartHeight01;
|
|
public float TerrainStartHeight10;
|
|
public float TerrainStartHeight11;
|
|
public float WaterHeight;
|
|
public LLUUID SimOwner;
|
|
public byte SimAccess;
|
|
public LLUUID TerrainBase0;
|
|
public LLUUID TerrainBase1;
|
|
public LLUUID TerrainBase2;
|
|
public LLUUID TerrainBase3;
|
|
public LLUUID TerrainDetail0;
|
|
public LLUUID TerrainDetail1;
|
|
public LLUUID TerrainDetail2;
|
|
public LLUUID TerrainDetail3;
|
|
public bool IsEstateManager;
|
|
public LLUUID CacheID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 206;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public RegionInfoBlock() { }
|
|
public RegionInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
BillableFactor = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainHeightRange00 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainHeightRange01 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainHeightRange10 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainHeightRange11 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainStartHeight00 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainStartHeight01 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainStartHeight10 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
TerrainStartHeight11 = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
WaterHeight = BitConverter.ToSingle(bytes, i); i += 4;
|
|
SimOwner = new LLUUID(bytes, i); i += 16;
|
|
SimAccess = (byte)bytes[i++];
|
|
TerrainBase0 = new LLUUID(bytes, i); i += 16;
|
|
TerrainBase1 = new LLUUID(bytes, i); i += 16;
|
|
TerrainBase2 = new LLUUID(bytes, i); i += 16;
|
|
TerrainBase3 = new LLUUID(bytes, i); i += 16;
|
|
TerrainDetail0 = new LLUUID(bytes, i); i += 16;
|
|
TerrainDetail1 = new LLUUID(bytes, i); i += 16;
|
|
TerrainDetail2 = new LLUUID(bytes, i); i += 16;
|
|
TerrainDetail3 = new LLUUID(bytes, i); i += 16;
|
|
IsEstateManager = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CacheID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(BillableFactor);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(TerrainHeightRange00);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(TerrainHeightRange01);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(TerrainHeightRange10);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(TerrainHeightRange11);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)(RegionFlags % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 24) % 256);
|
|
ba = BitConverter.GetBytes(TerrainStartHeight00);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(TerrainStartHeight01);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(TerrainStartHeight10);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(TerrainStartHeight11);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(WaterHeight);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(SimOwner == null) { Console.WriteLine("Warning: SimOwner is null, in " + this.GetType()); }
|
|
Array.Copy(SimOwner.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = SimAccess;
|
|
if(TerrainBase0 == null) { Console.WriteLine("Warning: TerrainBase0 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainBase0.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TerrainBase1 == null) { Console.WriteLine("Warning: TerrainBase1 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainBase1.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TerrainBase2 == null) { Console.WriteLine("Warning: TerrainBase2 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainBase2.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TerrainBase3 == null) { Console.WriteLine("Warning: TerrainBase3 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainBase3.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TerrainDetail0 == null) { Console.WriteLine("Warning: TerrainDetail0 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainDetail0.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TerrainDetail1 == null) { Console.WriteLine("Warning: TerrainDetail1 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainDetail1.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TerrainDetail2 == null) { Console.WriteLine("Warning: TerrainDetail2 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainDetail2.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TerrainDetail3 == null) { Console.WriteLine("Warning: TerrainDetail3 is null, in " + this.GetType()); }
|
|
Array.Copy(TerrainDetail3.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((IsEstateManager) ? 1 : 0);
|
|
if(CacheID == null) { Console.WriteLine("Warning: CacheID is null, in " + this.GetType()); }
|
|
Array.Copy(CacheID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionInfo --" + Environment.NewLine;
|
|
output += "BillableFactor: " + BillableFactor.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainHeightRange00: " + TerrainHeightRange00.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainHeightRange01: " + TerrainHeightRange01.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainHeightRange10: " + TerrainHeightRange10.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainHeightRange11: " + TerrainHeightRange11.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "RegionFlags: " + RegionFlags.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainStartHeight00: " + TerrainStartHeight00.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainStartHeight01: " + TerrainStartHeight01.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainStartHeight10: " + TerrainStartHeight10.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainStartHeight11: " + TerrainStartHeight11.ToString() + "" + Environment.NewLine;
|
|
output += "WaterHeight: " + WaterHeight.ToString() + "" + Environment.NewLine;
|
|
output += "SimOwner: " + SimOwner.ToString() + "" + Environment.NewLine;
|
|
output += "SimAccess: " + SimAccess.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainBase0: " + TerrainBase0.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainBase1: " + TerrainBase1.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainBase2: " + TerrainBase2.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainBase3: " + TerrainBase3.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainDetail0: " + TerrainDetail0.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainDetail1: " + TerrainDetail1.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainDetail2: " + TerrainDetail2.ToString() + "" + Environment.NewLine;
|
|
output += "TerrainDetail3: " + TerrainDetail3.ToString() + "" + Environment.NewLine;
|
|
output += "IsEstateManager: " + IsEstateManager.ToString() + "" + Environment.NewLine;
|
|
output += "CacheID: " + CacheID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RegionHandshake; } }
|
|
public RegionInfoBlock RegionInfo;
|
|
|
|
public RegionHandshakePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 176;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
RegionInfo = new RegionInfoBlock();
|
|
}
|
|
|
|
public RegionHandshakePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public RegionHandshakePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RegionInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RegionInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RegionHandshake ---" + Environment.NewLine;
|
|
output += RegionInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RegionHandshakeReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("regionhandshakereply_regioninfo")]
|
|
public class RegionInfoBlock
|
|
{
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public RegionInfoBlock() { }
|
|
public RegionInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionInfo --" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("regionhandshakereply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RegionHandshakeReply; } }
|
|
public RegionInfoBlock RegionInfo;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RegionHandshakeReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 177;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
RegionInfo = new RegionInfoBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RegionHandshakeReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RegionHandshakeReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RegionInfo = new RegionInfoBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RegionInfo.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RegionInfo.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RegionHandshakeReply ---" + Environment.NewLine;
|
|
output += RegionInfo.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SimulatorViewerTimeMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("simulatorviewertimemessage_timeinfo")]
|
|
public class TimeInfoBlock
|
|
{
|
|
public uint SecPerDay;
|
|
public ulong UsecSinceStart;
|
|
public uint SecPerYear;
|
|
public LLVector3 SunAngVelocity;
|
|
public float SunPhase;
|
|
public LLVector3 SunDirection;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 44;
|
|
}
|
|
}
|
|
|
|
public TimeInfoBlock() { }
|
|
public TimeInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SecPerDay = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
UsecSinceStart = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
SecPerYear = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SunAngVelocity = new LLVector3(bytes, i); i += 12;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
SunPhase = BitConverter.ToSingle(bytes, i); i += 4;
|
|
SunDirection = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(SecPerDay % 256);
|
|
bytes[i++] = (byte)((SecPerDay >> 8) % 256);
|
|
bytes[i++] = (byte)((SecPerDay >> 16) % 256);
|
|
bytes[i++] = (byte)((SecPerDay >> 24) % 256);
|
|
bytes[i++] = (byte)(UsecSinceStart % 256);
|
|
bytes[i++] = (byte)((UsecSinceStart >> 8) % 256);
|
|
bytes[i++] = (byte)((UsecSinceStart >> 16) % 256);
|
|
bytes[i++] = (byte)((UsecSinceStart >> 24) % 256);
|
|
bytes[i++] = (byte)((UsecSinceStart >> 32) % 256);
|
|
bytes[i++] = (byte)((UsecSinceStart >> 40) % 256);
|
|
bytes[i++] = (byte)((UsecSinceStart >> 48) % 256);
|
|
bytes[i++] = (byte)((UsecSinceStart >> 56) % 256);
|
|
bytes[i++] = (byte)(SecPerYear % 256);
|
|
bytes[i++] = (byte)((SecPerYear >> 8) % 256);
|
|
bytes[i++] = (byte)((SecPerYear >> 16) % 256);
|
|
bytes[i++] = (byte)((SecPerYear >> 24) % 256);
|
|
Array.Copy(SunAngVelocity.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
ba = BitConverter.GetBytes(SunPhase);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
Array.Copy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TimeInfo --" + Environment.NewLine;
|
|
output += "SecPerDay: " + SecPerDay.ToString() + "" + Environment.NewLine;
|
|
output += "UsecSinceStart: " + UsecSinceStart.ToString() + "" + Environment.NewLine;
|
|
output += "SecPerYear: " + SecPerYear.ToString() + "" + Environment.NewLine;
|
|
output += "SunAngVelocity: " + SunAngVelocity.ToString() + "" + Environment.NewLine;
|
|
output += "SunPhase: " + SunPhase.ToString() + "" + Environment.NewLine;
|
|
output += "SunDirection: " + SunDirection.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SimulatorViewerTimeMessage; } }
|
|
public TimeInfoBlock TimeInfo;
|
|
|
|
public SimulatorViewerTimeMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 178;
|
|
Header.Reliable = true;
|
|
TimeInfo = new TimeInfoBlock();
|
|
}
|
|
|
|
public SimulatorViewerTimeMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TimeInfo = new TimeInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public SimulatorViewerTimeMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TimeInfo = new TimeInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TimeInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TimeInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SimulatorViewerTimeMessage ---" + Environment.NewLine;
|
|
output += TimeInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EnableSimulatorPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("enablesimulator_simulatorinfo")]
|
|
public class SimulatorInfoBlock
|
|
{
|
|
public uint IP;
|
|
public ushort Port;
|
|
public ulong Handle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 14;
|
|
}
|
|
}
|
|
|
|
public SimulatorInfoBlock() { }
|
|
public SimulatorInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
|
|
Handle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(IP % 256);
|
|
bytes[i++] = (byte)((IP >> 8) % 256);
|
|
bytes[i++] = (byte)((IP >> 16) % 256);
|
|
bytes[i++] = (byte)((IP >> 24) % 256);
|
|
bytes[i++] = (byte)((Port >> 8) % 256);
|
|
bytes[i++] = (byte)(Port % 256);
|
|
bytes[i++] = (byte)(Handle % 256);
|
|
bytes[i++] = (byte)((Handle >> 8) % 256);
|
|
bytes[i++] = (byte)((Handle >> 16) % 256);
|
|
bytes[i++] = (byte)((Handle >> 24) % 256);
|
|
bytes[i++] = (byte)((Handle >> 32) % 256);
|
|
bytes[i++] = (byte)((Handle >> 40) % 256);
|
|
bytes[i++] = (byte)((Handle >> 48) % 256);
|
|
bytes[i++] = (byte)((Handle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- SimulatorInfo --" + Environment.NewLine;
|
|
output += "IP: " + IP.ToString() + "" + Environment.NewLine;
|
|
output += "Port: " + Port.ToString() + "" + Environment.NewLine;
|
|
output += "Handle: " + Handle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EnableSimulator; } }
|
|
public SimulatorInfoBlock SimulatorInfo;
|
|
|
|
public EnableSimulatorPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 179;
|
|
Header.Reliable = true;
|
|
SimulatorInfo = new SimulatorInfoBlock();
|
|
}
|
|
|
|
public EnableSimulatorPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
SimulatorInfo = new SimulatorInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public EnableSimulatorPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
SimulatorInfo = new SimulatorInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += SimulatorInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
SimulatorInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EnableSimulator ---" + Environment.NewLine;
|
|
output += SimulatorInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DisableSimulatorPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DisableSimulator; } }
|
|
|
|
public DisableSimulatorPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 180;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public DisableSimulatorPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public DisableSimulatorPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DisableSimulator ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TransferRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("transferrequest_transferinfo")]
|
|
public class TransferInfoBlock
|
|
{
|
|
public LLUUID TransferID;
|
|
private byte[] _params;
|
|
public byte[] Params
|
|
{
|
|
get { return _params; }
|
|
set
|
|
{
|
|
if (value == null) { _params = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _params = new byte[value.Length]; Array.Copy(value, _params, value.Length); }
|
|
}
|
|
}
|
|
public int ChannelType;
|
|
public int SourceType;
|
|
public float Priority;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (Params != null) { length += 2 + Params.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public TransferInfoBlock() { }
|
|
public TransferInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
TransferID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_params = new byte[length];
|
|
Array.Copy(bytes, i, _params, 0, length); i += length;
|
|
ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SourceType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Priority = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(TransferID == null) { Console.WriteLine("Warning: TransferID is null, in " + this.GetType()); }
|
|
Array.Copy(TransferID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Params == null) { Console.WriteLine("Warning: Params is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Params.Length % 256);
|
|
bytes[i++] = (byte)((Params.Length >> 8) % 256);
|
|
Array.Copy(Params, 0, bytes, i, Params.Length); i += Params.Length;
|
|
bytes[i++] = (byte)(ChannelType % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 8) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 16) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 24) % 256);
|
|
bytes[i++] = (byte)(SourceType % 256);
|
|
bytes[i++] = (byte)((SourceType >> 8) % 256);
|
|
bytes[i++] = (byte)((SourceType >> 16) % 256);
|
|
bytes[i++] = (byte)((SourceType >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Priority);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransferInfo --" + Environment.NewLine;
|
|
output += "TransferID: " + TransferID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Params, "Params") + "" + Environment.NewLine;
|
|
output += "ChannelType: " + ChannelType.ToString() + "" + Environment.NewLine;
|
|
output += "SourceType: " + SourceType.ToString() + "" + Environment.NewLine;
|
|
output += "Priority: " + Priority.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TransferRequest; } }
|
|
public TransferInfoBlock TransferInfo;
|
|
|
|
public TransferRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 181;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TransferInfo = new TransferInfoBlock();
|
|
}
|
|
|
|
public TransferRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TransferRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransferInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransferInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TransferRequest ---" + Environment.NewLine;
|
|
output += TransferInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TransferInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("transferinfo_transferinfo")]
|
|
public class TransferInfoBlock
|
|
{
|
|
public LLUUID TransferID;
|
|
public int Size;
|
|
private byte[] _params;
|
|
public byte[] Params
|
|
{
|
|
get { return _params; }
|
|
set
|
|
{
|
|
if (value == null) { _params = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _params = new byte[value.Length]; Array.Copy(value, _params, value.Length); }
|
|
}
|
|
}
|
|
public int ChannelType;
|
|
public int TargetType;
|
|
public int Status;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 32;
|
|
if (Params != null) { length += 2 + Params.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public TransferInfoBlock() { }
|
|
public TransferInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
TransferID = new LLUUID(bytes, i); i += 16;
|
|
Size = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_params = new byte[length];
|
|
Array.Copy(bytes, i, _params, 0, length); i += length;
|
|
ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TargetType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Status = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransferID == null) { Console.WriteLine("Warning: TransferID is null, in " + this.GetType()); }
|
|
Array.Copy(TransferID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Size % 256);
|
|
bytes[i++] = (byte)((Size >> 8) % 256);
|
|
bytes[i++] = (byte)((Size >> 16) % 256);
|
|
bytes[i++] = (byte)((Size >> 24) % 256);
|
|
if(Params == null) { Console.WriteLine("Warning: Params is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Params.Length % 256);
|
|
bytes[i++] = (byte)((Params.Length >> 8) % 256);
|
|
Array.Copy(Params, 0, bytes, i, Params.Length); i += Params.Length;
|
|
bytes[i++] = (byte)(ChannelType % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 8) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 16) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 24) % 256);
|
|
bytes[i++] = (byte)(TargetType % 256);
|
|
bytes[i++] = (byte)((TargetType >> 8) % 256);
|
|
bytes[i++] = (byte)((TargetType >> 16) % 256);
|
|
bytes[i++] = (byte)((TargetType >> 24) % 256);
|
|
bytes[i++] = (byte)(Status % 256);
|
|
bytes[i++] = (byte)((Status >> 8) % 256);
|
|
bytes[i++] = (byte)((Status >> 16) % 256);
|
|
bytes[i++] = (byte)((Status >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransferInfo --" + Environment.NewLine;
|
|
output += "TransferID: " + TransferID.ToString() + "" + Environment.NewLine;
|
|
output += "Size: " + Size.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Params, "Params") + "" + Environment.NewLine;
|
|
output += "ChannelType: " + ChannelType.ToString() + "" + Environment.NewLine;
|
|
output += "TargetType: " + TargetType.ToString() + "" + Environment.NewLine;
|
|
output += "Status: " + Status.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TransferInfo; } }
|
|
public TransferInfoBlock TransferInfo;
|
|
|
|
public TransferInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 182;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TransferInfo = new TransferInfoBlock();
|
|
}
|
|
|
|
public TransferInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TransferInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransferInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransferInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TransferInfo ---" + Environment.NewLine;
|
|
output += TransferInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TransferAbortPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("transferabort_transferinfo")]
|
|
public class TransferInfoBlock
|
|
{
|
|
public LLUUID TransferID;
|
|
public int ChannelType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public TransferInfoBlock() { }
|
|
public TransferInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransferID = new LLUUID(bytes, i); i += 16;
|
|
ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransferID == null) { Console.WriteLine("Warning: TransferID is null, in " + this.GetType()); }
|
|
Array.Copy(TransferID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(ChannelType % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 8) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 16) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransferInfo --" + Environment.NewLine;
|
|
output += "TransferID: " + TransferID.ToString() + "" + Environment.NewLine;
|
|
output += "ChannelType: " + ChannelType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TransferAbort; } }
|
|
public TransferInfoBlock TransferInfo;
|
|
|
|
public TransferAbortPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 183;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TransferInfo = new TransferInfoBlock();
|
|
}
|
|
|
|
public TransferAbortPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TransferAbortPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransferInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransferInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TransferAbort ---" + Environment.NewLine;
|
|
output += TransferInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TransferPriorityPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("transferpriority_transferinfo")]
|
|
public class TransferInfoBlock
|
|
{
|
|
public LLUUID TransferID;
|
|
public int ChannelType;
|
|
public float Priority;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public TransferInfoBlock() { }
|
|
public TransferInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransferID = new LLUUID(bytes, i); i += 16;
|
|
ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Priority = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(TransferID == null) { Console.WriteLine("Warning: TransferID is null, in " + this.GetType()); }
|
|
Array.Copy(TransferID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(ChannelType % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 8) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 16) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Priority);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransferInfo --" + Environment.NewLine;
|
|
output += "TransferID: " + TransferID.ToString() + "" + Environment.NewLine;
|
|
output += "ChannelType: " + ChannelType.ToString() + "" + Environment.NewLine;
|
|
output += "Priority: " + Priority.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TransferPriority; } }
|
|
public TransferInfoBlock TransferInfo;
|
|
|
|
public TransferPriorityPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 184;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TransferInfo = new TransferInfoBlock();
|
|
}
|
|
|
|
public TransferPriorityPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public TransferPriorityPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransferInfo = new TransferInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransferInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransferInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TransferPriority ---" + Environment.NewLine;
|
|
output += TransferInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestXferPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestxfer_xferid")]
|
|
public class XferIDBlock
|
|
{
|
|
public ulong ID;
|
|
public bool UseBigPackets;
|
|
public bool DeleteOnCompletion;
|
|
public byte FilePath;
|
|
private byte[] _filename;
|
|
public byte[] Filename
|
|
{
|
|
get { return _filename; }
|
|
set
|
|
{
|
|
if (value == null) { _filename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _filename = new byte[value.Length]; Array.Copy(value, _filename, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID VFileID;
|
|
public short VFileType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 29;
|
|
if (Filename != null) { length += 1 + Filename.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public XferIDBlock() { }
|
|
public XferIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ID = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
UseBigPackets = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
DeleteOnCompletion = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
FilePath = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_filename = new byte[length];
|
|
Array.Copy(bytes, i, _filename, 0, length); i += length;
|
|
VFileID = new LLUUID(bytes, i); i += 16;
|
|
VFileType = (short)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
bytes[i++] = (byte)((ID >> 32) % 256);
|
|
bytes[i++] = (byte)((ID >> 40) % 256);
|
|
bytes[i++] = (byte)((ID >> 48) % 256);
|
|
bytes[i++] = (byte)((ID >> 56) % 256);
|
|
bytes[i++] = (byte)((UseBigPackets) ? 1 : 0);
|
|
bytes[i++] = (byte)((DeleteOnCompletion) ? 1 : 0);
|
|
bytes[i++] = FilePath;
|
|
if(Filename == null) { Console.WriteLine("Warning: Filename is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Filename.Length;
|
|
Array.Copy(Filename, 0, bytes, i, Filename.Length); i += Filename.Length;
|
|
if(VFileID == null) { Console.WriteLine("Warning: VFileID is null, in " + this.GetType()); }
|
|
Array.Copy(VFileID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(VFileType % 256);
|
|
bytes[i++] = (byte)((VFileType >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- XferID --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "UseBigPackets: " + UseBigPackets.ToString() + "" + Environment.NewLine;
|
|
output += "DeleteOnCompletion: " + DeleteOnCompletion.ToString() + "" + Environment.NewLine;
|
|
output += "FilePath: " + FilePath.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Filename, "Filename") + "" + Environment.NewLine;
|
|
output += "VFileID: " + VFileID.ToString() + "" + Environment.NewLine;
|
|
output += "VFileType: " + VFileType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestXfer; } }
|
|
public XferIDBlock XferID;
|
|
|
|
public RequestXferPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 185;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
XferID = new XferIDBlock();
|
|
}
|
|
|
|
public RequestXferPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestXferPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += XferID.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
XferID.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestXfer ---" + Environment.NewLine;
|
|
output += XferID.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AbortXferPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("abortxfer_xferid")]
|
|
public class XferIDBlock
|
|
{
|
|
public ulong ID;
|
|
public int Result;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public XferIDBlock() { }
|
|
public XferIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
Result = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
bytes[i++] = (byte)((ID >> 32) % 256);
|
|
bytes[i++] = (byte)((ID >> 40) % 256);
|
|
bytes[i++] = (byte)((ID >> 48) % 256);
|
|
bytes[i++] = (byte)((ID >> 56) % 256);
|
|
bytes[i++] = (byte)(Result % 256);
|
|
bytes[i++] = (byte)((Result >> 8) % 256);
|
|
bytes[i++] = (byte)((Result >> 16) % 256);
|
|
bytes[i++] = (byte)((Result >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- XferID --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Result: " + Result.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AbortXfer; } }
|
|
public XferIDBlock XferID;
|
|
|
|
public AbortXferPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 186;
|
|
Header.Reliable = true;
|
|
XferID = new XferIDBlock();
|
|
}
|
|
|
|
public AbortXferPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public AbortXferPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += XferID.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
XferID.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AbortXfer ---" + Environment.NewLine;
|
|
output += XferID.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestAvatarInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestavatarinfo_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID FullID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
FullID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(FullID == null) { Console.WriteLine("Warning: FullID is null, in " + this.GetType()); }
|
|
Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "FullID: " + FullID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestAvatarInfo; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public RequestAvatarInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 187;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public RequestAvatarInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestAvatarInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestAvatarInfo ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarAppearancePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarappearance_visualparam")]
|
|
public class VisualParamBlock
|
|
{
|
|
public byte ParamValue;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public VisualParamBlock() { }
|
|
public VisualParamBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ParamValue = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ParamValue;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- VisualParam --" + Environment.NewLine;
|
|
output += "ParamValue: " + ParamValue.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarappearance_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
private byte[] _textureentry;
|
|
public byte[] TextureEntry
|
|
{
|
|
get { return _textureentry; }
|
|
set
|
|
{
|
|
if (value == null) { _textureentry = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _textureentry = new byte[value.Length]; Array.Copy(value, _textureentry, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (TextureEntry != null) { length += 2 + TextureEntry.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_textureentry = new byte[length];
|
|
Array.Copy(bytes, i, _textureentry, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TextureEntry == null) { Console.WriteLine("Warning: TextureEntry is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(TextureEntry.Length % 256);
|
|
bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
|
|
Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarappearance_sender")]
|
|
public class SenderBlock
|
|
{
|
|
public LLUUID ID;
|
|
public bool IsTrial;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public SenderBlock() { }
|
|
public SenderBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
IsTrial = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((IsTrial) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Sender --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "IsTrial: " + IsTrial.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarAppearance; } }
|
|
public VisualParamBlock[] VisualParam;
|
|
public ObjectDataBlock ObjectData;
|
|
public SenderBlock Sender;
|
|
|
|
public AvatarAppearancePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 188;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
VisualParam = new VisualParamBlock[0];
|
|
ObjectData = new ObjectDataBlock();
|
|
Sender = new SenderBlock();
|
|
}
|
|
|
|
public AvatarAppearancePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
VisualParam = new VisualParamBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VisualParam[j] = new VisualParamBlock(bytes, ref i); }
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
Sender = new SenderBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarAppearancePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
VisualParam = new VisualParamBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VisualParam[j] = new VisualParamBlock(bytes, ref i); }
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
Sender = new SenderBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += Sender.Length;;
|
|
length++;
|
|
for (int j = 0; j < VisualParam.Length; j++) { length += VisualParam[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)VisualParam.Length;
|
|
for (int j = 0; j < VisualParam.Length; j++) { VisualParam[j].ToBytes(bytes, ref i); }
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
Sender.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarAppearance ---" + Environment.NewLine;
|
|
for (int j = 0; j < VisualParam.Length; j++)
|
|
{
|
|
output += VisualParam[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += Sender.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SetFollowCamPropertiesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("setfollowcamproperties_cameraproperty")]
|
|
public class CameraPropertyBlock
|
|
{
|
|
public int Type;
|
|
public float Value;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public CameraPropertyBlock() { }
|
|
public CameraPropertyBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Value = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(Type % 256);
|
|
bytes[i++] = (byte)((Type >> 8) % 256);
|
|
bytes[i++] = (byte)((Type >> 16) % 256);
|
|
bytes[i++] = (byte)((Type >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Value);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- CameraProperty --" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "Value: " + Value.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("setfollowcamproperties_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SetFollowCamProperties; } }
|
|
public CameraPropertyBlock[] CameraProperty;
|
|
public ObjectDataBlock ObjectData;
|
|
|
|
public SetFollowCamPropertiesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 189;
|
|
Header.Reliable = true;
|
|
CameraProperty = new CameraPropertyBlock[0];
|
|
ObjectData = new ObjectDataBlock();
|
|
}
|
|
|
|
public SetFollowCamPropertiesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
CameraProperty = new CameraPropertyBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ CameraProperty[j] = new CameraPropertyBlock(bytes, ref i); }
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SetFollowCamPropertiesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
CameraProperty = new CameraPropertyBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ CameraProperty[j] = new CameraPropertyBlock(bytes, ref i); }
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length;;
|
|
length++;
|
|
for (int j = 0; j < CameraProperty.Length; j++) { length += CameraProperty[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)CameraProperty.Length;
|
|
for (int j = 0; j < CameraProperty.Length; j++) { CameraProperty[j].ToBytes(bytes, ref i); }
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SetFollowCamProperties ---" + Environment.NewLine;
|
|
for (int j = 0; j < CameraProperty.Length; j++)
|
|
{
|
|
output += CameraProperty[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ClearFollowCamPropertiesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("clearfollowcamproperties_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ClearFollowCamProperties; } }
|
|
public ObjectDataBlock ObjectData;
|
|
|
|
public ClearFollowCamPropertiesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 190;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
}
|
|
|
|
public ClearFollowCamPropertiesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ClearFollowCamPropertiesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ClearFollowCamProperties ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestPayPricePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestpayprice_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestPayPrice; } }
|
|
public ObjectDataBlock ObjectData;
|
|
|
|
public RequestPayPricePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 191;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
}
|
|
|
|
public RequestPayPricePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestPayPricePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestPayPrice ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PayPriceReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("paypricereply_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public int DefaultPayPrice;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
DefaultPayPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(DefaultPayPrice % 256);
|
|
bytes[i++] = (byte)((DefaultPayPrice >> 8) % 256);
|
|
bytes[i++] = (byte)((DefaultPayPrice >> 16) % 256);
|
|
bytes[i++] = (byte)((DefaultPayPrice >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "DefaultPayPrice: " + DefaultPayPrice.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("paypricereply_buttondata")]
|
|
public class ButtonDataBlock
|
|
{
|
|
public int PayButton;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ButtonDataBlock() { }
|
|
public ButtonDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PayButton = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(PayButton % 256);
|
|
bytes[i++] = (byte)((PayButton >> 8) % 256);
|
|
bytes[i++] = (byte)((PayButton >> 16) % 256);
|
|
bytes[i++] = (byte)((PayButton >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ButtonData --" + Environment.NewLine;
|
|
output += "PayButton: " + PayButton.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PayPriceReply; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public ButtonDataBlock[] ButtonData;
|
|
|
|
public PayPriceReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 192;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
ButtonData = new ButtonDataBlock[0];
|
|
}
|
|
|
|
public PayPriceReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ButtonData = new ButtonDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ButtonData[j] = new ButtonDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public PayPriceReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ButtonData = new ButtonDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ButtonData[j] = new ButtonDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ButtonData.Length; j++) { length += ButtonData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ButtonData.Length;
|
|
for (int j = 0; j < ButtonData.Length; j++) { ButtonData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PayPriceReply ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ButtonData.Length; j++)
|
|
{
|
|
output += ButtonData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class KickUserPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("kickuser_targetblock")]
|
|
public class TargetBlockBlock
|
|
{
|
|
public uint TargetIP;
|
|
public ushort TargetPort;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 6;
|
|
}
|
|
}
|
|
|
|
public TargetBlockBlock() { }
|
|
public TargetBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TargetIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TargetPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TargetIP % 256);
|
|
bytes[i++] = (byte)((TargetIP >> 8) % 256);
|
|
bytes[i++] = (byte)((TargetIP >> 16) % 256);
|
|
bytes[i++] = (byte)((TargetIP >> 24) % 256);
|
|
bytes[i++] = (byte)((TargetPort >> 8) % 256);
|
|
bytes[i++] = (byte)(TargetPort % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TargetBlock --" + Environment.NewLine;
|
|
output += "TargetIP: " + TargetIP.ToString() + "" + Environment.NewLine;
|
|
output += "TargetPort: " + TargetPort.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("kickuser_userinfo")]
|
|
public class UserInfoBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
private byte[] _reason;
|
|
public byte[] Reason
|
|
{
|
|
get { return _reason; }
|
|
set
|
|
{
|
|
if (value == null) { _reason = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _reason = new byte[value.Length]; Array.Copy(value, _reason, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 32;
|
|
if (Reason != null) { length += 2 + Reason.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public UserInfoBlock() { }
|
|
public UserInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_reason = new byte[length];
|
|
Array.Copy(bytes, i, _reason, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Reason == null) { Console.WriteLine("Warning: Reason is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Reason.Length % 256);
|
|
bytes[i++] = (byte)((Reason.Length >> 8) % 256);
|
|
Array.Copy(Reason, 0, bytes, i, Reason.Length); i += Reason.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UserInfo --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Reason, "Reason") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.KickUser; } }
|
|
public TargetBlockBlock TargetBlock;
|
|
public UserInfoBlock UserInfo;
|
|
|
|
public KickUserPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 193;
|
|
Header.Reliable = true;
|
|
TargetBlock = new TargetBlockBlock();
|
|
UserInfo = new UserInfoBlock();
|
|
}
|
|
|
|
public KickUserPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TargetBlock = new TargetBlockBlock(bytes, ref i);
|
|
UserInfo = new UserInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public KickUserPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TargetBlock = new TargetBlockBlock(bytes, ref i);
|
|
UserInfo = new UserInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TargetBlock.Length; length += UserInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TargetBlock.ToBytes(bytes, ref i);
|
|
UserInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- KickUser ---" + Environment.NewLine;
|
|
output += TargetBlock.ToString() + "" + Environment.NewLine;
|
|
output += UserInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class KickUserAckPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("kickuserack_userinfo")]
|
|
public class UserInfoBlock
|
|
{
|
|
public LLUUID SessionID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public UserInfoBlock() { }
|
|
public UserInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UserInfo --" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.KickUserAck; } }
|
|
public UserInfoBlock UserInfo;
|
|
|
|
public KickUserAckPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 194;
|
|
Header.Reliable = true;
|
|
UserInfo = new UserInfoBlock();
|
|
}
|
|
|
|
public KickUserAckPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
UserInfo = new UserInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public KickUserAckPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
UserInfo = new UserInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += UserInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
UserInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- KickUserAck ---" + Environment.NewLine;
|
|
output += UserInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GodKickUserPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("godkickuser_userinfo")]
|
|
public class UserInfoBlock
|
|
{
|
|
public LLUUID GodSessionID;
|
|
public LLUUID AgentID;
|
|
private byte[] _reason;
|
|
public byte[] Reason
|
|
{
|
|
get { return _reason; }
|
|
set
|
|
{
|
|
if (value == null) { _reason = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _reason = new byte[value.Length]; Array.Copy(value, _reason, value.Length); }
|
|
}
|
|
}
|
|
public uint KickFlags;
|
|
public LLUUID GodID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 52;
|
|
if (Reason != null) { length += 2 + Reason.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public UserInfoBlock() { }
|
|
public UserInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GodSessionID = new LLUUID(bytes, i); i += 16;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_reason = new byte[length];
|
|
Array.Copy(bytes, i, _reason, 0, length); i += length;
|
|
KickFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GodID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GodSessionID == null) { Console.WriteLine("Warning: GodSessionID is null, in " + this.GetType()); }
|
|
Array.Copy(GodSessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Reason == null) { Console.WriteLine("Warning: Reason is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Reason.Length % 256);
|
|
bytes[i++] = (byte)((Reason.Length >> 8) % 256);
|
|
Array.Copy(Reason, 0, bytes, i, Reason.Length); i += Reason.Length;
|
|
bytes[i++] = (byte)(KickFlags % 256);
|
|
bytes[i++] = (byte)((KickFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((KickFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((KickFlags >> 24) % 256);
|
|
if(GodID == null) { Console.WriteLine("Warning: GodID is null, in " + this.GetType()); }
|
|
Array.Copy(GodID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UserInfo --" + Environment.NewLine;
|
|
output += "GodSessionID: " + GodSessionID.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Reason, "Reason") + "" + Environment.NewLine;
|
|
output += "KickFlags: " + KickFlags.ToString() + "" + Environment.NewLine;
|
|
output += "GodID: " + GodID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GodKickUser; } }
|
|
public UserInfoBlock UserInfo;
|
|
|
|
public GodKickUserPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 195;
|
|
Header.Reliable = true;
|
|
UserInfo = new UserInfoBlock();
|
|
}
|
|
|
|
public GodKickUserPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
UserInfo = new UserInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public GodKickUserPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
UserInfo = new UserInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += UserInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
UserInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GodKickUser ---" + Environment.NewLine;
|
|
output += UserInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EjectUserPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("ejectuser_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID TargetID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("ejectuser_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EjectUser; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EjectUserPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 197;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EjectUserPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EjectUserPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EjectUser ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class FreezeUserPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("freezeuser_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID TargetID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("freezeuser_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.FreezeUser; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public FreezeUserPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 198;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public FreezeUserPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public FreezeUserPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- FreezeUser ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarPropertiesRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarpropertiesrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID AvatarID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
AvatarID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AvatarID == null) { Console.WriteLine("Warning: AvatarID is null, in " + this.GetType()); }
|
|
Array.Copy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "AvatarID: " + AvatarID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarPropertiesRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarPropertiesRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 199;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarPropertiesRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarPropertiesRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarPropertiesRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarPropertiesReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarpropertiesreply_propertiesdata")]
|
|
public class PropertiesDataBlock
|
|
{
|
|
public LLUUID PartnerID;
|
|
private byte[] _abouttext;
|
|
public byte[] AboutText
|
|
{
|
|
get { return _abouttext; }
|
|
set
|
|
{
|
|
if (value == null) { _abouttext = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _abouttext = new byte[value.Length]; Array.Copy(value, _abouttext, value.Length); }
|
|
}
|
|
}
|
|
public bool Transacted;
|
|
private byte[] _chartermember;
|
|
public byte[] CharterMember
|
|
{
|
|
get { return _chartermember; }
|
|
set
|
|
{
|
|
if (value == null) { _chartermember = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _chartermember = new byte[value.Length]; Array.Copy(value, _chartermember, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _flabouttext;
|
|
public byte[] FLAboutText
|
|
{
|
|
get { return _flabouttext; }
|
|
set
|
|
{
|
|
if (value == null) { _flabouttext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _flabouttext = new byte[value.Length]; Array.Copy(value, _flabouttext, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ImageID;
|
|
public LLUUID FLImageID;
|
|
public bool AllowPublish;
|
|
private byte[] _profileurl;
|
|
public byte[] ProfileURL
|
|
{
|
|
get { return _profileurl; }
|
|
set
|
|
{
|
|
if (value == null) { _profileurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _profileurl = new byte[value.Length]; Array.Copy(value, _profileurl, value.Length); }
|
|
}
|
|
}
|
|
public bool Identified;
|
|
private byte[] _bornon;
|
|
public byte[] BornOn
|
|
{
|
|
get { return _bornon; }
|
|
set
|
|
{
|
|
if (value == null) { _bornon = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _bornon = new byte[value.Length]; Array.Copy(value, _bornon, value.Length); }
|
|
}
|
|
}
|
|
public bool MaturePublish;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 52;
|
|
if (AboutText != null) { length += 2 + AboutText.Length; }
|
|
if (CharterMember != null) { length += 1 + CharterMember.Length; }
|
|
if (FLAboutText != null) { length += 1 + FLAboutText.Length; }
|
|
if (ProfileURL != null) { length += 1 + ProfileURL.Length; }
|
|
if (BornOn != null) { length += 1 + BornOn.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public PropertiesDataBlock() { }
|
|
public PropertiesDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
PartnerID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_abouttext = new byte[length];
|
|
Array.Copy(bytes, i, _abouttext, 0, length); i += length;
|
|
Transacted = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_chartermember = new byte[length];
|
|
Array.Copy(bytes, i, _chartermember, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_flabouttext = new byte[length];
|
|
Array.Copy(bytes, i, _flabouttext, 0, length); i += length;
|
|
ImageID = new LLUUID(bytes, i); i += 16;
|
|
FLImageID = new LLUUID(bytes, i); i += 16;
|
|
AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_profileurl = new byte[length];
|
|
Array.Copy(bytes, i, _profileurl, 0, length); i += length;
|
|
Identified = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_bornon = new byte[length];
|
|
Array.Copy(bytes, i, _bornon, 0, length); i += length;
|
|
MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(PartnerID == null) { Console.WriteLine("Warning: PartnerID is null, in " + this.GetType()); }
|
|
Array.Copy(PartnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AboutText == null) { Console.WriteLine("Warning: AboutText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(AboutText.Length % 256);
|
|
bytes[i++] = (byte)((AboutText.Length >> 8) % 256);
|
|
Array.Copy(AboutText, 0, bytes, i, AboutText.Length); i += AboutText.Length;
|
|
bytes[i++] = (byte)((Transacted) ? 1 : 0);
|
|
if(CharterMember == null) { Console.WriteLine("Warning: CharterMember is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)CharterMember.Length;
|
|
Array.Copy(CharterMember, 0, bytes, i, CharterMember.Length); i += CharterMember.Length;
|
|
if(FLAboutText == null) { Console.WriteLine("Warning: FLAboutText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FLAboutText.Length;
|
|
Array.Copy(FLAboutText, 0, bytes, i, FLAboutText.Length); i += FLAboutText.Length;
|
|
if(ImageID == null) { Console.WriteLine("Warning: ImageID is null, in " + this.GetType()); }
|
|
Array.Copy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FLImageID == null) { Console.WriteLine("Warning: FLImageID is null, in " + this.GetType()); }
|
|
Array.Copy(FLImageID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AllowPublish) ? 1 : 0);
|
|
if(ProfileURL == null) { Console.WriteLine("Warning: ProfileURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ProfileURL.Length;
|
|
Array.Copy(ProfileURL, 0, bytes, i, ProfileURL.Length); i += ProfileURL.Length;
|
|
bytes[i++] = (byte)((Identified) ? 1 : 0);
|
|
if(BornOn == null) { Console.WriteLine("Warning: BornOn is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)BornOn.Length;
|
|
Array.Copy(BornOn, 0, bytes, i, BornOn.Length); i += BornOn.Length;
|
|
bytes[i++] = (byte)((MaturePublish) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- PropertiesData --" + Environment.NewLine;
|
|
output += "PartnerID: " + PartnerID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(AboutText, "AboutText") + "" + Environment.NewLine;
|
|
output += "Transacted: " + Transacted.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(CharterMember, "CharterMember") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FLAboutText, "FLAboutText") + "" + Environment.NewLine;
|
|
output += "ImageID: " + ImageID.ToString() + "" + Environment.NewLine;
|
|
output += "FLImageID: " + FLImageID.ToString() + "" + Environment.NewLine;
|
|
output += "AllowPublish: " + AllowPublish.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ProfileURL, "ProfileURL") + "" + Environment.NewLine;
|
|
output += "Identified: " + Identified.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(BornOn, "BornOn") + "" + Environment.NewLine;
|
|
output += "MaturePublish: " + MaturePublish.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarpropertiesreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID AvatarID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
AvatarID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AvatarID == null) { Console.WriteLine("Warning: AvatarID is null, in " + this.GetType()); }
|
|
Array.Copy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "AvatarID: " + AvatarID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarPropertiesReply; } }
|
|
public PropertiesDataBlock PropertiesData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarPropertiesReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 201;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
PropertiesData = new PropertiesDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarPropertiesReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarPropertiesReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += PropertiesData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
PropertiesData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarPropertiesReply ---" + Environment.NewLine;
|
|
output += PropertiesData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarInterestsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarinterestsreply_propertiesdata")]
|
|
public class PropertiesDataBlock
|
|
{
|
|
public uint WantToMask;
|
|
private byte[] _wanttotext;
|
|
public byte[] WantToText
|
|
{
|
|
get { return _wanttotext; }
|
|
set
|
|
{
|
|
if (value == null) { _wanttotext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _wanttotext = new byte[value.Length]; Array.Copy(value, _wanttotext, value.Length); }
|
|
}
|
|
}
|
|
public uint SkillsMask;
|
|
private byte[] _skillstext;
|
|
public byte[] SkillsText
|
|
{
|
|
get { return _skillstext; }
|
|
set
|
|
{
|
|
if (value == null) { _skillstext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _skillstext = new byte[value.Length]; Array.Copy(value, _skillstext, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _languagestext;
|
|
public byte[] LanguagesText
|
|
{
|
|
get { return _languagestext; }
|
|
set
|
|
{
|
|
if (value == null) { _languagestext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _languagestext = new byte[value.Length]; Array.Copy(value, _languagestext, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 8;
|
|
if (WantToText != null) { length += 1 + WantToText.Length; }
|
|
if (SkillsText != null) { length += 1 + SkillsText.Length; }
|
|
if (LanguagesText != null) { length += 1 + LanguagesText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public PropertiesDataBlock() { }
|
|
public PropertiesDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
WantToMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_wanttotext = new byte[length];
|
|
Array.Copy(bytes, i, _wanttotext, 0, length); i += length;
|
|
SkillsMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_skillstext = new byte[length];
|
|
Array.Copy(bytes, i, _skillstext, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_languagestext = new byte[length];
|
|
Array.Copy(bytes, i, _languagestext, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(WantToMask % 256);
|
|
bytes[i++] = (byte)((WantToMask >> 8) % 256);
|
|
bytes[i++] = (byte)((WantToMask >> 16) % 256);
|
|
bytes[i++] = (byte)((WantToMask >> 24) % 256);
|
|
if(WantToText == null) { Console.WriteLine("Warning: WantToText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)WantToText.Length;
|
|
Array.Copy(WantToText, 0, bytes, i, WantToText.Length); i += WantToText.Length;
|
|
bytes[i++] = (byte)(SkillsMask % 256);
|
|
bytes[i++] = (byte)((SkillsMask >> 8) % 256);
|
|
bytes[i++] = (byte)((SkillsMask >> 16) % 256);
|
|
bytes[i++] = (byte)((SkillsMask >> 24) % 256);
|
|
if(SkillsText == null) { Console.WriteLine("Warning: SkillsText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SkillsText.Length;
|
|
Array.Copy(SkillsText, 0, bytes, i, SkillsText.Length); i += SkillsText.Length;
|
|
if(LanguagesText == null) { Console.WriteLine("Warning: LanguagesText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LanguagesText.Length;
|
|
Array.Copy(LanguagesText, 0, bytes, i, LanguagesText.Length); i += LanguagesText.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- PropertiesData --" + Environment.NewLine;
|
|
output += "WantToMask: " + WantToMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(WantToText, "WantToText") + "" + Environment.NewLine;
|
|
output += "SkillsMask: " + SkillsMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SkillsText, "SkillsText") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LanguagesText, "LanguagesText") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarinterestsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID AvatarID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
AvatarID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AvatarID == null) { Console.WriteLine("Warning: AvatarID is null, in " + this.GetType()); }
|
|
Array.Copy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "AvatarID: " + AvatarID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarInterestsReply; } }
|
|
public PropertiesDataBlock PropertiesData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarInterestsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 202;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
PropertiesData = new PropertiesDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarInterestsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarInterestsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += PropertiesData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
PropertiesData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarInterestsReply ---" + Environment.NewLine;
|
|
output += PropertiesData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarGroupsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatargroupsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID AvatarID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
AvatarID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AvatarID == null) { Console.WriteLine("Warning: AvatarID is null, in " + this.GetType()); }
|
|
Array.Copy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "AvatarID: " + AvatarID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatargroupsreply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
private byte[] _grouptitle;
|
|
public byte[] GroupTitle
|
|
{
|
|
get { return _grouptitle; }
|
|
set
|
|
{
|
|
if (value == null) { _grouptitle = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _grouptitle = new byte[value.Length]; Array.Copy(value, _grouptitle, value.Length); }
|
|
}
|
|
}
|
|
public ulong GroupPowers;
|
|
public LLUUID GroupID;
|
|
public LLUUID GroupInsigniaID;
|
|
public bool AcceptNotices;
|
|
private byte[] _groupname;
|
|
public byte[] GroupName
|
|
{
|
|
get { return _groupname; }
|
|
set
|
|
{
|
|
if (value == null) { _groupname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _groupname = new byte[value.Length]; Array.Copy(value, _groupname, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 41;
|
|
if (GroupTitle != null) { length += 1 + GroupTitle.Length; }
|
|
if (GroupName != null) { length += 1 + GroupName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_grouptitle = new byte[length];
|
|
Array.Copy(bytes, i, _grouptitle, 0, length); i += length;
|
|
GroupPowers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
GroupInsigniaID = new LLUUID(bytes, i); i += 16;
|
|
AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_groupname = new byte[length];
|
|
Array.Copy(bytes, i, _groupname, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupTitle == null) { Console.WriteLine("Warning: GroupTitle is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupTitle.Length;
|
|
Array.Copy(GroupTitle, 0, bytes, i, GroupTitle.Length); i += GroupTitle.Length;
|
|
bytes[i++] = (byte)(GroupPowers % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 24) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 32) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 40) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 48) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 56) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupInsigniaID == null) { Console.WriteLine("Warning: GroupInsigniaID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupInsigniaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AcceptNotices) ? 1 : 0);
|
|
if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupName.Length;
|
|
Array.Copy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupTitle, "GroupTitle") + "" + Environment.NewLine;
|
|
output += "GroupPowers: " + GroupPowers.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupInsigniaID: " + GroupInsigniaID.ToString() + "" + Environment.NewLine;
|
|
output += "AcceptNotices: " + AcceptNotices.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupName, "GroupName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarGroupsReply; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock[] GroupData;
|
|
|
|
public AvatarGroupsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 203;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock[0];
|
|
}
|
|
|
|
public AvatarGroupsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public AvatarGroupsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < GroupData.Length; j++) { length += GroupData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)GroupData.Length;
|
|
for (int j = 0; j < GroupData.Length; j++) { GroupData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarGroupsReply ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < GroupData.Length; j++)
|
|
{
|
|
output += GroupData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarPropertiesUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarpropertiesupdate_propertiesdata")]
|
|
public class PropertiesDataBlock
|
|
{
|
|
private byte[] _abouttext;
|
|
public byte[] AboutText
|
|
{
|
|
get { return _abouttext; }
|
|
set
|
|
{
|
|
if (value == null) { _abouttext = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _abouttext = new byte[value.Length]; Array.Copy(value, _abouttext, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _flabouttext;
|
|
public byte[] FLAboutText
|
|
{
|
|
get { return _flabouttext; }
|
|
set
|
|
{
|
|
if (value == null) { _flabouttext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _flabouttext = new byte[value.Length]; Array.Copy(value, _flabouttext, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ImageID;
|
|
public LLUUID FLImageID;
|
|
public bool AllowPublish;
|
|
private byte[] _profileurl;
|
|
public byte[] ProfileURL
|
|
{
|
|
get { return _profileurl; }
|
|
set
|
|
{
|
|
if (value == null) { _profileurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _profileurl = new byte[value.Length]; Array.Copy(value, _profileurl, value.Length); }
|
|
}
|
|
}
|
|
public bool MaturePublish;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 34;
|
|
if (AboutText != null) { length += 2 + AboutText.Length; }
|
|
if (FLAboutText != null) { length += 1 + FLAboutText.Length; }
|
|
if (ProfileURL != null) { length += 1 + ProfileURL.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public PropertiesDataBlock() { }
|
|
public PropertiesDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_abouttext = new byte[length];
|
|
Array.Copy(bytes, i, _abouttext, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_flabouttext = new byte[length];
|
|
Array.Copy(bytes, i, _flabouttext, 0, length); i += length;
|
|
ImageID = new LLUUID(bytes, i); i += 16;
|
|
FLImageID = new LLUUID(bytes, i); i += 16;
|
|
AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_profileurl = new byte[length];
|
|
Array.Copy(bytes, i, _profileurl, 0, length); i += length;
|
|
MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AboutText == null) { Console.WriteLine("Warning: AboutText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(AboutText.Length % 256);
|
|
bytes[i++] = (byte)((AboutText.Length >> 8) % 256);
|
|
Array.Copy(AboutText, 0, bytes, i, AboutText.Length); i += AboutText.Length;
|
|
if(FLAboutText == null) { Console.WriteLine("Warning: FLAboutText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FLAboutText.Length;
|
|
Array.Copy(FLAboutText, 0, bytes, i, FLAboutText.Length); i += FLAboutText.Length;
|
|
if(ImageID == null) { Console.WriteLine("Warning: ImageID is null, in " + this.GetType()); }
|
|
Array.Copy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FLImageID == null) { Console.WriteLine("Warning: FLImageID is null, in " + this.GetType()); }
|
|
Array.Copy(FLImageID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AllowPublish) ? 1 : 0);
|
|
if(ProfileURL == null) { Console.WriteLine("Warning: ProfileURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ProfileURL.Length;
|
|
Array.Copy(ProfileURL, 0, bytes, i, ProfileURL.Length); i += ProfileURL.Length;
|
|
bytes[i++] = (byte)((MaturePublish) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- PropertiesData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(AboutText, "AboutText") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FLAboutText, "FLAboutText") + "" + Environment.NewLine;
|
|
output += "ImageID: " + ImageID.ToString() + "" + Environment.NewLine;
|
|
output += "FLImageID: " + FLImageID.ToString() + "" + Environment.NewLine;
|
|
output += "AllowPublish: " + AllowPublish.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ProfileURL, "ProfileURL") + "" + Environment.NewLine;
|
|
output += "MaturePublish: " + MaturePublish.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarpropertiesupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarPropertiesUpdate; } }
|
|
public PropertiesDataBlock PropertiesData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarPropertiesUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 204;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
PropertiesData = new PropertiesDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarPropertiesUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarPropertiesUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += PropertiesData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
PropertiesData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarPropertiesUpdate ---" + Environment.NewLine;
|
|
output += PropertiesData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarInterestsUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarinterestsupdate_propertiesdata")]
|
|
public class PropertiesDataBlock
|
|
{
|
|
public uint WantToMask;
|
|
private byte[] _wanttotext;
|
|
public byte[] WantToText
|
|
{
|
|
get { return _wanttotext; }
|
|
set
|
|
{
|
|
if (value == null) { _wanttotext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _wanttotext = new byte[value.Length]; Array.Copy(value, _wanttotext, value.Length); }
|
|
}
|
|
}
|
|
public uint SkillsMask;
|
|
private byte[] _skillstext;
|
|
public byte[] SkillsText
|
|
{
|
|
get { return _skillstext; }
|
|
set
|
|
{
|
|
if (value == null) { _skillstext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _skillstext = new byte[value.Length]; Array.Copy(value, _skillstext, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _languagestext;
|
|
public byte[] LanguagesText
|
|
{
|
|
get { return _languagestext; }
|
|
set
|
|
{
|
|
if (value == null) { _languagestext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _languagestext = new byte[value.Length]; Array.Copy(value, _languagestext, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 8;
|
|
if (WantToText != null) { length += 1 + WantToText.Length; }
|
|
if (SkillsText != null) { length += 1 + SkillsText.Length; }
|
|
if (LanguagesText != null) { length += 1 + LanguagesText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public PropertiesDataBlock() { }
|
|
public PropertiesDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
WantToMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_wanttotext = new byte[length];
|
|
Array.Copy(bytes, i, _wanttotext, 0, length); i += length;
|
|
SkillsMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_skillstext = new byte[length];
|
|
Array.Copy(bytes, i, _skillstext, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_languagestext = new byte[length];
|
|
Array.Copy(bytes, i, _languagestext, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(WantToMask % 256);
|
|
bytes[i++] = (byte)((WantToMask >> 8) % 256);
|
|
bytes[i++] = (byte)((WantToMask >> 16) % 256);
|
|
bytes[i++] = (byte)((WantToMask >> 24) % 256);
|
|
if(WantToText == null) { Console.WriteLine("Warning: WantToText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)WantToText.Length;
|
|
Array.Copy(WantToText, 0, bytes, i, WantToText.Length); i += WantToText.Length;
|
|
bytes[i++] = (byte)(SkillsMask % 256);
|
|
bytes[i++] = (byte)((SkillsMask >> 8) % 256);
|
|
bytes[i++] = (byte)((SkillsMask >> 16) % 256);
|
|
bytes[i++] = (byte)((SkillsMask >> 24) % 256);
|
|
if(SkillsText == null) { Console.WriteLine("Warning: SkillsText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SkillsText.Length;
|
|
Array.Copy(SkillsText, 0, bytes, i, SkillsText.Length); i += SkillsText.Length;
|
|
if(LanguagesText == null) { Console.WriteLine("Warning: LanguagesText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LanguagesText.Length;
|
|
Array.Copy(LanguagesText, 0, bytes, i, LanguagesText.Length); i += LanguagesText.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- PropertiesData --" + Environment.NewLine;
|
|
output += "WantToMask: " + WantToMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(WantToText, "WantToText") + "" + Environment.NewLine;
|
|
output += "SkillsMask: " + SkillsMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SkillsText, "SkillsText") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LanguagesText, "LanguagesText") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarinterestsupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarInterestsUpdate; } }
|
|
public PropertiesDataBlock PropertiesData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarInterestsUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 205;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
PropertiesData = new PropertiesDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarInterestsUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarInterestsUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
PropertiesData = new PropertiesDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += PropertiesData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
PropertiesData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarInterestsUpdate ---" + Environment.NewLine;
|
|
output += PropertiesData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarStatisticsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarstatisticsreply_statisticsdata")]
|
|
public class StatisticsDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public int Negative;
|
|
public int Positive;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 8;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public StatisticsDataBlock() { }
|
|
public StatisticsDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
Negative = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Positive = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(Negative % 256);
|
|
bytes[i++] = (byte)((Negative >> 8) % 256);
|
|
bytes[i++] = (byte)((Negative >> 16) % 256);
|
|
bytes[i++] = (byte)((Negative >> 24) % 256);
|
|
bytes[i++] = (byte)(Positive % 256);
|
|
bytes[i++] = (byte)((Positive >> 8) % 256);
|
|
bytes[i++] = (byte)((Positive >> 16) % 256);
|
|
bytes[i++] = (byte)((Positive >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- StatisticsData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Negative: " + Negative.ToString() + "" + Environment.NewLine;
|
|
output += "Positive: " + Positive.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarstatisticsreply_avatardata")]
|
|
public class AvatarDataBlock
|
|
{
|
|
public LLUUID AvatarID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AvatarDataBlock() { }
|
|
public AvatarDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AvatarID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AvatarID == null) { Console.WriteLine("Warning: AvatarID is null, in " + this.GetType()); }
|
|
Array.Copy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AvatarData --" + Environment.NewLine;
|
|
output += "AvatarID: " + AvatarID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarstatisticsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarStatisticsReply; } }
|
|
public StatisticsDataBlock[] StatisticsData;
|
|
public AvatarDataBlock AvatarData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarStatisticsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 206;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
StatisticsData = new StatisticsDataBlock[0];
|
|
AvatarData = new AvatarDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarStatisticsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
StatisticsData = new StatisticsDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ StatisticsData[j] = new StatisticsDataBlock(bytes, ref i); }
|
|
AvatarData = new AvatarDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarStatisticsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
StatisticsData = new StatisticsDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ StatisticsData[j] = new StatisticsDataBlock(bytes, ref i); }
|
|
AvatarData = new AvatarDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AvatarData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < StatisticsData.Length; j++) { length += StatisticsData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)StatisticsData.Length;
|
|
for (int j = 0; j < StatisticsData.Length; j++) { StatisticsData[j].ToBytes(bytes, ref i); }
|
|
AvatarData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarStatisticsReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < StatisticsData.Length; j++)
|
|
{
|
|
output += StatisticsData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AvatarData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarNotesReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarnotesreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID TargetID;
|
|
private byte[] _notes;
|
|
public byte[] Notes
|
|
{
|
|
get { return _notes; }
|
|
set
|
|
{
|
|
if (value == null) { _notes = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _notes = new byte[value.Length]; Array.Copy(value, _notes, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Notes != null) { length += 2 + Notes.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_notes = new byte[length];
|
|
Array.Copy(bytes, i, _notes, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Notes == null) { Console.WriteLine("Warning: Notes is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Notes.Length % 256);
|
|
bytes[i++] = (byte)((Notes.Length >> 8) % 256);
|
|
Array.Copy(Notes, 0, bytes, i, Notes.Length); i += Notes.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Notes, "Notes") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarnotesreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarNotesReply; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarNotesReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 207;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarNotesReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarNotesReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarNotesReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarNotesUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarnotesupdate_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID TargetID;
|
|
private byte[] _notes;
|
|
public byte[] Notes
|
|
{
|
|
get { return _notes; }
|
|
set
|
|
{
|
|
if (value == null) { _notes = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _notes = new byte[value.Length]; Array.Copy(value, _notes, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Notes != null) { length += 2 + Notes.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_notes = new byte[length];
|
|
Array.Copy(bytes, i, _notes, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Notes == null) { Console.WriteLine("Warning: Notes is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Notes.Length % 256);
|
|
bytes[i++] = (byte)((Notes.Length >> 8) % 256);
|
|
Array.Copy(Notes, 0, bytes, i, Notes.Length); i += Notes.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Notes, "Notes") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarnotesupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarNotesUpdate; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarNotesUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 208;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarNotesUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarNotesUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarNotesUpdate ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarPicksReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarpicksreply_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _pickname;
|
|
public byte[] PickName
|
|
{
|
|
get { return _pickname; }
|
|
set
|
|
{
|
|
if (value == null) { _pickname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _pickname = new byte[value.Length]; Array.Copy(value, _pickname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID PickID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (PickName != null) { length += 1 + PickName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_pickname = new byte[length];
|
|
Array.Copy(bytes, i, _pickname, 0, length); i += length;
|
|
PickID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(PickName == null) { Console.WriteLine("Warning: PickName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)PickName.Length;
|
|
Array.Copy(PickName, 0, bytes, i, PickName.Length); i += PickName.Length;
|
|
if(PickID == null) { Console.WriteLine("Warning: PickID is null, in " + this.GetType()); }
|
|
Array.Copy(PickID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(PickName, "PickName") + "" + Environment.NewLine;
|
|
output += "PickID: " + PickID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarpicksreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID TargetID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarPicksReply; } }
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AvatarPicksReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 209;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AvatarPicksReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarPicksReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarPicksReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EventInfoRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("eventinforequest_eventdata")]
|
|
public class EventDataBlock
|
|
{
|
|
public uint EventID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public EventDataBlock() { }
|
|
public EventDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(EventID % 256);
|
|
bytes[i++] = (byte)((EventID >> 8) % 256);
|
|
bytes[i++] = (byte)((EventID >> 16) % 256);
|
|
bytes[i++] = (byte)((EventID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EventData --" + Environment.NewLine;
|
|
output += "EventID: " + EventID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("eventinforequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EventInfoRequest; } }
|
|
public EventDataBlock EventData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EventInfoRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 210;
|
|
Header.Reliable = true;
|
|
EventData = new EventDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EventInfoRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EventInfoRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += EventData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
EventData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EventInfoRequest ---" + Environment.NewLine;
|
|
output += EventData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EventInfoReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("eventinforeply_eventdata")]
|
|
public class EventDataBlock
|
|
{
|
|
public uint Duration;
|
|
public uint DateUTC;
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public LLVector3d GlobalPos;
|
|
private byte[] _creator;
|
|
public byte[] Creator
|
|
{
|
|
get { return _creator; }
|
|
set
|
|
{
|
|
if (value == null) { _creator = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _creator = new byte[value.Length]; Array.Copy(value, _creator, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _date;
|
|
public byte[] Date
|
|
{
|
|
get { return _date; }
|
|
set
|
|
{
|
|
if (value == null) { _date = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _date = new byte[value.Length]; Array.Copy(value, _date, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
public uint EventID;
|
|
private byte[] _category;
|
|
public byte[] Category
|
|
{
|
|
get { return _category; }
|
|
set
|
|
{
|
|
if (value == null) { _category = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _category = new byte[value.Length]; Array.Copy(value, _category, value.Length); }
|
|
}
|
|
}
|
|
public uint EventFlags;
|
|
public uint Amount;
|
|
public uint Cover;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 48;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
if (Creator != null) { length += 1 + Creator.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Date != null) { length += 1 + Date.Length; }
|
|
if (Desc != null) { length += 2 + Desc.Length; }
|
|
if (Category != null) { length += 1 + Category.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public EventDataBlock() { }
|
|
public EventDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Duration = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
DateUTC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
GlobalPos = new LLVector3d(bytes, i); i += 24;
|
|
length = (ushort)bytes[i++];
|
|
_creator = new byte[length];
|
|
Array.Copy(bytes, i, _creator, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_date = new byte[length];
|
|
Array.Copy(bytes, i, _date, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_category = new byte[length];
|
|
Array.Copy(bytes, i, _category, 0, length); i += length;
|
|
EventFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Amount = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Cover = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Duration % 256);
|
|
bytes[i++] = (byte)((Duration >> 8) % 256);
|
|
bytes[i++] = (byte)((Duration >> 16) % 256);
|
|
bytes[i++] = (byte)((Duration >> 24) % 256);
|
|
bytes[i++] = (byte)(DateUTC % 256);
|
|
bytes[i++] = (byte)((DateUTC >> 8) % 256);
|
|
bytes[i++] = (byte)((DateUTC >> 16) % 256);
|
|
bytes[i++] = (byte)((DateUTC >> 24) % 256);
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
Array.Copy(GlobalPos.GetBytes(), 0, bytes, i, 24); i += 24;
|
|
if(Creator == null) { Console.WriteLine("Warning: Creator is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Creator.Length;
|
|
Array.Copy(Creator, 0, bytes, i, Creator.Length); i += Creator.Length;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Date == null) { Console.WriteLine("Warning: Date is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Date.Length;
|
|
Array.Copy(Date, 0, bytes, i, Date.Length); i += Date.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Desc.Length % 256);
|
|
bytes[i++] = (byte)((Desc.Length >> 8) % 256);
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
bytes[i++] = (byte)(EventID % 256);
|
|
bytes[i++] = (byte)((EventID >> 8) % 256);
|
|
bytes[i++] = (byte)((EventID >> 16) % 256);
|
|
bytes[i++] = (byte)((EventID >> 24) % 256);
|
|
if(Category == null) { Console.WriteLine("Warning: Category is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Category.Length;
|
|
Array.Copy(Category, 0, bytes, i, Category.Length); i += Category.Length;
|
|
bytes[i++] = (byte)(EventFlags % 256);
|
|
bytes[i++] = (byte)((EventFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((EventFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((EventFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(Amount % 256);
|
|
bytes[i++] = (byte)((Amount >> 8) % 256);
|
|
bytes[i++] = (byte)((Amount >> 16) % 256);
|
|
bytes[i++] = (byte)((Amount >> 24) % 256);
|
|
bytes[i++] = (byte)(Cover % 256);
|
|
bytes[i++] = (byte)((Cover >> 8) % 256);
|
|
bytes[i++] = (byte)((Cover >> 16) % 256);
|
|
bytes[i++] = (byte)((Cover >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EventData --" + Environment.NewLine;
|
|
output += "Duration: " + Duration.ToString() + "" + Environment.NewLine;
|
|
output += "DateUTC: " + DateUTC.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "GlobalPos: " + GlobalPos.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Creator, "Creator") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Date, "Date") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += "EventID: " + EventID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Category, "Category") + "" + Environment.NewLine;
|
|
output += "EventFlags: " + EventFlags.ToString() + "" + Environment.NewLine;
|
|
output += "Amount: " + Amount.ToString() + "" + Environment.NewLine;
|
|
output += "Cover: " + Cover.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("eventinforeply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EventInfoReply; } }
|
|
public EventDataBlock EventData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EventInfoReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 211;
|
|
Header.Reliable = true;
|
|
EventData = new EventDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EventInfoReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EventInfoReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += EventData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
EventData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EventInfoReply ---" + Environment.NewLine;
|
|
output += EventData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EventNotificationAddRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("eventnotificationaddrequest_eventdata")]
|
|
public class EventDataBlock
|
|
{
|
|
public uint EventID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public EventDataBlock() { }
|
|
public EventDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(EventID % 256);
|
|
bytes[i++] = (byte)((EventID >> 8) % 256);
|
|
bytes[i++] = (byte)((EventID >> 16) % 256);
|
|
bytes[i++] = (byte)((EventID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EventData --" + Environment.NewLine;
|
|
output += "EventID: " + EventID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("eventnotificationaddrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EventNotificationAddRequest; } }
|
|
public EventDataBlock EventData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EventNotificationAddRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 212;
|
|
Header.Reliable = true;
|
|
EventData = new EventDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EventNotificationAddRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EventNotificationAddRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += EventData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
EventData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EventNotificationAddRequest ---" + Environment.NewLine;
|
|
output += EventData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EventNotificationRemoveRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("eventnotificationremoverequest_eventdata")]
|
|
public class EventDataBlock
|
|
{
|
|
public uint EventID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public EventDataBlock() { }
|
|
public EventDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(EventID % 256);
|
|
bytes[i++] = (byte)((EventID >> 8) % 256);
|
|
bytes[i++] = (byte)((EventID >> 16) % 256);
|
|
bytes[i++] = (byte)((EventID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EventData --" + Environment.NewLine;
|
|
output += "EventID: " + EventID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("eventnotificationremoverequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EventNotificationRemoveRequest; } }
|
|
public EventDataBlock EventData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EventNotificationRemoveRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 213;
|
|
Header.Reliable = true;
|
|
EventData = new EventDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EventNotificationRemoveRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EventNotificationRemoveRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += EventData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
EventData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EventNotificationRemoveRequest ---" + Environment.NewLine;
|
|
output += EventData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EventGodDeletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("eventgoddelete_eventdata")]
|
|
public class EventDataBlock
|
|
{
|
|
public uint EventID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public EventDataBlock() { }
|
|
public EventDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(EventID % 256);
|
|
bytes[i++] = (byte)((EventID >> 8) % 256);
|
|
bytes[i++] = (byte)((EventID >> 16) % 256);
|
|
bytes[i++] = (byte)((EventID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EventData --" + Environment.NewLine;
|
|
output += "EventID: " + EventID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("eventgoddelete_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
public uint QueryFlags;
|
|
public int QueryStart;
|
|
private byte[] _querytext;
|
|
public byte[] QueryText
|
|
{
|
|
get { return _querytext; }
|
|
set
|
|
{
|
|
if (value == null) { _querytext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _querytext = new byte[value.Length]; Array.Copy(value, _querytext, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (QueryText != null) { length += 1 + QueryText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_querytext = new byte[length];
|
|
Array.Copy(bytes, i, _querytext, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(QueryFlags % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(QueryStart % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 8) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 16) % 256);
|
|
bytes[i++] = (byte)((QueryStart >> 24) % 256);
|
|
if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)QueryText.Length;
|
|
Array.Copy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryFlags: " + QueryFlags.ToString() + "" + Environment.NewLine;
|
|
output += "QueryStart: " + QueryStart.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(QueryText, "QueryText") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("eventgoddelete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EventGodDelete; } }
|
|
public EventDataBlock EventData;
|
|
public QueryDataBlock QueryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EventGodDeletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 214;
|
|
Header.Reliable = true;
|
|
EventData = new EventDataBlock();
|
|
QueryData = new QueryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EventGodDeletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EventGodDeletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += EventData.Length; length += QueryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
EventData.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EventGodDelete ---" + Environment.NewLine;
|
|
output += EventData.ToString() + "" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PickInfoRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("pickinforequest_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID PickID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PickID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(PickID == null) { Console.WriteLine("Warning: PickID is null, in " + this.GetType()); }
|
|
Array.Copy(PickID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "PickID: " + PickID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("pickinforequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PickInfoRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public PickInfoRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 215;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public PickInfoRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PickInfoRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PickInfoRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PickInfoReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("pickinforeply_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _originalname;
|
|
public byte[] OriginalName
|
|
{
|
|
get { return _originalname; }
|
|
set
|
|
{
|
|
if (value == null) { _originalname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _originalname = new byte[value.Length]; Array.Copy(value, _originalname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public bool Enabled;
|
|
public LLVector3d PosGlobal;
|
|
public bool TopPick;
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _user;
|
|
public byte[] User
|
|
{
|
|
get { return _user; }
|
|
set
|
|
{
|
|
if (value == null) { _user = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _user = new byte[value.Length]; Array.Copy(value, _user, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID CreatorID;
|
|
public LLUUID PickID;
|
|
public LLUUID SnapshotID;
|
|
public int SortOrder;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 94;
|
|
if (OriginalName != null) { length += 1 + OriginalName.Length; }
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 2 + Desc.Length; }
|
|
if (User != null) { length += 1 + User.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_originalname = new byte[length];
|
|
Array.Copy(bytes, i, _originalname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
PosGlobal = new LLVector3d(bytes, i); i += 24;
|
|
TopPick = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_user = new byte[length];
|
|
Array.Copy(bytes, i, _user, 0, length); i += length;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
PickID = new LLUUID(bytes, i); i += 16;
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
SortOrder = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OriginalName == null) { Console.WriteLine("Warning: OriginalName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)OriginalName.Length;
|
|
Array.Copy(OriginalName, 0, bytes, i, OriginalName.Length); i += OriginalName.Length;
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)((Enabled) ? 1 : 0);
|
|
Array.Copy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24;
|
|
bytes[i++] = (byte)((TopPick) ? 1 : 0);
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Desc.Length % 256);
|
|
bytes[i++] = (byte)((Desc.Length >> 8) % 256);
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
if(User == null) { Console.WriteLine("Warning: User is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)User.Length;
|
|
Array.Copy(User, 0, bytes, i, User.Length); i += User.Length;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(PickID == null) { Console.WriteLine("Warning: PickID is null, in " + this.GetType()); }
|
|
Array.Copy(PickID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SortOrder % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 8) % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 16) % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(OriginalName, "OriginalName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "Enabled: " + Enabled.ToString() + "" + Environment.NewLine;
|
|
output += "PosGlobal: " + PosGlobal.ToString() + "" + Environment.NewLine;
|
|
output += "TopPick: " + TopPick.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(User, "User") + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "PickID: " + PickID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "SortOrder: " + SortOrder.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("pickinforeply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PickInfoReply; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public PickInfoReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 216;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public PickInfoReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PickInfoReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PickInfoReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PickInfoUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("pickinfoupdate_data")]
|
|
public class DataBlock
|
|
{
|
|
public bool Enabled;
|
|
public LLVector3d PosGlobal;
|
|
public bool TopPick;
|
|
public LLUUID ParcelID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID CreatorID;
|
|
public LLUUID PickID;
|
|
public LLUUID SnapshotID;
|
|
public int SortOrder;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 94;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 2 + Desc.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
PosGlobal = new LLVector3d(bytes, i); i += 24;
|
|
TopPick = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
PickID = new LLUUID(bytes, i); i += 16;
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
SortOrder = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Enabled) ? 1 : 0);
|
|
Array.Copy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24;
|
|
bytes[i++] = (byte)((TopPick) ? 1 : 0);
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Desc.Length % 256);
|
|
bytes[i++] = (byte)((Desc.Length >> 8) % 256);
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(PickID == null) { Console.WriteLine("Warning: PickID is null, in " + this.GetType()); }
|
|
Array.Copy(PickID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SortOrder % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 8) % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 16) % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "Enabled: " + Enabled.ToString() + "" + Environment.NewLine;
|
|
output += "PosGlobal: " + PosGlobal.ToString() + "" + Environment.NewLine;
|
|
output += "TopPick: " + TopPick.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "PickID: " + PickID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "SortOrder: " + SortOrder.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("pickinfoupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PickInfoUpdate; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public PickInfoUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 217;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public PickInfoUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PickInfoUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PickInfoUpdate ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PickDeletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("pickdelete_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID PickID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PickID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(PickID == null) { Console.WriteLine("Warning: PickID is null, in " + this.GetType()); }
|
|
Array.Copy(PickID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "PickID: " + PickID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("pickdelete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PickDelete; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public PickDeletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 218;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public PickDeletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PickDeletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PickDelete ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PickGodDeletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("pickgoddelete_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
public LLUUID PickID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
PickID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(PickID == null) { Console.WriteLine("Warning: PickID is null, in " + this.GetType()); }
|
|
Array.Copy(PickID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "PickID: " + PickID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("pickgoddelete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PickGodDelete; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public PickGodDeletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 219;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public PickGodDeletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PickGodDeletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PickGodDelete ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptQuestionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptquestion_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _objectname;
|
|
public byte[] ObjectName
|
|
{
|
|
get { return _objectname; }
|
|
set
|
|
{
|
|
if (value == null) { _objectname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectname = new byte[value.Length]; Array.Copy(value, _objectname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _objectowner;
|
|
public byte[] ObjectOwner
|
|
{
|
|
get { return _objectowner; }
|
|
set
|
|
{
|
|
if (value == null) { _objectowner = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectowner = new byte[value.Length]; Array.Copy(value, _objectowner, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID TaskID;
|
|
public LLUUID ItemID;
|
|
public int Questions;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 36;
|
|
if (ObjectName != null) { length += 1 + ObjectName.Length; }
|
|
if (ObjectOwner != null) { length += 1 + ObjectOwner.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_objectname = new byte[length];
|
|
Array.Copy(bytes, i, _objectname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_objectowner = new byte[length];
|
|
Array.Copy(bytes, i, _objectowner, 0, length); i += length;
|
|
TaskID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
Questions = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectName.Length;
|
|
Array.Copy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length;
|
|
if(ObjectOwner == null) { Console.WriteLine("Warning: ObjectOwner is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectOwner.Length;
|
|
Array.Copy(ObjectOwner, 0, bytes, i, ObjectOwner.Length); i += ObjectOwner.Length;
|
|
if(TaskID == null) { Console.WriteLine("Warning: TaskID is null, in " + this.GetType()); }
|
|
Array.Copy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Questions % 256);
|
|
bytes[i++] = (byte)((Questions >> 8) % 256);
|
|
bytes[i++] = (byte)((Questions >> 16) % 256);
|
|
bytes[i++] = (byte)((Questions >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectName, "ObjectName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectOwner, "ObjectOwner") + "" + Environment.NewLine;
|
|
output += "TaskID: " + TaskID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "Questions: " + Questions.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptQuestion; } }
|
|
public DataBlock Data;
|
|
|
|
public ScriptQuestionPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 220;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
}
|
|
|
|
public ScriptQuestionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ScriptQuestionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptQuestion ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptControlChangePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptcontrolchange_data")]
|
|
public class DataBlock
|
|
{
|
|
public bool PassToAgent;
|
|
public uint Controls;
|
|
public bool TakeControls;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 6;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PassToAgent = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Controls = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TakeControls = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((PassToAgent) ? 1 : 0);
|
|
bytes[i++] = (byte)(Controls % 256);
|
|
bytes[i++] = (byte)((Controls >> 8) % 256);
|
|
bytes[i++] = (byte)((Controls >> 16) % 256);
|
|
bytes[i++] = (byte)((Controls >> 24) % 256);
|
|
bytes[i++] = (byte)((TakeControls) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "PassToAgent: " + PassToAgent.ToString() + "" + Environment.NewLine;
|
|
output += "Controls: " + Controls.ToString() + "" + Environment.NewLine;
|
|
output += "TakeControls: " + TakeControls.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptControlChange; } }
|
|
public DataBlock[] Data;
|
|
|
|
public ScriptControlChangePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 221;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
}
|
|
|
|
public ScriptControlChangePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ScriptControlChangePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptControlChange ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptDialogPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptdialog_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _objectname;
|
|
public byte[] ObjectName
|
|
{
|
|
get { return _objectname; }
|
|
set
|
|
{
|
|
if (value == null) { _objectname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectname = new byte[value.Length]; Array.Copy(value, _objectname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ImageID;
|
|
public LLUUID ObjectID;
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _lastname;
|
|
public byte[] LastName
|
|
{
|
|
get { return _lastname; }
|
|
set
|
|
{
|
|
if (value == null) { _lastname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _lastname = new byte[value.Length]; Array.Copy(value, _lastname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _firstname;
|
|
public byte[] FirstName
|
|
{
|
|
get { return _firstname; }
|
|
set
|
|
{
|
|
if (value == null) { _firstname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _firstname = new byte[value.Length]; Array.Copy(value, _firstname, value.Length); }
|
|
}
|
|
}
|
|
public int ChatChannel;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 36;
|
|
if (ObjectName != null) { length += 1 + ObjectName.Length; }
|
|
if (Message != null) { length += 2 + Message.Length; }
|
|
if (LastName != null) { length += 1 + LastName.Length; }
|
|
if (FirstName != null) { length += 1 + FirstName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_objectname = new byte[length];
|
|
Array.Copy(bytes, i, _objectname, 0, length); i += length;
|
|
ImageID = new LLUUID(bytes, i); i += 16;
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_lastname = new byte[length];
|
|
Array.Copy(bytes, i, _lastname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_firstname = new byte[length];
|
|
Array.Copy(bytes, i, _firstname, 0, length); i += length;
|
|
ChatChannel = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectName.Length;
|
|
Array.Copy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length;
|
|
if(ImageID == null) { Console.WriteLine("Warning: ImageID is null, in " + this.GetType()); }
|
|
Array.Copy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Message.Length % 256);
|
|
bytes[i++] = (byte)((Message.Length >> 8) % 256);
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LastName.Length;
|
|
Array.Copy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length;
|
|
if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FirstName.Length;
|
|
Array.Copy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length;
|
|
bytes[i++] = (byte)(ChatChannel % 256);
|
|
bytes[i++] = (byte)((ChatChannel >> 8) % 256);
|
|
bytes[i++] = (byte)((ChatChannel >> 16) % 256);
|
|
bytes[i++] = (byte)((ChatChannel >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectName, "ObjectName") + "" + Environment.NewLine;
|
|
output += "ImageID: " + ImageID.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LastName, "LastName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FirstName, "FirstName") + "" + Environment.NewLine;
|
|
output += "ChatChannel: " + ChatChannel.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("scriptdialog_buttons")]
|
|
public class ButtonsBlock
|
|
{
|
|
private byte[] _buttonlabel;
|
|
public byte[] ButtonLabel
|
|
{
|
|
get { return _buttonlabel; }
|
|
set
|
|
{
|
|
if (value == null) { _buttonlabel = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _buttonlabel = new byte[value.Length]; Array.Copy(value, _buttonlabel, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (ButtonLabel != null) { length += 1 + ButtonLabel.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ButtonsBlock() { }
|
|
public ButtonsBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_buttonlabel = new byte[length];
|
|
Array.Copy(bytes, i, _buttonlabel, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ButtonLabel == null) { Console.WriteLine("Warning: ButtonLabel is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ButtonLabel.Length;
|
|
Array.Copy(ButtonLabel, 0, bytes, i, ButtonLabel.Length); i += ButtonLabel.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Buttons --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ButtonLabel, "ButtonLabel") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptDialog; } }
|
|
public DataBlock Data;
|
|
public ButtonsBlock[] Buttons;
|
|
|
|
public ScriptDialogPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 222;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
Buttons = new ButtonsBlock[0];
|
|
}
|
|
|
|
public ScriptDialogPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
Buttons = new ButtonsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Buttons[j] = new ButtonsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ScriptDialogPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
Buttons = new ButtonsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Buttons[j] = new ButtonsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length;;
|
|
length++;
|
|
for (int j = 0; j < Buttons.Length; j++) { length += Buttons[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Buttons.Length;
|
|
for (int j = 0; j < Buttons.Length; j++) { Buttons[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptDialog ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < Buttons.Length; j++)
|
|
{
|
|
output += Buttons[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptDialogReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptdialogreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
private byte[] _buttonlabel;
|
|
public byte[] ButtonLabel
|
|
{
|
|
get { return _buttonlabel; }
|
|
set
|
|
{
|
|
if (value == null) { _buttonlabel = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _buttonlabel = new byte[value.Length]; Array.Copy(value, _buttonlabel, value.Length); }
|
|
}
|
|
}
|
|
public int ButtonIndex;
|
|
public int ChatChannel;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (ButtonLabel != null) { length += 1 + ButtonLabel.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_buttonlabel = new byte[length];
|
|
Array.Copy(bytes, i, _buttonlabel, 0, length); i += length;
|
|
ButtonIndex = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ChatChannel = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ButtonLabel == null) { Console.WriteLine("Warning: ButtonLabel is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ButtonLabel.Length;
|
|
Array.Copy(ButtonLabel, 0, bytes, i, ButtonLabel.Length); i += ButtonLabel.Length;
|
|
bytes[i++] = (byte)(ButtonIndex % 256);
|
|
bytes[i++] = (byte)((ButtonIndex >> 8) % 256);
|
|
bytes[i++] = (byte)((ButtonIndex >> 16) % 256);
|
|
bytes[i++] = (byte)((ButtonIndex >> 24) % 256);
|
|
bytes[i++] = (byte)(ChatChannel % 256);
|
|
bytes[i++] = (byte)((ChatChannel >> 8) % 256);
|
|
bytes[i++] = (byte)((ChatChannel >> 16) % 256);
|
|
bytes[i++] = (byte)((ChatChannel >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ButtonLabel, "ButtonLabel") + "" + Environment.NewLine;
|
|
output += "ButtonIndex: " + ButtonIndex.ToString() + "" + Environment.NewLine;
|
|
output += "ChatChannel: " + ChatChannel.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("scriptdialogreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptDialogReply; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ScriptDialogReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 223;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ScriptDialogReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ScriptDialogReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptDialogReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ForceScriptControlReleasePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("forcescriptcontrolrelease_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ForceScriptControlRelease; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ForceScriptControlReleasePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 224;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ForceScriptControlReleasePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ForceScriptControlReleasePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ForceScriptControlRelease ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RevokePermissionsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("revokepermissions_data")]
|
|
public class DataBlock
|
|
{
|
|
public uint ObjectPermissions;
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectPermissions = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectPermissions % 256);
|
|
bytes[i++] = (byte)((ObjectPermissions >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectPermissions >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectPermissions >> 24) % 256);
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "ObjectPermissions: " + ObjectPermissions.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("revokepermissions_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RevokePermissions; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RevokePermissionsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 225;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RevokePermissionsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RevokePermissionsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RevokePermissions ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LoadURLPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("loadurl_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _url;
|
|
public byte[] URL
|
|
{
|
|
get { return _url; }
|
|
set
|
|
{
|
|
if (value == null) { _url = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _url = new byte[value.Length]; Array.Copy(value, _url, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _objectname;
|
|
public byte[] ObjectName
|
|
{
|
|
get { return _objectname; }
|
|
set
|
|
{
|
|
if (value == null) { _objectname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectname = new byte[value.Length]; Array.Copy(value, _objectname, value.Length); }
|
|
}
|
|
}
|
|
public bool OwnerIsGroup;
|
|
public LLUUID ObjectID;
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID OwnerID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 33;
|
|
if (URL != null) { length += 1 + URL.Length; }
|
|
if (ObjectName != null) { length += 1 + ObjectName.Length; }
|
|
if (Message != null) { length += 1 + Message.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_url = new byte[length];
|
|
Array.Copy(bytes, i, _url, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_objectname = new byte[length];
|
|
Array.Copy(bytes, i, _objectname, 0, length); i += length;
|
|
OwnerIsGroup = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(URL == null) { Console.WriteLine("Warning: URL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)URL.Length;
|
|
Array.Copy(URL, 0, bytes, i, URL.Length); i += URL.Length;
|
|
if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectName.Length;
|
|
Array.Copy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length;
|
|
bytes[i++] = (byte)((OwnerIsGroup) ? 1 : 0);
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Message.Length;
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(URL, "URL") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectName, "ObjectName") + "" + Environment.NewLine;
|
|
output += "OwnerIsGroup: " + OwnerIsGroup.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LoadURL; } }
|
|
public DataBlock Data;
|
|
|
|
public LoadURLPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 226;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
}
|
|
|
|
public LoadURLPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LoadURLPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LoadURL ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptTeleportRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptteleportrequest_data")]
|
|
public class DataBlock
|
|
{
|
|
private byte[] _objectname;
|
|
public byte[] ObjectName
|
|
{
|
|
get { return _objectname; }
|
|
set
|
|
{
|
|
if (value == null) { _objectname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectname = new byte[value.Length]; Array.Copy(value, _objectname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public LLVector3 LookAt;
|
|
public LLVector3 SimPosition;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (ObjectName != null) { length += 1 + ObjectName.Length; }
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_objectname = new byte[length];
|
|
Array.Copy(bytes, i, _objectname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
LookAt = new LLVector3(bytes, i); i += 12;
|
|
SimPosition = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectName.Length;
|
|
Array.Copy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length;
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(SimPosition.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectName, "ObjectName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "LookAt: " + LookAt.ToString() + "" + Environment.NewLine;
|
|
output += "SimPosition: " + SimPosition.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptTeleportRequest; } }
|
|
public DataBlock Data;
|
|
|
|
public ScriptTeleportRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 227;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
}
|
|
|
|
public ScriptTeleportRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ScriptTeleportRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptTeleportRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelOverlayPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parceloverlay_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
public int SequenceID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
bytes[i++] = (byte)(SequenceID % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output += "SequenceID: " + SequenceID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelOverlay; } }
|
|
public ParcelDataBlock ParcelData;
|
|
|
|
public ParcelOverlayPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 228;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
}
|
|
|
|
public ParcelOverlayPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelOverlayPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelOverlay ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelPropertiesRequestByIDPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelpropertiesrequestbyid_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public int SequenceID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(SequenceID % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "SequenceID: " + SequenceID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelpropertiesrequestbyid_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelPropertiesRequestByID; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelPropertiesRequestByIDPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 229;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelPropertiesRequestByIDPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelPropertiesRequestByIDPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelPropertiesRequestByID ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelPropertiesUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelpropertiesupdate_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public LLUUID MediaID;
|
|
public LLVector3 UserLookAt;
|
|
private byte[] _mediaurl;
|
|
public byte[] MediaURL
|
|
{
|
|
get { return _mediaurl; }
|
|
set
|
|
{
|
|
if (value == null) { _mediaurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _mediaurl = new byte[value.Length]; Array.Copy(value, _mediaurl, value.Length); }
|
|
}
|
|
}
|
|
public int LocalID;
|
|
public LLVector3 UserLocation;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
public byte Category;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID SnapshotID;
|
|
public uint Flags;
|
|
public byte LandingType;
|
|
public LLUUID AuthBuyerID;
|
|
public float PassHours;
|
|
public uint ParcelFlags;
|
|
public int PassPrice;
|
|
public byte MediaAutoScale;
|
|
private byte[] _musicurl;
|
|
public byte[] MusicURL
|
|
{
|
|
get { return _musicurl; }
|
|
set
|
|
{
|
|
if (value == null) { _musicurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _musicurl = new byte[value.Length]; Array.Copy(value, _musicurl, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 115;
|
|
if (MediaURL != null) { length += 1 + MediaURL.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 1 + Desc.Length; }
|
|
if (MusicURL != null) { length += 1 + MusicURL.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
MediaID = new LLUUID(bytes, i); i += 16;
|
|
UserLookAt = new LLVector3(bytes, i); i += 12;
|
|
length = (ushort)bytes[i++];
|
|
_mediaurl = new byte[length];
|
|
Array.Copy(bytes, i, _mediaurl, 0, length); i += length;
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
UserLocation = new LLVector3(bytes, i); i += 12;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
Category = (byte)bytes[i++];
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LandingType = (byte)bytes[i++];
|
|
AuthBuyerID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
PassHours = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ParcelFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PassPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MediaAutoScale = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_musicurl = new byte[length];
|
|
Array.Copy(bytes, i, _musicurl, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(MediaID == null) { Console.WriteLine("Warning: MediaID is null, in " + this.GetType()); }
|
|
Array.Copy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(UserLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MediaURL.Length;
|
|
Array.Copy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length;
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
Array.Copy(UserLocation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Desc.Length;
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
bytes[i++] = Category;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = LandingType;
|
|
if(AuthBuyerID == null) { Console.WriteLine("Warning: AuthBuyerID is null, in " + this.GetType()); }
|
|
Array.Copy(AuthBuyerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(PassHours);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(ParcelFlags % 256);
|
|
bytes[i++] = (byte)((ParcelFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ParcelFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ParcelFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(PassPrice % 256);
|
|
bytes[i++] = (byte)((PassPrice >> 8) % 256);
|
|
bytes[i++] = (byte)((PassPrice >> 16) % 256);
|
|
bytes[i++] = (byte)((PassPrice >> 24) % 256);
|
|
bytes[i++] = MediaAutoScale;
|
|
if(MusicURL == null) { Console.WriteLine("Warning: MusicURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MusicURL.Length;
|
|
Array.Copy(MusicURL, 0, bytes, i, MusicURL.Length); i += MusicURL.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "MediaID: " + MediaID.ToString() + "" + Environment.NewLine;
|
|
output += "UserLookAt: " + UserLookAt.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MediaURL, "MediaURL") + "" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "UserLocation: " + UserLocation.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "LandingType: " + LandingType.ToString() + "" + Environment.NewLine;
|
|
output += "AuthBuyerID: " + AuthBuyerID.ToString() + "" + Environment.NewLine;
|
|
output += "PassHours: " + PassHours.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelFlags: " + ParcelFlags.ToString() + "" + Environment.NewLine;
|
|
output += "PassPrice: " + PassPrice.ToString() + "" + Environment.NewLine;
|
|
output += "MediaAutoScale: " + MediaAutoScale.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MusicURL, "MusicURL") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelpropertiesupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelPropertiesUpdate; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelPropertiesUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 230;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelPropertiesUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelPropertiesUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelPropertiesUpdate ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelReturnObjectsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelreturnobjects_taskids")]
|
|
public class TaskIDsBlock
|
|
{
|
|
public LLUUID TaskID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TaskIDsBlock() { }
|
|
public TaskIDsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TaskID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TaskID == null) { Console.WriteLine("Warning: TaskID is null, in " + this.GetType()); }
|
|
Array.Copy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TaskIDs --" + Environment.NewLine;
|
|
output += "TaskID: " + TaskID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelreturnobjects_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public uint ReturnType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ReturnType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(ReturnType % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 8) % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 16) % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "ReturnType: " + ReturnType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelreturnobjects_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelreturnobjects_ownerids")]
|
|
public class OwnerIDsBlock
|
|
{
|
|
public LLUUID OwnerID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public OwnerIDsBlock() { }
|
|
public OwnerIDsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- OwnerIDs --" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelReturnObjects; } }
|
|
public TaskIDsBlock[] TaskIDs;
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
public OwnerIDsBlock[] OwnerIDs;
|
|
|
|
public ParcelReturnObjectsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 231;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TaskIDs = new TaskIDsBlock[0];
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
OwnerIDs = new OwnerIDsBlock[0];
|
|
}
|
|
|
|
public ParcelReturnObjectsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
TaskIDs = new TaskIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ TaskIDs[j] = new TaskIDsBlock(bytes, ref i); }
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
OwnerIDs = new OwnerIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ OwnerIDs[j] = new OwnerIDsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ParcelReturnObjectsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
TaskIDs = new TaskIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ TaskIDs[j] = new TaskIDsBlock(bytes, ref i); }
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
OwnerIDs = new OwnerIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ OwnerIDs[j] = new OwnerIDsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < TaskIDs.Length; j++) { length += TaskIDs[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < OwnerIDs.Length; j++) { length += OwnerIDs[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)TaskIDs.Length;
|
|
for (int j = 0; j < TaskIDs.Length; j++) { TaskIDs[j].ToBytes(bytes, ref i); }
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)OwnerIDs.Length;
|
|
for (int j = 0; j < OwnerIDs.Length; j++) { OwnerIDs[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelReturnObjects ---" + Environment.NewLine;
|
|
for (int j = 0; j < TaskIDs.Length; j++)
|
|
{
|
|
output += TaskIDs[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < OwnerIDs.Length; j++)
|
|
{
|
|
output += OwnerIDs[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelSetOtherCleanTimePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelsetothercleantime_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public int OtherCleanTime;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OtherCleanTime = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(OtherCleanTime % 256);
|
|
bytes[i++] = (byte)((OtherCleanTime >> 8) % 256);
|
|
bytes[i++] = (byte)((OtherCleanTime >> 16) % 256);
|
|
bytes[i++] = (byte)((OtherCleanTime >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "OtherCleanTime: " + OtherCleanTime.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelsetothercleantime_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelSetOtherCleanTime; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelSetOtherCleanTimePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 232;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelSetOtherCleanTimePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelSetOtherCleanTimePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelSetOtherCleanTime ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelDisableObjectsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parceldisableobjects_taskids")]
|
|
public class TaskIDsBlock
|
|
{
|
|
public LLUUID TaskID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TaskIDsBlock() { }
|
|
public TaskIDsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TaskID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TaskID == null) { Console.WriteLine("Warning: TaskID is null, in " + this.GetType()); }
|
|
Array.Copy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TaskIDs --" + Environment.NewLine;
|
|
output += "TaskID: " + TaskID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceldisableobjects_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public uint ReturnType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ReturnType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(ReturnType % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 8) % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 16) % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "ReturnType: " + ReturnType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceldisableobjects_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceldisableobjects_ownerids")]
|
|
public class OwnerIDsBlock
|
|
{
|
|
public LLUUID OwnerID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public OwnerIDsBlock() { }
|
|
public OwnerIDsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- OwnerIDs --" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelDisableObjects; } }
|
|
public TaskIDsBlock[] TaskIDs;
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
public OwnerIDsBlock[] OwnerIDs;
|
|
|
|
public ParcelDisableObjectsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 233;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TaskIDs = new TaskIDsBlock[0];
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
OwnerIDs = new OwnerIDsBlock[0];
|
|
}
|
|
|
|
public ParcelDisableObjectsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
TaskIDs = new TaskIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ TaskIDs[j] = new TaskIDsBlock(bytes, ref i); }
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
OwnerIDs = new OwnerIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ OwnerIDs[j] = new OwnerIDsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ParcelDisableObjectsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
TaskIDs = new TaskIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ TaskIDs[j] = new TaskIDsBlock(bytes, ref i); }
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
OwnerIDs = new OwnerIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ OwnerIDs[j] = new OwnerIDsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < TaskIDs.Length; j++) { length += TaskIDs[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < OwnerIDs.Length; j++) { length += OwnerIDs[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)TaskIDs.Length;
|
|
for (int j = 0; j < TaskIDs.Length; j++) { TaskIDs[j].ToBytes(bytes, ref i); }
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)OwnerIDs.Length;
|
|
for (int j = 0; j < OwnerIDs.Length; j++) { OwnerIDs[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelDisableObjects ---" + Environment.NewLine;
|
|
for (int j = 0; j < TaskIDs.Length; j++)
|
|
{
|
|
output += TaskIDs[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < OwnerIDs.Length; j++)
|
|
{
|
|
output += OwnerIDs[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelSelectObjectsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelselectobjects_returnids")]
|
|
public class ReturnIDsBlock
|
|
{
|
|
public LLUUID ReturnID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ReturnIDsBlock() { }
|
|
public ReturnIDsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ReturnID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ReturnID == null) { Console.WriteLine("Warning: ReturnID is null, in " + this.GetType()); }
|
|
Array.Copy(ReturnID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReturnIDs --" + Environment.NewLine;
|
|
output += "ReturnID: " + ReturnID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelselectobjects_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public uint ReturnType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ReturnType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(ReturnType % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 8) % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 16) % 256);
|
|
bytes[i++] = (byte)((ReturnType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "ReturnType: " + ReturnType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelselectobjects_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelSelectObjects; } }
|
|
public ReturnIDsBlock[] ReturnIDs;
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelSelectObjectsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 234;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ReturnIDs = new ReturnIDsBlock[0];
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelSelectObjectsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ReturnIDs = new ReturnIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ReturnIDs[j] = new ReturnIDsBlock(bytes, ref i); }
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelSelectObjectsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ReturnIDs = new ReturnIDsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ReturnIDs[j] = new ReturnIDsBlock(bytes, ref i); }
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ReturnIDs.Length; j++) { length += ReturnIDs[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ReturnIDs.Length;
|
|
for (int j = 0; j < ReturnIDs.Length; j++) { ReturnIDs[j].ToBytes(bytes, ref i); }
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelSelectObjects ---" + Environment.NewLine;
|
|
for (int j = 0; j < ReturnIDs.Length; j++)
|
|
{
|
|
output += ReturnIDs[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EstateCovenantRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("estatecovenantrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EstateCovenantRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EstateCovenantRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 235;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EstateCovenantRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EstateCovenantRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EstateCovenantRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EstateCovenantReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("estatecovenantreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID CovenantID;
|
|
public uint CovenantTimestamp;
|
|
private byte[] _estatename;
|
|
public byte[] EstateName
|
|
{
|
|
get { return _estatename; }
|
|
set
|
|
{
|
|
if (value == null) { _estatename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _estatename = new byte[value.Length]; Array.Copy(value, _estatename, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID EstateOwnerID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 36;
|
|
if (EstateName != null) { length += 1 + EstateName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
CovenantID = new LLUUID(bytes, i); i += 16;
|
|
CovenantTimestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_estatename = new byte[length];
|
|
Array.Copy(bytes, i, _estatename, 0, length); i += length;
|
|
EstateOwnerID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(CovenantID == null) { Console.WriteLine("Warning: CovenantID is null, in " + this.GetType()); }
|
|
Array.Copy(CovenantID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(CovenantTimestamp % 256);
|
|
bytes[i++] = (byte)((CovenantTimestamp >> 8) % 256);
|
|
bytes[i++] = (byte)((CovenantTimestamp >> 16) % 256);
|
|
bytes[i++] = (byte)((CovenantTimestamp >> 24) % 256);
|
|
if(EstateName == null) { Console.WriteLine("Warning: EstateName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)EstateName.Length;
|
|
Array.Copy(EstateName, 0, bytes, i, EstateName.Length); i += EstateName.Length;
|
|
if(EstateOwnerID == null) { Console.WriteLine("Warning: EstateOwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(EstateOwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "CovenantID: " + CovenantID.ToString() + "" + Environment.NewLine;
|
|
output += "CovenantTimestamp: " + CovenantTimestamp.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(EstateName, "EstateName") + "" + Environment.NewLine;
|
|
output += "EstateOwnerID: " + EstateOwnerID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EstateCovenantReply; } }
|
|
public DataBlock Data;
|
|
|
|
public EstateCovenantReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 236;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
}
|
|
|
|
public EstateCovenantReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EstateCovenantReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EstateCovenantReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ForceObjectSelectPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("forceobjectselect_data")]
|
|
public class DataBlock
|
|
{
|
|
public uint LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("forceobjectselect_header")]
|
|
public class HeaderBlock
|
|
{
|
|
public bool ResetList;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public HeaderBlock() { }
|
|
public HeaderBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ResetList = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((ResetList) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Header --" + Environment.NewLine;
|
|
output += "ResetList: " + ResetList.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ForceObjectSelect; } }
|
|
public DataBlock[] Data;
|
|
public HeaderBlock _Header;
|
|
|
|
public ForceObjectSelectPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 237;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
_Header = new HeaderBlock();
|
|
}
|
|
|
|
public ForceObjectSelectPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
_Header = new HeaderBlock(bytes, ref i);
|
|
}
|
|
|
|
public ForceObjectSelectPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
_Header = new HeaderBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += _Header.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
_Header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ForceObjectSelect ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += _Header.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelBuyPassPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelbuypass_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelbuypass_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelBuyPass; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelBuyPassPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 238;
|
|
Header.Reliable = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelBuyPassPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelBuyPassPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelBuyPass ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelDeedToGroupPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parceldeedtogroup_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceldeedtogroup_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelDeedToGroup; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelDeedToGroupPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 239;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelDeedToGroupPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelDeedToGroupPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelDeedToGroup ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelReclaimPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelreclaim_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelreclaim_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelReclaim; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelReclaimPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 240;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelReclaimPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelReclaimPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelReclaim ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelClaimPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelclaim_data")]
|
|
public class DataBlock
|
|
{
|
|
public bool IsGroupOwned;
|
|
public LLUUID GroupID;
|
|
public bool Final;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 18;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
Final = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Final) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "Final: " + Final.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelclaim_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public float East;
|
|
public float West;
|
|
public float North;
|
|
public float South;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
East = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
West = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
North = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
South = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(East);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(West);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(North);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(South);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "East: " + East.ToString() + "" + Environment.NewLine;
|
|
output += "West: " + West.ToString() + "" + Environment.NewLine;
|
|
output += "North: " + North.ToString() + "" + Environment.NewLine;
|
|
output += "South: " + South.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelclaim_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelClaim; } }
|
|
public DataBlock Data;
|
|
public ParcelDataBlock[] ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelClaimPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 241;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
ParcelData = new ParcelDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelClaimPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParcelData = new ParcelDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelClaimPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParcelData = new ParcelDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ParcelData.Length; j++) { length += ParcelData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ParcelData.Length;
|
|
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelClaim ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ParcelData.Length; j++)
|
|
{
|
|
output += ParcelData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelJoinPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parceljoin_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public float East;
|
|
public float West;
|
|
public float North;
|
|
public float South;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
East = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
West = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
North = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
South = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(East);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(West);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(North);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(South);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "East: " + East.ToString() + "" + Environment.NewLine;
|
|
output += "West: " + West.ToString() + "" + Environment.NewLine;
|
|
output += "North: " + North.ToString() + "" + Environment.NewLine;
|
|
output += "South: " + South.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceljoin_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelJoin; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelJoinPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 242;
|
|
Header.Reliable = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelJoinPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelJoinPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelJoin ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelDividePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parceldivide_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public float East;
|
|
public float West;
|
|
public float North;
|
|
public float South;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
East = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
West = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
North = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
South = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(East);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(West);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(North);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(South);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "East: " + East.ToString() + "" + Environment.NewLine;
|
|
output += "West: " + West.ToString() + "" + Environment.NewLine;
|
|
output += "North: " + North.ToString() + "" + Environment.NewLine;
|
|
output += "South: " + South.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceldivide_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelDivide; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelDividePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 243;
|
|
Header.Reliable = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelDividePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelDividePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelDivide ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelReleasePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelrelease_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelrelease_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelRelease; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelReleasePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 244;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelReleasePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelReleasePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelRelease ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelBuyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelbuy_data")]
|
|
public class DataBlock
|
|
{
|
|
public bool RemoveContribution;
|
|
public int LocalID;
|
|
public bool IsGroupOwned;
|
|
public LLUUID GroupID;
|
|
public bool Final;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 23;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RemoveContribution = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
Final = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((RemoveContribution) ? 1 : 0);
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Final) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "RemoveContribution: " + RemoveContribution.ToString() + "" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "Final: " + Final.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelbuy_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelBuy; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelBuyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 245;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelBuyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelBuyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelBuy ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelGodForceOwnerPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelgodforceowner_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
public LLUUID OwnerID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelgodforceowner_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelGodForceOwner; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelGodForceOwnerPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 246;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelGodForceOwnerPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelGodForceOwnerPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelGodForceOwner ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelAccessListRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelaccesslistrequest_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
public int SequenceID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(SequenceID % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 24) % 256);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "SequenceID: " + SequenceID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelaccesslistrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelAccessListRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelAccessListRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 247;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelAccessListRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelAccessListRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelAccessListRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelAccessListReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelaccesslistreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public int LocalID;
|
|
public int SequenceID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 28;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(SequenceID % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 24) % 256);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "SequenceID: " + SequenceID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelaccesslistreply_list")]
|
|
public class ListBlock
|
|
{
|
|
public LLUUID ID;
|
|
public int Time;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public ListBlock() { }
|
|
public ListBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
Time = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Time % 256);
|
|
bytes[i++] = (byte)((Time >> 8) % 256);
|
|
bytes[i++] = (byte)((Time >> 16) % 256);
|
|
bytes[i++] = (byte)((Time >> 24) % 256);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- List --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Time: " + Time.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelAccessListReply; } }
|
|
public DataBlock Data;
|
|
public ListBlock[] List;
|
|
|
|
public ParcelAccessListReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 248;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
List = new ListBlock[0];
|
|
}
|
|
|
|
public ParcelAccessListReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
List = new ListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ List[j] = new ListBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ParcelAccessListReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
List = new ListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ List[j] = new ListBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length;;
|
|
length++;
|
|
for (int j = 0; j < List.Length; j++) { length += List[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)List.Length;
|
|
for (int j = 0; j < List.Length; j++) { List[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelAccessListReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < List.Length; j++)
|
|
{
|
|
output += List[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelAccessListUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelaccesslistupdate_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
public int Sections;
|
|
public int SequenceID;
|
|
public uint Flags;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Sections = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(Sections % 256);
|
|
bytes[i++] = (byte)((Sections >> 8) % 256);
|
|
bytes[i++] = (byte)((Sections >> 16) % 256);
|
|
bytes[i++] = (byte)((Sections >> 24) % 256);
|
|
bytes[i++] = (byte)(SequenceID % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 24) % 256);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "Sections: " + Sections.ToString() + "" + Environment.NewLine;
|
|
output += "SequenceID: " + SequenceID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelaccesslistupdate_list")]
|
|
public class ListBlock
|
|
{
|
|
public LLUUID ID;
|
|
public int Time;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public ListBlock() { }
|
|
public ListBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
Time = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Time % 256);
|
|
bytes[i++] = (byte)((Time >> 8) % 256);
|
|
bytes[i++] = (byte)((Time >> 16) % 256);
|
|
bytes[i++] = (byte)((Time >> 24) % 256);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- List --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Time: " + Time.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelaccesslistupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelAccessListUpdate; } }
|
|
public DataBlock Data;
|
|
public ListBlock[] List;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelAccessListUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 249;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Data = new DataBlock();
|
|
List = new ListBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelAccessListUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
List = new ListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ List[j] = new ListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelAccessListUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
List = new ListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ List[j] = new ListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < List.Length; j++) { length += List[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)List.Length;
|
|
for (int j = 0; j < List.Length; j++) { List[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelAccessListUpdate ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < List.Length; j++)
|
|
{
|
|
output += List[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelDwellRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parceldwellrequest_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
public LLUUID ParcelID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceldwellrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelDwellRequest; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelDwellRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 250;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelDwellRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelDwellRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelDwellRequest ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelDwellReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parceldwellreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public int LocalID;
|
|
public LLUUID ParcelID;
|
|
public float Dwell;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParcelID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Dwell = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
|
|
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Dwell);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelID: " + ParcelID.ToString() + "" + Environment.NewLine;
|
|
output += "Dwell: " + Dwell.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parceldwellreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelDwellReply; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelDwellReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 251;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelDwellReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelDwellReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelDwellReply ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelGodMarkAsContentPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelgodmarkascontent_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelgodmarkascontent_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelGodMarkAsContent; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelGodMarkAsContentPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 259;
|
|
Header.Reliable = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelGodMarkAsContentPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelGodMarkAsContentPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelGodMarkAsContent ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelGodReserveForNewbiePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelgodreservefornewbie_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public LLUUID SnapshotID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelgodreservefornewbie_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelGodReserveForNewbie; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelGodReserveForNewbiePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 260;
|
|
Header.Reliable = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelGodReserveForNewbiePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelGodReserveForNewbiePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelGodReserveForNewbie ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ViewerStartAuctionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("viewerstartauction_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public int LocalID;
|
|
public LLUUID SnapshotID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("viewerstartauction_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ViewerStartAuction; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ViewerStartAuctionPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 261;
|
|
Header.Reliable = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ViewerStartAuctionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ViewerStartAuctionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ViewerStartAuction ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UUIDNameRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("uuidnamerequest_uuidnameblock")]
|
|
public class UUIDNameBlockBlock
|
|
{
|
|
public LLUUID ID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public UUIDNameBlockBlock() { }
|
|
public UUIDNameBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UUIDNameBlock --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UUIDNameRequest; } }
|
|
public UUIDNameBlockBlock[] UUIDNameBlock;
|
|
|
|
public UUIDNameRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 268;
|
|
Header.Reliable = true;
|
|
UUIDNameBlock = new UUIDNameBlockBlock[0];
|
|
}
|
|
|
|
public UUIDNameRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public UUIDNameRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)UUIDNameBlock.Length;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { UUIDNameBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UUIDNameRequest ---" + Environment.NewLine;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++)
|
|
{
|
|
output += UUIDNameBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UUIDNameReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("uuidnamereply_uuidnameblock")]
|
|
public class UUIDNameBlockBlock
|
|
{
|
|
public LLUUID ID;
|
|
private byte[] _lastname;
|
|
public byte[] LastName
|
|
{
|
|
get { return _lastname; }
|
|
set
|
|
{
|
|
if (value == null) { _lastname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _lastname = new byte[value.Length]; Array.Copy(value, _lastname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _firstname;
|
|
public byte[] FirstName
|
|
{
|
|
get { return _firstname; }
|
|
set
|
|
{
|
|
if (value == null) { _firstname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _firstname = new byte[value.Length]; Array.Copy(value, _firstname, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (LastName != null) { length += 1 + LastName.Length; }
|
|
if (FirstName != null) { length += 1 + FirstName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public UUIDNameBlockBlock() { }
|
|
public UUIDNameBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_lastname = new byte[length];
|
|
Array.Copy(bytes, i, _lastname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_firstname = new byte[length];
|
|
Array.Copy(bytes, i, _firstname, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LastName.Length;
|
|
Array.Copy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length;
|
|
if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FirstName.Length;
|
|
Array.Copy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UUIDNameBlock --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LastName, "LastName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FirstName, "FirstName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UUIDNameReply; } }
|
|
public UUIDNameBlockBlock[] UUIDNameBlock;
|
|
|
|
public UUIDNameReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 269;
|
|
Header.Reliable = true;
|
|
UUIDNameBlock = new UUIDNameBlockBlock[0];
|
|
}
|
|
|
|
public UUIDNameReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public UUIDNameReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)UUIDNameBlock.Length;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { UUIDNameBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UUIDNameReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++)
|
|
{
|
|
output += UUIDNameBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UUIDGroupNameRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("uuidgroupnamerequest_uuidnameblock")]
|
|
public class UUIDNameBlockBlock
|
|
{
|
|
public LLUUID ID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public UUIDNameBlockBlock() { }
|
|
public UUIDNameBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UUIDNameBlock --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UUIDGroupNameRequest; } }
|
|
public UUIDNameBlockBlock[] UUIDNameBlock;
|
|
|
|
public UUIDGroupNameRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 270;
|
|
Header.Reliable = true;
|
|
UUIDNameBlock = new UUIDNameBlockBlock[0];
|
|
}
|
|
|
|
public UUIDGroupNameRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public UUIDGroupNameRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)UUIDNameBlock.Length;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { UUIDNameBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UUIDGroupNameRequest ---" + Environment.NewLine;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++)
|
|
{
|
|
output += UUIDNameBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UUIDGroupNameReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("uuidgroupnamereply_uuidnameblock")]
|
|
public class UUIDNameBlockBlock
|
|
{
|
|
public LLUUID ID;
|
|
private byte[] _groupname;
|
|
public byte[] GroupName
|
|
{
|
|
get { return _groupname; }
|
|
set
|
|
{
|
|
if (value == null) { _groupname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _groupname = new byte[value.Length]; Array.Copy(value, _groupname, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (GroupName != null) { length += 1 + GroupName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public UUIDNameBlockBlock() { }
|
|
public UUIDNameBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_groupname = new byte[length];
|
|
Array.Copy(bytes, i, _groupname, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupName.Length;
|
|
Array.Copy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UUIDNameBlock --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupName, "GroupName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UUIDGroupNameReply; } }
|
|
public UUIDNameBlockBlock[] UUIDNameBlock;
|
|
|
|
public UUIDGroupNameReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 271;
|
|
Header.Reliable = true;
|
|
UUIDNameBlock = new UUIDNameBlockBlock[0];
|
|
}
|
|
|
|
public UUIDGroupNameReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public UUIDGroupNameReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
UUIDNameBlock = new UUIDNameBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ UUIDNameBlock[j] = new UUIDNameBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)UUIDNameBlock.Length;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++) { UUIDNameBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UUIDGroupNameReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < UUIDNameBlock.Length; j++)
|
|
{
|
|
output += UUIDNameBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChildAgentDyingPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("childagentdying_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChildAgentDying; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ChildAgentDyingPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 273;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ChildAgentDyingPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChildAgentDyingPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChildAgentDying ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChildAgentUnknownPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("childagentunknown_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChildAgentUnknown; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ChildAgentUnknownPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 274;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ChildAgentUnknownPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChildAgentUnknownPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChildAgentUnknown ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GetScriptRunningPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("getscriptrunning_script")]
|
|
public class ScriptBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public ScriptBlock() { }
|
|
public ScriptBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Script --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GetScriptRunning; } }
|
|
public ScriptBlock Script;
|
|
|
|
public GetScriptRunningPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 276;
|
|
Header.Reliable = true;
|
|
Script = new ScriptBlock();
|
|
}
|
|
|
|
public GetScriptRunningPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
}
|
|
|
|
public GetScriptRunningPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Script.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Script.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GetScriptRunning ---" + Environment.NewLine;
|
|
output += Script.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptRunningReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptrunningreply_script")]
|
|
public class ScriptBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public bool Running;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public ScriptBlock() { }
|
|
public ScriptBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
Running = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Running) ? 1 : 0);
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Script --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Running: " + Running.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptRunningReply; } }
|
|
public ScriptBlock Script;
|
|
|
|
public ScriptRunningReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 277;
|
|
Header.Reliable = true;
|
|
Script = new ScriptBlock();
|
|
}
|
|
|
|
public ScriptRunningReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
}
|
|
|
|
public ScriptRunningReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Script.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Script.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptRunningReply ---" + Environment.NewLine;
|
|
output += Script.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SetScriptRunningPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("setscriptrunning_script")]
|
|
public class ScriptBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public bool Running;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public ScriptBlock() { }
|
|
public ScriptBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
Running = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Running) ? 1 : 0);
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Script --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Running: " + Running.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("setscriptrunning_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SetScriptRunning; } }
|
|
public ScriptBlock Script;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SetScriptRunningPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 278;
|
|
Header.Reliable = true;
|
|
Script = new ScriptBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SetScriptRunningPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SetScriptRunningPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Script.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Script.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SetScriptRunning ---" + Environment.NewLine;
|
|
output += Script.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ScriptResetPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("scriptreset_script")]
|
|
public class ScriptBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public ScriptBlock() { }
|
|
public ScriptBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Script --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("scriptreset_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ScriptReset; } }
|
|
public ScriptBlock Script;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ScriptResetPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 279;
|
|
Header.Reliable = true;
|
|
Script = new ScriptBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ScriptResetPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ScriptResetPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Script = new ScriptBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Script.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Script.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ScriptReset ---" + Environment.NewLine;
|
|
output += Script.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CompleteAgentMovementPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("completeagentmovement_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public uint CircuitCode;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(CircuitCode % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((CircuitCode >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "CircuitCode: " + CircuitCode.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CompleteAgentMovement; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public CompleteAgentMovementPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 282;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public CompleteAgentMovementPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CompleteAgentMovementPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CompleteAgentMovement ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentMovementCompletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentmovementcomplete_data")]
|
|
public class DataBlock
|
|
{
|
|
public uint Timestamp;
|
|
public ulong RegionHandle;
|
|
public LLVector3 LookAt;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
LookAt = new LLVector3(bytes, i); i += 12;
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Timestamp % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 8) % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 16) % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 24) % 256);
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "Timestamp: " + Timestamp.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output += "LookAt: " + LookAt.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentmovementcomplete_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentMovementComplete; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentMovementCompletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 283;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentMovementCompletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentMovementCompletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentMovementComplete ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ConnectAgentToUserserverPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("connectagenttouserserver_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ConnectAgentToUserserver; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ConnectAgentToUserserverPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 285;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ConnectAgentToUserserverPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ConnectAgentToUserserverPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ConnectAgentToUserserver ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ConnectToUserserverPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ConnectToUserserver; } }
|
|
|
|
public ConnectToUserserverPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 286;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public ConnectToUserserverPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public ConnectToUserserverPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ConnectToUserserver ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LogoutRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("logoutrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LogoutRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public LogoutRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 288;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public LogoutRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LogoutRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LogoutRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class FinalizeLogoutPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("finalizelogout_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.FinalizeLogout; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public FinalizeLogoutPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 289;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public FinalizeLogoutPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public FinalizeLogoutPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- FinalizeLogout ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LogoutReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("logoutreply_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("logoutreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LogoutReply; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public LogoutReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 290;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public LogoutReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LogoutReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LogoutReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LogoutDemandPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("logoutdemand_logoutblock")]
|
|
public class LogoutBlockBlock
|
|
{
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public LogoutBlockBlock() { }
|
|
public LogoutBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- LogoutBlock --" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LogoutDemand; } }
|
|
public LogoutBlockBlock LogoutBlock;
|
|
|
|
public LogoutDemandPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 291;
|
|
Header.Reliable = true;
|
|
LogoutBlock = new LogoutBlockBlock();
|
|
}
|
|
|
|
public LogoutDemandPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
LogoutBlock = new LogoutBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public LogoutDemandPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
LogoutBlock = new LogoutBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += LogoutBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
LogoutBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LogoutDemand ---" + Environment.NewLine;
|
|
output += LogoutBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ImprovedInstantMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("improvedinstantmessage_messageblock")]
|
|
public class MessageBlockBlock
|
|
{
|
|
public LLUUID ID;
|
|
public LLUUID ToAgentID;
|
|
public byte Offline;
|
|
public uint Timestamp;
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID RegionID;
|
|
public byte Dialog;
|
|
public bool FromGroup;
|
|
private byte[] _binarybucket;
|
|
public byte[] BinaryBucket
|
|
{
|
|
get { return _binarybucket; }
|
|
set
|
|
{
|
|
if (value == null) { _binarybucket = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _binarybucket = new byte[value.Length]; Array.Copy(value, _binarybucket, value.Length); }
|
|
}
|
|
}
|
|
public uint ParentEstateID;
|
|
private byte[] _fromagentname;
|
|
public byte[] FromAgentName
|
|
{
|
|
get { return _fromagentname; }
|
|
set
|
|
{
|
|
if (value == null) { _fromagentname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _fromagentname = new byte[value.Length]; Array.Copy(value, _fromagentname, value.Length); }
|
|
}
|
|
}
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 71;
|
|
if (Message != null) { length += 2 + Message.Length; }
|
|
if (BinaryBucket != null) { length += 2 + BinaryBucket.Length; }
|
|
if (FromAgentName != null) { length += 1 + FromAgentName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MessageBlockBlock() { }
|
|
public MessageBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
ToAgentID = new LLUUID(bytes, i); i += 16;
|
|
Offline = (byte)bytes[i++];
|
|
Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
RegionID = new LLUUID(bytes, i); i += 16;
|
|
Dialog = (byte)bytes[i++];
|
|
FromGroup = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_binarybucket = new byte[length];
|
|
Array.Copy(bytes, i, _binarybucket, 0, length); i += length;
|
|
ParentEstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_fromagentname = new byte[length];
|
|
Array.Copy(bytes, i, _fromagentname, 0, length); i += length;
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ToAgentID == null) { Console.WriteLine("Warning: ToAgentID is null, in " + this.GetType()); }
|
|
Array.Copy(ToAgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Offline;
|
|
bytes[i++] = (byte)(Timestamp % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 8) % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 16) % 256);
|
|
bytes[i++] = (byte)((Timestamp >> 24) % 256);
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Message.Length % 256);
|
|
bytes[i++] = (byte)((Message.Length >> 8) % 256);
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
|
|
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Dialog;
|
|
bytes[i++] = (byte)((FromGroup) ? 1 : 0);
|
|
if(BinaryBucket == null) { Console.WriteLine("Warning: BinaryBucket is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(BinaryBucket.Length % 256);
|
|
bytes[i++] = (byte)((BinaryBucket.Length >> 8) % 256);
|
|
Array.Copy(BinaryBucket, 0, bytes, i, BinaryBucket.Length); i += BinaryBucket.Length;
|
|
bytes[i++] = (byte)(ParentEstateID % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((ParentEstateID >> 24) % 256);
|
|
if(FromAgentName == null) { Console.WriteLine("Warning: FromAgentName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FromAgentName.Length;
|
|
Array.Copy(FromAgentName, 0, bytes, i, FromAgentName.Length); i += FromAgentName.Length;
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MessageBlock --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "ToAgentID: " + ToAgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Offline: " + Offline.ToString() + "" + Environment.NewLine;
|
|
output += "Timestamp: " + Timestamp.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "RegionID: " + RegionID.ToString() + "" + Environment.NewLine;
|
|
output += "Dialog: " + Dialog.ToString() + "" + Environment.NewLine;
|
|
output += "FromGroup: " + FromGroup.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(BinaryBucket, "BinaryBucket") + "" + Environment.NewLine;
|
|
output += "ParentEstateID: " + ParentEstateID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FromAgentName, "FromAgentName") + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("improvedinstantmessage_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ImprovedInstantMessage; } }
|
|
public MessageBlockBlock MessageBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ImprovedInstantMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 292;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MessageBlock = new MessageBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ImprovedInstantMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MessageBlock = new MessageBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ImprovedInstantMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MessageBlock = new MessageBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MessageBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MessageBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ImprovedInstantMessage ---" + Environment.NewLine;
|
|
output += MessageBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RetrieveInstantMessagesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("retrieveinstantmessages_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RetrieveInstantMessages; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RetrieveInstantMessagesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 293;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RetrieveInstantMessagesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RetrieveInstantMessagesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RetrieveInstantMessages ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DequeueInstantMessagesPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DequeueInstantMessages; } }
|
|
|
|
public DequeueInstantMessagesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 294;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public DequeueInstantMessagesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public DequeueInstantMessagesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DequeueInstantMessages ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class FindAgentPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("findagent_locationblock")]
|
|
public class LocationBlockBlock
|
|
{
|
|
public double GlobalX;
|
|
public double GlobalY;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public LocationBlockBlock() { }
|
|
public LocationBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8);
|
|
GlobalX = BitConverter.ToDouble(bytes, i); i += 8;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8);
|
|
GlobalY = BitConverter.ToDouble(bytes, i); i += 8;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(GlobalX);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); }
|
|
Array.Copy(ba, 0, bytes, i, 8); i += 8;
|
|
ba = BitConverter.GetBytes(GlobalY);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); }
|
|
Array.Copy(ba, 0, bytes, i, 8); i += 8;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- LocationBlock --" + Environment.NewLine;
|
|
output += "GlobalX: " + GlobalX.ToString() + "" + Environment.NewLine;
|
|
output += "GlobalY: " + GlobalY.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("findagent_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public uint SpaceIP;
|
|
public LLUUID Prey;
|
|
public LLUUID Hunter;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SpaceIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Prey = new LLUUID(bytes, i); i += 16;
|
|
Hunter = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SpaceIP % 256);
|
|
bytes[i++] = (byte)((SpaceIP >> 8) % 256);
|
|
bytes[i++] = (byte)((SpaceIP >> 16) % 256);
|
|
bytes[i++] = (byte)((SpaceIP >> 24) % 256);
|
|
if(Prey == null) { Console.WriteLine("Warning: Prey is null, in " + this.GetType()); }
|
|
Array.Copy(Prey.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Hunter == null) { Console.WriteLine("Warning: Hunter is null, in " + this.GetType()); }
|
|
Array.Copy(Hunter.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "SpaceIP: " + SpaceIP.ToString() + "" + Environment.NewLine;
|
|
output += "Prey: " + Prey.ToString() + "" + Environment.NewLine;
|
|
output += "Hunter: " + Hunter.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.FindAgent; } }
|
|
public LocationBlockBlock[] LocationBlock;
|
|
public AgentBlockBlock AgentBlock;
|
|
|
|
public FindAgentPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 295;
|
|
Header.Reliable = true;
|
|
LocationBlock = new LocationBlockBlock[0];
|
|
AgentBlock = new AgentBlockBlock();
|
|
}
|
|
|
|
public FindAgentPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
LocationBlock = new LocationBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ LocationBlock[j] = new LocationBlockBlock(bytes, ref i); }
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public FindAgentPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
LocationBlock = new LocationBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ LocationBlock[j] = new LocationBlockBlock(bytes, ref i); }
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentBlock.Length;;
|
|
length++;
|
|
for (int j = 0; j < LocationBlock.Length; j++) { length += LocationBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)LocationBlock.Length;
|
|
for (int j = 0; j < LocationBlock.Length; j++) { LocationBlock[j].ToBytes(bytes, ref i); }
|
|
AgentBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- FindAgent ---" + Environment.NewLine;
|
|
for (int j = 0; j < LocationBlock.Length; j++)
|
|
{
|
|
output += LocationBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestGodlikePowersPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestgodlikepowers_requestblock")]
|
|
public class RequestBlockBlock
|
|
{
|
|
public bool Godlike;
|
|
public LLUUID Token;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public RequestBlockBlock() { }
|
|
public RequestBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Token = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Godlike) ? 1 : 0);
|
|
if(Token == null) { Console.WriteLine("Warning: Token is null, in " + this.GetType()); }
|
|
Array.Copy(Token.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestBlock --" + Environment.NewLine;
|
|
output += "Godlike: " + Godlike.ToString() + "" + Environment.NewLine;
|
|
output += "Token: " + Token.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("requestgodlikepowers_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestGodlikePowers; } }
|
|
public RequestBlockBlock RequestBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RequestGodlikePowersPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 296;
|
|
Header.Reliable = true;
|
|
RequestBlock = new RequestBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RequestGodlikePowersPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RequestBlock = new RequestBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestGodlikePowersPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RequestBlock = new RequestBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RequestBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RequestBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestGodlikePowers ---" + Environment.NewLine;
|
|
output += RequestBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GrantGodlikePowersPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grantgodlikepowers_grantdata")]
|
|
public class GrantDataBlock
|
|
{
|
|
public byte GodLevel;
|
|
public LLUUID Token;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public GrantDataBlock() { }
|
|
public GrantDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GodLevel = (byte)bytes[i++];
|
|
Token = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = GodLevel;
|
|
if(Token == null) { Console.WriteLine("Warning: Token is null, in " + this.GetType()); }
|
|
Array.Copy(Token.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GrantData --" + Environment.NewLine;
|
|
output += "GodLevel: " + GodLevel.ToString() + "" + Environment.NewLine;
|
|
output += "Token: " + Token.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grantgodlikepowers_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GrantGodlikePowers; } }
|
|
public GrantDataBlock GrantData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GrantGodlikePowersPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 297;
|
|
Header.Reliable = true;
|
|
GrantData = new GrantDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GrantGodlikePowersPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
GrantData = new GrantDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GrantGodlikePowersPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
GrantData = new GrantDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += GrantData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
GrantData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GrantGodlikePowers ---" + Environment.NewLine;
|
|
output += GrantData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GodlikeMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("godlikemessage_methoddata")]
|
|
public class MethodDataBlock
|
|
{
|
|
public LLUUID Invoice;
|
|
private byte[] _method;
|
|
public byte[] Method
|
|
{
|
|
get { return _method; }
|
|
set
|
|
{
|
|
if (value == null) { _method = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _method = new byte[value.Length]; Array.Copy(value, _method, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Method != null) { length += 1 + Method.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MethodDataBlock() { }
|
|
public MethodDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Invoice = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_method = new byte[length];
|
|
Array.Copy(bytes, i, _method, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Invoice == null) { Console.WriteLine("Warning: Invoice is null, in " + this.GetType()); }
|
|
Array.Copy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Method == null) { Console.WriteLine("Warning: Method is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Method.Length;
|
|
Array.Copy(Method, 0, bytes, i, Method.Length); i += Method.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MethodData --" + Environment.NewLine;
|
|
output += "Invoice: " + Invoice.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Method, "Method") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("godlikemessage_paramlist")]
|
|
public class ParamListBlock
|
|
{
|
|
private byte[] _parameter;
|
|
public byte[] Parameter
|
|
{
|
|
get { return _parameter; }
|
|
set
|
|
{
|
|
if (value == null) { _parameter = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _parameter = new byte[value.Length]; Array.Copy(value, _parameter, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Parameter != null) { length += 1 + Parameter.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ParamListBlock() { }
|
|
public ParamListBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_parameter = new byte[length];
|
|
Array.Copy(bytes, i, _parameter, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Parameter == null) { Console.WriteLine("Warning: Parameter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Parameter.Length;
|
|
Array.Copy(Parameter, 0, bytes, i, Parameter.Length); i += Parameter.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParamList --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Parameter, "Parameter") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("godlikemessage_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GodlikeMessage; } }
|
|
public MethodDataBlock MethodData;
|
|
public ParamListBlock[] ParamList;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GodlikeMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 298;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MethodData = new MethodDataBlock();
|
|
ParamList = new ParamListBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GodlikeMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GodlikeMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MethodData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ParamList.Length; j++) { length += ParamList[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MethodData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ParamList.Length;
|
|
for (int j = 0; j < ParamList.Length; j++) { ParamList[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GodlikeMessage ---" + Environment.NewLine;
|
|
output += MethodData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ParamList.Length; j++)
|
|
{
|
|
output += ParamList[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EstateOwnerMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("estateownermessage_methoddata")]
|
|
public class MethodDataBlock
|
|
{
|
|
public LLUUID Invoice;
|
|
private byte[] _method;
|
|
public byte[] Method
|
|
{
|
|
get { return _method; }
|
|
set
|
|
{
|
|
if (value == null) { _method = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _method = new byte[value.Length]; Array.Copy(value, _method, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Method != null) { length += 1 + Method.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MethodDataBlock() { }
|
|
public MethodDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Invoice = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_method = new byte[length];
|
|
Array.Copy(bytes, i, _method, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Invoice == null) { Console.WriteLine("Warning: Invoice is null, in " + this.GetType()); }
|
|
Array.Copy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Method == null) { Console.WriteLine("Warning: Method is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Method.Length;
|
|
Array.Copy(Method, 0, bytes, i, Method.Length); i += Method.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MethodData --" + Environment.NewLine;
|
|
output += "Invoice: " + Invoice.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Method, "Method") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("estateownermessage_paramlist")]
|
|
public class ParamListBlock
|
|
{
|
|
private byte[] _parameter;
|
|
public byte[] Parameter
|
|
{
|
|
get { return _parameter; }
|
|
set
|
|
{
|
|
if (value == null) { _parameter = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _parameter = new byte[value.Length]; Array.Copy(value, _parameter, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Parameter != null) { length += 1 + Parameter.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ParamListBlock() { }
|
|
public ParamListBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_parameter = new byte[length];
|
|
Array.Copy(bytes, i, _parameter, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Parameter == null) { Console.WriteLine("Warning: Parameter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Parameter.Length;
|
|
Array.Copy(Parameter, 0, bytes, i, Parameter.Length); i += Parameter.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParamList --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Parameter, "Parameter") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("estateownermessage_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EstateOwnerMessage; } }
|
|
public MethodDataBlock MethodData;
|
|
public ParamListBlock[] ParamList;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public EstateOwnerMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 299;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MethodData = new MethodDataBlock();
|
|
ParamList = new ParamListBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public EstateOwnerMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EstateOwnerMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MethodData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ParamList.Length; j++) { length += ParamList[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MethodData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ParamList.Length;
|
|
for (int j = 0; j < ParamList.Length; j++) { ParamList[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EstateOwnerMessage ---" + Environment.NewLine;
|
|
output += MethodData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ParamList.Length; j++)
|
|
{
|
|
output += ParamList[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GenericMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("genericmessage_methoddata")]
|
|
public class MethodDataBlock
|
|
{
|
|
public LLUUID Invoice;
|
|
private byte[] _method;
|
|
public byte[] Method
|
|
{
|
|
get { return _method; }
|
|
set
|
|
{
|
|
if (value == null) { _method = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _method = new byte[value.Length]; Array.Copy(value, _method, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Method != null) { length += 1 + Method.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MethodDataBlock() { }
|
|
public MethodDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Invoice = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_method = new byte[length];
|
|
Array.Copy(bytes, i, _method, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Invoice == null) { Console.WriteLine("Warning: Invoice is null, in " + this.GetType()); }
|
|
Array.Copy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Method == null) { Console.WriteLine("Warning: Method is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Method.Length;
|
|
Array.Copy(Method, 0, bytes, i, Method.Length); i += Method.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MethodData --" + Environment.NewLine;
|
|
output += "Invoice: " + Invoice.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Method, "Method") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("genericmessage_paramlist")]
|
|
public class ParamListBlock
|
|
{
|
|
private byte[] _parameter;
|
|
public byte[] Parameter
|
|
{
|
|
get { return _parameter; }
|
|
set
|
|
{
|
|
if (value == null) { _parameter = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _parameter = new byte[value.Length]; Array.Copy(value, _parameter, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Parameter != null) { length += 1 + Parameter.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ParamListBlock() { }
|
|
public ParamListBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_parameter = new byte[length];
|
|
Array.Copy(bytes, i, _parameter, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Parameter == null) { Console.WriteLine("Warning: Parameter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Parameter.Length;
|
|
Array.Copy(Parameter, 0, bytes, i, Parameter.Length); i += Parameter.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParamList --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Parameter, "Parameter") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("genericmessage_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GenericMessage; } }
|
|
public MethodDataBlock MethodData;
|
|
public ParamListBlock[] ParamList;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GenericMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 300;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MethodData = new MethodDataBlock();
|
|
ParamList = new ParamListBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GenericMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GenericMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MethodData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ParamList.Length; j++) { length += ParamList[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MethodData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ParamList.Length;
|
|
for (int j = 0; j < ParamList.Length; j++) { ParamList[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GenericMessage ---" + Environment.NewLine;
|
|
output += MethodData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ParamList.Length; j++)
|
|
{
|
|
output += ParamList[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MuteListRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("mutelistrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("mutelistrequest_mutedata")]
|
|
public class MuteDataBlock
|
|
{
|
|
public uint MuteCRC;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public MuteDataBlock() { }
|
|
public MuteDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
MuteCRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(MuteCRC % 256);
|
|
bytes[i++] = (byte)((MuteCRC >> 8) % 256);
|
|
bytes[i++] = (byte)((MuteCRC >> 16) % 256);
|
|
bytes[i++] = (byte)((MuteCRC >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MuteData --" + Environment.NewLine;
|
|
output += "MuteCRC: " + MuteCRC.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MuteListRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public MuteDataBlock MuteData;
|
|
|
|
public MuteListRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 301;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
MuteData = new MuteDataBlock();
|
|
}
|
|
|
|
public MuteListRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MuteListRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += MuteData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
MuteData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MuteListRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += MuteData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UpdateMuteListEntryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("updatemutelistentry_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updatemutelistentry_mutedata")]
|
|
public class MuteDataBlock
|
|
{
|
|
public LLUUID MuteID;
|
|
public uint MuteFlags;
|
|
private byte[] _mutename;
|
|
public byte[] MuteName
|
|
{
|
|
get { return _mutename; }
|
|
set
|
|
{
|
|
if (value == null) { _mutename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _mutename = new byte[value.Length]; Array.Copy(value, _mutename, value.Length); }
|
|
}
|
|
}
|
|
public int MuteType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (MuteName != null) { length += 1 + MuteName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MuteDataBlock() { }
|
|
public MuteDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
MuteID = new LLUUID(bytes, i); i += 16;
|
|
MuteFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_mutename = new byte[length];
|
|
Array.Copy(bytes, i, _mutename, 0, length); i += length;
|
|
MuteType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(MuteID == null) { Console.WriteLine("Warning: MuteID is null, in " + this.GetType()); }
|
|
Array.Copy(MuteID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MuteFlags % 256);
|
|
bytes[i++] = (byte)((MuteFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((MuteFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((MuteFlags >> 24) % 256);
|
|
if(MuteName == null) { Console.WriteLine("Warning: MuteName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MuteName.Length;
|
|
Array.Copy(MuteName, 0, bytes, i, MuteName.Length); i += MuteName.Length;
|
|
bytes[i++] = (byte)(MuteType % 256);
|
|
bytes[i++] = (byte)((MuteType >> 8) % 256);
|
|
bytes[i++] = (byte)((MuteType >> 16) % 256);
|
|
bytes[i++] = (byte)((MuteType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MuteData --" + Environment.NewLine;
|
|
output += "MuteID: " + MuteID.ToString() + "" + Environment.NewLine;
|
|
output += "MuteFlags: " + MuteFlags.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MuteName, "MuteName") + "" + Environment.NewLine;
|
|
output += "MuteType: " + MuteType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UpdateMuteListEntry; } }
|
|
public AgentDataBlock AgentData;
|
|
public MuteDataBlock MuteData;
|
|
|
|
public UpdateMuteListEntryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 302;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
MuteData = new MuteDataBlock();
|
|
}
|
|
|
|
public UpdateMuteListEntryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UpdateMuteListEntryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += MuteData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
MuteData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UpdateMuteListEntry ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += MuteData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RemoveMuteListEntryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("removemutelistentry_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("removemutelistentry_mutedata")]
|
|
public class MuteDataBlock
|
|
{
|
|
public LLUUID MuteID;
|
|
private byte[] _mutename;
|
|
public byte[] MuteName
|
|
{
|
|
get { return _mutename; }
|
|
set
|
|
{
|
|
if (value == null) { _mutename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _mutename = new byte[value.Length]; Array.Copy(value, _mutename, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (MuteName != null) { length += 1 + MuteName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MuteDataBlock() { }
|
|
public MuteDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
MuteID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_mutename = new byte[length];
|
|
Array.Copy(bytes, i, _mutename, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(MuteID == null) { Console.WriteLine("Warning: MuteID is null, in " + this.GetType()); }
|
|
Array.Copy(MuteID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(MuteName == null) { Console.WriteLine("Warning: MuteName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MuteName.Length;
|
|
Array.Copy(MuteName, 0, bytes, i, MuteName.Length); i += MuteName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MuteData --" + Environment.NewLine;
|
|
output += "MuteID: " + MuteID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MuteName, "MuteName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RemoveMuteListEntry; } }
|
|
public AgentDataBlock AgentData;
|
|
public MuteDataBlock MuteData;
|
|
|
|
public RemoveMuteListEntryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 303;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
MuteData = new MuteDataBlock();
|
|
}
|
|
|
|
public RemoveMuteListEntryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RemoveMuteListEntryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += MuteData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
MuteData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RemoveMuteListEntry ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += MuteData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CopyInventoryFromNotecardPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("copyinventoryfromnotecard_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("copyinventoryfromnotecard_notecarddata")]
|
|
public class NotecardDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLUUID NotecardItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public NotecardDataBlock() { }
|
|
public NotecardDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
NotecardItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(NotecardItemID == null) { Console.WriteLine("Warning: NotecardItemID is null, in " + this.GetType()); }
|
|
Array.Copy(NotecardItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- NotecardData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "NotecardItemID: " + NotecardItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("copyinventoryfromnotecard_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CopyInventoryFromNotecard; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public NotecardDataBlock NotecardData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public CopyInventoryFromNotecardPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 304;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
NotecardData = new NotecardDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public CopyInventoryFromNotecardPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
NotecardData = new NotecardDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CopyInventoryFromNotecardPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
NotecardData = new NotecardDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += NotecardData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
NotecardData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CopyInventoryFromNotecard ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += NotecardData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UpdateInventoryItemPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("updateinventoryitem_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint CallbackID;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public LLUUID TransactionID;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 140;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(CallbackID % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 8) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 16) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 24) % 256);
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "CallbackID: " + CallbackID.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updateinventoryitem_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UpdateInventoryItem; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UpdateInventoryItemPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 305;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UpdateInventoryItemPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UpdateInventoryItemPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UpdateInventoryItem ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UpdateCreateInventoryItemPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("updatecreateinventoryitem_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint CallbackID;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID AssetID;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 140;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(CallbackID % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 8) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 16) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 24) % 256);
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "CallbackID: " + CallbackID.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updatecreateinventoryitem_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public bool SimApproved;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SimApproved = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((SimApproved) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SimApproved: " + SimApproved.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UpdateCreateInventoryItem; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UpdateCreateInventoryItemPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 306;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UpdateCreateInventoryItemPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UpdateCreateInventoryItemPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UpdateCreateInventoryItem ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoveInventoryItemPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moveinventoryitem_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
private byte[] _newname;
|
|
public byte[] NewName
|
|
{
|
|
get { return _newname; }
|
|
set
|
|
{
|
|
if (value == null) { _newname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _newname = new byte[value.Length]; Array.Copy(value, _newname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 32;
|
|
if (NewName != null) { length += 1 + NewName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_newname = new byte[length];
|
|
Array.Copy(bytes, i, _newname, 0, length); i += length;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(NewName == null) { Console.WriteLine("Warning: NewName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)NewName.Length;
|
|
Array.Copy(NewName, 0, bytes, i, NewName.Length); i += NewName.Length;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(NewName, "NewName") + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moveinventoryitem_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool Stamp;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Stamp = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Stamp) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Stamp: " + Stamp.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoveInventoryItem; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoveInventoryItemPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 307;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoveInventoryItemPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoveInventoryItemPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoveInventoryItem ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CopyInventoryItemPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("copyinventoryitem_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
private byte[] _newname;
|
|
public byte[] NewName
|
|
{
|
|
get { return _newname; }
|
|
set
|
|
{
|
|
if (value == null) { _newname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _newname = new byte[value.Length]; Array.Copy(value, _newname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID NewFolderID;
|
|
public uint CallbackID;
|
|
public LLUUID OldItemID;
|
|
public LLUUID OldAgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 52;
|
|
if (NewName != null) { length += 1 + NewName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_newname = new byte[length];
|
|
Array.Copy(bytes, i, _newname, 0, length); i += length;
|
|
NewFolderID = new LLUUID(bytes, i); i += 16;
|
|
CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OldItemID = new LLUUID(bytes, i); i += 16;
|
|
OldAgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(NewName == null) { Console.WriteLine("Warning: NewName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)NewName.Length;
|
|
Array.Copy(NewName, 0, bytes, i, NewName.Length); i += NewName.Length;
|
|
if(NewFolderID == null) { Console.WriteLine("Warning: NewFolderID is null, in " + this.GetType()); }
|
|
Array.Copy(NewFolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(CallbackID % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 8) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 16) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 24) % 256);
|
|
if(OldItemID == null) { Console.WriteLine("Warning: OldItemID is null, in " + this.GetType()); }
|
|
Array.Copy(OldItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(OldAgentID == null) { Console.WriteLine("Warning: OldAgentID is null, in " + this.GetType()); }
|
|
Array.Copy(OldAgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(NewName, "NewName") + "" + Environment.NewLine;
|
|
output += "NewFolderID: " + NewFolderID.ToString() + "" + Environment.NewLine;
|
|
output += "CallbackID: " + CallbackID.ToString() + "" + Environment.NewLine;
|
|
output += "OldItemID: " + OldItemID.ToString() + "" + Environment.NewLine;
|
|
output += "OldAgentID: " + OldAgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("copyinventoryitem_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CopyInventoryItem; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public CopyInventoryItemPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 308;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public CopyInventoryItemPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CopyInventoryItemPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CopyInventoryItem ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RemoveInventoryItemPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("removeinventoryitem_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("removeinventoryitem_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RemoveInventoryItem; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RemoveInventoryItemPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 309;
|
|
Header.Reliable = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RemoveInventoryItemPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RemoveInventoryItemPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RemoveInventoryItem ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChangeInventoryItemFlagsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("changeinventoryitemflags_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID ItemID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("changeinventoryitemflags_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChangeInventoryItemFlags; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ChangeInventoryItemFlagsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 310;
|
|
Header.Reliable = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ChangeInventoryItemFlagsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChangeInventoryItemFlagsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChangeInventoryItemFlags ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SaveAssetIntoInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("saveassetintoinventory_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID NewAssetID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
NewAssetID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(NewAssetID == null) { Console.WriteLine("Warning: NewAssetID is null, in " + this.GetType()); }
|
|
Array.Copy(NewAssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "NewAssetID: " + NewAssetID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("saveassetintoinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SaveAssetIntoInventory; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SaveAssetIntoInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 311;
|
|
Header.Reliable = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SaveAssetIntoInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SaveAssetIntoInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SaveAssetIntoInventory ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CreateInventoryFolderPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("createinventoryfolder_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("createinventoryfolder_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ParentID;
|
|
public sbyte Type;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 33;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
ParentID = new LLUUID(bytes, i); i += 16;
|
|
Type = (sbyte)bytes[i++];
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(ParentID == null) { Console.WriteLine("Warning: ParentID is null, in " + this.GetType()); }
|
|
Array.Copy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)Type;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "ParentID: " + ParentID.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CreateInventoryFolder; } }
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock FolderData;
|
|
|
|
public CreateInventoryFolderPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 312;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock();
|
|
}
|
|
|
|
public CreateInventoryFolderPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
FolderData = new FolderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CreateInventoryFolderPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
FolderData = new FolderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += FolderData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
FolderData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CreateInventoryFolder ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += FolderData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UpdateInventoryFolderPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("updateinventoryfolder_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updateinventoryfolder_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ParentID;
|
|
public sbyte Type;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 33;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
ParentID = new LLUUID(bytes, i); i += 16;
|
|
Type = (sbyte)bytes[i++];
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(ParentID == null) { Console.WriteLine("Warning: ParentID is null, in " + this.GetType()); }
|
|
Array.Copy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)Type;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "ParentID: " + ParentID.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UpdateInventoryFolder; } }
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock[] FolderData;
|
|
|
|
public UpdateInventoryFolderPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 313;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock[0];
|
|
}
|
|
|
|
public UpdateInventoryFolderPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public UpdateInventoryFolderPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)FolderData.Length;
|
|
for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UpdateInventoryFolder ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < FolderData.Length; j++)
|
|
{
|
|
output += FolderData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoveInventoryFolderPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moveinventoryfolder_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID ParentID;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ParentID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ParentID == null) { Console.WriteLine("Warning: ParentID is null, in " + this.GetType()); }
|
|
Array.Copy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "ParentID: " + ParentID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moveinventoryfolder_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool Stamp;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Stamp = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Stamp) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Stamp: " + Stamp.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoveInventoryFolder; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoveInventoryFolderPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 314;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoveInventoryFolderPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoveInventoryFolderPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoveInventoryFolder ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RemoveInventoryFolderPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("removeinventoryfolder_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("removeinventoryfolder_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RemoveInventoryFolder; } }
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock[] FolderData;
|
|
|
|
public RemoveInventoryFolderPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 315;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock[0];
|
|
}
|
|
|
|
public RemoveInventoryFolderPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public RemoveInventoryFolderPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)FolderData.Length;
|
|
for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RemoveInventoryFolder ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < FolderData.Length; j++)
|
|
{
|
|
output += FolderData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class FetchInventoryDescendentsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("fetchinventorydescendents_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID OwnerID;
|
|
public LLUUID FolderID;
|
|
public int SortOrder;
|
|
public bool FetchFolders;
|
|
public bool FetchItems;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 38;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
SortOrder = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
FetchFolders = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
FetchItems = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SortOrder % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 8) % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 16) % 256);
|
|
bytes[i++] = (byte)((SortOrder >> 24) % 256);
|
|
bytes[i++] = (byte)((FetchFolders) ? 1 : 0);
|
|
bytes[i++] = (byte)((FetchItems) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "SortOrder: " + SortOrder.ToString() + "" + Environment.NewLine;
|
|
output += "FetchFolders: " + FetchFolders.ToString() + "" + Environment.NewLine;
|
|
output += "FetchItems: " + FetchItems.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("fetchinventorydescendents_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.FetchInventoryDescendents; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public FetchInventoryDescendentsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 316;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public FetchInventoryDescendentsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public FetchInventoryDescendentsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- FetchInventoryDescendents ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class InventoryDescendentsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("inventorydescendents_itemdata")]
|
|
public class ItemDataBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID AssetID;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 136;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ItemDataBlock() { }
|
|
public ItemDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ItemData --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("inventorydescendents_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public int Descendents;
|
|
public int Version;
|
|
public LLUUID OwnerID;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 56;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
Descendents = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Version = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Descendents % 256);
|
|
bytes[i++] = (byte)((Descendents >> 8) % 256);
|
|
bytes[i++] = (byte)((Descendents >> 16) % 256);
|
|
bytes[i++] = (byte)((Descendents >> 24) % 256);
|
|
bytes[i++] = (byte)(Version % 256);
|
|
bytes[i++] = (byte)((Version >> 8) % 256);
|
|
bytes[i++] = (byte)((Version >> 16) % 256);
|
|
bytes[i++] = (byte)((Version >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Descendents: " + Descendents.ToString() + "" + Environment.NewLine;
|
|
output += "Version: " + Version.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("inventorydescendents_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ParentID;
|
|
public sbyte Type;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 33;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
ParentID = new LLUUID(bytes, i); i += 16;
|
|
Type = (sbyte)bytes[i++];
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(ParentID == null) { Console.WriteLine("Warning: ParentID is null, in " + this.GetType()); }
|
|
Array.Copy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)Type;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "ParentID: " + ParentID.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.InventoryDescendents; } }
|
|
public ItemDataBlock[] ItemData;
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock[] FolderData;
|
|
|
|
public InventoryDescendentsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 317;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ItemData = new ItemDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock[0];
|
|
}
|
|
|
|
public InventoryDescendentsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ItemData = new ItemDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ItemData[j] = new ItemDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public InventoryDescendentsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ItemData = new ItemDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ItemData[j] = new ItemDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ItemData.Length; j++) { length += ItemData[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ItemData.Length;
|
|
for (int j = 0; j < ItemData.Length; j++) { ItemData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)FolderData.Length;
|
|
for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- InventoryDescendents ---" + Environment.NewLine;
|
|
for (int j = 0; j < ItemData.Length; j++)
|
|
{
|
|
output += ItemData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < FolderData.Length; j++)
|
|
{
|
|
output += FolderData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class FetchInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("fetchinventory_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID OwnerID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("fetchinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.FetchInventory; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public FetchInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 318;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public FetchInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public FetchInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- FetchInventory ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class FetchInventoryReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("fetchinventoryreply_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID AssetID;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 136;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("fetchinventoryreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.FetchInventoryReply; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public FetchInventoryReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 319;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public FetchInventoryReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public FetchInventoryReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- FetchInventoryReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class BulkUpdateInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("bulkupdateinventory_itemdata")]
|
|
public class ItemDataBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint CallbackID;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID AssetID;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 140;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ItemDataBlock() { }
|
|
public ItemDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(CallbackID % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 8) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 16) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 24) % 256);
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ItemData --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "CallbackID: " + CallbackID.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("bulkupdateinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("bulkupdateinventory_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ParentID;
|
|
public sbyte Type;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 33;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
ParentID = new LLUUID(bytes, i); i += 16;
|
|
Type = (sbyte)bytes[i++];
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(ParentID == null) { Console.WriteLine("Warning: ParentID is null, in " + this.GetType()); }
|
|
Array.Copy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)Type;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "ParentID: " + ParentID.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.BulkUpdateInventory; } }
|
|
public ItemDataBlock[] ItemData;
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock[] FolderData;
|
|
|
|
public BulkUpdateInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 320;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ItemData = new ItemDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock[0];
|
|
}
|
|
|
|
public BulkUpdateInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ItemData = new ItemDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ItemData[j] = new ItemDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public BulkUpdateInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ItemData = new ItemDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ItemData[j] = new ItemDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ItemData.Length; j++) { length += ItemData[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ItemData.Length;
|
|
for (int j = 0; j < ItemData.Length; j++) { ItemData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)FolderData.Length;
|
|
for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- BulkUpdateInventory ---" + Environment.NewLine;
|
|
for (int j = 0; j < ItemData.Length; j++)
|
|
{
|
|
output += ItemData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < FolderData.Length; j++)
|
|
{
|
|
output += FolderData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestInventoryAssetPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestinventoryasset_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID QueryID;
|
|
public LLUUID OwnerID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 64;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestInventoryAsset; } }
|
|
public QueryDataBlock QueryData;
|
|
|
|
public RequestInventoryAssetPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 321;
|
|
Header.Reliable = true;
|
|
QueryData = new QueryDataBlock();
|
|
}
|
|
|
|
public RequestInventoryAssetPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestInventoryAssetPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestInventoryAsset ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class InventoryAssetResponsePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("inventoryassetresponse_querydata")]
|
|
public class QueryDataBlock
|
|
{
|
|
public LLUUID QueryID;
|
|
public LLUUID AssetID;
|
|
public bool IsReadable;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public QueryDataBlock() { }
|
|
public QueryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
QueryID = new LLUUID(bytes, i); i += 16;
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
IsReadable = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
|
|
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((IsReadable) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- QueryData --" + Environment.NewLine;
|
|
output += "QueryID: " + QueryID.ToString() + "" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "IsReadable: " + IsReadable.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.InventoryAssetResponse; } }
|
|
public QueryDataBlock QueryData;
|
|
|
|
public InventoryAssetResponsePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 322;
|
|
Header.Reliable = true;
|
|
QueryData = new QueryDataBlock();
|
|
}
|
|
|
|
public InventoryAssetResponsePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public InventoryAssetResponsePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
QueryData = new QueryDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += QueryData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
QueryData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- InventoryAssetResponse ---" + Environment.NewLine;
|
|
output += QueryData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RemoveInventoryObjectsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("removeinventoryobjects_itemdata")]
|
|
public class ItemDataBlock
|
|
{
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ItemDataBlock() { }
|
|
public ItemDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ItemData --" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("removeinventoryobjects_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("removeinventoryobjects_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RemoveInventoryObjects; } }
|
|
public ItemDataBlock[] ItemData;
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock[] FolderData;
|
|
|
|
public RemoveInventoryObjectsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 323;
|
|
Header.Reliable = true;
|
|
ItemData = new ItemDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock[0];
|
|
}
|
|
|
|
public RemoveInventoryObjectsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ItemData = new ItemDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ItemData[j] = new ItemDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public RemoveInventoryObjectsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ItemData = new ItemDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ItemData[j] = new ItemDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ItemData.Length; j++) { length += ItemData[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ItemData.Length;
|
|
for (int j = 0; j < ItemData.Length; j++) { ItemData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)FolderData.Length;
|
|
for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RemoveInventoryObjects ---" + Environment.NewLine;
|
|
for (int j = 0; j < ItemData.Length; j++)
|
|
{
|
|
output += ItemData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < FolderData.Length; j++)
|
|
{
|
|
output += FolderData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PurgeInventoryDescendentsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("purgeinventorydescendents_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("purgeinventorydescendents_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PurgeInventoryDescendents; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public PurgeInventoryDescendentsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 324;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public PurgeInventoryDescendentsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public PurgeInventoryDescendentsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PurgeInventoryDescendents ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UpdateTaskInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("updatetaskinventory_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public LLUUID TransactionID;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 136;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updatetaskinventory_updatedata")]
|
|
public class UpdateDataBlock
|
|
{
|
|
public byte Key;
|
|
public uint LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 5;
|
|
}
|
|
}
|
|
|
|
public UpdateDataBlock() { }
|
|
public UpdateDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Key = (byte)bytes[i++];
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = Key;
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UpdateData --" + Environment.NewLine;
|
|
output += "Key: " + Key.ToString() + "" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updatetaskinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UpdateTaskInventory; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public UpdateDataBlock UpdateData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UpdateTaskInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 325;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
UpdateData = new UpdateDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UpdateTaskInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
UpdateData = new UpdateDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UpdateTaskInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
UpdateData = new UpdateDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += UpdateData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
UpdateData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UpdateTaskInventory ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += UpdateData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RemoveTaskInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("removetaskinventory_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public uint LocalID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("removetaskinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RemoveTaskInventory; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RemoveTaskInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 326;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RemoveTaskInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RemoveTaskInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RemoveTaskInventory ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoveTaskInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("movetaskinventory_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public uint LocalID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("movetaskinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoveTaskInventory; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoveTaskInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 327;
|
|
Header.Reliable = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoveTaskInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoveTaskInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoveTaskInventory ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestTaskInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requesttaskinventory_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public uint LocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("requesttaskinventory_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestTaskInventory; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RequestTaskInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 328;
|
|
Header.Reliable = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RequestTaskInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestTaskInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestTaskInventory ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ReplyTaskInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("replytaskinventory_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID TaskID;
|
|
private byte[] _filename;
|
|
public byte[] Filename
|
|
{
|
|
get { return _filename; }
|
|
set
|
|
{
|
|
if (value == null) { _filename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _filename = new byte[value.Length]; Array.Copy(value, _filename, value.Length); }
|
|
}
|
|
}
|
|
public short Serial;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 18;
|
|
if (Filename != null) { length += 1 + Filename.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
TaskID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_filename = new byte[length];
|
|
Array.Copy(bytes, i, _filename, 0, length); i += length;
|
|
Serial = (short)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TaskID == null) { Console.WriteLine("Warning: TaskID is null, in " + this.GetType()); }
|
|
Array.Copy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Filename == null) { Console.WriteLine("Warning: Filename is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Filename.Length;
|
|
Array.Copy(Filename, 0, bytes, i, Filename.Length); i += Filename.Length;
|
|
bytes[i++] = (byte)(Serial % 256);
|
|
bytes[i++] = (byte)((Serial >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "TaskID: " + TaskID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Filename, "Filename") + "" + Environment.NewLine;
|
|
output += "Serial: " + Serial.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ReplyTaskInventory; } }
|
|
public InventoryDataBlock InventoryData;
|
|
|
|
public ReplyTaskInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 329;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
}
|
|
|
|
public ReplyTaskInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ReplyTaskInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ReplyTaskInventory ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DeRezObjectPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("derezobject_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("derezobject_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
public byte Destination;
|
|
public byte PacketNumber;
|
|
public byte PacketCount;
|
|
public LLUUID TransactionID;
|
|
public LLUUID DestinationID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 51;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
Destination = (byte)bytes[i++];
|
|
PacketNumber = (byte)bytes[i++];
|
|
PacketCount = (byte)bytes[i++];
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
DestinationID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Destination;
|
|
bytes[i++] = PacketNumber;
|
|
bytes[i++] = PacketCount;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(DestinationID == null) { Console.WriteLine("Warning: DestinationID is null, in " + this.GetType()); }
|
|
Array.Copy(DestinationID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "Destination: " + Destination.ToString() + "" + Environment.NewLine;
|
|
output += "PacketNumber: " + PacketNumber.ToString() + "" + Environment.NewLine;
|
|
output += "PacketCount: " + PacketCount.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "DestinationID: " + DestinationID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("derezobject_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DeRezObject; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentBlockBlock AgentBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DeRezObjectPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 330;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentBlock = new AgentBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DeRezObjectPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DeRezObjectPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentBlock.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DeRezObject ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DeRezAckPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DeRezAck; } }
|
|
|
|
public DeRezAckPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 331;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public DeRezAckPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public DeRezAckPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DeRezAck ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RezObjectPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("rezobject_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public LLUUID TransactionID;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 136;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezobject_rezdata")]
|
|
public class RezDataBlock
|
|
{
|
|
public bool RezSelected;
|
|
public bool RemoveItem;
|
|
public LLVector3 RayStart;
|
|
public uint ItemFlags;
|
|
public LLUUID FromTaskID;
|
|
public bool RayEndIsIntersection;
|
|
public LLVector3 RayEnd;
|
|
public byte BypassRaycast;
|
|
public uint EveryoneMask;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public LLUUID RayTargetID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 76;
|
|
}
|
|
}
|
|
|
|
public RezDataBlock() { }
|
|
public RezDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RezSelected = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RemoveItem = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RayStart = new LLVector3(bytes, i); i += 12;
|
|
ItemFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
FromTaskID = new LLUUID(bytes, i); i += 16;
|
|
RayEndIsIntersection = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RayEnd = new LLVector3(bytes, i); i += 12;
|
|
BypassRaycast = (byte)bytes[i++];
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RayTargetID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((RezSelected) ? 1 : 0);
|
|
bytes[i++] = (byte)((RemoveItem) ? 1 : 0);
|
|
Array.Copy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)(ItemFlags % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 24) % 256);
|
|
if(FromTaskID == null) { Console.WriteLine("Warning: FromTaskID is null, in " + this.GetType()); }
|
|
Array.Copy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0);
|
|
Array.Copy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = BypassRaycast;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
if(RayTargetID == null) { Console.WriteLine("Warning: RayTargetID is null, in " + this.GetType()); }
|
|
Array.Copy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RezData --" + Environment.NewLine;
|
|
output += "RezSelected: " + RezSelected.ToString() + "" + Environment.NewLine;
|
|
output += "RemoveItem: " + RemoveItem.ToString() + "" + Environment.NewLine;
|
|
output += "RayStart: " + RayStart.ToString() + "" + Environment.NewLine;
|
|
output += "ItemFlags: " + ItemFlags.ToString() + "" + Environment.NewLine;
|
|
output += "FromTaskID: " + FromTaskID.ToString() + "" + Environment.NewLine;
|
|
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "" + Environment.NewLine;
|
|
output += "RayEnd: " + RayEnd.ToString() + "" + Environment.NewLine;
|
|
output += "BypassRaycast: " + BypassRaycast.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "RayTargetID: " + RayTargetID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezobject_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RezObject; } }
|
|
public InventoryDataBlock InventoryData;
|
|
public RezDataBlock RezData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RezObjectPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 332;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock();
|
|
RezData = new RezDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RezObjectPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
RezData = new RezDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RezObjectPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryData = new InventoryDataBlock(bytes, ref i);
|
|
RezData = new RezDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryData.Length; length += RezData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryData.ToBytes(bytes, ref i);
|
|
RezData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RezObject ---" + Environment.NewLine;
|
|
output += InventoryData.ToString() + "" + Environment.NewLine;
|
|
output += RezData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RezObjectFromNotecardPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("rezobjectfromnotecard_inventorydata")]
|
|
public class InventoryDataBlock
|
|
{
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public InventoryDataBlock() { }
|
|
public InventoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryData --" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezobjectfromnotecard_rezdata")]
|
|
public class RezDataBlock
|
|
{
|
|
public bool RezSelected;
|
|
public bool RemoveItem;
|
|
public LLVector3 RayStart;
|
|
public uint ItemFlags;
|
|
public LLUUID FromTaskID;
|
|
public bool RayEndIsIntersection;
|
|
public LLVector3 RayEnd;
|
|
public byte BypassRaycast;
|
|
public uint EveryoneMask;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public LLUUID RayTargetID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 76;
|
|
}
|
|
}
|
|
|
|
public RezDataBlock() { }
|
|
public RezDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RezSelected = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RemoveItem = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RayStart = new LLVector3(bytes, i); i += 12;
|
|
ItemFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
FromTaskID = new LLUUID(bytes, i); i += 16;
|
|
RayEndIsIntersection = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RayEnd = new LLVector3(bytes, i); i += 12;
|
|
BypassRaycast = (byte)bytes[i++];
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RayTargetID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((RezSelected) ? 1 : 0);
|
|
bytes[i++] = (byte)((RemoveItem) ? 1 : 0);
|
|
Array.Copy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)(ItemFlags % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 24) % 256);
|
|
if(FromTaskID == null) { Console.WriteLine("Warning: FromTaskID is null, in " + this.GetType()); }
|
|
Array.Copy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0);
|
|
Array.Copy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = BypassRaycast;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
if(RayTargetID == null) { Console.WriteLine("Warning: RayTargetID is null, in " + this.GetType()); }
|
|
Array.Copy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RezData --" + Environment.NewLine;
|
|
output += "RezSelected: " + RezSelected.ToString() + "" + Environment.NewLine;
|
|
output += "RemoveItem: " + RemoveItem.ToString() + "" + Environment.NewLine;
|
|
output += "RayStart: " + RayStart.ToString() + "" + Environment.NewLine;
|
|
output += "ItemFlags: " + ItemFlags.ToString() + "" + Environment.NewLine;
|
|
output += "FromTaskID: " + FromTaskID.ToString() + "" + Environment.NewLine;
|
|
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "" + Environment.NewLine;
|
|
output += "RayEnd: " + RayEnd.ToString() + "" + Environment.NewLine;
|
|
output += "BypassRaycast: " + BypassRaycast.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "RayTargetID: " + RayTargetID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezobjectfromnotecard_notecarddata")]
|
|
public class NotecardDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLUUID NotecardItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public NotecardDataBlock() { }
|
|
public NotecardDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
NotecardItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(NotecardItemID == null) { Console.WriteLine("Warning: NotecardItemID is null, in " + this.GetType()); }
|
|
Array.Copy(NotecardItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- NotecardData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "NotecardItemID: " + NotecardItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezobjectfromnotecard_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RezObjectFromNotecard; } }
|
|
public InventoryDataBlock[] InventoryData;
|
|
public RezDataBlock RezData;
|
|
public NotecardDataBlock NotecardData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RezObjectFromNotecardPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 333;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryData = new InventoryDataBlock[0];
|
|
RezData = new RezDataBlock();
|
|
NotecardData = new NotecardDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RezObjectFromNotecardPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
RezData = new RezDataBlock(bytes, ref i);
|
|
NotecardData = new NotecardDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RezObjectFromNotecardPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InventoryData = new InventoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InventoryData[j] = new InventoryDataBlock(bytes, ref i); }
|
|
RezData = new RezDataBlock(bytes, ref i);
|
|
NotecardData = new NotecardDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RezData.Length; length += NotecardData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InventoryData.Length;
|
|
for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); }
|
|
RezData.ToBytes(bytes, ref i);
|
|
NotecardData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RezObjectFromNotecard ---" + Environment.NewLine;
|
|
for (int j = 0; j < InventoryData.Length; j++)
|
|
{
|
|
output += InventoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += RezData.ToString() + "" + Environment.NewLine;
|
|
output += NotecardData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DeclineInventoryPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("declineinventory_infoblock")]
|
|
public class InfoBlockBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public InfoBlockBlock() { }
|
|
public InfoBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InfoBlock --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DeclineInventory; } }
|
|
public InfoBlockBlock InfoBlock;
|
|
|
|
public DeclineInventoryPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 334;
|
|
Header.Reliable = true;
|
|
InfoBlock = new InfoBlockBlock();
|
|
}
|
|
|
|
public DeclineInventoryPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InfoBlock = new InfoBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public DeclineInventoryPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InfoBlock = new InfoBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InfoBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InfoBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DeclineInventory ---" + Environment.NewLine;
|
|
output += InfoBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestFriendshipPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestfriendship_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID DestID;
|
|
public LLUUID FolderID;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
DestID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(DestID == null) { Console.WriteLine("Warning: DestID is null, in " + this.GetType()); }
|
|
Array.Copy(DestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "DestID: " + DestID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("requestfriendship_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestFriendship; } }
|
|
public AgentBlockBlock AgentBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RequestFriendshipPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 337;
|
|
Header.Reliable = true;
|
|
AgentBlock = new AgentBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RequestFriendshipPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestFriendshipPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestFriendship ---" + Environment.NewLine;
|
|
output += AgentBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AcceptFriendshipPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("acceptfriendship_transactionblock")]
|
|
public class TransactionBlockBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionBlockBlock() { }
|
|
public TransactionBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionBlock --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("acceptfriendship_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("acceptfriendship_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AcceptFriendship; } }
|
|
public TransactionBlockBlock TransactionBlock;
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock[] FolderData;
|
|
|
|
public AcceptFriendshipPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 338;
|
|
Header.Reliable = true;
|
|
TransactionBlock = new TransactionBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock[0];
|
|
}
|
|
|
|
public AcceptFriendshipPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public AcceptFriendshipPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransactionBlock.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransactionBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)FolderData.Length;
|
|
for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AcceptFriendship ---" + Environment.NewLine;
|
|
output += TransactionBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < FolderData.Length; j++)
|
|
{
|
|
output += FolderData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DeclineFriendshipPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("declinefriendship_transactionblock")]
|
|
public class TransactionBlockBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionBlockBlock() { }
|
|
public TransactionBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionBlock --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("declinefriendship_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DeclineFriendship; } }
|
|
public TransactionBlockBlock TransactionBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DeclineFriendshipPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 339;
|
|
Header.Reliable = true;
|
|
TransactionBlock = new TransactionBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DeclineFriendshipPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DeclineFriendshipPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransactionBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransactionBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DeclineFriendship ---" + Environment.NewLine;
|
|
output += TransactionBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class FormFriendshipPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("formfriendship_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID DestID;
|
|
public LLUUID SourceID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
DestID = new LLUUID(bytes, i); i += 16;
|
|
SourceID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(DestID == null) { Console.WriteLine("Warning: DestID is null, in " + this.GetType()); }
|
|
Array.Copy(DestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SourceID == null) { Console.WriteLine("Warning: SourceID is null, in " + this.GetType()); }
|
|
Array.Copy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "DestID: " + DestID.ToString() + "" + Environment.NewLine;
|
|
output += "SourceID: " + SourceID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.FormFriendship; } }
|
|
public AgentBlockBlock AgentBlock;
|
|
|
|
public FormFriendshipPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 340;
|
|
Header.Reliable = true;
|
|
AgentBlock = new AgentBlockBlock();
|
|
}
|
|
|
|
public FormFriendshipPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public FormFriendshipPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- FormFriendship ---" + Environment.NewLine;
|
|
output += AgentBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TerminateFriendshipPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("terminatefriendship_exblock")]
|
|
public class ExBlockBlock
|
|
{
|
|
public LLUUID OtherID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ExBlockBlock() { }
|
|
public ExBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
OtherID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OtherID == null) { Console.WriteLine("Warning: OtherID is null, in " + this.GetType()); }
|
|
Array.Copy(OtherID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ExBlock --" + Environment.NewLine;
|
|
output += "OtherID: " + OtherID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("terminatefriendship_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TerminateFriendship; } }
|
|
public ExBlockBlock ExBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public TerminateFriendshipPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 341;
|
|
Header.Reliable = true;
|
|
ExBlock = new ExBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public TerminateFriendshipPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ExBlock = new ExBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public TerminateFriendshipPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ExBlock = new ExBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ExBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ExBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TerminateFriendship ---" + Environment.NewLine;
|
|
output += ExBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class OfferCallingCardPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("offercallingcard_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID DestID;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
DestID = new LLUUID(bytes, i); i += 16;
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(DestID == null) { Console.WriteLine("Warning: DestID is null, in " + this.GetType()); }
|
|
Array.Copy(DestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "DestID: " + DestID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("offercallingcard_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.OfferCallingCard; } }
|
|
public AgentBlockBlock AgentBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public OfferCallingCardPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 342;
|
|
Header.Reliable = true;
|
|
AgentBlock = new AgentBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public OfferCallingCardPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public OfferCallingCardPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- OfferCallingCard ---" + Environment.NewLine;
|
|
output += AgentBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AcceptCallingCardPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("acceptcallingcard_transactionblock")]
|
|
public class TransactionBlockBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionBlockBlock() { }
|
|
public TransactionBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionBlock --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("acceptcallingcard_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("acceptcallingcard_folderdata")]
|
|
public class FolderDataBlock
|
|
{
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public FolderDataBlock() { }
|
|
public FolderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FolderData --" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AcceptCallingCard; } }
|
|
public TransactionBlockBlock TransactionBlock;
|
|
public AgentDataBlock AgentData;
|
|
public FolderDataBlock[] FolderData;
|
|
|
|
public AcceptCallingCardPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 343;
|
|
Header.Reliable = true;
|
|
TransactionBlock = new TransactionBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
FolderData = new FolderDataBlock[0];
|
|
}
|
|
|
|
public AcceptCallingCardPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public AcceptCallingCardPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
FolderData = new FolderDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ FolderData[j] = new FolderDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransactionBlock.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransactionBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)FolderData.Length;
|
|
for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AcceptCallingCard ---" + Environment.NewLine;
|
|
output += TransactionBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < FolderData.Length; j++)
|
|
{
|
|
output += FolderData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DeclineCallingCardPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("declinecallingcard_transactionblock")]
|
|
public class TransactionBlockBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionBlockBlock() { }
|
|
public TransactionBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionBlock --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("declinecallingcard_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DeclineCallingCard; } }
|
|
public TransactionBlockBlock TransactionBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DeclineCallingCardPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 344;
|
|
Header.Reliable = true;
|
|
TransactionBlock = new TransactionBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DeclineCallingCardPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DeclineCallingCardPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransactionBlock = new TransactionBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TransactionBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransactionBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DeclineCallingCard ---" + Environment.NewLine;
|
|
output += TransactionBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RezScriptPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("rezscript_updateblock")]
|
|
public class UpdateBlockBlock
|
|
{
|
|
public bool Enabled;
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 5;
|
|
}
|
|
}
|
|
|
|
public UpdateBlockBlock() { }
|
|
public UpdateBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Enabled) ? 1 : 0);
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UpdateBlock --" + Environment.NewLine;
|
|
output += "Enabled: " + Enabled.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezscript_inventoryblock")]
|
|
public class InventoryBlockBlock
|
|
{
|
|
public bool GroupOwned;
|
|
public uint CRC;
|
|
public int CreationDate;
|
|
public byte SaleType;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
public LLUUID ItemID;
|
|
public LLUUID FolderID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint Flags;
|
|
public uint NextOwnerMask;
|
|
public LLUUID TransactionID;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 136;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryBlockBlock() { }
|
|
public InventoryBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SaleType = (byte)bytes[i++];
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryBlock --" + Environment.NewLine;
|
|
output += "GroupOwned: " + GroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezscript_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RezScript; } }
|
|
public UpdateBlockBlock UpdateBlock;
|
|
public InventoryBlockBlock InventoryBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RezScriptPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 345;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
UpdateBlock = new UpdateBlockBlock();
|
|
InventoryBlock = new InventoryBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RezScriptPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
UpdateBlock = new UpdateBlockBlock(bytes, ref i);
|
|
InventoryBlock = new InventoryBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RezScriptPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
UpdateBlock = new UpdateBlockBlock(bytes, ref i);
|
|
InventoryBlock = new InventoryBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += UpdateBlock.Length; length += InventoryBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
UpdateBlock.ToBytes(bytes, ref i);
|
|
InventoryBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RezScript ---" + Environment.NewLine;
|
|
output += UpdateBlock.ToString() + "" + Environment.NewLine;
|
|
output += InventoryBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CreateInventoryItemPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("createinventoryitem_inventoryblock")]
|
|
public class InventoryBlockBlock
|
|
{
|
|
public uint CallbackID;
|
|
public byte WearableType;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public sbyte InvType;
|
|
public sbyte Type;
|
|
public LLUUID FolderID;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public uint NextOwnerMask;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 43;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryBlockBlock() { }
|
|
public InventoryBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
WearableType = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InvType = (sbyte)bytes[i++];
|
|
Type = (sbyte)bytes[i++];
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(CallbackID % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 8) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 16) % 256);
|
|
bytes[i++] = (byte)((CallbackID >> 24) % 256);
|
|
bytes[i++] = WearableType;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)InvType;
|
|
bytes[i++] = (byte)Type;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryBlock --" + Environment.NewLine;
|
|
output += "CallbackID: " + CallbackID.ToString() + "" + Environment.NewLine;
|
|
output += "WearableType: " + WearableType.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InvType: " + InvType.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("createinventoryitem_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CreateInventoryItem; } }
|
|
public InventoryBlockBlock InventoryBlock;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public CreateInventoryItemPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 346;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryBlock = new InventoryBlockBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public CreateInventoryItemPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryBlock = new InventoryBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CreateInventoryItemPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryBlock = new InventoryBlockBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryBlock.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryBlock.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CreateInventoryItem ---" + Environment.NewLine;
|
|
output += InventoryBlock.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CreateLandmarkForEventPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("createlandmarkforevent_inventoryblock")]
|
|
public class InventoryBlockBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID FolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public InventoryBlockBlock() { }
|
|
public InventoryBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InventoryBlock --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("createlandmarkforevent_eventdata")]
|
|
public class EventDataBlock
|
|
{
|
|
public uint EventID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public EventDataBlock() { }
|
|
public EventDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(EventID % 256);
|
|
bytes[i++] = (byte)((EventID >> 8) % 256);
|
|
bytes[i++] = (byte)((EventID >> 16) % 256);
|
|
bytes[i++] = (byte)((EventID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EventData --" + Environment.NewLine;
|
|
output += "EventID: " + EventID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("createlandmarkforevent_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CreateLandmarkForEvent; } }
|
|
public InventoryBlockBlock InventoryBlock;
|
|
public EventDataBlock EventData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public CreateLandmarkForEventPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 347;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
InventoryBlock = new InventoryBlockBlock();
|
|
EventData = new EventDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public CreateLandmarkForEventPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
InventoryBlock = new InventoryBlockBlock(bytes, ref i);
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CreateLandmarkForEventPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
InventoryBlock = new InventoryBlockBlock(bytes, ref i);
|
|
EventData = new EventDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += InventoryBlock.Length; length += EventData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
InventoryBlock.ToBytes(bytes, ref i);
|
|
EventData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CreateLandmarkForEvent ---" + Environment.NewLine;
|
|
output += InventoryBlock.ToString() + "" + Environment.NewLine;
|
|
output += EventData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RegionHandleRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("regionhandlerequest_requestblock")]
|
|
public class RequestBlockBlock
|
|
{
|
|
public LLUUID RegionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public RequestBlockBlock() { }
|
|
public RequestBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RegionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
|
|
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestBlock --" + Environment.NewLine;
|
|
output += "RegionID: " + RegionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RegionHandleRequest; } }
|
|
public RequestBlockBlock RequestBlock;
|
|
|
|
public RegionHandleRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 350;
|
|
Header.Reliable = true;
|
|
RequestBlock = new RequestBlockBlock();
|
|
}
|
|
|
|
public RegionHandleRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RequestBlock = new RequestBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public RegionHandleRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RequestBlock = new RequestBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RequestBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RequestBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RegionHandleRequest ---" + Environment.NewLine;
|
|
output += RequestBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RegionIDAndHandleReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("regionidandhandlereply_replyblock")]
|
|
public class ReplyBlockBlock
|
|
{
|
|
public LLUUID RegionID;
|
|
public ulong RegionHandle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public ReplyBlockBlock() { }
|
|
public ReplyBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RegionID = new LLUUID(bytes, i); i += 16;
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
|
|
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReplyBlock --" + Environment.NewLine;
|
|
output += "RegionID: " + RegionID.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RegionIDAndHandleReply; } }
|
|
public ReplyBlockBlock ReplyBlock;
|
|
|
|
public RegionIDAndHandleReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 351;
|
|
Header.Reliable = true;
|
|
ReplyBlock = new ReplyBlockBlock();
|
|
}
|
|
|
|
public RegionIDAndHandleReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ReplyBlock = new ReplyBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public RegionIDAndHandleReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ReplyBlock = new ReplyBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ReplyBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ReplyBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RegionIDAndHandleReply ---" + Environment.NewLine;
|
|
output += ReplyBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyTransferRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneytransferrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public byte AggregatePermInventory;
|
|
public byte AggregatePermNextOwner;
|
|
public LLUUID DestID;
|
|
public int Amount;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public byte Flags;
|
|
public LLUUID SourceID;
|
|
public int TransactionType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 43;
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AggregatePermInventory = (byte)bytes[i++];
|
|
AggregatePermNextOwner = (byte)bytes[i++];
|
|
DestID = new LLUUID(bytes, i); i += 16;
|
|
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
Flags = (byte)bytes[i++];
|
|
SourceID = new LLUUID(bytes, i); i += 16;
|
|
TransactionType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = AggregatePermInventory;
|
|
bytes[i++] = AggregatePermNextOwner;
|
|
if(DestID == null) { Console.WriteLine("Warning: DestID is null, in " + this.GetType()); }
|
|
Array.Copy(DestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Amount % 256);
|
|
bytes[i++] = (byte)((Amount >> 8) % 256);
|
|
bytes[i++] = (byte)((Amount >> 16) % 256);
|
|
bytes[i++] = (byte)((Amount >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = Flags;
|
|
if(SourceID == null) { Console.WriteLine("Warning: SourceID is null, in " + this.GetType()); }
|
|
Array.Copy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(TransactionType % 256);
|
|
bytes[i++] = (byte)((TransactionType >> 8) % 256);
|
|
bytes[i++] = (byte)((TransactionType >> 16) % 256);
|
|
bytes[i++] = (byte)((TransactionType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "AggregatePermInventory: " + AggregatePermInventory.ToString() + "" + Environment.NewLine;
|
|
output += "AggregatePermNextOwner: " + AggregatePermNextOwner.ToString() + "" + Environment.NewLine;
|
|
output += "DestID: " + DestID.ToString() + "" + Environment.NewLine;
|
|
output += "Amount: " + Amount.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "SourceID: " + SourceID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionType: " + TransactionType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneytransferrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyTransferRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneyTransferRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 352;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneyTransferRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyTransferRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyTransferRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AdjustBalancePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("adjustbalance_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public int Delta;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
Delta = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Delta % 256);
|
|
bytes[i++] = (byte)((Delta >> 8) % 256);
|
|
bytes[i++] = (byte)((Delta >> 16) % 256);
|
|
bytes[i++] = (byte)((Delta >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Delta: " + Delta.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AdjustBalance; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AdjustBalancePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 355;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AdjustBalancePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AdjustBalancePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AdjustBalance ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyBalanceRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneybalancerequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneybalancerequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyBalanceRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneyBalanceRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 356;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneyBalanceRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyBalanceRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyBalanceRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyBalanceReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneybalancereply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public int MoneyBalance;
|
|
public int SquareMetersCredit;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public int SquareMetersCommitted;
|
|
public LLUUID TransactionID;
|
|
public bool TransactionSuccess;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 45;
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
MoneyBalance = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SquareMetersCredit = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
SquareMetersCommitted = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
TransactionSuccess = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MoneyBalance % 256);
|
|
bytes[i++] = (byte)((MoneyBalance >> 8) % 256);
|
|
bytes[i++] = (byte)((MoneyBalance >> 16) % 256);
|
|
bytes[i++] = (byte)((MoneyBalance >> 24) % 256);
|
|
bytes[i++] = (byte)(SquareMetersCredit % 256);
|
|
bytes[i++] = (byte)((SquareMetersCredit >> 8) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCredit >> 16) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCredit >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(SquareMetersCommitted % 256);
|
|
bytes[i++] = (byte)((SquareMetersCommitted >> 8) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCommitted >> 16) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCommitted >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((TransactionSuccess) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "MoneyBalance: " + MoneyBalance.ToString() + "" + Environment.NewLine;
|
|
output += "SquareMetersCredit: " + SquareMetersCredit.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "SquareMetersCommitted: " + SquareMetersCommitted.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionSuccess: " + TransactionSuccess.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyBalanceReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
|
|
public MoneyBalanceReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 357;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
}
|
|
|
|
public MoneyBalanceReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyBalanceReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyBalanceReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RoutedMoneyBalanceReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("routedmoneybalancereply_targetblock")]
|
|
public class TargetBlockBlock
|
|
{
|
|
public uint TargetIP;
|
|
public ushort TargetPort;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 6;
|
|
}
|
|
}
|
|
|
|
public TargetBlockBlock() { }
|
|
public TargetBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TargetIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TargetPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TargetIP % 256);
|
|
bytes[i++] = (byte)((TargetIP >> 8) % 256);
|
|
bytes[i++] = (byte)((TargetIP >> 16) % 256);
|
|
bytes[i++] = (byte)((TargetIP >> 24) % 256);
|
|
bytes[i++] = (byte)((TargetPort >> 8) % 256);
|
|
bytes[i++] = (byte)(TargetPort % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TargetBlock --" + Environment.NewLine;
|
|
output += "TargetIP: " + TargetIP.ToString() + "" + Environment.NewLine;
|
|
output += "TargetPort: " + TargetPort.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("routedmoneybalancereply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public int MoneyBalance;
|
|
public int SquareMetersCredit;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public int SquareMetersCommitted;
|
|
public LLUUID TransactionID;
|
|
public bool TransactionSuccess;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 45;
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
MoneyBalance = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SquareMetersCredit = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
SquareMetersCommitted = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
TransactionSuccess = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MoneyBalance % 256);
|
|
bytes[i++] = (byte)((MoneyBalance >> 8) % 256);
|
|
bytes[i++] = (byte)((MoneyBalance >> 16) % 256);
|
|
bytes[i++] = (byte)((MoneyBalance >> 24) % 256);
|
|
bytes[i++] = (byte)(SquareMetersCredit % 256);
|
|
bytes[i++] = (byte)((SquareMetersCredit >> 8) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCredit >> 16) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCredit >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = (byte)(SquareMetersCommitted % 256);
|
|
bytes[i++] = (byte)((SquareMetersCommitted >> 8) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCommitted >> 16) % 256);
|
|
bytes[i++] = (byte)((SquareMetersCommitted >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((TransactionSuccess) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "MoneyBalance: " + MoneyBalance.ToString() + "" + Environment.NewLine;
|
|
output += "SquareMetersCredit: " + SquareMetersCredit.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "SquareMetersCommitted: " + SquareMetersCommitted.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionSuccess: " + TransactionSuccess.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RoutedMoneyBalanceReply; } }
|
|
public TargetBlockBlock TargetBlock;
|
|
public MoneyDataBlock MoneyData;
|
|
|
|
public RoutedMoneyBalanceReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 358;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TargetBlock = new TargetBlockBlock();
|
|
MoneyData = new MoneyDataBlock();
|
|
}
|
|
|
|
public RoutedMoneyBalanceReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TargetBlock = new TargetBlockBlock(bytes, ref i);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RoutedMoneyBalanceReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TargetBlock = new TargetBlockBlock(bytes, ref i);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TargetBlock.Length; length += MoneyData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TargetBlock.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RoutedMoneyBalanceReply ---" + Environment.NewLine;
|
|
output += TargetBlock.ToString() + "" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyHistoryRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneyhistoryrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public int StartPeriod;
|
|
public int EndPeriod;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
StartPeriod = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
EndPeriod = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(StartPeriod % 256);
|
|
bytes[i++] = (byte)((StartPeriod >> 8) % 256);
|
|
bytes[i++] = (byte)((StartPeriod >> 16) % 256);
|
|
bytes[i++] = (byte)((StartPeriod >> 24) % 256);
|
|
bytes[i++] = (byte)(EndPeriod % 256);
|
|
bytes[i++] = (byte)((EndPeriod >> 8) % 256);
|
|
bytes[i++] = (byte)((EndPeriod >> 16) % 256);
|
|
bytes[i++] = (byte)((EndPeriod >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "StartPeriod: " + StartPeriod.ToString() + "" + Environment.NewLine;
|
|
output += "EndPeriod: " + EndPeriod.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyHistoryRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
|
|
public MoneyHistoryRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 359;
|
|
Header.Reliable = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
}
|
|
|
|
public MoneyHistoryRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyHistoryRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyHistoryRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyHistoryReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneyhistoryreply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public int Balance;
|
|
public int TaxEstimate;
|
|
private byte[] _startdate;
|
|
public byte[] StartDate
|
|
{
|
|
get { return _startdate; }
|
|
set
|
|
{
|
|
if (value == null) { _startdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdate = new byte[value.Length]; Array.Copy(value, _startdate, value.Length); }
|
|
}
|
|
}
|
|
public int StartPeriod;
|
|
public int StipendEstimate;
|
|
public int EndPeriod;
|
|
public int BonusEstimate;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (StartDate != null) { length += 1 + StartDate.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Balance = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_startdate = new byte[length];
|
|
Array.Copy(bytes, i, _startdate, 0, length); i += length;
|
|
StartPeriod = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
StipendEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
EndPeriod = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
BonusEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Balance % 256);
|
|
bytes[i++] = (byte)((Balance >> 8) % 256);
|
|
bytes[i++] = (byte)((Balance >> 16) % 256);
|
|
bytes[i++] = (byte)((Balance >> 24) % 256);
|
|
bytes[i++] = (byte)(TaxEstimate % 256);
|
|
bytes[i++] = (byte)((TaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((TaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((TaxEstimate >> 24) % 256);
|
|
if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDate.Length;
|
|
Array.Copy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length;
|
|
bytes[i++] = (byte)(StartPeriod % 256);
|
|
bytes[i++] = (byte)((StartPeriod >> 8) % 256);
|
|
bytes[i++] = (byte)((StartPeriod >> 16) % 256);
|
|
bytes[i++] = (byte)((StartPeriod >> 24) % 256);
|
|
bytes[i++] = (byte)(StipendEstimate % 256);
|
|
bytes[i++] = (byte)((StipendEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((StipendEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((StipendEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(EndPeriod % 256);
|
|
bytes[i++] = (byte)((EndPeriod >> 8) % 256);
|
|
bytes[i++] = (byte)((EndPeriod >> 16) % 256);
|
|
bytes[i++] = (byte)((EndPeriod >> 24) % 256);
|
|
bytes[i++] = (byte)(BonusEstimate % 256);
|
|
bytes[i++] = (byte)((BonusEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((BonusEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((BonusEstimate >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "Balance: " + Balance.ToString() + "" + Environment.NewLine;
|
|
output += "TaxEstimate: " + TaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDate, "StartDate") + "" + Environment.NewLine;
|
|
output += "StartPeriod: " + StartPeriod.ToString() + "" + Environment.NewLine;
|
|
output += "StipendEstimate: " + StipendEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "EndPeriod: " + EndPeriod.ToString() + "" + Environment.NewLine;
|
|
output += "BonusEstimate: " + BonusEstimate.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneyhistoryreply_historydata")]
|
|
public class HistoryDataBlock
|
|
{
|
|
public int Amount;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public HistoryDataBlock() { }
|
|
public HistoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Amount % 256);
|
|
bytes[i++] = (byte)((Amount >> 8) % 256);
|
|
bytes[i++] = (byte)((Amount >> 16) % 256);
|
|
bytes[i++] = (byte)((Amount >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HistoryData --" + Environment.NewLine;
|
|
output += "Amount: " + Amount.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneyhistoryreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyHistoryReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public HistoryDataBlock[] HistoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneyHistoryReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 360;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
HistoryData = new HistoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneyHistoryReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyHistoryReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)HistoryData.Length;
|
|
for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyHistoryReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < HistoryData.Length; j++)
|
|
{
|
|
output += HistoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneySummaryRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneysummaryrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneysummaryrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneySummaryRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneySummaryRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 361;
|
|
Header.Reliable = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneySummaryRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneySummaryRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneySummaryRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneySummaryReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneysummaryreply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public int ParcelDirFeeCurrent;
|
|
private byte[] _taxdate;
|
|
public byte[] TaxDate
|
|
{
|
|
get { return _taxdate; }
|
|
set
|
|
{
|
|
if (value == null) { _taxdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _taxdate = new byte[value.Length]; Array.Copy(value, _taxdate, value.Length); }
|
|
}
|
|
}
|
|
public int Balance;
|
|
public int ParcelDirFeeEstimate;
|
|
public LLUUID RequestID;
|
|
public int ObjectTaxCurrent;
|
|
public int LightTaxCurrent;
|
|
public int LandTaxCurrent;
|
|
public int GroupTaxCurrent;
|
|
public int TotalDebits;
|
|
public int IntervalDays;
|
|
public int ObjectTaxEstimate;
|
|
public int LightTaxEstimate;
|
|
public int LandTaxEstimate;
|
|
public int GroupTaxEstimate;
|
|
private byte[] _lasttaxdate;
|
|
public byte[] LastTaxDate
|
|
{
|
|
get { return _lasttaxdate; }
|
|
set
|
|
{
|
|
if (value == null) { _lasttaxdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _lasttaxdate = new byte[value.Length]; Array.Copy(value, _lasttaxdate, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _startdate;
|
|
public byte[] StartDate
|
|
{
|
|
get { return _startdate; }
|
|
set
|
|
{
|
|
if (value == null) { _startdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdate = new byte[value.Length]; Array.Copy(value, _startdate, value.Length); }
|
|
}
|
|
}
|
|
public int TotalCredits;
|
|
public int StipendEstimate;
|
|
public int CurrentInterval;
|
|
public int BonusEstimate;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 84;
|
|
if (TaxDate != null) { length += 1 + TaxDate.Length; }
|
|
if (LastTaxDate != null) { length += 1 + LastTaxDate.Length; }
|
|
if (StartDate != null) { length += 1 + StartDate.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ParcelDirFeeCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_taxdate = new byte[length];
|
|
Array.Copy(bytes, i, _taxdate, 0, length); i += length;
|
|
Balance = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParcelDirFeeEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
ObjectTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LightTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LandTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TotalDebits = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LightTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LandTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_lasttaxdate = new byte[length];
|
|
Array.Copy(bytes, i, _lasttaxdate, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_startdate = new byte[length];
|
|
Array.Copy(bytes, i, _startdate, 0, length); i += length;
|
|
TotalCredits = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
StipendEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
BonusEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ParcelDirFeeCurrent % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeCurrent >> 24) % 256);
|
|
if(TaxDate == null) { Console.WriteLine("Warning: TaxDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TaxDate.Length;
|
|
Array.Copy(TaxDate, 0, bytes, i, TaxDate.Length); i += TaxDate.Length;
|
|
bytes[i++] = (byte)(Balance % 256);
|
|
bytes[i++] = (byte)((Balance >> 8) % 256);
|
|
bytes[i++] = (byte)((Balance >> 16) % 256);
|
|
bytes[i++] = (byte)((Balance >> 24) % 256);
|
|
bytes[i++] = (byte)(ParcelDirFeeEstimate % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeEstimate >> 24) % 256);
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(ObjectTaxCurrent % 256);
|
|
bytes[i++] = (byte)((ObjectTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(LightTaxCurrent % 256);
|
|
bytes[i++] = (byte)((LightTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((LightTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((LightTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(LandTaxCurrent % 256);
|
|
bytes[i++] = (byte)((LandTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((LandTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((LandTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupTaxCurrent % 256);
|
|
bytes[i++] = (byte)((GroupTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(TotalDebits % 256);
|
|
bytes[i++] = (byte)((TotalDebits >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalDebits >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalDebits >> 24) % 256);
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(ObjectTaxEstimate % 256);
|
|
bytes[i++] = (byte)((ObjectTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(LightTaxEstimate % 256);
|
|
bytes[i++] = (byte)((LightTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((LightTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((LightTaxEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(LandTaxEstimate % 256);
|
|
bytes[i++] = (byte)((LandTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((LandTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((LandTaxEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupTaxEstimate % 256);
|
|
bytes[i++] = (byte)((GroupTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupTaxEstimate >> 24) % 256);
|
|
if(LastTaxDate == null) { Console.WriteLine("Warning: LastTaxDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LastTaxDate.Length;
|
|
Array.Copy(LastTaxDate, 0, bytes, i, LastTaxDate.Length); i += LastTaxDate.Length;
|
|
if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDate.Length;
|
|
Array.Copy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length;
|
|
bytes[i++] = (byte)(TotalCredits % 256);
|
|
bytes[i++] = (byte)((TotalCredits >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalCredits >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalCredits >> 24) % 256);
|
|
bytes[i++] = (byte)(StipendEstimate % 256);
|
|
bytes[i++] = (byte)((StipendEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((StipendEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((StipendEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
bytes[i++] = (byte)(BonusEstimate % 256);
|
|
bytes[i++] = (byte)((BonusEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((BonusEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((BonusEstimate >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "ParcelDirFeeCurrent: " + ParcelDirFeeCurrent.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TaxDate, "TaxDate") + "" + Environment.NewLine;
|
|
output += "Balance: " + Balance.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelDirFeeEstimate: " + ParcelDirFeeEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectTaxCurrent: " + ObjectTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "LightTaxCurrent: " + LightTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "LandTaxCurrent: " + LandTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "GroupTaxCurrent: " + GroupTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "TotalDebits: " + TotalDebits.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectTaxEstimate: " + ObjectTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "LightTaxEstimate: " + LightTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "LandTaxEstimate: " + LandTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "GroupTaxEstimate: " + GroupTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LastTaxDate, "LastTaxDate") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDate, "StartDate") + "" + Environment.NewLine;
|
|
output += "TotalCredits: " + TotalCredits.ToString() + "" + Environment.NewLine;
|
|
output += "StipendEstimate: " + StipendEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output += "BonusEstimate: " + BonusEstimate.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneysummaryreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneySummaryReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneySummaryReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 362;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneySummaryReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneySummaryReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneySummaryReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyDetailsRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneydetailsrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneydetailsrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyDetailsRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneyDetailsRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 363;
|
|
Header.Reliable = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneyDetailsRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyDetailsRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyDetailsRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyDetailsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneydetailsreply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
private byte[] _startdate;
|
|
public byte[] StartDate
|
|
{
|
|
get { return _startdate; }
|
|
set
|
|
{
|
|
if (value == null) { _startdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdate = new byte[value.Length]; Array.Copy(value, _startdate, value.Length); }
|
|
}
|
|
}
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (StartDate != null) { length += 1 + StartDate.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_startdate = new byte[length];
|
|
Array.Copy(bytes, i, _startdate, 0, length); i += length;
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDate.Length;
|
|
Array.Copy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length;
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDate, "StartDate") + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneydetailsreply_historydata")]
|
|
public class HistoryDataBlock
|
|
{
|
|
public int Amount;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public HistoryDataBlock() { }
|
|
public HistoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Amount % 256);
|
|
bytes[i++] = (byte)((Amount >> 8) % 256);
|
|
bytes[i++] = (byte)((Amount >> 16) % 256);
|
|
bytes[i++] = (byte)((Amount >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HistoryData --" + Environment.NewLine;
|
|
output += "Amount: " + Amount.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneydetailsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyDetailsReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public HistoryDataBlock[] HistoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneyDetailsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 364;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
HistoryData = new HistoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneyDetailsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyDetailsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)HistoryData.Length;
|
|
for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyDetailsReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < HistoryData.Length; j++)
|
|
{
|
|
output += HistoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyTransactionsRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneytransactionsrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneytransactionsrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyTransactionsRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneyTransactionsRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 365;
|
|
Header.Reliable = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneyTransactionsRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyTransactionsRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyTransactionsRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MoneyTransactionsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("moneytransactionsreply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
private byte[] _startdate;
|
|
public byte[] StartDate
|
|
{
|
|
get { return _startdate; }
|
|
set
|
|
{
|
|
if (value == null) { _startdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdate = new byte[value.Length]; Array.Copy(value, _startdate, value.Length); }
|
|
}
|
|
}
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (StartDate != null) { length += 1 + StartDate.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_startdate = new byte[length];
|
|
Array.Copy(bytes, i, _startdate, 0, length); i += length;
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDate.Length;
|
|
Array.Copy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length;
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDate, "StartDate") + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneytransactionsreply_historydata")]
|
|
public class HistoryDataBlock
|
|
{
|
|
private byte[] _time;
|
|
public byte[] Time
|
|
{
|
|
get { return _time; }
|
|
set
|
|
{
|
|
if (value == null) { _time = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _time = new byte[value.Length]; Array.Copy(value, _time, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _item;
|
|
public byte[] Item
|
|
{
|
|
get { return _item; }
|
|
set
|
|
{
|
|
if (value == null) { _item = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _item = new byte[value.Length]; Array.Copy(value, _item, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _user;
|
|
public byte[] User
|
|
{
|
|
get { return _user; }
|
|
set
|
|
{
|
|
if (value == null) { _user = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _user = new byte[value.Length]; Array.Copy(value, _user, value.Length); }
|
|
}
|
|
}
|
|
public int Type;
|
|
public int Amount;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 8;
|
|
if (Time != null) { length += 1 + Time.Length; }
|
|
if (Item != null) { length += 1 + Item.Length; }
|
|
if (User != null) { length += 1 + User.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public HistoryDataBlock() { }
|
|
public HistoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_time = new byte[length];
|
|
Array.Copy(bytes, i, _time, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_item = new byte[length];
|
|
Array.Copy(bytes, i, _item, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_user = new byte[length];
|
|
Array.Copy(bytes, i, _user, 0, length); i += length;
|
|
Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Time == null) { Console.WriteLine("Warning: Time is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Time.Length;
|
|
Array.Copy(Time, 0, bytes, i, Time.Length); i += Time.Length;
|
|
if(Item == null) { Console.WriteLine("Warning: Item is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Item.Length;
|
|
Array.Copy(Item, 0, bytes, i, Item.Length); i += Item.Length;
|
|
if(User == null) { Console.WriteLine("Warning: User is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)User.Length;
|
|
Array.Copy(User, 0, bytes, i, User.Length); i += User.Length;
|
|
bytes[i++] = (byte)(Type % 256);
|
|
bytes[i++] = (byte)((Type >> 8) % 256);
|
|
bytes[i++] = (byte)((Type >> 16) % 256);
|
|
bytes[i++] = (byte)((Type >> 24) % 256);
|
|
bytes[i++] = (byte)(Amount % 256);
|
|
bytes[i++] = (byte)((Amount >> 8) % 256);
|
|
bytes[i++] = (byte)((Amount >> 16) % 256);
|
|
bytes[i++] = (byte)((Amount >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HistoryData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Time, "Time") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Item, "Item") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(User, "User") + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "Amount: " + Amount.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("moneytransactionsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MoneyTransactionsReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public HistoryDataBlock[] HistoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MoneyTransactionsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 366;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
HistoryData = new HistoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MoneyTransactionsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MoneyTransactionsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)HistoryData.Length;
|
|
for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MoneyTransactionsReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < HistoryData.Length; j++)
|
|
{
|
|
output += HistoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GestureRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("gesturerequest_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public bool Reset;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
Reset = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Reset) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Reset: " + Reset.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GestureRequest; } }
|
|
public AgentBlockBlock AgentBlock;
|
|
|
|
public GestureRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 367;
|
|
Header.Reliable = true;
|
|
AgentBlock = new AgentBlockBlock();
|
|
}
|
|
|
|
public GestureRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public GestureRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GestureRequest ---" + Environment.NewLine;
|
|
output += AgentBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ActivateGesturesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("activategestures_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID AssetID;
|
|
public uint GestureFlags;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
GestureFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(GestureFlags % 256);
|
|
bytes[i++] = (byte)((GestureFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((GestureFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((GestureFlags >> 24) % 256);
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "GestureFlags: " + GestureFlags.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("activategestures_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ActivateGestures; } }
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ActivateGesturesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 368;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ActivateGesturesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ActivateGesturesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ActivateGestures ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DeactivateGesturesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("deactivategestures_data")]
|
|
public class DataBlock
|
|
{
|
|
public uint GestureFlags;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GestureFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(GestureFlags % 256);
|
|
bytes[i++] = (byte)((GestureFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((GestureFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((GestureFlags >> 24) % 256);
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "GestureFlags: " + GestureFlags.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("deactivategestures_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DeactivateGestures; } }
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public DeactivateGesturesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 369;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public DeactivateGesturesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DeactivateGesturesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DeactivateGestures ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MuteListUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("mutelistupdate_mutedata")]
|
|
public class MuteDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
private byte[] _filename;
|
|
public byte[] Filename
|
|
{
|
|
get { return _filename; }
|
|
set
|
|
{
|
|
if (value == null) { _filename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _filename = new byte[value.Length]; Array.Copy(value, _filename, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 16;
|
|
if (Filename != null) { length += 1 + Filename.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MuteDataBlock() { }
|
|
public MuteDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_filename = new byte[length];
|
|
Array.Copy(bytes, i, _filename, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Filename == null) { Console.WriteLine("Warning: Filename is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Filename.Length;
|
|
Array.Copy(Filename, 0, bytes, i, Filename.Length); i += Filename.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MuteData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Filename, "Filename") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MuteListUpdate; } }
|
|
public MuteDataBlock MuteData;
|
|
|
|
public MuteListUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 370;
|
|
Header.Reliable = true;
|
|
MuteData = new MuteDataBlock();
|
|
}
|
|
|
|
public MuteListUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MuteListUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MuteData = new MuteDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MuteData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MuteData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MuteListUpdate ---" + Environment.NewLine;
|
|
output += MuteData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UseCachedMuteListPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("usecachedmutelist_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UseCachedMuteList; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UseCachedMuteListPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 371;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UseCachedMuteListPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UseCachedMuteListPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UseCachedMuteList ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GrantUserRightsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grantuserrights_rights")]
|
|
public class RightsBlock
|
|
{
|
|
public int RelatedRights;
|
|
public LLUUID AgentRelated;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public RightsBlock() { }
|
|
public RightsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RelatedRights = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentRelated = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RelatedRights % 256);
|
|
bytes[i++] = (byte)((RelatedRights >> 8) % 256);
|
|
bytes[i++] = (byte)((RelatedRights >> 16) % 256);
|
|
bytes[i++] = (byte)((RelatedRights >> 24) % 256);
|
|
if(AgentRelated == null) { Console.WriteLine("Warning: AgentRelated is null, in " + this.GetType()); }
|
|
Array.Copy(AgentRelated.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Rights --" + Environment.NewLine;
|
|
output += "RelatedRights: " + RelatedRights.ToString() + "" + Environment.NewLine;
|
|
output += "AgentRelated: " + AgentRelated.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grantuserrights_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GrantUserRights; } }
|
|
public RightsBlock[] Rights;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GrantUserRightsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 372;
|
|
Header.Reliable = true;
|
|
Rights = new RightsBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GrantUserRightsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Rights = new RightsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Rights[j] = new RightsBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GrantUserRightsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Rights = new RightsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Rights[j] = new RightsBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Rights.Length; j++) { length += Rights[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Rights.Length;
|
|
for (int j = 0; j < Rights.Length; j++) { Rights[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GrantUserRights ---" + Environment.NewLine;
|
|
for (int j = 0; j < Rights.Length; j++)
|
|
{
|
|
output += Rights[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChangeUserRightsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("changeuserrights_rights")]
|
|
public class RightsBlock
|
|
{
|
|
public int RelatedRights;
|
|
public LLUUID AgentRelated;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public RightsBlock() { }
|
|
public RightsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RelatedRights = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentRelated = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RelatedRights % 256);
|
|
bytes[i++] = (byte)((RelatedRights >> 8) % 256);
|
|
bytes[i++] = (byte)((RelatedRights >> 16) % 256);
|
|
bytes[i++] = (byte)((RelatedRights >> 24) % 256);
|
|
if(AgentRelated == null) { Console.WriteLine("Warning: AgentRelated is null, in " + this.GetType()); }
|
|
Array.Copy(AgentRelated.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Rights --" + Environment.NewLine;
|
|
output += "RelatedRights: " + RelatedRights.ToString() + "" + Environment.NewLine;
|
|
output += "AgentRelated: " + AgentRelated.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("changeuserrights_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChangeUserRights; } }
|
|
public RightsBlock[] Rights;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ChangeUserRightsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 373;
|
|
Header.Reliable = true;
|
|
Rights = new RightsBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ChangeUserRightsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Rights = new RightsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Rights[j] = new RightsBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChangeUserRightsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Rights = new RightsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Rights[j] = new RightsBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Rights.Length; j++) { length += Rights[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Rights.Length;
|
|
for (int j = 0; j < Rights.Length; j++) { Rights[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChangeUserRights ---" + Environment.NewLine;
|
|
for (int j = 0; j < Rights.Length; j++)
|
|
{
|
|
output += Rights[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class OnlineNotificationPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("onlinenotification_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.OnlineNotification; } }
|
|
public AgentBlockBlock[] AgentBlock;
|
|
|
|
public OnlineNotificationPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 374;
|
|
Header.Reliable = true;
|
|
AgentBlock = new AgentBlockBlock[0];
|
|
}
|
|
|
|
public OnlineNotificationPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
AgentBlock = new AgentBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AgentBlock[j] = new AgentBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public OnlineNotificationPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
AgentBlock = new AgentBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AgentBlock[j] = new AgentBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < AgentBlock.Length; j++) { length += AgentBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)AgentBlock.Length;
|
|
for (int j = 0; j < AgentBlock.Length; j++) { AgentBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- OnlineNotification ---" + Environment.NewLine;
|
|
for (int j = 0; j < AgentBlock.Length; j++)
|
|
{
|
|
output += AgentBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class OfflineNotificationPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("offlinenotification_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.OfflineNotification; } }
|
|
public AgentBlockBlock[] AgentBlock;
|
|
|
|
public OfflineNotificationPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 375;
|
|
Header.Reliable = true;
|
|
AgentBlock = new AgentBlockBlock[0];
|
|
}
|
|
|
|
public OfflineNotificationPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
AgentBlock = new AgentBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AgentBlock[j] = new AgentBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public OfflineNotificationPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
AgentBlock = new AgentBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AgentBlock[j] = new AgentBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < AgentBlock.Length; j++) { length += AgentBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)AgentBlock.Length;
|
|
for (int j = 0; j < AgentBlock.Length; j++) { AgentBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- OfflineNotification ---" + Environment.NewLine;
|
|
for (int j = 0; j < AgentBlock.Length; j++)
|
|
{
|
|
output += AgentBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SetStartLocationRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("setstartlocationrequest_startlocationdata")]
|
|
public class StartLocationDataBlock
|
|
{
|
|
public LLVector3 LocationPos;
|
|
private byte[] _simname;
|
|
public byte[] SimName
|
|
{
|
|
get { return _simname; }
|
|
set
|
|
{
|
|
if (value == null) { _simname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simname = new byte[value.Length]; Array.Copy(value, _simname, value.Length); }
|
|
}
|
|
}
|
|
public uint LocationID;
|
|
public LLVector3 LocationLookAt;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (SimName != null) { length += 1 + SimName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public StartLocationDataBlock() { }
|
|
public StartLocationDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
LocationPos = new LLVector3(bytes, i); i += 12;
|
|
length = (ushort)bytes[i++];
|
|
_simname = new byte[length];
|
|
Array.Copy(bytes, i, _simname, 0, length); i += length;
|
|
LocationID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LocationLookAt = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(LocationPos.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimName.Length;
|
|
Array.Copy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length;
|
|
bytes[i++] = (byte)(LocationID % 256);
|
|
bytes[i++] = (byte)((LocationID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocationID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocationID >> 24) % 256);
|
|
Array.Copy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- StartLocationData --" + Environment.NewLine;
|
|
output += "LocationPos: " + LocationPos.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimName, "SimName") + "" + Environment.NewLine;
|
|
output += "LocationID: " + LocationID.ToString() + "" + Environment.NewLine;
|
|
output += "LocationLookAt: " + LocationLookAt.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("setstartlocationrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SetStartLocationRequest; } }
|
|
public StartLocationDataBlock StartLocationData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SetStartLocationRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 376;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
StartLocationData = new StartLocationDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SetStartLocationRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
StartLocationData = new StartLocationDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SetStartLocationRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
StartLocationData = new StartLocationDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += StartLocationData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
StartLocationData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SetStartLocationRequest ---" + Environment.NewLine;
|
|
output += StartLocationData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AssetUploadRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("assetuploadrequest_assetblock")]
|
|
public class AssetBlockBlock
|
|
{
|
|
public sbyte Type;
|
|
public bool Tempfile;
|
|
private byte[] _assetdata;
|
|
public byte[] AssetData
|
|
{
|
|
get { return _assetdata; }
|
|
set
|
|
{
|
|
if (value == null) { _assetdata = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _assetdata = new byte[value.Length]; Array.Copy(value, _assetdata, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID TransactionID;
|
|
public bool StoreLocal;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 19;
|
|
if (AssetData != null) { length += 2 + AssetData.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AssetBlockBlock() { }
|
|
public AssetBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Type = (sbyte)bytes[i++];
|
|
Tempfile = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_assetdata = new byte[length];
|
|
Array.Copy(bytes, i, _assetdata, 0, length); i += length;
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
StoreLocal = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)Type;
|
|
bytes[i++] = (byte)((Tempfile) ? 1 : 0);
|
|
if(AssetData == null) { Console.WriteLine("Warning: AssetData is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(AssetData.Length % 256);
|
|
bytes[i++] = (byte)((AssetData.Length >> 8) % 256);
|
|
Array.Copy(AssetData, 0, bytes, i, AssetData.Length); i += AssetData.Length;
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((StoreLocal) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AssetBlock --" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "Tempfile: " + Tempfile.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(AssetData, "AssetData") + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output += "StoreLocal: " + StoreLocal.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AssetUploadRequest; } }
|
|
public AssetBlockBlock AssetBlock;
|
|
|
|
public AssetUploadRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 386;
|
|
Header.Reliable = true;
|
|
AssetBlock = new AssetBlockBlock();
|
|
}
|
|
|
|
public AssetUploadRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AssetBlock = new AssetBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public AssetUploadRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AssetBlock = new AssetBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AssetBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AssetBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AssetUploadRequest ---" + Environment.NewLine;
|
|
output += AssetBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AssetUploadCompletePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("assetuploadcomplete_assetblock")]
|
|
public class AssetBlockBlock
|
|
{
|
|
public LLUUID UUID;
|
|
public bool Success;
|
|
public sbyte Type;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 18;
|
|
}
|
|
}
|
|
|
|
public AssetBlockBlock() { }
|
|
public AssetBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
UUID = new LLUUID(bytes, i); i += 16;
|
|
Success = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Type = (sbyte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(UUID == null) { Console.WriteLine("Warning: UUID is null, in " + this.GetType()); }
|
|
Array.Copy(UUID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Success) ? 1 : 0);
|
|
bytes[i++] = (byte)Type;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AssetBlock --" + Environment.NewLine;
|
|
output += "UUID: " + UUID.ToString() + "" + Environment.NewLine;
|
|
output += "Success: " + Success.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AssetUploadComplete; } }
|
|
public AssetBlockBlock AssetBlock;
|
|
|
|
public AssetUploadCompletePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 387;
|
|
Header.Reliable = true;
|
|
AssetBlock = new AssetBlockBlock();
|
|
}
|
|
|
|
public AssetUploadCompletePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AssetBlock = new AssetBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public AssetUploadCompletePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AssetBlock = new AssetBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AssetBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AssetBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AssetUploadComplete ---" + Environment.NewLine;
|
|
output += AssetBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ReputationAgentAssignPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("reputationagentassign_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID RateeID;
|
|
public LLUUID RatorID;
|
|
public float Appearance;
|
|
public float Behavior;
|
|
public float Building;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 44;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RateeID = new LLUUID(bytes, i); i += 16;
|
|
RatorID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Appearance = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Behavior = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Building = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(RateeID == null) { Console.WriteLine("Warning: RateeID is null, in " + this.GetType()); }
|
|
Array.Copy(RateeID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(RatorID == null) { Console.WriteLine("Warning: RatorID is null, in " + this.GetType()); }
|
|
Array.Copy(RatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Appearance);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(Behavior);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(Building);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "RateeID: " + RateeID.ToString() + "" + Environment.NewLine;
|
|
output += "RatorID: " + RatorID.ToString() + "" + Environment.NewLine;
|
|
output += "Appearance: " + Appearance.ToString() + "" + Environment.NewLine;
|
|
output += "Behavior: " + Behavior.ToString() + "" + Environment.NewLine;
|
|
output += "Building: " + Building.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ReputationAgentAssign; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public ReputationAgentAssignPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 388;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public ReputationAgentAssignPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public ReputationAgentAssignPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ReputationAgentAssign ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ReputationIndividualRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("reputationindividualrequest_reputationdata")]
|
|
public class ReputationDataBlock
|
|
{
|
|
public LLUUID ToID;
|
|
public LLUUID FromID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public ReputationDataBlock() { }
|
|
public ReputationDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ToID = new LLUUID(bytes, i); i += 16;
|
|
FromID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ToID == null) { Console.WriteLine("Warning: ToID is null, in " + this.GetType()); }
|
|
Array.Copy(ToID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(FromID == null) { Console.WriteLine("Warning: FromID is null, in " + this.GetType()); }
|
|
Array.Copy(FromID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReputationData --" + Environment.NewLine;
|
|
output += "ToID: " + ToID.ToString() + "" + Environment.NewLine;
|
|
output += "FromID: " + FromID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ReputationIndividualRequest; } }
|
|
public ReputationDataBlock ReputationData;
|
|
|
|
public ReputationIndividualRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 389;
|
|
Header.Reliable = true;
|
|
ReputationData = new ReputationDataBlock();
|
|
}
|
|
|
|
public ReputationIndividualRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ReputationData = new ReputationDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ReputationIndividualRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ReputationData = new ReputationDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ReputationData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ReputationData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ReputationIndividualRequest ---" + Environment.NewLine;
|
|
output += ReputationData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ReputationIndividualReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("reputationindividualreply_reputationdata")]
|
|
public class ReputationDataBlock
|
|
{
|
|
public float Appearance;
|
|
public LLUUID ToID;
|
|
public float Behavior;
|
|
public LLUUID FromID;
|
|
public float Building;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 44;
|
|
}
|
|
}
|
|
|
|
public ReputationDataBlock() { }
|
|
public ReputationDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Appearance = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ToID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Behavior = BitConverter.ToSingle(bytes, i); i += 4;
|
|
FromID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Building = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(Appearance);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(ToID == null) { Console.WriteLine("Warning: ToID is null, in " + this.GetType()); }
|
|
Array.Copy(ToID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Behavior);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(FromID == null) { Console.WriteLine("Warning: FromID is null, in " + this.GetType()); }
|
|
Array.Copy(FromID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Building);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReputationData --" + Environment.NewLine;
|
|
output += "Appearance: " + Appearance.ToString() + "" + Environment.NewLine;
|
|
output += "ToID: " + ToID.ToString() + "" + Environment.NewLine;
|
|
output += "Behavior: " + Behavior.ToString() + "" + Environment.NewLine;
|
|
output += "FromID: " + FromID.ToString() + "" + Environment.NewLine;
|
|
output += "Building: " + Building.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ReputationIndividualReply; } }
|
|
public ReputationDataBlock ReputationData;
|
|
|
|
public ReputationIndividualReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 390;
|
|
Header.Reliable = true;
|
|
ReputationData = new ReputationDataBlock();
|
|
}
|
|
|
|
public ReputationIndividualReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ReputationData = new ReputationDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ReputationIndividualReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ReputationData = new ReputationDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ReputationData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ReputationData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ReputationIndividualReply ---" + Environment.NewLine;
|
|
output += ReputationData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CreateGroupRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("creategrouprequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("creategrouprequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public bool AllowPublish;
|
|
private byte[] _charter;
|
|
public byte[] Charter
|
|
{
|
|
get { return _charter; }
|
|
set
|
|
{
|
|
if (value == null) { _charter = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _charter = new byte[value.Length]; Array.Copy(value, _charter, value.Length); }
|
|
}
|
|
}
|
|
public bool ShowInList;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID InsigniaID;
|
|
public int MembershipFee;
|
|
public bool MaturePublish;
|
|
public bool OpenEnrollment;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (Charter != null) { length += 2 + Charter.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_charter = new byte[length];
|
|
Array.Copy(bytes, i, _charter, 0, length); i += length;
|
|
ShowInList = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
InsigniaID = new LLUUID(bytes, i); i += 16;
|
|
MembershipFee = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
OpenEnrollment = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((AllowPublish) ? 1 : 0);
|
|
if(Charter == null) { Console.WriteLine("Warning: Charter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Charter.Length % 256);
|
|
bytes[i++] = (byte)((Charter.Length >> 8) % 256);
|
|
Array.Copy(Charter, 0, bytes, i, Charter.Length); i += Charter.Length;
|
|
bytes[i++] = (byte)((ShowInList) ? 1 : 0);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(InsigniaID == null) { Console.WriteLine("Warning: InsigniaID is null, in " + this.GetType()); }
|
|
Array.Copy(InsigniaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MembershipFee % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 8) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 16) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 24) % 256);
|
|
bytes[i++] = (byte)((MaturePublish) ? 1 : 0);
|
|
bytes[i++] = (byte)((OpenEnrollment) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "AllowPublish: " + AllowPublish.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Charter, "Charter") + "" + Environment.NewLine;
|
|
output += "ShowInList: " + ShowInList.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "InsigniaID: " + InsigniaID.ToString() + "" + Environment.NewLine;
|
|
output += "MembershipFee: " + MembershipFee.ToString() + "" + Environment.NewLine;
|
|
output += "MaturePublish: " + MaturePublish.ToString() + "" + Environment.NewLine;
|
|
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CreateGroupRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public CreateGroupRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 395;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public CreateGroupRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CreateGroupRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CreateGroupRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CreateGroupReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("creategroupreply_replydata")]
|
|
public class ReplyDataBlock
|
|
{
|
|
private byte[] _message;
|
|
public byte[] Message
|
|
{
|
|
get { return _message; }
|
|
set
|
|
{
|
|
if (value == null) { _message = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _message = new byte[value.Length]; Array.Copy(value, _message, value.Length); }
|
|
}
|
|
}
|
|
public bool Success;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 17;
|
|
if (Message != null) { length += 1 + Message.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ReplyDataBlock() { }
|
|
public ReplyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_message = new byte[length];
|
|
Array.Copy(bytes, i, _message, 0, length); i += length;
|
|
Success = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Message.Length;
|
|
Array.Copy(Message, 0, bytes, i, Message.Length); i += Message.Length;
|
|
bytes[i++] = (byte)((Success) ? 1 : 0);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReplyData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Message, "Message") + "" + Environment.NewLine;
|
|
output += "Success: " + Success.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("creategroupreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CreateGroupReply; } }
|
|
public ReplyDataBlock ReplyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public CreateGroupReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 396;
|
|
Header.Reliable = true;
|
|
ReplyData = new ReplyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public CreateGroupReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ReplyData = new ReplyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CreateGroupReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ReplyData = new ReplyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ReplyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ReplyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CreateGroupReply ---" + Environment.NewLine;
|
|
output += ReplyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UpdateGroupInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("updategroupinfo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updategroupinfo_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public bool AllowPublish;
|
|
private byte[] _charter;
|
|
public byte[] Charter
|
|
{
|
|
get { return _charter; }
|
|
set
|
|
{
|
|
if (value == null) { _charter = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _charter = new byte[value.Length]; Array.Copy(value, _charter, value.Length); }
|
|
}
|
|
}
|
|
public bool ShowInList;
|
|
public LLUUID InsigniaID;
|
|
public LLUUID GroupID;
|
|
public int MembershipFee;
|
|
public bool MaturePublish;
|
|
public bool OpenEnrollment;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 40;
|
|
if (Charter != null) { length += 2 + Charter.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_charter = new byte[length];
|
|
Array.Copy(bytes, i, _charter, 0, length); i += length;
|
|
ShowInList = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
InsigniaID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
MembershipFee = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
OpenEnrollment = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((AllowPublish) ? 1 : 0);
|
|
if(Charter == null) { Console.WriteLine("Warning: Charter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Charter.Length % 256);
|
|
bytes[i++] = (byte)((Charter.Length >> 8) % 256);
|
|
Array.Copy(Charter, 0, bytes, i, Charter.Length); i += Charter.Length;
|
|
bytes[i++] = (byte)((ShowInList) ? 1 : 0);
|
|
if(InsigniaID == null) { Console.WriteLine("Warning: InsigniaID is null, in " + this.GetType()); }
|
|
Array.Copy(InsigniaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MembershipFee % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 8) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 16) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 24) % 256);
|
|
bytes[i++] = (byte)((MaturePublish) ? 1 : 0);
|
|
bytes[i++] = (byte)((OpenEnrollment) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "AllowPublish: " + AllowPublish.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Charter, "Charter") + "" + Environment.NewLine;
|
|
output += "ShowInList: " + ShowInList.ToString() + "" + Environment.NewLine;
|
|
output += "InsigniaID: " + InsigniaID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "MembershipFee: " + MembershipFee.ToString() + "" + Environment.NewLine;
|
|
output += "MaturePublish: " + MaturePublish.ToString() + "" + Environment.NewLine;
|
|
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UpdateGroupInfo; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public UpdateGroupInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 397;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public UpdateGroupInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UpdateGroupInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UpdateGroupInfo ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupRoleChangesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouprolechanges_rolechange")]
|
|
public class RoleChangeBlock
|
|
{
|
|
public LLUUID MemberID;
|
|
public uint Change;
|
|
public LLUUID RoleID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public RoleChangeBlock() { }
|
|
public RoleChangeBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
MemberID = new LLUUID(bytes, i); i += 16;
|
|
Change = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RoleID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(MemberID == null) { Console.WriteLine("Warning: MemberID is null, in " + this.GetType()); }
|
|
Array.Copy(MemberID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Change % 256);
|
|
bytes[i++] = (byte)((Change >> 8) % 256);
|
|
bytes[i++] = (byte)((Change >> 16) % 256);
|
|
bytes[i++] = (byte)((Change >> 24) % 256);
|
|
if(RoleID == null) { Console.WriteLine("Warning: RoleID is null, in " + this.GetType()); }
|
|
Array.Copy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RoleChange --" + Environment.NewLine;
|
|
output += "MemberID: " + MemberID.ToString() + "" + Environment.NewLine;
|
|
output += "Change: " + Change.ToString() + "" + Environment.NewLine;
|
|
output += "RoleID: " + RoleID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouprolechanges_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupRoleChanges; } }
|
|
public RoleChangeBlock[] RoleChange;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupRoleChangesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 398;
|
|
Header.Reliable = true;
|
|
RoleChange = new RoleChangeBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupRoleChangesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
RoleChange = new RoleChangeBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RoleChange[j] = new RoleChangeBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupRoleChangesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
RoleChange = new RoleChangeBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RoleChange[j] = new RoleChangeBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < RoleChange.Length; j++) { length += RoleChange[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)RoleChange.Length;
|
|
for (int j = 0; j < RoleChange.Length; j++) { RoleChange[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupRoleChanges ---" + Environment.NewLine;
|
|
for (int j = 0; j < RoleChange.Length; j++)
|
|
{
|
|
output += RoleChange[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class JoinGroupRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("joingrouprequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("joingrouprequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.JoinGroupRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public JoinGroupRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 399;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public JoinGroupRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public JoinGroupRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- JoinGroupRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class JoinGroupReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("joingroupreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("joingroupreply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public bool Success;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Success = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Success) ? 1 : 0);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "Success: " + Success.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.JoinGroupReply; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public JoinGroupReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 400;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public JoinGroupReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public JoinGroupReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- JoinGroupReply ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EjectGroupMemberRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("ejectgroupmemberrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("ejectgroupmemberrequest_ejectdata")]
|
|
public class EjectDataBlock
|
|
{
|
|
public LLUUID EjecteeID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public EjectDataBlock() { }
|
|
public EjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
EjecteeID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(EjecteeID == null) { Console.WriteLine("Warning: EjecteeID is null, in " + this.GetType()); }
|
|
Array.Copy(EjecteeID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EjectData --" + Environment.NewLine;
|
|
output += "EjecteeID: " + EjecteeID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("ejectgroupmemberrequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EjectGroupMemberRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public EjectDataBlock[] EjectData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public EjectGroupMemberRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 401;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
EjectData = new EjectDataBlock[0];
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public EjectGroupMemberRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
EjectData = new EjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ EjectData[j] = new EjectDataBlock(bytes, ref i); }
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EjectGroupMemberRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
EjectData = new EjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ EjectData[j] = new EjectDataBlock(bytes, ref i); }
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
length++;
|
|
for (int j = 0; j < EjectData.Length; j++) { length += EjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)EjectData.Length;
|
|
for (int j = 0; j < EjectData.Length; j++) { EjectData[j].ToBytes(bytes, ref i); }
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EjectGroupMemberRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < EjectData.Length; j++)
|
|
{
|
|
output += EjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class EjectGroupMemberReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("ejectgroupmemberreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("ejectgroupmemberreply_ejectdata")]
|
|
public class EjectDataBlock
|
|
{
|
|
public bool Success;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public EjectDataBlock() { }
|
|
public EjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Success = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Success) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- EjectData --" + Environment.NewLine;
|
|
output += "Success: " + Success.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("ejectgroupmemberreply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.EjectGroupMemberReply; } }
|
|
public AgentDataBlock AgentData;
|
|
public EjectDataBlock EjectData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public EjectGroupMemberReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 402;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
EjectData = new EjectDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public EjectGroupMemberReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
EjectData = new EjectDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public EjectGroupMemberReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
EjectData = new EjectDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += EjectData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
EjectData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- EjectGroupMemberReply ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += EjectData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LeaveGroupRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("leavegrouprequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("leavegrouprequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LeaveGroupRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public LeaveGroupRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 403;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public LeaveGroupRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LeaveGroupRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LeaveGroupRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LeaveGroupReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("leavegroupreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("leavegroupreply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public bool Success;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Success = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Success) ? 1 : 0);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "Success: " + Success.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LeaveGroupReply; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public LeaveGroupReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 404;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public LeaveGroupReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LeaveGroupReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LeaveGroupReply ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class InviteGroupRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("invitegrouprequest_invitedata")]
|
|
public class InviteDataBlock
|
|
{
|
|
public LLUUID RoleID;
|
|
public LLUUID InviteeID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public InviteDataBlock() { }
|
|
public InviteDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RoleID = new LLUUID(bytes, i); i += 16;
|
|
InviteeID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RoleID == null) { Console.WriteLine("Warning: RoleID is null, in " + this.GetType()); }
|
|
Array.Copy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(InviteeID == null) { Console.WriteLine("Warning: InviteeID is null, in " + this.GetType()); }
|
|
Array.Copy(InviteeID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- InviteData --" + Environment.NewLine;
|
|
output += "RoleID: " + RoleID.ToString() + "" + Environment.NewLine;
|
|
output += "InviteeID: " + InviteeID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("invitegrouprequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("invitegrouprequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.InviteGroupRequest; } }
|
|
public InviteDataBlock[] InviteData;
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public InviteGroupRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 405;
|
|
Header.Reliable = true;
|
|
InviteData = new InviteDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public InviteGroupRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
InviteData = new InviteDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InviteData[j] = new InviteDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public InviteGroupRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
InviteData = new InviteDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ InviteData[j] = new InviteDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
length++;
|
|
for (int j = 0; j < InviteData.Length; j++) { length += InviteData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)InviteData.Length;
|
|
for (int j = 0; j < InviteData.Length; j++) { InviteData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- InviteGroupRequest ---" + Environment.NewLine;
|
|
for (int j = 0; j < InviteData.Length; j++)
|
|
{
|
|
output += InviteData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupProfileRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupprofilerequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupprofilerequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupProfileRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupProfileRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 407;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupProfileRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupProfileRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupProfileRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupProfileReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupprofilereply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupprofilereply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID OwnerRole;
|
|
public bool AllowPublish;
|
|
private byte[] _charter;
|
|
public byte[] Charter
|
|
{
|
|
get { return _charter; }
|
|
set
|
|
{
|
|
if (value == null) { _charter = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _charter = new byte[value.Length]; Array.Copy(value, _charter, value.Length); }
|
|
}
|
|
}
|
|
public int GroupMembershipCount;
|
|
public bool ShowInList;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _membertitle;
|
|
public byte[] MemberTitle
|
|
{
|
|
get { return _membertitle; }
|
|
set
|
|
{
|
|
if (value == null) { _membertitle = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _membertitle = new byte[value.Length]; Array.Copy(value, _membertitle, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID InsigniaID;
|
|
public int GroupRolesCount;
|
|
public LLUUID GroupID;
|
|
public int MembershipFee;
|
|
public bool MaturePublish;
|
|
public ulong PowersMask;
|
|
public int Money;
|
|
public LLUUID FounderID;
|
|
public bool OpenEnrollment;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 92;
|
|
if (Charter != null) { length += 2 + Charter.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (MemberTitle != null) { length += 1 + MemberTitle.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
OwnerRole = new LLUUID(bytes, i); i += 16;
|
|
AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_charter = new byte[length];
|
|
Array.Copy(bytes, i, _charter, 0, length); i += length;
|
|
GroupMembershipCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ShowInList = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_membertitle = new byte[length];
|
|
Array.Copy(bytes, i, _membertitle, 0, length); i += length;
|
|
InsigniaID = new LLUUID(bytes, i); i += 16;
|
|
GroupRolesCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
MembershipFee = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
PowersMask = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
Money = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
FounderID = new LLUUID(bytes, i); i += 16;
|
|
OpenEnrollment = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OwnerRole == null) { Console.WriteLine("Warning: OwnerRole is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerRole.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AllowPublish) ? 1 : 0);
|
|
if(Charter == null) { Console.WriteLine("Warning: Charter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Charter.Length % 256);
|
|
bytes[i++] = (byte)((Charter.Length >> 8) % 256);
|
|
Array.Copy(Charter, 0, bytes, i, Charter.Length); i += Charter.Length;
|
|
bytes[i++] = (byte)(GroupMembershipCount % 256);
|
|
bytes[i++] = (byte)((GroupMembershipCount >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMembershipCount >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMembershipCount >> 24) % 256);
|
|
bytes[i++] = (byte)((ShowInList) ? 1 : 0);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(MemberTitle == null) { Console.WriteLine("Warning: MemberTitle is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MemberTitle.Length;
|
|
Array.Copy(MemberTitle, 0, bytes, i, MemberTitle.Length); i += MemberTitle.Length;
|
|
if(InsigniaID == null) { Console.WriteLine("Warning: InsigniaID is null, in " + this.GetType()); }
|
|
Array.Copy(InsigniaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(GroupRolesCount % 256);
|
|
bytes[i++] = (byte)((GroupRolesCount >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupRolesCount >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupRolesCount >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MembershipFee % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 8) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 16) % 256);
|
|
bytes[i++] = (byte)((MembershipFee >> 24) % 256);
|
|
bytes[i++] = (byte)((MaturePublish) ? 1 : 0);
|
|
bytes[i++] = (byte)(PowersMask % 256);
|
|
bytes[i++] = (byte)((PowersMask >> 8) % 256);
|
|
bytes[i++] = (byte)((PowersMask >> 16) % 256);
|
|
bytes[i++] = (byte)((PowersMask >> 24) % 256);
|
|
bytes[i++] = (byte)((PowersMask >> 32) % 256);
|
|
bytes[i++] = (byte)((PowersMask >> 40) % 256);
|
|
bytes[i++] = (byte)((PowersMask >> 48) % 256);
|
|
bytes[i++] = (byte)((PowersMask >> 56) % 256);
|
|
bytes[i++] = (byte)(Money % 256);
|
|
bytes[i++] = (byte)((Money >> 8) % 256);
|
|
bytes[i++] = (byte)((Money >> 16) % 256);
|
|
bytes[i++] = (byte)((Money >> 24) % 256);
|
|
if(FounderID == null) { Console.WriteLine("Warning: FounderID is null, in " + this.GetType()); }
|
|
Array.Copy(FounderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((OpenEnrollment) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "OwnerRole: " + OwnerRole.ToString() + "" + Environment.NewLine;
|
|
output += "AllowPublish: " + AllowPublish.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Charter, "Charter") + "" + Environment.NewLine;
|
|
output += "GroupMembershipCount: " + GroupMembershipCount.ToString() + "" + Environment.NewLine;
|
|
output += "ShowInList: " + ShowInList.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MemberTitle, "MemberTitle") + "" + Environment.NewLine;
|
|
output += "InsigniaID: " + InsigniaID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupRolesCount: " + GroupRolesCount.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "MembershipFee: " + MembershipFee.ToString() + "" + Environment.NewLine;
|
|
output += "MaturePublish: " + MaturePublish.ToString() + "" + Environment.NewLine;
|
|
output += "PowersMask: " + PowersMask.ToString() + "" + Environment.NewLine;
|
|
output += "Money: " + Money.ToString() + "" + Environment.NewLine;
|
|
output += "FounderID: " + FounderID.ToString() + "" + Environment.NewLine;
|
|
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupProfileReply; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupProfileReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 408;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupProfileReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupProfileReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupProfileReply ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupAccountSummaryRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupaccountsummaryrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccountsummaryrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupAccountSummaryRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupAccountSummaryRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 409;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupAccountSummaryRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupAccountSummaryRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupAccountSummaryRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupAccountSummaryReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupaccountsummaryreply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public int ParcelDirFeeCurrent;
|
|
private byte[] _taxdate;
|
|
public byte[] TaxDate
|
|
{
|
|
get { return _taxdate; }
|
|
set
|
|
{
|
|
if (value == null) { _taxdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _taxdate = new byte[value.Length]; Array.Copy(value, _taxdate, value.Length); }
|
|
}
|
|
}
|
|
public int Balance;
|
|
public int ParcelDirFeeEstimate;
|
|
public LLUUID RequestID;
|
|
public int ObjectTaxCurrent;
|
|
public int LightTaxCurrent;
|
|
public int LandTaxCurrent;
|
|
public int GroupTaxCurrent;
|
|
public int TotalDebits;
|
|
public int IntervalDays;
|
|
public int ObjectTaxEstimate;
|
|
public int LightTaxEstimate;
|
|
public int LandTaxEstimate;
|
|
public int GroupTaxEstimate;
|
|
private byte[] _lasttaxdate;
|
|
public byte[] LastTaxDate
|
|
{
|
|
get { return _lasttaxdate; }
|
|
set
|
|
{
|
|
if (value == null) { _lasttaxdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _lasttaxdate = new byte[value.Length]; Array.Copy(value, _lasttaxdate, value.Length); }
|
|
}
|
|
}
|
|
public int NonExemptMembers;
|
|
private byte[] _startdate;
|
|
public byte[] StartDate
|
|
{
|
|
get { return _startdate; }
|
|
set
|
|
{
|
|
if (value == null) { _startdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdate = new byte[value.Length]; Array.Copy(value, _startdate, value.Length); }
|
|
}
|
|
}
|
|
public int TotalCredits;
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 80;
|
|
if (TaxDate != null) { length += 1 + TaxDate.Length; }
|
|
if (LastTaxDate != null) { length += 1 + LastTaxDate.Length; }
|
|
if (StartDate != null) { length += 1 + StartDate.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ParcelDirFeeCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_taxdate = new byte[length];
|
|
Array.Copy(bytes, i, _taxdate, 0, length); i += length;
|
|
Balance = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ParcelDirFeeEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
ObjectTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LightTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LandTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupTaxCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TotalDebits = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LightTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
LandTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupTaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_lasttaxdate = new byte[length];
|
|
Array.Copy(bytes, i, _lasttaxdate, 0, length); i += length;
|
|
NonExemptMembers = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_startdate = new byte[length];
|
|
Array.Copy(bytes, i, _startdate, 0, length); i += length;
|
|
TotalCredits = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ParcelDirFeeCurrent % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeCurrent >> 24) % 256);
|
|
if(TaxDate == null) { Console.WriteLine("Warning: TaxDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TaxDate.Length;
|
|
Array.Copy(TaxDate, 0, bytes, i, TaxDate.Length); i += TaxDate.Length;
|
|
bytes[i++] = (byte)(Balance % 256);
|
|
bytes[i++] = (byte)((Balance >> 8) % 256);
|
|
bytes[i++] = (byte)((Balance >> 16) % 256);
|
|
bytes[i++] = (byte)((Balance >> 24) % 256);
|
|
bytes[i++] = (byte)(ParcelDirFeeEstimate % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((ParcelDirFeeEstimate >> 24) % 256);
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(ObjectTaxCurrent % 256);
|
|
bytes[i++] = (byte)((ObjectTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(LightTaxCurrent % 256);
|
|
bytes[i++] = (byte)((LightTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((LightTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((LightTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(LandTaxCurrent % 256);
|
|
bytes[i++] = (byte)((LandTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((LandTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((LandTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupTaxCurrent % 256);
|
|
bytes[i++] = (byte)((GroupTaxCurrent >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupTaxCurrent >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupTaxCurrent >> 24) % 256);
|
|
bytes[i++] = (byte)(TotalDebits % 256);
|
|
bytes[i++] = (byte)((TotalDebits >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalDebits >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalDebits >> 24) % 256);
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(ObjectTaxEstimate % 256);
|
|
bytes[i++] = (byte)((ObjectTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectTaxEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(LightTaxEstimate % 256);
|
|
bytes[i++] = (byte)((LightTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((LightTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((LightTaxEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(LandTaxEstimate % 256);
|
|
bytes[i++] = (byte)((LandTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((LandTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((LandTaxEstimate >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupTaxEstimate % 256);
|
|
bytes[i++] = (byte)((GroupTaxEstimate >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupTaxEstimate >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupTaxEstimate >> 24) % 256);
|
|
if(LastTaxDate == null) { Console.WriteLine("Warning: LastTaxDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LastTaxDate.Length;
|
|
Array.Copy(LastTaxDate, 0, bytes, i, LastTaxDate.Length); i += LastTaxDate.Length;
|
|
bytes[i++] = (byte)(NonExemptMembers % 256);
|
|
bytes[i++] = (byte)((NonExemptMembers >> 8) % 256);
|
|
bytes[i++] = (byte)((NonExemptMembers >> 16) % 256);
|
|
bytes[i++] = (byte)((NonExemptMembers >> 24) % 256);
|
|
if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDate.Length;
|
|
Array.Copy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length;
|
|
bytes[i++] = (byte)(TotalCredits % 256);
|
|
bytes[i++] = (byte)((TotalCredits >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalCredits >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalCredits >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "ParcelDirFeeCurrent: " + ParcelDirFeeCurrent.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TaxDate, "TaxDate") + "" + Environment.NewLine;
|
|
output += "Balance: " + Balance.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelDirFeeEstimate: " + ParcelDirFeeEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectTaxCurrent: " + ObjectTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "LightTaxCurrent: " + LightTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "LandTaxCurrent: " + LandTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "GroupTaxCurrent: " + GroupTaxCurrent.ToString() + "" + Environment.NewLine;
|
|
output += "TotalDebits: " + TotalDebits.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectTaxEstimate: " + ObjectTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "LightTaxEstimate: " + LightTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "LandTaxEstimate: " + LandTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += "GroupTaxEstimate: " + GroupTaxEstimate.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LastTaxDate, "LastTaxDate") + "" + Environment.NewLine;
|
|
output += "NonExemptMembers: " + NonExemptMembers.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDate, "StartDate") + "" + Environment.NewLine;
|
|
output += "TotalCredits: " + TotalCredits.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccountsummaryreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupAccountSummaryReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupAccountSummaryReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 410;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupAccountSummaryReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupAccountSummaryReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupAccountSummaryReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupAccountDetailsRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupaccountdetailsrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccountdetailsrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupAccountDetailsRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupAccountDetailsRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 411;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupAccountDetailsRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupAccountDetailsRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupAccountDetailsRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupAccountDetailsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupaccountdetailsreply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
private byte[] _startdate;
|
|
public byte[] StartDate
|
|
{
|
|
get { return _startdate; }
|
|
set
|
|
{
|
|
if (value == null) { _startdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdate = new byte[value.Length]; Array.Copy(value, _startdate, value.Length); }
|
|
}
|
|
}
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (StartDate != null) { length += 1 + StartDate.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_startdate = new byte[length];
|
|
Array.Copy(bytes, i, _startdate, 0, length); i += length;
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDate.Length;
|
|
Array.Copy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length;
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDate, "StartDate") + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccountdetailsreply_historydata")]
|
|
public class HistoryDataBlock
|
|
{
|
|
public int Amount;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public HistoryDataBlock() { }
|
|
public HistoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Amount % 256);
|
|
bytes[i++] = (byte)((Amount >> 8) % 256);
|
|
bytes[i++] = (byte)((Amount >> 16) % 256);
|
|
bytes[i++] = (byte)((Amount >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HistoryData --" + Environment.NewLine;
|
|
output += "Amount: " + Amount.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccountdetailsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupAccountDetailsReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public HistoryDataBlock[] HistoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupAccountDetailsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 412;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
HistoryData = new HistoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupAccountDetailsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupAccountDetailsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)HistoryData.Length;
|
|
for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupAccountDetailsReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < HistoryData.Length; j++)
|
|
{
|
|
output += HistoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupAccountTransactionsRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupaccounttransactionsrequest_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccounttransactionsrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupAccountTransactionsRequest; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupAccountTransactionsRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 413;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupAccountTransactionsRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupAccountTransactionsRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupAccountTransactionsRequest ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupAccountTransactionsReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupaccounttransactionsreply_moneydata")]
|
|
public class MoneyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int IntervalDays;
|
|
private byte[] _startdate;
|
|
public byte[] StartDate
|
|
{
|
|
get { return _startdate; }
|
|
set
|
|
{
|
|
if (value == null) { _startdate = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdate = new byte[value.Length]; Array.Copy(value, _startdate, value.Length); }
|
|
}
|
|
}
|
|
public int CurrentInterval;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 24;
|
|
if (StartDate != null) { length += 1 + StartDate.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MoneyDataBlock() { }
|
|
public MoneyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_startdate = new byte[length];
|
|
Array.Copy(bytes, i, _startdate, 0, length); i += length;
|
|
CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(IntervalDays % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 8) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 16) % 256);
|
|
bytes[i++] = (byte)((IntervalDays >> 24) % 256);
|
|
if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDate.Length;
|
|
Array.Copy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length;
|
|
bytes[i++] = (byte)(CurrentInterval % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 8) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 16) % 256);
|
|
bytes[i++] = (byte)((CurrentInterval >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MoneyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "IntervalDays: " + IntervalDays.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDate, "StartDate") + "" + Environment.NewLine;
|
|
output += "CurrentInterval: " + CurrentInterval.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccounttransactionsreply_historydata")]
|
|
public class HistoryDataBlock
|
|
{
|
|
private byte[] _time;
|
|
public byte[] Time
|
|
{
|
|
get { return _time; }
|
|
set
|
|
{
|
|
if (value == null) { _time = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _time = new byte[value.Length]; Array.Copy(value, _time, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _item;
|
|
public byte[] Item
|
|
{
|
|
get { return _item; }
|
|
set
|
|
{
|
|
if (value == null) { _item = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _item = new byte[value.Length]; Array.Copy(value, _item, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _user;
|
|
public byte[] User
|
|
{
|
|
get { return _user; }
|
|
set
|
|
{
|
|
if (value == null) { _user = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _user = new byte[value.Length]; Array.Copy(value, _user, value.Length); }
|
|
}
|
|
}
|
|
public int Type;
|
|
public int Amount;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 8;
|
|
if (Time != null) { length += 1 + Time.Length; }
|
|
if (Item != null) { length += 1 + Item.Length; }
|
|
if (User != null) { length += 1 + User.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public HistoryDataBlock() { }
|
|
public HistoryDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_time = new byte[length];
|
|
Array.Copy(bytes, i, _time, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_item = new byte[length];
|
|
Array.Copy(bytes, i, _item, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_user = new byte[length];
|
|
Array.Copy(bytes, i, _user, 0, length); i += length;
|
|
Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Time == null) { Console.WriteLine("Warning: Time is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Time.Length;
|
|
Array.Copy(Time, 0, bytes, i, Time.Length); i += Time.Length;
|
|
if(Item == null) { Console.WriteLine("Warning: Item is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Item.Length;
|
|
Array.Copy(Item, 0, bytes, i, Item.Length); i += Item.Length;
|
|
if(User == null) { Console.WriteLine("Warning: User is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)User.Length;
|
|
Array.Copy(User, 0, bytes, i, User.Length); i += User.Length;
|
|
bytes[i++] = (byte)(Type % 256);
|
|
bytes[i++] = (byte)((Type >> 8) % 256);
|
|
bytes[i++] = (byte)((Type >> 16) % 256);
|
|
bytes[i++] = (byte)((Type >> 24) % 256);
|
|
bytes[i++] = (byte)(Amount % 256);
|
|
bytes[i++] = (byte)((Amount >> 8) % 256);
|
|
bytes[i++] = (byte)((Amount >> 16) % 256);
|
|
bytes[i++] = (byte)((Amount >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HistoryData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Time, "Time") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Item, "Item") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(User, "User") + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "Amount: " + Amount.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupaccounttransactionsreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupAccountTransactionsReply; } }
|
|
public MoneyDataBlock MoneyData;
|
|
public HistoryDataBlock[] HistoryData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupAccountTransactionsReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 414;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MoneyData = new MoneyDataBlock();
|
|
HistoryData = new HistoryDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupAccountTransactionsReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupAccountTransactionsReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MoneyData = new MoneyDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
HistoryData = new HistoryDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ HistoryData[j] = new HistoryDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MoneyData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MoneyData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)HistoryData.Length;
|
|
for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupAccountTransactionsReply ---" + Environment.NewLine;
|
|
output += MoneyData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < HistoryData.Length; j++)
|
|
{
|
|
output += HistoryData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupActiveProposalsRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupactiveproposalsrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupactiveproposalsrequest_transactiondata")]
|
|
public class TransactionDataBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionDataBlock() { }
|
|
public TransactionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionData --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupactiveproposalsrequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupActiveProposalsRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public TransactionDataBlock TransactionData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupActiveProposalsRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 415;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
TransactionData = new TransactionDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupActiveProposalsRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupActiveProposalsRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += TransactionData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
TransactionData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupActiveProposalsRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += TransactionData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupActiveProposalItemReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupactiveproposalitemreply_proposaldata")]
|
|
public class ProposalDataBlock
|
|
{
|
|
private byte[] _startdatetime;
|
|
public byte[] StartDateTime
|
|
{
|
|
get { return _startdatetime; }
|
|
set
|
|
{
|
|
if (value == null) { _startdatetime = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdatetime = new byte[value.Length]; Array.Copy(value, _startdatetime, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _proposaltext;
|
|
public byte[] ProposalText
|
|
{
|
|
get { return _proposaltext; }
|
|
set
|
|
{
|
|
if (value == null) { _proposaltext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _proposaltext = new byte[value.Length]; Array.Copy(value, _proposaltext, value.Length); }
|
|
}
|
|
}
|
|
public float Majority;
|
|
private byte[] _tersedateid;
|
|
public byte[] TerseDateID
|
|
{
|
|
get { return _tersedateid; }
|
|
set
|
|
{
|
|
if (value == null) { _tersedateid = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _tersedateid = new byte[value.Length]; Array.Copy(value, _tersedateid, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _enddatetime;
|
|
public byte[] EndDateTime
|
|
{
|
|
get { return _enddatetime; }
|
|
set
|
|
{
|
|
if (value == null) { _enddatetime = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _enddatetime = new byte[value.Length]; Array.Copy(value, _enddatetime, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID VoteID;
|
|
public bool AlreadyVoted;
|
|
private byte[] _votecast;
|
|
public byte[] VoteCast
|
|
{
|
|
get { return _votecast; }
|
|
set
|
|
{
|
|
if (value == null) { _votecast = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _votecast = new byte[value.Length]; Array.Copy(value, _votecast, value.Length); }
|
|
}
|
|
}
|
|
public int Quorum;
|
|
public LLUUID VoteInitiator;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 41;
|
|
if (StartDateTime != null) { length += 1 + StartDateTime.Length; }
|
|
if (ProposalText != null) { length += 1 + ProposalText.Length; }
|
|
if (TerseDateID != null) { length += 1 + TerseDateID.Length; }
|
|
if (EndDateTime != null) { length += 1 + EndDateTime.Length; }
|
|
if (VoteCast != null) { length += 1 + VoteCast.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ProposalDataBlock() { }
|
|
public ProposalDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_startdatetime = new byte[length];
|
|
Array.Copy(bytes, i, _startdatetime, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_proposaltext = new byte[length];
|
|
Array.Copy(bytes, i, _proposaltext, 0, length); i += length;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Majority = BitConverter.ToSingle(bytes, i); i += 4;
|
|
length = (ushort)bytes[i++];
|
|
_tersedateid = new byte[length];
|
|
Array.Copy(bytes, i, _tersedateid, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_enddatetime = new byte[length];
|
|
Array.Copy(bytes, i, _enddatetime, 0, length); i += length;
|
|
VoteID = new LLUUID(bytes, i); i += 16;
|
|
AlreadyVoted = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_votecast = new byte[length];
|
|
Array.Copy(bytes, i, _votecast, 0, length); i += length;
|
|
Quorum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
VoteInitiator = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(StartDateTime == null) { Console.WriteLine("Warning: StartDateTime is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDateTime.Length;
|
|
Array.Copy(StartDateTime, 0, bytes, i, StartDateTime.Length); i += StartDateTime.Length;
|
|
if(ProposalText == null) { Console.WriteLine("Warning: ProposalText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ProposalText.Length;
|
|
Array.Copy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length;
|
|
ba = BitConverter.GetBytes(Majority);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(TerseDateID == null) { Console.WriteLine("Warning: TerseDateID is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TerseDateID.Length;
|
|
Array.Copy(TerseDateID, 0, bytes, i, TerseDateID.Length); i += TerseDateID.Length;
|
|
if(EndDateTime == null) { Console.WriteLine("Warning: EndDateTime is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)EndDateTime.Length;
|
|
Array.Copy(EndDateTime, 0, bytes, i, EndDateTime.Length); i += EndDateTime.Length;
|
|
if(VoteID == null) { Console.WriteLine("Warning: VoteID is null, in " + this.GetType()); }
|
|
Array.Copy(VoteID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AlreadyVoted) ? 1 : 0);
|
|
if(VoteCast == null) { Console.WriteLine("Warning: VoteCast is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)VoteCast.Length;
|
|
Array.Copy(VoteCast, 0, bytes, i, VoteCast.Length); i += VoteCast.Length;
|
|
bytes[i++] = (byte)(Quorum % 256);
|
|
bytes[i++] = (byte)((Quorum >> 8) % 256);
|
|
bytes[i++] = (byte)((Quorum >> 16) % 256);
|
|
bytes[i++] = (byte)((Quorum >> 24) % 256);
|
|
if(VoteInitiator == null) { Console.WriteLine("Warning: VoteInitiator is null, in " + this.GetType()); }
|
|
Array.Copy(VoteInitiator.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ProposalData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDateTime, "StartDateTime") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ProposalText, "ProposalText") + "" + Environment.NewLine;
|
|
output += "Majority: " + Majority.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TerseDateID, "TerseDateID") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(EndDateTime, "EndDateTime") + "" + Environment.NewLine;
|
|
output += "VoteID: " + VoteID.ToString() + "" + Environment.NewLine;
|
|
output += "AlreadyVoted: " + AlreadyVoted.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(VoteCast, "VoteCast") + "" + Environment.NewLine;
|
|
output += "Quorum: " + Quorum.ToString() + "" + Environment.NewLine;
|
|
output += "VoteInitiator: " + VoteInitiator.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupactiveproposalitemreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupactiveproposalitemreply_transactiondata")]
|
|
public class TransactionDataBlock
|
|
{
|
|
public uint TotalNumItems;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public TransactionDataBlock() { }
|
|
public TransactionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TotalNumItems = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TotalNumItems % 256);
|
|
bytes[i++] = (byte)((TotalNumItems >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalNumItems >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalNumItems >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionData --" + Environment.NewLine;
|
|
output += "TotalNumItems: " + TotalNumItems.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupActiveProposalItemReply; } }
|
|
public ProposalDataBlock[] ProposalData;
|
|
public AgentDataBlock AgentData;
|
|
public TransactionDataBlock TransactionData;
|
|
|
|
public GroupActiveProposalItemReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 416;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ProposalData = new ProposalDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
TransactionData = new TransactionDataBlock();
|
|
}
|
|
|
|
public GroupActiveProposalItemReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ProposalData = new ProposalDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ProposalData[j] = new ProposalDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupActiveProposalItemReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ProposalData = new ProposalDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ProposalData[j] = new ProposalDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += TransactionData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ProposalData.Length; j++) { length += ProposalData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ProposalData.Length;
|
|
for (int j = 0; j < ProposalData.Length; j++) { ProposalData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
TransactionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupActiveProposalItemReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < ProposalData.Length; j++)
|
|
{
|
|
output += ProposalData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += TransactionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupVoteHistoryRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupvotehistoryrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupvotehistoryrequest_transactiondata")]
|
|
public class TransactionDataBlock
|
|
{
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TransactionDataBlock() { }
|
|
public TransactionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionData --" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupvotehistoryrequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupVoteHistoryRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public TransactionDataBlock TransactionData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupVoteHistoryRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 417;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
TransactionData = new TransactionDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupVoteHistoryRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupVoteHistoryRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += TransactionData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
TransactionData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupVoteHistoryRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += TransactionData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupVoteHistoryItemReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupvotehistoryitemreply_historyitemdata")]
|
|
public class HistoryItemDataBlock
|
|
{
|
|
private byte[] _startdatetime;
|
|
public byte[] StartDateTime
|
|
{
|
|
get { return _startdatetime; }
|
|
set
|
|
{
|
|
if (value == null) { _startdatetime = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _startdatetime = new byte[value.Length]; Array.Copy(value, _startdatetime, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _voteresult;
|
|
public byte[] VoteResult
|
|
{
|
|
get { return _voteresult; }
|
|
set
|
|
{
|
|
if (value == null) { _voteresult = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _voteresult = new byte[value.Length]; Array.Copy(value, _voteresult, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _proposaltext;
|
|
public byte[] ProposalText
|
|
{
|
|
get { return _proposaltext; }
|
|
set
|
|
{
|
|
if (value == null) { _proposaltext = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _proposaltext = new byte[value.Length]; Array.Copy(value, _proposaltext, value.Length); }
|
|
}
|
|
}
|
|
public float Majority;
|
|
private byte[] _tersedateid;
|
|
public byte[] TerseDateID
|
|
{
|
|
get { return _tersedateid; }
|
|
set
|
|
{
|
|
if (value == null) { _tersedateid = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _tersedateid = new byte[value.Length]; Array.Copy(value, _tersedateid, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _enddatetime;
|
|
public byte[] EndDateTime
|
|
{
|
|
get { return _enddatetime; }
|
|
set
|
|
{
|
|
if (value == null) { _enddatetime = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _enddatetime = new byte[value.Length]; Array.Copy(value, _enddatetime, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID VoteID;
|
|
public int Quorum;
|
|
private byte[] _votetype;
|
|
public byte[] VoteType
|
|
{
|
|
get { return _votetype; }
|
|
set
|
|
{
|
|
if (value == null) { _votetype = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _votetype = new byte[value.Length]; Array.Copy(value, _votetype, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID VoteInitiator;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 40;
|
|
if (StartDateTime != null) { length += 1 + StartDateTime.Length; }
|
|
if (VoteResult != null) { length += 1 + VoteResult.Length; }
|
|
if (ProposalText != null) { length += 2 + ProposalText.Length; }
|
|
if (TerseDateID != null) { length += 1 + TerseDateID.Length; }
|
|
if (EndDateTime != null) { length += 1 + EndDateTime.Length; }
|
|
if (VoteType != null) { length += 1 + VoteType.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public HistoryItemDataBlock() { }
|
|
public HistoryItemDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_startdatetime = new byte[length];
|
|
Array.Copy(bytes, i, _startdatetime, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_voteresult = new byte[length];
|
|
Array.Copy(bytes, i, _voteresult, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_proposaltext = new byte[length];
|
|
Array.Copy(bytes, i, _proposaltext, 0, length); i += length;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Majority = BitConverter.ToSingle(bytes, i); i += 4;
|
|
length = (ushort)bytes[i++];
|
|
_tersedateid = new byte[length];
|
|
Array.Copy(bytes, i, _tersedateid, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_enddatetime = new byte[length];
|
|
Array.Copy(bytes, i, _enddatetime, 0, length); i += length;
|
|
VoteID = new LLUUID(bytes, i); i += 16;
|
|
Quorum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_votetype = new byte[length];
|
|
Array.Copy(bytes, i, _votetype, 0, length); i += length;
|
|
VoteInitiator = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(StartDateTime == null) { Console.WriteLine("Warning: StartDateTime is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)StartDateTime.Length;
|
|
Array.Copy(StartDateTime, 0, bytes, i, StartDateTime.Length); i += StartDateTime.Length;
|
|
if(VoteResult == null) { Console.WriteLine("Warning: VoteResult is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)VoteResult.Length;
|
|
Array.Copy(VoteResult, 0, bytes, i, VoteResult.Length); i += VoteResult.Length;
|
|
if(ProposalText == null) { Console.WriteLine("Warning: ProposalText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(ProposalText.Length % 256);
|
|
bytes[i++] = (byte)((ProposalText.Length >> 8) % 256);
|
|
Array.Copy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length;
|
|
ba = BitConverter.GetBytes(Majority);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(TerseDateID == null) { Console.WriteLine("Warning: TerseDateID is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TerseDateID.Length;
|
|
Array.Copy(TerseDateID, 0, bytes, i, TerseDateID.Length); i += TerseDateID.Length;
|
|
if(EndDateTime == null) { Console.WriteLine("Warning: EndDateTime is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)EndDateTime.Length;
|
|
Array.Copy(EndDateTime, 0, bytes, i, EndDateTime.Length); i += EndDateTime.Length;
|
|
if(VoteID == null) { Console.WriteLine("Warning: VoteID is null, in " + this.GetType()); }
|
|
Array.Copy(VoteID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Quorum % 256);
|
|
bytes[i++] = (byte)((Quorum >> 8) % 256);
|
|
bytes[i++] = (byte)((Quorum >> 16) % 256);
|
|
bytes[i++] = (byte)((Quorum >> 24) % 256);
|
|
if(VoteType == null) { Console.WriteLine("Warning: VoteType is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)VoteType.Length;
|
|
Array.Copy(VoteType, 0, bytes, i, VoteType.Length); i += VoteType.Length;
|
|
if(VoteInitiator == null) { Console.WriteLine("Warning: VoteInitiator is null, in " + this.GetType()); }
|
|
Array.Copy(VoteInitiator.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HistoryItemData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(StartDateTime, "StartDateTime") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(VoteResult, "VoteResult") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ProposalText, "ProposalText") + "" + Environment.NewLine;
|
|
output += "Majority: " + Majority.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TerseDateID, "TerseDateID") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(EndDateTime, "EndDateTime") + "" + Environment.NewLine;
|
|
output += "VoteID: " + VoteID.ToString() + "" + Environment.NewLine;
|
|
output += "Quorum: " + Quorum.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(VoteType, "VoteType") + "" + Environment.NewLine;
|
|
output += "VoteInitiator: " + VoteInitiator.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupvotehistoryitemreply_voteitem")]
|
|
public class VoteItemBlock
|
|
{
|
|
public LLUUID CandidateID;
|
|
private byte[] _votecast;
|
|
public byte[] VoteCast
|
|
{
|
|
get { return _votecast; }
|
|
set
|
|
{
|
|
if (value == null) { _votecast = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _votecast = new byte[value.Length]; Array.Copy(value, _votecast, value.Length); }
|
|
}
|
|
}
|
|
public int NumVotes;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 20;
|
|
if (VoteCast != null) { length += 1 + VoteCast.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public VoteItemBlock() { }
|
|
public VoteItemBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
CandidateID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_votecast = new byte[length];
|
|
Array.Copy(bytes, i, _votecast, 0, length); i += length;
|
|
NumVotes = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(CandidateID == null) { Console.WriteLine("Warning: CandidateID is null, in " + this.GetType()); }
|
|
Array.Copy(CandidateID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(VoteCast == null) { Console.WriteLine("Warning: VoteCast is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)VoteCast.Length;
|
|
Array.Copy(VoteCast, 0, bytes, i, VoteCast.Length); i += VoteCast.Length;
|
|
bytes[i++] = (byte)(NumVotes % 256);
|
|
bytes[i++] = (byte)((NumVotes >> 8) % 256);
|
|
bytes[i++] = (byte)((NumVotes >> 16) % 256);
|
|
bytes[i++] = (byte)((NumVotes >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- VoteItem --" + Environment.NewLine;
|
|
output += "CandidateID: " + CandidateID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(VoteCast, "VoteCast") + "" + Environment.NewLine;
|
|
output += "NumVotes: " + NumVotes.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupvotehistoryitemreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupvotehistoryitemreply_transactiondata")]
|
|
public class TransactionDataBlock
|
|
{
|
|
public uint TotalNumItems;
|
|
public LLUUID TransactionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public TransactionDataBlock() { }
|
|
public TransactionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TotalNumItems = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TransactionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TotalNumItems % 256);
|
|
bytes[i++] = (byte)((TotalNumItems >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalNumItems >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalNumItems >> 24) % 256);
|
|
if(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
|
|
Array.Copy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransactionData --" + Environment.NewLine;
|
|
output += "TotalNumItems: " + TotalNumItems.ToString() + "" + Environment.NewLine;
|
|
output += "TransactionID: " + TransactionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupVoteHistoryItemReply; } }
|
|
public HistoryItemDataBlock HistoryItemData;
|
|
public VoteItemBlock[] VoteItem;
|
|
public AgentDataBlock AgentData;
|
|
public TransactionDataBlock TransactionData;
|
|
|
|
public GroupVoteHistoryItemReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 418;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
HistoryItemData = new HistoryItemDataBlock();
|
|
VoteItem = new VoteItemBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
TransactionData = new TransactionDataBlock();
|
|
}
|
|
|
|
public GroupVoteHistoryItemReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
HistoryItemData = new HistoryItemDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
VoteItem = new VoteItemBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VoteItem[j] = new VoteItemBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupVoteHistoryItemReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
HistoryItemData = new HistoryItemDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
VoteItem = new VoteItemBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VoteItem[j] = new VoteItemBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
TransactionData = new TransactionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += HistoryItemData.Length; length += AgentData.Length; length += TransactionData.Length;;
|
|
length++;
|
|
for (int j = 0; j < VoteItem.Length; j++) { length += VoteItem[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
HistoryItemData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)VoteItem.Length;
|
|
for (int j = 0; j < VoteItem.Length; j++) { VoteItem[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
TransactionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupVoteHistoryItemReply ---" + Environment.NewLine;
|
|
output += HistoryItemData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < VoteItem.Length; j++)
|
|
{
|
|
output += VoteItem[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += TransactionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class StartGroupProposalPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("startgroupproposal_proposaldata")]
|
|
public class ProposalDataBlock
|
|
{
|
|
public int Duration;
|
|
private byte[] _proposaltext;
|
|
public byte[] ProposalText
|
|
{
|
|
get { return _proposaltext; }
|
|
set
|
|
{
|
|
if (value == null) { _proposaltext = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _proposaltext = new byte[value.Length]; Array.Copy(value, _proposaltext, value.Length); }
|
|
}
|
|
}
|
|
public float Majority;
|
|
public LLUUID GroupID;
|
|
public int Quorum;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (ProposalText != null) { length += 1 + ProposalText.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ProposalDataBlock() { }
|
|
public ProposalDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Duration = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_proposaltext = new byte[length];
|
|
Array.Copy(bytes, i, _proposaltext, 0, length); i += length;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Majority = BitConverter.ToSingle(bytes, i); i += 4;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
Quorum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(Duration % 256);
|
|
bytes[i++] = (byte)((Duration >> 8) % 256);
|
|
bytes[i++] = (byte)((Duration >> 16) % 256);
|
|
bytes[i++] = (byte)((Duration >> 24) % 256);
|
|
if(ProposalText == null) { Console.WriteLine("Warning: ProposalText is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ProposalText.Length;
|
|
Array.Copy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length;
|
|
ba = BitConverter.GetBytes(Majority);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Quorum % 256);
|
|
bytes[i++] = (byte)((Quorum >> 8) % 256);
|
|
bytes[i++] = (byte)((Quorum >> 16) % 256);
|
|
bytes[i++] = (byte)((Quorum >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ProposalData --" + Environment.NewLine;
|
|
output += "Duration: " + Duration.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ProposalText, "ProposalText") + "" + Environment.NewLine;
|
|
output += "Majority: " + Majority.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "Quorum: " + Quorum.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("startgroupproposal_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.StartGroupProposal; } }
|
|
public ProposalDataBlock ProposalData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public StartGroupProposalPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 419;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ProposalData = new ProposalDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public StartGroupProposalPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ProposalData = new ProposalDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public StartGroupProposalPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ProposalData = new ProposalDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ProposalData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ProposalData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- StartGroupProposal ---" + Environment.NewLine;
|
|
output += ProposalData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupProposalBallotPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupproposalballot_proposaldata")]
|
|
public class ProposalDataBlock
|
|
{
|
|
public LLUUID ProposalID;
|
|
public LLUUID GroupID;
|
|
private byte[] _votecast;
|
|
public byte[] VoteCast
|
|
{
|
|
get { return _votecast; }
|
|
set
|
|
{
|
|
if (value == null) { _votecast = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _votecast = new byte[value.Length]; Array.Copy(value, _votecast, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 32;
|
|
if (VoteCast != null) { length += 1 + VoteCast.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ProposalDataBlock() { }
|
|
public ProposalDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ProposalID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_votecast = new byte[length];
|
|
Array.Copy(bytes, i, _votecast, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ProposalID == null) { Console.WriteLine("Warning: ProposalID is null, in " + this.GetType()); }
|
|
Array.Copy(ProposalID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(VoteCast == null) { Console.WriteLine("Warning: VoteCast is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)VoteCast.Length;
|
|
Array.Copy(VoteCast, 0, bytes, i, VoteCast.Length); i += VoteCast.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ProposalData --" + Environment.NewLine;
|
|
output += "ProposalID: " + ProposalID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(VoteCast, "VoteCast") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupproposalballot_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupProposalBallot; } }
|
|
public ProposalDataBlock ProposalData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupProposalBallotPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 420;
|
|
Header.Reliable = true;
|
|
ProposalData = new ProposalDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupProposalBallotPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ProposalData = new ProposalDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupProposalBallotPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ProposalData = new ProposalDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ProposalData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ProposalData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupProposalBallot ---" + Environment.NewLine;
|
|
output += ProposalData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupMembersRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupmembersrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupmembersrequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupMembersRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupMembersRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 422;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupMembersRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupMembersRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupMembersRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupMembersReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupmembersreply_memberdata")]
|
|
public class MemberDataBlock
|
|
{
|
|
private byte[] _onlinestatus;
|
|
public byte[] OnlineStatus
|
|
{
|
|
get { return _onlinestatus; }
|
|
set
|
|
{
|
|
if (value == null) { _onlinestatus = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _onlinestatus = new byte[value.Length]; Array.Copy(value, _onlinestatus, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID AgentID;
|
|
public int Contribution;
|
|
public bool IsOwner;
|
|
private byte[] _title;
|
|
public byte[] Title
|
|
{
|
|
get { return _title; }
|
|
set
|
|
{
|
|
if (value == null) { _title = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _title = new byte[value.Length]; Array.Copy(value, _title, value.Length); }
|
|
}
|
|
}
|
|
public ulong AgentPowers;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 29;
|
|
if (OnlineStatus != null) { length += 1 + OnlineStatus.Length; }
|
|
if (Title != null) { length += 1 + Title.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MemberDataBlock() { }
|
|
public MemberDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_onlinestatus = new byte[length];
|
|
Array.Copy(bytes, i, _onlinestatus, 0, length); i += length;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
Contribution = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
IsOwner = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_title = new byte[length];
|
|
Array.Copy(bytes, i, _title, 0, length); i += length;
|
|
AgentPowers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OnlineStatus == null) { Console.WriteLine("Warning: OnlineStatus is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)OnlineStatus.Length;
|
|
Array.Copy(OnlineStatus, 0, bytes, i, OnlineStatus.Length); i += OnlineStatus.Length;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Contribution % 256);
|
|
bytes[i++] = (byte)((Contribution >> 8) % 256);
|
|
bytes[i++] = (byte)((Contribution >> 16) % 256);
|
|
bytes[i++] = (byte)((Contribution >> 24) % 256);
|
|
bytes[i++] = (byte)((IsOwner) ? 1 : 0);
|
|
if(Title == null) { Console.WriteLine("Warning: Title is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Title.Length;
|
|
Array.Copy(Title, 0, bytes, i, Title.Length); i += Title.Length;
|
|
bytes[i++] = (byte)(AgentPowers % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 8) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 16) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 24) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 32) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 40) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 48) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MemberData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(OnlineStatus, "OnlineStatus") + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Contribution: " + Contribution.ToString() + "" + Environment.NewLine;
|
|
output += "IsOwner: " + IsOwner.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Title, "Title") + "" + Environment.NewLine;
|
|
output += "AgentPowers: " + AgentPowers.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupmembersreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("groupmembersreply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public int MemberCount;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
MemberCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(MemberCount % 256);
|
|
bytes[i++] = (byte)((MemberCount >> 8) % 256);
|
|
bytes[i++] = (byte)((MemberCount >> 16) % 256);
|
|
bytes[i++] = (byte)((MemberCount >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "MemberCount: " + MemberCount.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupMembersReply; } }
|
|
public MemberDataBlock[] MemberData;
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupMembersReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 423;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MemberData = new MemberDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupMembersReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
MemberData = new MemberDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MemberData[j] = new MemberDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupMembersReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
MemberData = new MemberDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MemberData[j] = new MemberDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
length++;
|
|
for (int j = 0; j < MemberData.Length; j++) { length += MemberData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)MemberData.Length;
|
|
for (int j = 0; j < MemberData.Length; j++) { MemberData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupMembersReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < MemberData.Length; j++)
|
|
{
|
|
output += MemberData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ActivateGroupPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("activategroup_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ActivateGroup; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ActivateGroupPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 424;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ActivateGroupPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ActivateGroupPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ActivateGroup ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SetGroupContributionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("setgroupcontribution_data")]
|
|
public class DataBlock
|
|
{
|
|
public int Contribution;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Contribution = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Contribution % 256);
|
|
bytes[i++] = (byte)((Contribution >> 8) % 256);
|
|
bytes[i++] = (byte)((Contribution >> 16) % 256);
|
|
bytes[i++] = (byte)((Contribution >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "Contribution: " + Contribution.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("setgroupcontribution_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SetGroupContribution; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SetGroupContributionPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 425;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SetGroupContributionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SetGroupContributionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SetGroupContribution ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SetGroupAcceptNoticesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("setgroupacceptnotices_data")]
|
|
public class DataBlock
|
|
{
|
|
public LLUUID GroupID;
|
|
public bool AcceptNotices;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AcceptNotices) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "AcceptNotices: " + AcceptNotices.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("setgroupacceptnotices_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SetGroupAcceptNotices; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SetGroupAcceptNoticesPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 426;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SetGroupAcceptNoticesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SetGroupAcceptNoticesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SetGroupAcceptNotices ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupRoleDataRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouproledatarequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouproledatarequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupRoleDataRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupRoleDataRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 427;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupRoleDataRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupRoleDataRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupRoleDataRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupRoleDataReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouproledatareply_roledata")]
|
|
public class RoleDataBlock
|
|
{
|
|
public uint Members;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID RoleID;
|
|
public ulong Powers;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _title;
|
|
public byte[] Title
|
|
{
|
|
get { return _title; }
|
|
set
|
|
{
|
|
if (value == null) { _title = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _title = new byte[value.Length]; Array.Copy(value, _title, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
if (Title != null) { length += 1 + Title.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public RoleDataBlock() { }
|
|
public RoleDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Members = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
RoleID = new LLUUID(bytes, i); i += 16;
|
|
Powers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_title = new byte[length];
|
|
Array.Copy(bytes, i, _title, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Members % 256);
|
|
bytes[i++] = (byte)((Members >> 8) % 256);
|
|
bytes[i++] = (byte)((Members >> 16) % 256);
|
|
bytes[i++] = (byte)((Members >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(RoleID == null) { Console.WriteLine("Warning: RoleID is null, in " + this.GetType()); }
|
|
Array.Copy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Powers % 256);
|
|
bytes[i++] = (byte)((Powers >> 8) % 256);
|
|
bytes[i++] = (byte)((Powers >> 16) % 256);
|
|
bytes[i++] = (byte)((Powers >> 24) % 256);
|
|
bytes[i++] = (byte)((Powers >> 32) % 256);
|
|
bytes[i++] = (byte)((Powers >> 40) % 256);
|
|
bytes[i++] = (byte)((Powers >> 48) % 256);
|
|
bytes[i++] = (byte)((Powers >> 56) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
if(Title == null) { Console.WriteLine("Warning: Title is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Title.Length;
|
|
Array.Copy(Title, 0, bytes, i, Title.Length); i += Title.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RoleData --" + Environment.NewLine;
|
|
output += "Members: " + Members.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "RoleID: " + RoleID.ToString() + "" + Environment.NewLine;
|
|
output += "Powers: " + Powers.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Title, "Title") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouproledatareply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouproledatareply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public int RoleCount;
|
|
public LLUUID RequestID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RoleCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RoleCount % 256);
|
|
bytes[i++] = (byte)((RoleCount >> 8) % 256);
|
|
bytes[i++] = (byte)((RoleCount >> 16) % 256);
|
|
bytes[i++] = (byte)((RoleCount >> 24) % 256);
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "RoleCount: " + RoleCount.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupRoleDataReply; } }
|
|
public RoleDataBlock[] RoleData;
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupRoleDataReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 428;
|
|
Header.Reliable = true;
|
|
RoleData = new RoleDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupRoleDataReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
RoleData = new RoleDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RoleData[j] = new RoleDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupRoleDataReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
RoleData = new RoleDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RoleData[j] = new RoleDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
length++;
|
|
for (int j = 0; j < RoleData.Length; j++) { length += RoleData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)RoleData.Length;
|
|
for (int j = 0; j < RoleData.Length; j++) { RoleData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupRoleDataReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < RoleData.Length; j++)
|
|
{
|
|
output += RoleData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupRoleMembersRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouprolemembersrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouprolemembersrequest_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupRoleMembersRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock GroupData;
|
|
|
|
public GroupRoleMembersRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 429;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock();
|
|
}
|
|
|
|
public GroupRoleMembersRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupRoleMembersRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
GroupData = new GroupDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += GroupData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
GroupData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupRoleMembersRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += GroupData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupRoleMembersReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouprolemembersreply_memberdata")]
|
|
public class MemberDataBlock
|
|
{
|
|
public LLUUID MemberID;
|
|
public LLUUID RoleID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public MemberDataBlock() { }
|
|
public MemberDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
MemberID = new LLUUID(bytes, i); i += 16;
|
|
RoleID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(MemberID == null) { Console.WriteLine("Warning: MemberID is null, in " + this.GetType()); }
|
|
Array.Copy(MemberID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(RoleID == null) { Console.WriteLine("Warning: RoleID is null, in " + this.GetType()); }
|
|
Array.Copy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MemberData --" + Environment.NewLine;
|
|
output += "MemberID: " + MemberID.ToString() + "" + Environment.NewLine;
|
|
output += "RoleID: " + RoleID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouprolemembersreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public uint TotalPairs;
|
|
public LLUUID RequestID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 52;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
TotalPairs = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(TotalPairs % 256);
|
|
bytes[i++] = (byte)((TotalPairs >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalPairs >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalPairs >> 24) % 256);
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "TotalPairs: " + TotalPairs.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupRoleMembersReply; } }
|
|
public MemberDataBlock[] MemberData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupRoleMembersReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 430;
|
|
Header.Reliable = true;
|
|
MemberData = new MemberDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupRoleMembersReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
MemberData = new MemberDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MemberData[j] = new MemberDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupRoleMembersReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
MemberData = new MemberDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ MemberData[j] = new MemberDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < MemberData.Length; j++) { length += MemberData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)MemberData.Length;
|
|
for (int j = 0; j < MemberData.Length; j++) { MemberData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupRoleMembersReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < MemberData.Length; j++)
|
|
{
|
|
output += MemberData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupTitlesRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouptitlesrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID RequestID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 64;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupTitlesRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupTitlesRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 431;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupTitlesRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupTitlesRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupTitlesRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupTitlesReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouptitlesreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID RequestID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouptitlesreply_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public bool Selected;
|
|
public LLUUID RoleID;
|
|
private byte[] _title;
|
|
public byte[] Title
|
|
{
|
|
get { return _title; }
|
|
set
|
|
{
|
|
if (value == null) { _title = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _title = new byte[value.Length]; Array.Copy(value, _title, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 17;
|
|
if (Title != null) { length += 1 + Title.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Selected = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RoleID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_title = new byte[length];
|
|
Array.Copy(bytes, i, _title, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((Selected) ? 1 : 0);
|
|
if(RoleID == null) { Console.WriteLine("Warning: RoleID is null, in " + this.GetType()); }
|
|
Array.Copy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Title == null) { Console.WriteLine("Warning: Title is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Title.Length;
|
|
Array.Copy(Title, 0, bytes, i, Title.Length); i += Title.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "Selected: " + Selected.ToString() + "" + Environment.NewLine;
|
|
output += "RoleID: " + RoleID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Title, "Title") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupTitlesReply; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock[] GroupData;
|
|
|
|
public GroupTitlesReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 432;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock[0];
|
|
}
|
|
|
|
public GroupTitlesReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public GroupTitlesReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < GroupData.Length; j++) { length += GroupData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)GroupData.Length;
|
|
for (int j = 0; j < GroupData.Length; j++) { GroupData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupTitlesReply ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < GroupData.Length; j++)
|
|
{
|
|
output += GroupData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupTitleUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouptitleupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
public LLUUID TitleRoleID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 64;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
TitleRoleID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TitleRoleID == null) { Console.WriteLine("Warning: TitleRoleID is null, in " + this.GetType()); }
|
|
Array.Copy(TitleRoleID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "TitleRoleID: " + TitleRoleID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupTitleUpdate; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupTitleUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 433;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupTitleUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupTitleUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupTitleUpdate ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupRoleUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("grouproleupdate_roledata")]
|
|
public class RoleDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID RoleID;
|
|
public byte UpdateType;
|
|
public ulong Powers;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _title;
|
|
public byte[] Title
|
|
{
|
|
get { return _title; }
|
|
set
|
|
{
|
|
if (value == null) { _title = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _title = new byte[value.Length]; Array.Copy(value, _title, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 25;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
if (Title != null) { length += 1 + Title.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public RoleDataBlock() { }
|
|
public RoleDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
RoleID = new LLUUID(bytes, i); i += 16;
|
|
UpdateType = (byte)bytes[i++];
|
|
Powers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_title = new byte[length];
|
|
Array.Copy(bytes, i, _title, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(RoleID == null) { Console.WriteLine("Warning: RoleID is null, in " + this.GetType()); }
|
|
Array.Copy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = UpdateType;
|
|
bytes[i++] = (byte)(Powers % 256);
|
|
bytes[i++] = (byte)((Powers >> 8) % 256);
|
|
bytes[i++] = (byte)((Powers >> 16) % 256);
|
|
bytes[i++] = (byte)((Powers >> 24) % 256);
|
|
bytes[i++] = (byte)((Powers >> 32) % 256);
|
|
bytes[i++] = (byte)((Powers >> 40) % 256);
|
|
bytes[i++] = (byte)((Powers >> 48) % 256);
|
|
bytes[i++] = (byte)((Powers >> 56) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
if(Title == null) { Console.WriteLine("Warning: Title is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Title.Length;
|
|
Array.Copy(Title, 0, bytes, i, Title.Length); i += Title.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RoleData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "RoleID: " + RoleID.ToString() + "" + Environment.NewLine;
|
|
output += "UpdateType: " + UpdateType.ToString() + "" + Environment.NewLine;
|
|
output += "Powers: " + Powers.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Title, "Title") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("grouproleupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupRoleUpdate; } }
|
|
public RoleDataBlock[] RoleData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GroupRoleUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 434;
|
|
Header.Reliable = true;
|
|
RoleData = new RoleDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GroupRoleUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
RoleData = new RoleDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RoleData[j] = new RoleDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GroupRoleUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
RoleData = new RoleDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RoleData[j] = new RoleDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < RoleData.Length; j++) { length += RoleData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)RoleData.Length;
|
|
for (int j = 0; j < RoleData.Length; j++) { RoleData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupRoleUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < RoleData.Length; j++)
|
|
{
|
|
output += RoleData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LiveHelpGroupRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("livehelpgrouprequest_requestdata")]
|
|
public class RequestDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID RequestID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public RequestDataBlock() { }
|
|
public RequestDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LiveHelpGroupRequest; } }
|
|
public RequestDataBlock RequestData;
|
|
|
|
public LiveHelpGroupRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 435;
|
|
Header.Reliable = true;
|
|
RequestData = new RequestDataBlock();
|
|
}
|
|
|
|
public LiveHelpGroupRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LiveHelpGroupRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RequestData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RequestData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LiveHelpGroupRequest ---" + Environment.NewLine;
|
|
output += RequestData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LiveHelpGroupReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("livehelpgroupreply_replydata")]
|
|
public class ReplyDataBlock
|
|
{
|
|
public LLUUID RequestID;
|
|
public LLUUID GroupID;
|
|
private byte[] _selection;
|
|
public byte[] Selection
|
|
{
|
|
get { return _selection; }
|
|
set
|
|
{
|
|
if (value == null) { _selection = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _selection = new byte[value.Length]; Array.Copy(value, _selection, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 32;
|
|
if (Selection != null) { length += 1 + Selection.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ReplyDataBlock() { }
|
|
public ReplyDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
RequestID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_selection = new byte[length];
|
|
Array.Copy(bytes, i, _selection, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
|
|
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Selection == null) { Console.WriteLine("Warning: Selection is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Selection.Length;
|
|
Array.Copy(Selection, 0, bytes, i, Selection.Length); i += Selection.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReplyData --" + Environment.NewLine;
|
|
output += "RequestID: " + RequestID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Selection, "Selection") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LiveHelpGroupReply; } }
|
|
public ReplyDataBlock ReplyData;
|
|
|
|
public LiveHelpGroupReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 436;
|
|
Header.Reliable = true;
|
|
ReplyData = new ReplyDataBlock();
|
|
}
|
|
|
|
public LiveHelpGroupReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ReplyData = new ReplyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LiveHelpGroupReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ReplyData = new ReplyDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ReplyData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ReplyData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LiveHelpGroupReply ---" + Environment.NewLine;
|
|
output += ReplyData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentWearablesRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentwearablesrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentWearablesRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentWearablesRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 437;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentWearablesRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentWearablesRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentWearablesRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentWearablesUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentwearablesupdate_wearabledata")]
|
|
public class WearableDataBlock
|
|
{
|
|
public byte WearableType;
|
|
public LLUUID AssetID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 33;
|
|
}
|
|
}
|
|
|
|
public WearableDataBlock() { }
|
|
public WearableDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
WearableType = (byte)bytes[i++];
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = WearableType;
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- WearableData --" + Environment.NewLine;
|
|
output += "WearableType: " + WearableType.ToString() + "" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentwearablesupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint SerialNum;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SerialNum % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 8) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 16) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "SerialNum: " + SerialNum.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentWearablesUpdate; } }
|
|
public WearableDataBlock[] WearableData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentWearablesUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 438;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
WearableData = new WearableDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentWearablesUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentWearablesUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)WearableData.Length;
|
|
for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentWearablesUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < WearableData.Length; j++)
|
|
{
|
|
output += WearableData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentIsNowWearingPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentisnowwearing_wearabledata")]
|
|
public class WearableDataBlock
|
|
{
|
|
public byte WearableType;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public WearableDataBlock() { }
|
|
public WearableDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
WearableType = (byte)bytes[i++];
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = WearableType;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- WearableData --" + Environment.NewLine;
|
|
output += "WearableType: " + WearableType.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentisnowwearing_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentIsNowWearing; } }
|
|
public WearableDataBlock[] WearableData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentIsNowWearingPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 439;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
WearableData = new WearableDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentIsNowWearingPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentIsNowWearingPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)WearableData.Length;
|
|
for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentIsNowWearing ---" + Environment.NewLine;
|
|
for (int j = 0; j < WearableData.Length; j++)
|
|
{
|
|
output += WearableData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentCachedTexturePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentcachedtexture_wearabledata")]
|
|
public class WearableDataBlock
|
|
{
|
|
public LLUUID ID;
|
|
public byte TextureIndex;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public WearableDataBlock() { }
|
|
public WearableDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
TextureIndex = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = TextureIndex;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- WearableData --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "TextureIndex: " + TextureIndex.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentcachedtexture_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public int SerialNum;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SerialNum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SerialNum % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 8) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 16) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "SerialNum: " + SerialNum.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentCachedTexture; } }
|
|
public WearableDataBlock[] WearableData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentCachedTexturePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 440;
|
|
Header.Reliable = true;
|
|
WearableData = new WearableDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentCachedTexturePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentCachedTexturePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)WearableData.Length;
|
|
for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentCachedTexture ---" + Environment.NewLine;
|
|
for (int j = 0; j < WearableData.Length; j++)
|
|
{
|
|
output += WearableData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentCachedTextureResponsePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentcachedtextureresponse_wearabledata")]
|
|
public class WearableDataBlock
|
|
{
|
|
public LLUUID TextureID;
|
|
public byte TextureIndex;
|
|
private byte[] _hostname;
|
|
public byte[] HostName
|
|
{
|
|
get { return _hostname; }
|
|
set
|
|
{
|
|
if (value == null) { _hostname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _hostname = new byte[value.Length]; Array.Copy(value, _hostname, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 17;
|
|
if (HostName != null) { length += 1 + HostName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public WearableDataBlock() { }
|
|
public WearableDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
TextureID = new LLUUID(bytes, i); i += 16;
|
|
TextureIndex = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_hostname = new byte[length];
|
|
Array.Copy(bytes, i, _hostname, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TextureID == null) { Console.WriteLine("Warning: TextureID is null, in " + this.GetType()); }
|
|
Array.Copy(TextureID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = TextureIndex;
|
|
if(HostName == null) { Console.WriteLine("Warning: HostName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)HostName.Length;
|
|
Array.Copy(HostName, 0, bytes, i, HostName.Length); i += HostName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- WearableData --" + Environment.NewLine;
|
|
output += "TextureID: " + TextureID.ToString() + "" + Environment.NewLine;
|
|
output += "TextureIndex: " + TextureIndex.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(HostName, "HostName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentcachedtextureresponse_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public int SerialNum;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 36;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
SerialNum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(SerialNum % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 8) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 16) % 256);
|
|
bytes[i++] = (byte)((SerialNum >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "SerialNum: " + SerialNum.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentCachedTextureResponse; } }
|
|
public WearableDataBlock[] WearableData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentCachedTextureResponsePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 441;
|
|
Header.Reliable = true;
|
|
WearableData = new WearableDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentCachedTextureResponsePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentCachedTextureResponsePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
WearableData = new WearableDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ WearableData[j] = new WearableDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)WearableData.Length;
|
|
for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentCachedTextureResponse ---" + Environment.NewLine;
|
|
for (int j = 0; j < WearableData.Length; j++)
|
|
{
|
|
output += WearableData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentDataUpdateRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentdataupdaterequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentDataUpdateRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentDataUpdateRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 442;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentDataUpdateRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentDataUpdateRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentDataUpdateRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentDataUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentdataupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
private byte[] _grouptitle;
|
|
public byte[] GroupTitle
|
|
{
|
|
get { return _grouptitle; }
|
|
set
|
|
{
|
|
if (value == null) { _grouptitle = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _grouptitle = new byte[value.Length]; Array.Copy(value, _grouptitle, value.Length); }
|
|
}
|
|
}
|
|
public ulong GroupPowers;
|
|
public LLUUID AgentID;
|
|
private byte[] _lastname;
|
|
public byte[] LastName
|
|
{
|
|
get { return _lastname; }
|
|
set
|
|
{
|
|
if (value == null) { _lastname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _lastname = new byte[value.Length]; Array.Copy(value, _lastname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _firstname;
|
|
public byte[] FirstName
|
|
{
|
|
get { return _firstname; }
|
|
set
|
|
{
|
|
if (value == null) { _firstname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _firstname = new byte[value.Length]; Array.Copy(value, _firstname, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _groupname;
|
|
public byte[] GroupName
|
|
{
|
|
get { return _groupname; }
|
|
set
|
|
{
|
|
if (value == null) { _groupname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _groupname = new byte[value.Length]; Array.Copy(value, _groupname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ActiveGroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 40;
|
|
if (GroupTitle != null) { length += 1 + GroupTitle.Length; }
|
|
if (LastName != null) { length += 1 + LastName.Length; }
|
|
if (FirstName != null) { length += 1 + FirstName.Length; }
|
|
if (GroupName != null) { length += 1 + GroupName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_grouptitle = new byte[length];
|
|
Array.Copy(bytes, i, _grouptitle, 0, length); i += length;
|
|
GroupPowers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_lastname = new byte[length];
|
|
Array.Copy(bytes, i, _lastname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_firstname = new byte[length];
|
|
Array.Copy(bytes, i, _firstname, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_groupname = new byte[length];
|
|
Array.Copy(bytes, i, _groupname, 0, length); i += length;
|
|
ActiveGroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupTitle == null) { Console.WriteLine("Warning: GroupTitle is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupTitle.Length;
|
|
Array.Copy(GroupTitle, 0, bytes, i, GroupTitle.Length); i += GroupTitle.Length;
|
|
bytes[i++] = (byte)(GroupPowers % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 24) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 32) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 40) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 48) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 56) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)LastName.Length;
|
|
Array.Copy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length;
|
|
if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)FirstName.Length;
|
|
Array.Copy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length;
|
|
if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupName.Length;
|
|
Array.Copy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length;
|
|
if(ActiveGroupID == null) { Console.WriteLine("Warning: ActiveGroupID is null, in " + this.GetType()); }
|
|
Array.Copy(ActiveGroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupTitle, "GroupTitle") + "" + Environment.NewLine;
|
|
output += "GroupPowers: " + GroupPowers.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(LastName, "LastName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(FirstName, "FirstName") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupName, "GroupName") + "" + Environment.NewLine;
|
|
output += "ActiveGroupID: " + ActiveGroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentDataUpdate; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentDataUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 443;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentDataUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentDataUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentDataUpdate ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GroupDataUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("groupdataupdate_agentgroupdata")]
|
|
public class AgentGroupDataBlock
|
|
{
|
|
private byte[] _grouptitle;
|
|
public byte[] GroupTitle
|
|
{
|
|
get { return _grouptitle; }
|
|
set
|
|
{
|
|
if (value == null) { _grouptitle = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _grouptitle = new byte[value.Length]; Array.Copy(value, _grouptitle, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
public ulong AgentPowers;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 40;
|
|
if (GroupTitle != null) { length += 1 + GroupTitle.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AgentGroupDataBlock() { }
|
|
public AgentGroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_grouptitle = new byte[length];
|
|
Array.Copy(bytes, i, _grouptitle, 0, length); i += length;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
AgentPowers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GroupTitle == null) { Console.WriteLine("Warning: GroupTitle is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupTitle.Length;
|
|
Array.Copy(GroupTitle, 0, bytes, i, GroupTitle.Length); i += GroupTitle.Length;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(AgentPowers % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 8) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 16) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 24) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 32) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 40) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 48) % 256);
|
|
bytes[i++] = (byte)((AgentPowers >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentGroupData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupTitle, "GroupTitle") + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "AgentPowers: " + AgentPowers.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GroupDataUpdate; } }
|
|
public AgentGroupDataBlock[] AgentGroupData;
|
|
|
|
public GroupDataUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 444;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentGroupData = new AgentGroupDataBlock[0];
|
|
}
|
|
|
|
public GroupDataUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
AgentGroupData = new AgentGroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AgentGroupData[j] = new AgentGroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public GroupDataUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
AgentGroupData = new AgentGroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AgentGroupData[j] = new AgentGroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < AgentGroupData.Length; j++) { length += AgentGroupData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)AgentGroupData.Length;
|
|
for (int j = 0; j < AgentGroupData.Length; j++) { AgentGroupData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GroupDataUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < AgentGroupData.Length; j++)
|
|
{
|
|
output += AgentGroupData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentGroupDataUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentgroupdataupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentgroupdataupdate_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public ulong GroupPowers;
|
|
public int Contribution;
|
|
public LLUUID GroupID;
|
|
public LLUUID GroupInsigniaID;
|
|
public bool AcceptNotices;
|
|
private byte[] _groupname;
|
|
public byte[] GroupName
|
|
{
|
|
get { return _groupname; }
|
|
set
|
|
{
|
|
if (value == null) { _groupname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _groupname = new byte[value.Length]; Array.Copy(value, _groupname, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 45;
|
|
if (GroupName != null) { length += 1 + GroupName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
GroupPowers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
Contribution = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
GroupInsigniaID = new LLUUID(bytes, i); i += 16;
|
|
AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_groupname = new byte[length];
|
|
Array.Copy(bytes, i, _groupname, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(GroupPowers % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 24) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 32) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 40) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 48) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 56) % 256);
|
|
bytes[i++] = (byte)(Contribution % 256);
|
|
bytes[i++] = (byte)((Contribution >> 8) % 256);
|
|
bytes[i++] = (byte)((Contribution >> 16) % 256);
|
|
bytes[i++] = (byte)((Contribution >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupInsigniaID == null) { Console.WriteLine("Warning: GroupInsigniaID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupInsigniaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AcceptNotices) ? 1 : 0);
|
|
if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)GroupName.Length;
|
|
Array.Copy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupPowers: " + GroupPowers.ToString() + "" + Environment.NewLine;
|
|
output += "Contribution: " + Contribution.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupInsigniaID: " + GroupInsigniaID.ToString() + "" + Environment.NewLine;
|
|
output += "AcceptNotices: " + AcceptNotices.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(GroupName, "GroupName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentGroupDataUpdate; } }
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock[] GroupData;
|
|
|
|
public AgentGroupDataUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 445;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock[0];
|
|
}
|
|
|
|
public AgentGroupDataUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public AgentGroupDataUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < GroupData.Length; j++) { length += GroupData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)GroupData.Length;
|
|
for (int j = 0; j < GroupData.Length; j++) { GroupData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentGroupDataUpdate ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < GroupData.Length; j++)
|
|
{
|
|
output += GroupData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentDropGroupPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentdropgroup_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentDropGroup; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentDropGroupPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 446;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentDropGroupPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentDropGroupPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentDropGroup ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CreateTrustedCircuitPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("createtrustedcircuit_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public byte[] Digest;
|
|
public LLUUID EndPointID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Digest = new byte[32];
|
|
Array.Copy(bytes, i, Digest, 0, 32); i += 32;
|
|
EndPointID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(Digest, 0, bytes, i, 32);i += 32;
|
|
if(EndPointID == null) { Console.WriteLine("Warning: EndPointID is null, in " + this.GetType()); }
|
|
Array.Copy(EndPointID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Digest, "Digest") + "" + Environment.NewLine;
|
|
output += "EndPointID: " + EndPointID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CreateTrustedCircuit; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public CreateTrustedCircuitPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 448;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public CreateTrustedCircuitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public CreateTrustedCircuitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CreateTrustedCircuit ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DenyTrustedCircuitPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("denytrustedcircuit_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID EndPointID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
EndPointID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(EndPointID == null) { Console.WriteLine("Warning: EndPointID is null, in " + this.GetType()); }
|
|
Array.Copy(EndPointID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "EndPointID: " + EndPointID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DenyTrustedCircuit; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public DenyTrustedCircuitPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 449;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public DenyTrustedCircuitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public DenyTrustedCircuitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DenyTrustedCircuit ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestTrustedCircuitPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestTrustedCircuit; } }
|
|
|
|
public RequestTrustedCircuitPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 450;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public RequestTrustedCircuitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public RequestTrustedCircuitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestTrustedCircuit ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RezSingleAttachmentFromInvPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("rezsingleattachmentfrominv_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public uint ItemFlags;
|
|
public LLUUID OwnerID;
|
|
public LLUUID ItemID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public byte AttachmentPt;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 49;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
ItemFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
AttachmentPt = (byte)bytes[i++];
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(ItemFlags % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = AttachmentPt;
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "ItemFlags: " + ItemFlags.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "AttachmentPt: " + AttachmentPt.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezsingleattachmentfrominv_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RezSingleAttachmentFromInv; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RezSingleAttachmentFromInvPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 451;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RezSingleAttachmentFromInvPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RezSingleAttachmentFromInvPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RezSingleAttachmentFromInv ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RezMultipleAttachmentsFromInvPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("rezmultipleattachmentsfrominv_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public uint ItemFlags;
|
|
public LLUUID OwnerID;
|
|
public LLUUID ItemID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public byte AttachmentPt;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 49;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
ItemFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
AttachmentPt = (byte)bytes[i++];
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(ItemFlags % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ItemFlags >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
bytes[i++] = AttachmentPt;
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "ItemFlags: " + ItemFlags.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "AttachmentPt: " + AttachmentPt.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezmultipleattachmentsfrominv_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("rezmultipleattachmentsfrominv_headerdata")]
|
|
public class HeaderDataBlock
|
|
{
|
|
public LLUUID CompoundMsgID;
|
|
public bool FirstDetachAll;
|
|
public byte TotalObjects;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 18;
|
|
}
|
|
}
|
|
|
|
public HeaderDataBlock() { }
|
|
public HeaderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
CompoundMsgID = new LLUUID(bytes, i); i += 16;
|
|
FirstDetachAll = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
TotalObjects = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(CompoundMsgID == null) { Console.WriteLine("Warning: CompoundMsgID is null, in " + this.GetType()); }
|
|
Array.Copy(CompoundMsgID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((FirstDetachAll) ? 1 : 0);
|
|
bytes[i++] = TotalObjects;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HeaderData --" + Environment.NewLine;
|
|
output += "CompoundMsgID: " + CompoundMsgID.ToString() + "" + Environment.NewLine;
|
|
output += "FirstDetachAll: " + FirstDetachAll.ToString() + "" + Environment.NewLine;
|
|
output += "TotalObjects: " + TotalObjects.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RezMultipleAttachmentsFromInv; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
public HeaderDataBlock HeaderData;
|
|
|
|
public RezMultipleAttachmentsFromInvPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 452;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
HeaderData = new HeaderDataBlock();
|
|
}
|
|
|
|
public RezMultipleAttachmentsFromInvPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RezMultipleAttachmentsFromInvPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += HeaderData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
HeaderData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RezMultipleAttachmentsFromInv ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += HeaderData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class DetachAttachmentIntoInvPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("detachattachmentintoinv_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID ItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.DetachAttachmentIntoInv; } }
|
|
public ObjectDataBlock ObjectData;
|
|
|
|
public DetachAttachmentIntoInvPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 453;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
}
|
|
|
|
public DetachAttachmentIntoInvPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public DetachAttachmentIntoInvPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += ObjectData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- DetachAttachmentIntoInv ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CreateNewOutfitAttachmentsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("createnewoutfitattachments_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID OldFolderID;
|
|
public LLUUID OldItemID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
OldFolderID = new LLUUID(bytes, i); i += 16;
|
|
OldItemID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(OldFolderID == null) { Console.WriteLine("Warning: OldFolderID is null, in " + this.GetType()); }
|
|
Array.Copy(OldFolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(OldItemID == null) { Console.WriteLine("Warning: OldItemID is null, in " + this.GetType()); }
|
|
Array.Copy(OldItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "OldFolderID: " + OldFolderID.ToString() + "" + Environment.NewLine;
|
|
output += "OldItemID: " + OldItemID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("createnewoutfitattachments_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("createnewoutfitattachments_headerdata")]
|
|
public class HeaderDataBlock
|
|
{
|
|
public LLUUID NewFolderID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public HeaderDataBlock() { }
|
|
public HeaderDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
NewFolderID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(NewFolderID == null) { Console.WriteLine("Warning: NewFolderID is null, in " + this.GetType()); }
|
|
Array.Copy(NewFolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- HeaderData --" + Environment.NewLine;
|
|
output += "NewFolderID: " + NewFolderID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CreateNewOutfitAttachments; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
public HeaderDataBlock HeaderData;
|
|
|
|
public CreateNewOutfitAttachmentsPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 454;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
HeaderData = new HeaderDataBlock();
|
|
}
|
|
|
|
public CreateNewOutfitAttachmentsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CreateNewOutfitAttachmentsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
HeaderData = new HeaderDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length; length += HeaderData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
HeaderData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CreateNewOutfitAttachments ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
output += HeaderData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UserInfoRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("userinforequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UserInfoRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UserInfoRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 455;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UserInfoRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UserInfoRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UserInfoRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UserInfoReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("userinforeply_userdata")]
|
|
public class UserDataBlock
|
|
{
|
|
private byte[] _email;
|
|
public byte[] EMail
|
|
{
|
|
get { return _email; }
|
|
set
|
|
{
|
|
if (value == null) { _email = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _email = new byte[value.Length]; Array.Copy(value, _email, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _directoryvisibility;
|
|
public byte[] DirectoryVisibility
|
|
{
|
|
get { return _directoryvisibility; }
|
|
set
|
|
{
|
|
if (value == null) { _directoryvisibility = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _directoryvisibility = new byte[value.Length]; Array.Copy(value, _directoryvisibility, value.Length); }
|
|
}
|
|
}
|
|
public bool IMViaEMail;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 1;
|
|
if (EMail != null) { length += 2 + EMail.Length; }
|
|
if (DirectoryVisibility != null) { length += 1 + DirectoryVisibility.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public UserDataBlock() { }
|
|
public UserDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_email = new byte[length];
|
|
Array.Copy(bytes, i, _email, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_directoryvisibility = new byte[length];
|
|
Array.Copy(bytes, i, _directoryvisibility, 0, length); i += length;
|
|
IMViaEMail = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(EMail == null) { Console.WriteLine("Warning: EMail is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(EMail.Length % 256);
|
|
bytes[i++] = (byte)((EMail.Length >> 8) % 256);
|
|
Array.Copy(EMail, 0, bytes, i, EMail.Length); i += EMail.Length;
|
|
if(DirectoryVisibility == null) { Console.WriteLine("Warning: DirectoryVisibility is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)DirectoryVisibility.Length;
|
|
Array.Copy(DirectoryVisibility, 0, bytes, i, DirectoryVisibility.Length); i += DirectoryVisibility.Length;
|
|
bytes[i++] = (byte)((IMViaEMail) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UserData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(EMail, "EMail") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(DirectoryVisibility, "DirectoryVisibility") + "" + Environment.NewLine;
|
|
output += "IMViaEMail: " + IMViaEMail.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("userinforeply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UserInfoReply; } }
|
|
public UserDataBlock UserData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UserInfoReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 456;
|
|
Header.Reliable = true;
|
|
UserData = new UserDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UserInfoReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
UserData = new UserDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UserInfoReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
UserData = new UserDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += UserData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
UserData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UserInfoReply ---" + Environment.NewLine;
|
|
output += UserData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class UpdateUserInfoPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("updateuserinfo_userdata")]
|
|
public class UserDataBlock
|
|
{
|
|
private byte[] _directoryvisibility;
|
|
public byte[] DirectoryVisibility
|
|
{
|
|
get { return _directoryvisibility; }
|
|
set
|
|
{
|
|
if (value == null) { _directoryvisibility = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _directoryvisibility = new byte[value.Length]; Array.Copy(value, _directoryvisibility, value.Length); }
|
|
}
|
|
}
|
|
public bool IMViaEMail;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 1;
|
|
if (DirectoryVisibility != null) { length += 1 + DirectoryVisibility.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public UserDataBlock() { }
|
|
public UserDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_directoryvisibility = new byte[length];
|
|
Array.Copy(bytes, i, _directoryvisibility, 0, length); i += length;
|
|
IMViaEMail = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(DirectoryVisibility == null) { Console.WriteLine("Warning: DirectoryVisibility is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)DirectoryVisibility.Length;
|
|
Array.Copy(DirectoryVisibility, 0, bytes, i, DirectoryVisibility.Length); i += DirectoryVisibility.Length;
|
|
bytes[i++] = (byte)((IMViaEMail) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- UserData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(DirectoryVisibility, "DirectoryVisibility") + "" + Environment.NewLine;
|
|
output += "IMViaEMail: " + IMViaEMail.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("updateuserinfo_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.UpdateUserInfo; } }
|
|
public UserDataBlock UserData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public UpdateUserInfoPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 457;
|
|
Header.Reliable = true;
|
|
UserData = new UserDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public UpdateUserInfoPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
UserData = new UserDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public UpdateUserInfoPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
UserData = new UserDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += UserData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
UserData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- UpdateUserInfo ---" + Environment.NewLine;
|
|
output += UserData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GodExpungeUserPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("godexpungeuser_expungedata")]
|
|
public class ExpungeDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ExpungeDataBlock() { }
|
|
public ExpungeDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ExpungeData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("godexpungeuser_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GodExpungeUser; } }
|
|
public ExpungeDataBlock[] ExpungeData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public GodExpungeUserPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 458;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ExpungeData = new ExpungeDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public GodExpungeUserPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ExpungeData = new ExpungeDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ExpungeData[j] = new ExpungeDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public GodExpungeUserPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ExpungeData = new ExpungeDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ExpungeData[j] = new ExpungeDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ExpungeData.Length; j++) { length += ExpungeData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ExpungeData.Length;
|
|
for (int j = 0; j < ExpungeData.Length; j++) { ExpungeData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GodExpungeUser ---" + Environment.NewLine;
|
|
for (int j = 0; j < ExpungeData.Length; j++)
|
|
{
|
|
output += ExpungeData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class StartParcelRemoveAckPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.StartParcelRemoveAck; } }
|
|
|
|
public StartParcelRemoveAckPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 466;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public StartParcelRemoveAckPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public StartParcelRemoveAckPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- StartParcelRemoveAck ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class InitiateDownloadPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("initiatedownload_filedata")]
|
|
public class FileDataBlock
|
|
{
|
|
private byte[] _simfilename;
|
|
public byte[] SimFilename
|
|
{
|
|
get { return _simfilename; }
|
|
set
|
|
{
|
|
if (value == null) { _simfilename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _simfilename = new byte[value.Length]; Array.Copy(value, _simfilename, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _viewerfilename;
|
|
public byte[] ViewerFilename
|
|
{
|
|
get { return _viewerfilename; }
|
|
set
|
|
{
|
|
if (value == null) { _viewerfilename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _viewerfilename = new byte[value.Length]; Array.Copy(value, _viewerfilename, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (SimFilename != null) { length += 1 + SimFilename.Length; }
|
|
if (ViewerFilename != null) { length += 1 + ViewerFilename.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public FileDataBlock() { }
|
|
public FileDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_simfilename = new byte[length];
|
|
Array.Copy(bytes, i, _simfilename, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_viewerfilename = new byte[length];
|
|
Array.Copy(bytes, i, _viewerfilename, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(SimFilename == null) { Console.WriteLine("Warning: SimFilename is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SimFilename.Length;
|
|
Array.Copy(SimFilename, 0, bytes, i, SimFilename.Length); i += SimFilename.Length;
|
|
if(ViewerFilename == null) { Console.WriteLine("Warning: ViewerFilename is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ViewerFilename.Length;
|
|
Array.Copy(ViewerFilename, 0, bytes, i, ViewerFilename.Length); i += ViewerFilename.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- FileData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SimFilename, "SimFilename") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ViewerFilename, "ViewerFilename") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("initiatedownload_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.InitiateDownload; } }
|
|
public FileDataBlock FileData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public InitiateDownloadPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 468;
|
|
Header.Reliable = true;
|
|
FileData = new FileDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public InitiateDownloadPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
FileData = new FileDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public InitiateDownloadPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
FileData = new FileDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += FileData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
FileData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- InitiateDownload ---" + Environment.NewLine;
|
|
output += FileData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SystemMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("systemmessage_methoddata")]
|
|
public class MethodDataBlock
|
|
{
|
|
public LLUUID Invoice;
|
|
public byte[] Digest;
|
|
private byte[] _method;
|
|
public byte[] Method
|
|
{
|
|
get { return _method; }
|
|
set
|
|
{
|
|
if (value == null) { _method = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _method = new byte[value.Length]; Array.Copy(value, _method, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 48;
|
|
if (Method != null) { length += 1 + Method.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public MethodDataBlock() { }
|
|
public MethodDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
Invoice = new LLUUID(bytes, i); i += 16;
|
|
Digest = new byte[32];
|
|
Array.Copy(bytes, i, Digest, 0, 32); i += 32;
|
|
length = (ushort)bytes[i++];
|
|
_method = new byte[length];
|
|
Array.Copy(bytes, i, _method, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Invoice == null) { Console.WriteLine("Warning: Invoice is null, in " + this.GetType()); }
|
|
Array.Copy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(Digest, 0, bytes, i, 32);i += 32;
|
|
if(Method == null) { Console.WriteLine("Warning: Method is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Method.Length;
|
|
Array.Copy(Method, 0, bytes, i, Method.Length); i += Method.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- MethodData --" + Environment.NewLine;
|
|
output += "Invoice: " + Invoice.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Digest, "Digest") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Method, "Method") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("systemmessage_paramlist")]
|
|
public class ParamListBlock
|
|
{
|
|
private byte[] _parameter;
|
|
public byte[] Parameter
|
|
{
|
|
get { return _parameter; }
|
|
set
|
|
{
|
|
if (value == null) { _parameter = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _parameter = new byte[value.Length]; Array.Copy(value, _parameter, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Parameter != null) { length += 1 + Parameter.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ParamListBlock() { }
|
|
public ParamListBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_parameter = new byte[length];
|
|
Array.Copy(bytes, i, _parameter, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Parameter == null) { Console.WriteLine("Warning: Parameter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Parameter.Length;
|
|
Array.Copy(Parameter, 0, bytes, i, Parameter.Length); i += Parameter.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParamList --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Parameter, "Parameter") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SystemMessage; } }
|
|
public MethodDataBlock MethodData;
|
|
public ParamListBlock[] ParamList;
|
|
|
|
public SystemMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 469;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
MethodData = new MethodDataBlock();
|
|
ParamList = new ParamListBlock[0];
|
|
}
|
|
|
|
public SystemMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
}
|
|
|
|
public SystemMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
MethodData = new MethodDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ParamList = new ParamListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ParamList[j] = new ParamListBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += MethodData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ParamList.Length; j++) { length += ParamList[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
MethodData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ParamList.Length;
|
|
for (int j = 0; j < ParamList.Length; j++) { ParamList[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SystemMessage ---" + Environment.NewLine;
|
|
output += MethodData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ParamList.Length; j++)
|
|
{
|
|
output += ParamList[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MapLayerRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("maplayerrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool Godlike;
|
|
public uint Flags;
|
|
public uint EstateID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 41;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Godlike) ? 1 : 0);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(EstateID % 256);
|
|
bytes[i++] = (byte)((EstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Godlike: " + Godlike.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "EstateID: " + EstateID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MapLayerRequest; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MapLayerRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 470;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MapLayerRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MapLayerRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MapLayerRequest ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MapLayerReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("maplayerreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("maplayerreply_layerdata")]
|
|
public class LayerDataBlock
|
|
{
|
|
public uint Top;
|
|
public LLUUID ImageID;
|
|
public uint Left;
|
|
public uint Bottom;
|
|
public uint Right;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public LayerDataBlock() { }
|
|
public LayerDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Top = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ImageID = new LLUUID(bytes, i); i += 16;
|
|
Left = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Bottom = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Right = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(Top % 256);
|
|
bytes[i++] = (byte)((Top >> 8) % 256);
|
|
bytes[i++] = (byte)((Top >> 16) % 256);
|
|
bytes[i++] = (byte)((Top >> 24) % 256);
|
|
if(ImageID == null) { Console.WriteLine("Warning: ImageID is null, in " + this.GetType()); }
|
|
Array.Copy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Left % 256);
|
|
bytes[i++] = (byte)((Left >> 8) % 256);
|
|
bytes[i++] = (byte)((Left >> 16) % 256);
|
|
bytes[i++] = (byte)((Left >> 24) % 256);
|
|
bytes[i++] = (byte)(Bottom % 256);
|
|
bytes[i++] = (byte)((Bottom >> 8) % 256);
|
|
bytes[i++] = (byte)((Bottom >> 16) % 256);
|
|
bytes[i++] = (byte)((Bottom >> 24) % 256);
|
|
bytes[i++] = (byte)(Right % 256);
|
|
bytes[i++] = (byte)((Right >> 8) % 256);
|
|
bytes[i++] = (byte)((Right >> 16) % 256);
|
|
bytes[i++] = (byte)((Right >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- LayerData --" + Environment.NewLine;
|
|
output += "Top: " + Top.ToString() + "" + Environment.NewLine;
|
|
output += "ImageID: " + ImageID.ToString() + "" + Environment.NewLine;
|
|
output += "Left: " + Left.ToString() + "" + Environment.NewLine;
|
|
output += "Bottom: " + Bottom.ToString() + "" + Environment.NewLine;
|
|
output += "Right: " + Right.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MapLayerReply; } }
|
|
public AgentDataBlock AgentData;
|
|
public LayerDataBlock[] LayerData;
|
|
|
|
public MapLayerReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 471;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
LayerData = new LayerDataBlock[0];
|
|
}
|
|
|
|
public MapLayerReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
LayerData = new LayerDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ LayerData[j] = new LayerDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public MapLayerReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
LayerData = new LayerDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ LayerData[j] = new LayerDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < LayerData.Length; j++) { length += LayerData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)LayerData.Length;
|
|
for (int j = 0; j < LayerData.Length; j++) { LayerData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MapLayerReply ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < LayerData.Length; j++)
|
|
{
|
|
output += LayerData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MapBlockRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("mapblockrequest_positiondata")]
|
|
public class PositionDataBlock
|
|
{
|
|
public ushort MaxX;
|
|
public ushort MaxY;
|
|
public ushort MinX;
|
|
public ushort MinY;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
}
|
|
|
|
public PositionDataBlock() { }
|
|
public PositionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
MaxX = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
MaxY = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
MinX = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
MinY = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(MaxX % 256);
|
|
bytes[i++] = (byte)((MaxX >> 8) % 256);
|
|
bytes[i++] = (byte)(MaxY % 256);
|
|
bytes[i++] = (byte)((MaxY >> 8) % 256);
|
|
bytes[i++] = (byte)(MinX % 256);
|
|
bytes[i++] = (byte)((MinX >> 8) % 256);
|
|
bytes[i++] = (byte)(MinY % 256);
|
|
bytes[i++] = (byte)((MinY >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- PositionData --" + Environment.NewLine;
|
|
output += "MaxX: " + MaxX.ToString() + "" + Environment.NewLine;
|
|
output += "MaxY: " + MaxY.ToString() + "" + Environment.NewLine;
|
|
output += "MinX: " + MinX.ToString() + "" + Environment.NewLine;
|
|
output += "MinY: " + MinY.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("mapblockrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool Godlike;
|
|
public uint Flags;
|
|
public uint EstateID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 41;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Godlike) ? 1 : 0);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(EstateID % 256);
|
|
bytes[i++] = (byte)((EstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Godlike: " + Godlike.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "EstateID: " + EstateID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MapBlockRequest; } }
|
|
public PositionDataBlock PositionData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MapBlockRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 472;
|
|
Header.Reliable = true;
|
|
PositionData = new PositionDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MapBlockRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
PositionData = new PositionDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MapBlockRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
PositionData = new PositionDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += PositionData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
PositionData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MapBlockRequest ---" + Environment.NewLine;
|
|
output += PositionData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MapNameRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("mapnamerequest_namedata")]
|
|
public class NameDataBlock
|
|
{
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public NameDataBlock() { }
|
|
public NameDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- NameData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("mapnamerequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool Godlike;
|
|
public uint Flags;
|
|
public uint EstateID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 41;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Godlike) ? 1 : 0);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(EstateID % 256);
|
|
bytes[i++] = (byte)((EstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Godlike: " + Godlike.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "EstateID: " + EstateID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MapNameRequest; } }
|
|
public NameDataBlock NameData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MapNameRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 473;
|
|
Header.Reliable = true;
|
|
NameData = new NameDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MapNameRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
NameData = new NameDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MapNameRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
NameData = new NameDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += NameData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
NameData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MapNameRequest ---" + Environment.NewLine;
|
|
output += NameData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MapBlockReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("mapblockreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public ushort X;
|
|
public ushort Y;
|
|
public uint RegionFlags;
|
|
public byte WaterHeight;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public byte Access;
|
|
public LLUUID MapImageID;
|
|
public byte Agents;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 27;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
X = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
Y = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
WaterHeight = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
Access = (byte)bytes[i++];
|
|
MapImageID = new LLUUID(bytes, i); i += 16;
|
|
Agents = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(X % 256);
|
|
bytes[i++] = (byte)((X >> 8) % 256);
|
|
bytes[i++] = (byte)(Y % 256);
|
|
bytes[i++] = (byte)((Y >> 8) % 256);
|
|
bytes[i++] = (byte)(RegionFlags % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionFlags >> 24) % 256);
|
|
bytes[i++] = WaterHeight;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = Access;
|
|
if(MapImageID == null) { Console.WriteLine("Warning: MapImageID is null, in " + this.GetType()); }
|
|
Array.Copy(MapImageID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Agents;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "X: " + X.ToString() + "" + Environment.NewLine;
|
|
output += "Y: " + Y.ToString() + "" + Environment.NewLine;
|
|
output += "RegionFlags: " + RegionFlags.ToString() + "" + Environment.NewLine;
|
|
output += "WaterHeight: " + WaterHeight.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Access: " + Access.ToString() + "" + Environment.NewLine;
|
|
output += "MapImageID: " + MapImageID.ToString() + "" + Environment.NewLine;
|
|
output += "Agents: " + Agents.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("mapblockreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MapBlockReply; } }
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MapBlockReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 474;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MapBlockReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MapBlockReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MapBlockReply ---" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MapItemRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("mapitemrequest_requestdata")]
|
|
public class RequestDataBlock
|
|
{
|
|
public ulong RegionHandle;
|
|
public uint ItemType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public RequestDataBlock() { }
|
|
public RequestDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
ItemType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
bytes[i++] = (byte)(ItemType % 256);
|
|
bytes[i++] = (byte)((ItemType >> 8) % 256);
|
|
bytes[i++] = (byte)((ItemType >> 16) % 256);
|
|
bytes[i++] = (byte)((ItemType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestData --" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output += "ItemType: " + ItemType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("mapitemrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public bool Godlike;
|
|
public uint Flags;
|
|
public uint EstateID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 41;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Godlike) ? 1 : 0);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = (byte)(EstateID % 256);
|
|
bytes[i++] = (byte)((EstateID >> 8) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 16) % 256);
|
|
bytes[i++] = (byte)((EstateID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Godlike: " + Godlike.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "EstateID: " + EstateID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MapItemRequest; } }
|
|
public RequestDataBlock RequestData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MapItemRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 475;
|
|
Header.Reliable = true;
|
|
RequestData = new RequestDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MapItemRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MapItemRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RequestData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RequestData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MapItemRequest ---" + Environment.NewLine;
|
|
output += RequestData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MapItemReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("mapitemreply_requestdata")]
|
|
public class RequestDataBlock
|
|
{
|
|
public uint ItemType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public RequestDataBlock() { }
|
|
public RequestDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ItemType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ItemType % 256);
|
|
bytes[i++] = (byte)((ItemType >> 8) % 256);
|
|
bytes[i++] = (byte)((ItemType >> 16) % 256);
|
|
bytes[i++] = (byte)((ItemType >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestData --" + Environment.NewLine;
|
|
output += "ItemType: " + ItemType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("mapitemreply_data")]
|
|
public class DataBlock
|
|
{
|
|
public uint X;
|
|
public uint Y;
|
|
public LLUUID ID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public int Extra2;
|
|
public int Extra;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 32;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
X = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Y = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
Extra2 = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Extra = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(X % 256);
|
|
bytes[i++] = (byte)((X >> 8) % 256);
|
|
bytes[i++] = (byte)((X >> 16) % 256);
|
|
bytes[i++] = (byte)((X >> 24) % 256);
|
|
bytes[i++] = (byte)(Y % 256);
|
|
bytes[i++] = (byte)((Y >> 8) % 256);
|
|
bytes[i++] = (byte)((Y >> 16) % 256);
|
|
bytes[i++] = (byte)((Y >> 24) % 256);
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(Extra2 % 256);
|
|
bytes[i++] = (byte)((Extra2 >> 8) % 256);
|
|
bytes[i++] = (byte)((Extra2 >> 16) % 256);
|
|
bytes[i++] = (byte)((Extra2 >> 24) % 256);
|
|
bytes[i++] = (byte)(Extra % 256);
|
|
bytes[i++] = (byte)((Extra >> 8) % 256);
|
|
bytes[i++] = (byte)((Extra >> 16) % 256);
|
|
bytes[i++] = (byte)((Extra >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "X: " + X.ToString() + "" + Environment.NewLine;
|
|
output += "Y: " + Y.ToString() + "" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Extra2: " + Extra2.ToString() + "" + Environment.NewLine;
|
|
output += "Extra: " + Extra.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("mapitemreply_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MapItemReply; } }
|
|
public RequestDataBlock RequestData;
|
|
public DataBlock[] Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MapItemReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 476;
|
|
Header.Reliable = true;
|
|
RequestData = new RequestDataBlock();
|
|
Data = new DataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MapItemReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MapItemReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
Data = new DataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Data[j] = new DataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RequestData.Length; length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RequestData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Data.Length;
|
|
for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MapItemReply ---" + Environment.NewLine;
|
|
output += RequestData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < Data.Length; j++)
|
|
{
|
|
output += Data[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SendPostcardPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("sendpostcard_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
private byte[] _to;
|
|
public byte[] To
|
|
{
|
|
get { return _to; }
|
|
set
|
|
{
|
|
if (value == null) { _to = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _to = new byte[value.Length]; Array.Copy(value, _to, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID AgentID;
|
|
private byte[] _msg;
|
|
public byte[] Msg
|
|
{
|
|
get { return _msg; }
|
|
set
|
|
{
|
|
if (value == null) { _msg = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _msg = new byte[value.Length]; Array.Copy(value, _msg, value.Length); }
|
|
}
|
|
}
|
|
public bool AllowPublish;
|
|
public LLVector3d PosGlobal;
|
|
public LLUUID SessionID;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _subject;
|
|
public byte[] Subject
|
|
{
|
|
get { return _subject; }
|
|
set
|
|
{
|
|
if (value == null) { _subject = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _subject = new byte[value.Length]; Array.Copy(value, _subject, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _from;
|
|
public byte[] From
|
|
{
|
|
get { return _from; }
|
|
set
|
|
{
|
|
if (value == null) { _from = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _from = new byte[value.Length]; Array.Copy(value, _from, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID AssetID;
|
|
public bool MaturePublish;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 74;
|
|
if (To != null) { length += 1 + To.Length; }
|
|
if (Msg != null) { length += 2 + Msg.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Subject != null) { length += 1 + Subject.Length; }
|
|
if (From != null) { length += 1 + From.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_to = new byte[length];
|
|
Array.Copy(bytes, i, _to, 0, length); i += length;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_msg = new byte[length];
|
|
Array.Copy(bytes, i, _msg, 0, length); i += length;
|
|
AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
PosGlobal = new LLVector3d(bytes, i); i += 24;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_subject = new byte[length];
|
|
Array.Copy(bytes, i, _subject, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_from = new byte[length];
|
|
Array.Copy(bytes, i, _from, 0, length); i += length;
|
|
AssetID = new LLUUID(bytes, i); i += 16;
|
|
MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(To == null) { Console.WriteLine("Warning: To is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)To.Length;
|
|
Array.Copy(To, 0, bytes, i, To.Length); i += To.Length;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Msg == null) { Console.WriteLine("Warning: Msg is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Msg.Length % 256);
|
|
bytes[i++] = (byte)((Msg.Length >> 8) % 256);
|
|
Array.Copy(Msg, 0, bytes, i, Msg.Length); i += Msg.Length;
|
|
bytes[i++] = (byte)((AllowPublish) ? 1 : 0);
|
|
Array.Copy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
if(Subject == null) { Console.WriteLine("Warning: Subject is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Subject.Length;
|
|
Array.Copy(Subject, 0, bytes, i, Subject.Length); i += Subject.Length;
|
|
if(From == null) { Console.WriteLine("Warning: From is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)From.Length;
|
|
Array.Copy(From, 0, bytes, i, From.Length); i += From.Length;
|
|
if(AssetID == null) { Console.WriteLine("Warning: AssetID is null, in " + this.GetType()); }
|
|
Array.Copy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((MaturePublish) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(To, "To") + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Msg, "Msg") + "" + Environment.NewLine;
|
|
output += "AllowPublish: " + AllowPublish.ToString() + "" + Environment.NewLine;
|
|
output += "PosGlobal: " + PosGlobal.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Subject, "Subject") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(From, "From") + "" + Environment.NewLine;
|
|
output += "AssetID: " + AssetID.ToString() + "" + Environment.NewLine;
|
|
output += "MaturePublish: " + MaturePublish.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SendPostcard; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SendPostcardPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 477;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SendPostcardPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SendPostcardPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SendPostcard ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelMediaCommandMessagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelmediacommandmessage_commandblock")]
|
|
public class CommandBlockBlock
|
|
{
|
|
public uint Command;
|
|
public float Time;
|
|
public uint Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public CommandBlockBlock() { }
|
|
public CommandBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Command = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Time = BitConverter.ToSingle(bytes, i); i += 4;
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(Command % 256);
|
|
bytes[i++] = (byte)((Command >> 8) % 256);
|
|
bytes[i++] = (byte)((Command >> 16) % 256);
|
|
bytes[i++] = (byte)((Command >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Time);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- CommandBlock --" + Environment.NewLine;
|
|
output += "Command: " + Command.ToString() + "" + Environment.NewLine;
|
|
output += "Time: " + Time.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelMediaCommandMessage; } }
|
|
public CommandBlockBlock CommandBlock;
|
|
|
|
public ParcelMediaCommandMessagePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 486;
|
|
Header.Reliable = true;
|
|
CommandBlock = new CommandBlockBlock();
|
|
}
|
|
|
|
public ParcelMediaCommandMessagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
CommandBlock = new CommandBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelMediaCommandMessagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
CommandBlock = new CommandBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += CommandBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
CommandBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelMediaCommandMessage ---" + Environment.NewLine;
|
|
output += CommandBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelMediaUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelmediaupdate_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID MediaID;
|
|
private byte[] _mediaurl;
|
|
public byte[] MediaURL
|
|
{
|
|
get { return _mediaurl; }
|
|
set
|
|
{
|
|
if (value == null) { _mediaurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _mediaurl = new byte[value.Length]; Array.Copy(value, _mediaurl, value.Length); }
|
|
}
|
|
}
|
|
public byte MediaAutoScale;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 17;
|
|
if (MediaURL != null) { length += 1 + MediaURL.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
MediaID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_mediaurl = new byte[length];
|
|
Array.Copy(bytes, i, _mediaurl, 0, length); i += length;
|
|
MediaAutoScale = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(MediaID == null) { Console.WriteLine("Warning: MediaID is null, in " + this.GetType()); }
|
|
Array.Copy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MediaURL.Length;
|
|
Array.Copy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length;
|
|
bytes[i++] = MediaAutoScale;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "MediaID: " + MediaID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MediaURL, "MediaURL") + "" + Environment.NewLine;
|
|
output += "MediaAutoScale: " + MediaAutoScale.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelMediaUpdate; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public ParcelMediaUpdatePacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 487;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public ParcelMediaUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelMediaUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelMediaUpdate ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LandStatRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("landstatrequest_requestdata")]
|
|
public class RequestDataBlock
|
|
{
|
|
public uint RequestFlags;
|
|
public uint ReportType;
|
|
private byte[] _filter;
|
|
public byte[] Filter
|
|
{
|
|
get { return _filter; }
|
|
set
|
|
{
|
|
if (value == null) { _filter = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _filter = new byte[value.Length]; Array.Copy(value, _filter, value.Length); }
|
|
}
|
|
}
|
|
public int ParcelLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 12;
|
|
if (Filter != null) { length += 1 + Filter.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public RequestDataBlock() { }
|
|
public RequestDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ReportType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_filter = new byte[length];
|
|
Array.Copy(bytes, i, _filter, 0, length); i += length;
|
|
ParcelLocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RequestFlags % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(ReportType % 256);
|
|
bytes[i++] = (byte)((ReportType >> 8) % 256);
|
|
bytes[i++] = (byte)((ReportType >> 16) % 256);
|
|
bytes[i++] = (byte)((ReportType >> 24) % 256);
|
|
if(Filter == null) { Console.WriteLine("Warning: Filter is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Filter.Length;
|
|
Array.Copy(Filter, 0, bytes, i, Filter.Length); i += Filter.Length;
|
|
bytes[i++] = (byte)(ParcelLocalID % 256);
|
|
bytes[i++] = (byte)((ParcelLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ParcelLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ParcelLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestData --" + Environment.NewLine;
|
|
output += "RequestFlags: " + RequestFlags.ToString() + "" + Environment.NewLine;
|
|
output += "ReportType: " + ReportType.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Filter, "Filter") + "" + Environment.NewLine;
|
|
output += "ParcelLocalID: " + ParcelLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("landstatrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LandStatRequest; } }
|
|
public RequestDataBlock RequestData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public LandStatRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 488;
|
|
Header.Reliable = true;
|
|
RequestData = new RequestDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public LandStatRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LandStatRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RequestData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RequestData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LandStatRequest ---" + Environment.NewLine;
|
|
output += RequestData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LandStatReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("landstatreply_requestdata")]
|
|
public class RequestDataBlock
|
|
{
|
|
public uint RequestFlags;
|
|
public uint ReportType;
|
|
public uint TotalObjectCount;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public RequestDataBlock() { }
|
|
public RequestDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ReportType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TotalObjectCount = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(RequestFlags % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(ReportType % 256);
|
|
bytes[i++] = (byte)((ReportType >> 8) % 256);
|
|
bytes[i++] = (byte)((ReportType >> 16) % 256);
|
|
bytes[i++] = (byte)((ReportType >> 24) % 256);
|
|
bytes[i++] = (byte)(TotalObjectCount % 256);
|
|
bytes[i++] = (byte)((TotalObjectCount >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalObjectCount >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalObjectCount >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestData --" + Environment.NewLine;
|
|
output += "RequestFlags: " + RequestFlags.ToString() + "" + Environment.NewLine;
|
|
output += "ReportType: " + ReportType.ToString() + "" + Environment.NewLine;
|
|
output += "TotalObjectCount: " + TotalObjectCount.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("landstatreply_reportdata")]
|
|
public class ReportDataBlock
|
|
{
|
|
public float LocationX;
|
|
public float LocationY;
|
|
public float LocationZ;
|
|
private byte[] _taskname;
|
|
public byte[] TaskName
|
|
{
|
|
get { return _taskname; }
|
|
set
|
|
{
|
|
if (value == null) { _taskname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _taskname = new byte[value.Length]; Array.Copy(value, _taskname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID TaskID;
|
|
public float Score;
|
|
public uint TaskLocalID;
|
|
private byte[] _ownername;
|
|
public byte[] OwnerName
|
|
{
|
|
get { return _ownername; }
|
|
set
|
|
{
|
|
if (value == null) { _ownername = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _ownername = new byte[value.Length]; Array.Copy(value, _ownername, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 36;
|
|
if (TaskName != null) { length += 1 + TaskName.Length; }
|
|
if (OwnerName != null) { length += 1 + OwnerName.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ReportDataBlock() { }
|
|
public ReportDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
LocationX = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
LocationY = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
LocationZ = BitConverter.ToSingle(bytes, i); i += 4;
|
|
length = (ushort)bytes[i++];
|
|
_taskname = new byte[length];
|
|
Array.Copy(bytes, i, _taskname, 0, length); i += length;
|
|
TaskID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Score = BitConverter.ToSingle(bytes, i); i += 4;
|
|
TaskLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_ownername = new byte[length];
|
|
Array.Copy(bytes, i, _ownername, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(LocationX);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(LocationY);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(LocationZ);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(TaskName == null) { Console.WriteLine("Warning: TaskName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TaskName.Length;
|
|
Array.Copy(TaskName, 0, bytes, i, TaskName.Length); i += TaskName.Length;
|
|
if(TaskID == null) { Console.WriteLine("Warning: TaskID is null, in " + this.GetType()); }
|
|
Array.Copy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Score);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(TaskLocalID % 256);
|
|
bytes[i++] = (byte)((TaskLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((TaskLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((TaskLocalID >> 24) % 256);
|
|
if(OwnerName == null) { Console.WriteLine("Warning: OwnerName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)OwnerName.Length;
|
|
Array.Copy(OwnerName, 0, bytes, i, OwnerName.Length); i += OwnerName.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ReportData --" + Environment.NewLine;
|
|
output += "LocationX: " + LocationX.ToString() + "" + Environment.NewLine;
|
|
output += "LocationY: " + LocationY.ToString() + "" + Environment.NewLine;
|
|
output += "LocationZ: " + LocationZ.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TaskName, "TaskName") + "" + Environment.NewLine;
|
|
output += "TaskID: " + TaskID.ToString() + "" + Environment.NewLine;
|
|
output += "Score: " + Score.ToString() + "" + Environment.NewLine;
|
|
output += "TaskLocalID: " + TaskLocalID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(OwnerName, "OwnerName") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LandStatReply; } }
|
|
public RequestDataBlock RequestData;
|
|
public ReportDataBlock[] ReportData;
|
|
|
|
public LandStatReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 489;
|
|
Header.Reliable = true;
|
|
RequestData = new RequestDataBlock();
|
|
ReportData = new ReportDataBlock[0];
|
|
}
|
|
|
|
public LandStatReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ReportData = new ReportDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ReportData[j] = new ReportDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public LandStatReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RequestData = new RequestDataBlock(bytes, ref i);
|
|
int count = (int)bytes[i++];
|
|
ReportData = new ReportDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ReportData[j] = new ReportDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += RequestData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ReportData.Length; j++) { length += ReportData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RequestData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ReportData.Length;
|
|
for (int j = 0; j < ReportData.Length; j++) { ReportData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LandStatReply ---" + Environment.NewLine;
|
|
output += RequestData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < ReportData.Length; j++)
|
|
{
|
|
output += ReportData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SecuredTemplateChecksumRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("securedtemplatechecksumrequest_tokenblock")]
|
|
public class TokenBlockBlock
|
|
{
|
|
public LLUUID Token;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TokenBlockBlock() { }
|
|
public TokenBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Token = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Token == null) { Console.WriteLine("Warning: Token is null, in " + this.GetType()); }
|
|
Array.Copy(Token.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TokenBlock --" + Environment.NewLine;
|
|
output += "Token: " + Token.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SecuredTemplateChecksumRequest; } }
|
|
public TokenBlockBlock TokenBlock;
|
|
|
|
public SecuredTemplateChecksumRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 65530;
|
|
Header.Reliable = true;
|
|
TokenBlock = new TokenBlockBlock();
|
|
}
|
|
|
|
public SecuredTemplateChecksumRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
TokenBlock = new TokenBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public SecuredTemplateChecksumRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TokenBlock = new TokenBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += TokenBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TokenBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SecuredTemplateChecksumRequest ---" + Environment.NewLine;
|
|
output += TokenBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PacketAckPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("packetack_packets")]
|
|
public class PacketsBlock
|
|
{
|
|
public uint ID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public PacketsBlock() { }
|
|
public PacketsBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Packets --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PacketAck; } }
|
|
public PacketsBlock[] Packets;
|
|
|
|
public PacketAckPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 65531;
|
|
Header.Reliable = true;
|
|
Packets = new PacketsBlock[0];
|
|
}
|
|
|
|
public PacketAckPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Packets = new PacketsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Packets[j] = new PacketsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public PacketAckPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Packets = new PacketsBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Packets[j] = new PacketsBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < Packets.Length; j++) { length += Packets[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Packets.Length;
|
|
for (int j = 0; j < Packets.Length; j++) { Packets[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PacketAck ---" + Environment.NewLine;
|
|
for (int j = 0; j < Packets.Length; j++)
|
|
{
|
|
output += Packets[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class OpenCircuitPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("opencircuit_circuitinfo")]
|
|
public class CircuitInfoBlock
|
|
{
|
|
public uint IP;
|
|
public ushort Port;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 6;
|
|
}
|
|
}
|
|
|
|
public CircuitInfoBlock() { }
|
|
public CircuitInfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(IP % 256);
|
|
bytes[i++] = (byte)((IP >> 8) % 256);
|
|
bytes[i++] = (byte)((IP >> 16) % 256);
|
|
bytes[i++] = (byte)((IP >> 24) % 256);
|
|
bytes[i++] = (byte)((Port >> 8) % 256);
|
|
bytes[i++] = (byte)(Port % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- CircuitInfo --" + Environment.NewLine;
|
|
output += "IP: " + IP.ToString() + "" + Environment.NewLine;
|
|
output += "Port: " + Port.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.OpenCircuit; } }
|
|
public CircuitInfoBlock CircuitInfo;
|
|
|
|
public OpenCircuitPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 65532;
|
|
Header.Reliable = true;
|
|
CircuitInfo = new CircuitInfoBlock();
|
|
}
|
|
|
|
public OpenCircuitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
CircuitInfo = new CircuitInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public OpenCircuitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
CircuitInfo = new CircuitInfoBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += CircuitInfo.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
CircuitInfo.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- OpenCircuit ---" + Environment.NewLine;
|
|
output += CircuitInfo.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CloseCircuitPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CloseCircuit; } }
|
|
|
|
public CloseCircuitPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 65533;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public CloseCircuitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public CloseCircuitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CloseCircuit ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TemplateChecksumRequestPacket : Packet
|
|
{
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TemplateChecksumRequest; } }
|
|
|
|
public TemplateChecksumRequestPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 65534;
|
|
Header.Reliable = true;
|
|
}
|
|
|
|
public TemplateChecksumRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
}
|
|
|
|
public TemplateChecksumRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TemplateChecksumRequest ---" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TemplateChecksumReplyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("templatechecksumreply_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public byte ServerVersion;
|
|
public byte PatchVersion;
|
|
public uint Checksum;
|
|
public uint Flags;
|
|
public byte MajorVersion;
|
|
public byte MinorVersion;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ServerVersion = (byte)bytes[i++];
|
|
PatchVersion = (byte)bytes[i++];
|
|
Checksum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MajorVersion = (byte)bytes[i++];
|
|
MinorVersion = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ServerVersion;
|
|
bytes[i++] = PatchVersion;
|
|
bytes[i++] = (byte)(Checksum % 256);
|
|
bytes[i++] = (byte)((Checksum >> 8) % 256);
|
|
bytes[i++] = (byte)((Checksum >> 16) % 256);
|
|
bytes[i++] = (byte)((Checksum >> 24) % 256);
|
|
bytes[i++] = (byte)(Flags % 256);
|
|
bytes[i++] = (byte)((Flags >> 8) % 256);
|
|
bytes[i++] = (byte)((Flags >> 16) % 256);
|
|
bytes[i++] = (byte)((Flags >> 24) % 256);
|
|
bytes[i++] = MajorVersion;
|
|
bytes[i++] = MinorVersion;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "ServerVersion: " + ServerVersion.ToString() + "" + Environment.NewLine;
|
|
output += "PatchVersion: " + PatchVersion.ToString() + "" + Environment.NewLine;
|
|
output += "Checksum: " + Checksum.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "MajorVersion: " + MajorVersion.ToString() + "" + Environment.NewLine;
|
|
output += "MinorVersion: " + MinorVersion.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("templatechecksumreply_tokenblock")]
|
|
public class TokenBlockBlock
|
|
{
|
|
public LLUUID Token;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public TokenBlockBlock() { }
|
|
public TokenBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Token = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Token == null) { Console.WriteLine("Warning: Token is null, in " + this.GetType()); }
|
|
Array.Copy(Token.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TokenBlock --" + Environment.NewLine;
|
|
output += "Token: " + Token.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TemplateChecksumReply; } }
|
|
public DataBlockBlock DataBlock;
|
|
public TokenBlockBlock TokenBlock;
|
|
|
|
public TemplateChecksumReplyPacket()
|
|
{
|
|
Header = new LowHeader();
|
|
Header.ID = 65535;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
TokenBlock = new TokenBlockBlock();
|
|
}
|
|
|
|
public TemplateChecksumReplyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
TokenBlock = new TokenBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public TemplateChecksumReplyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
TokenBlock = new TokenBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 8;
|
|
length += DataBlock.Length; length += TokenBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
TokenBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TemplateChecksumReply ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
output += TokenBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectAddPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectadd_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint AddFlags;
|
|
public sbyte PathTwistBegin;
|
|
public byte PathEnd;
|
|
public byte ProfileBegin;
|
|
public sbyte PathRadiusOffset;
|
|
public sbyte PathSkew;
|
|
public LLVector3 RayStart;
|
|
public byte ProfileCurve;
|
|
public byte PathScaleX;
|
|
public byte PathScaleY;
|
|
public byte Material;
|
|
public byte PathShearX;
|
|
public byte PathShearY;
|
|
public sbyte PathTaperX;
|
|
public sbyte PathTaperY;
|
|
public byte RayEndIsIntersection;
|
|
public LLVector3 RayEnd;
|
|
public byte ProfileEnd;
|
|
public byte PathBegin;
|
|
public byte BypassRaycast;
|
|
public byte PCode;
|
|
public byte PathCurve;
|
|
public LLVector3 Scale;
|
|
public byte State;
|
|
public sbyte PathTwist;
|
|
public byte ProfileHollow;
|
|
public byte PathRevolutions;
|
|
public LLQuaternion Rotation;
|
|
public LLUUID RayTargetID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 91;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AddFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PathTwistBegin = (sbyte)bytes[i++];
|
|
PathEnd = (byte)bytes[i++];
|
|
ProfileBegin = (byte)bytes[i++];
|
|
PathRadiusOffset = (sbyte)bytes[i++];
|
|
PathSkew = (sbyte)bytes[i++];
|
|
RayStart = new LLVector3(bytes, i); i += 12;
|
|
ProfileCurve = (byte)bytes[i++];
|
|
PathScaleX = (byte)bytes[i++];
|
|
PathScaleY = (byte)bytes[i++];
|
|
Material = (byte)bytes[i++];
|
|
PathShearX = (byte)bytes[i++];
|
|
PathShearY = (byte)bytes[i++];
|
|
PathTaperX = (sbyte)bytes[i++];
|
|
PathTaperY = (sbyte)bytes[i++];
|
|
RayEndIsIntersection = (byte)bytes[i++];
|
|
RayEnd = new LLVector3(bytes, i); i += 12;
|
|
ProfileEnd = (byte)bytes[i++];
|
|
PathBegin = (byte)bytes[i++];
|
|
BypassRaycast = (byte)bytes[i++];
|
|
PCode = (byte)bytes[i++];
|
|
PathCurve = (byte)bytes[i++];
|
|
Scale = new LLVector3(bytes, i); i += 12;
|
|
State = (byte)bytes[i++];
|
|
PathTwist = (sbyte)bytes[i++];
|
|
ProfileHollow = (byte)bytes[i++];
|
|
PathRevolutions = (byte)bytes[i++];
|
|
Rotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
RayTargetID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(AddFlags % 256);
|
|
bytes[i++] = (byte)((AddFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((AddFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((AddFlags >> 24) % 256);
|
|
bytes[i++] = (byte)PathTwistBegin;
|
|
bytes[i++] = PathEnd;
|
|
bytes[i++] = ProfileBegin;
|
|
bytes[i++] = (byte)PathRadiusOffset;
|
|
bytes[i++] = (byte)PathSkew;
|
|
Array.Copy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = ProfileCurve;
|
|
bytes[i++] = PathScaleX;
|
|
bytes[i++] = PathScaleY;
|
|
bytes[i++] = Material;
|
|
bytes[i++] = PathShearX;
|
|
bytes[i++] = PathShearY;
|
|
bytes[i++] = (byte)PathTaperX;
|
|
bytes[i++] = (byte)PathTaperY;
|
|
bytes[i++] = RayEndIsIntersection;
|
|
Array.Copy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = ProfileEnd;
|
|
bytes[i++] = PathBegin;
|
|
bytes[i++] = BypassRaycast;
|
|
bytes[i++] = PCode;
|
|
bytes[i++] = PathCurve;
|
|
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = State;
|
|
bytes[i++] = (byte)PathTwist;
|
|
bytes[i++] = ProfileHollow;
|
|
bytes[i++] = PathRevolutions;
|
|
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(RayTargetID == null) { Console.WriteLine("Warning: RayTargetID is null, in " + this.GetType()); }
|
|
Array.Copy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "AddFlags: " + AddFlags.ToString() + "" + Environment.NewLine;
|
|
output += "PathTwistBegin: " + PathTwistBegin.ToString() + "" + Environment.NewLine;
|
|
output += "PathEnd: " + PathEnd.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileBegin: " + ProfileBegin.ToString() + "" + Environment.NewLine;
|
|
output += "PathRadiusOffset: " + PathRadiusOffset.ToString() + "" + Environment.NewLine;
|
|
output += "PathSkew: " + PathSkew.ToString() + "" + Environment.NewLine;
|
|
output += "RayStart: " + RayStart.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileCurve: " + ProfileCurve.ToString() + "" + Environment.NewLine;
|
|
output += "PathScaleX: " + PathScaleX.ToString() + "" + Environment.NewLine;
|
|
output += "PathScaleY: " + PathScaleY.ToString() + "" + Environment.NewLine;
|
|
output += "Material: " + Material.ToString() + "" + Environment.NewLine;
|
|
output += "PathShearX: " + PathShearX.ToString() + "" + Environment.NewLine;
|
|
output += "PathShearY: " + PathShearY.ToString() + "" + Environment.NewLine;
|
|
output += "PathTaperX: " + PathTaperX.ToString() + "" + Environment.NewLine;
|
|
output += "PathTaperY: " + PathTaperY.ToString() + "" + Environment.NewLine;
|
|
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "" + Environment.NewLine;
|
|
output += "RayEnd: " + RayEnd.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileEnd: " + ProfileEnd.ToString() + "" + Environment.NewLine;
|
|
output += "PathBegin: " + PathBegin.ToString() + "" + Environment.NewLine;
|
|
output += "BypassRaycast: " + BypassRaycast.ToString() + "" + Environment.NewLine;
|
|
output += "PCode: " + PCode.ToString() + "" + Environment.NewLine;
|
|
output += "PathCurve: " + PathCurve.ToString() + "" + Environment.NewLine;
|
|
output += "Scale: " + Scale.ToString() + "" + Environment.NewLine;
|
|
output += "State: " + State.ToString() + "" + Environment.NewLine;
|
|
output += "PathTwist: " + PathTwist.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileHollow: " + ProfileHollow.ToString() + "" + Environment.NewLine;
|
|
output += "PathRevolutions: " + PathRevolutions.ToString() + "" + Environment.NewLine;
|
|
output += "Rotation: " + Rotation.ToString() + "" + Environment.NewLine;
|
|
output += "RayTargetID: " + RayTargetID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectadd_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public LLUUID GroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectAdd; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectAddPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 2;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectAddPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectAddPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectAdd ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class MultipleObjectUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("multipleobjectupdate_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
public byte Type;
|
|
public uint ObjectLocalID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 5;
|
|
if (Data != null) { length += 1 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
Type = (byte)bytes[i++];
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Data.Length;
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
bytes[i++] = Type;
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("multipleobjectupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.MultipleObjectUpdate; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public MultipleObjectUpdatePacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 3;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public MultipleObjectUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public MultipleObjectUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- MultipleObjectUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestMultipleObjectsPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestmultipleobjects_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ID;
|
|
public byte CacheMissType;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 5;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CacheMissType = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
bytes[i++] = CacheMissType;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "CacheMissType: " + CacheMissType.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("requestmultipleobjects_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestMultipleObjects; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RequestMultipleObjectsPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 4;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RequestMultipleObjectsPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestMultipleObjectsPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestMultipleObjects ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectPositionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectposition_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ObjectLocalID;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ObjectLocalID % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((ObjectLocalID >> 24) % 256);
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectposition_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectPosition; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ObjectPositionPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 5;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ObjectPositionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectPositionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectPosition ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestObjectPropertiesFamilyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestobjectpropertiesfamily_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public uint RequestFlags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(RequestFlags % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "RequestFlags: " + RequestFlags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("requestobjectpropertiesfamily_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestObjectPropertiesFamily; } }
|
|
public ObjectDataBlock ObjectData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RequestObjectPropertiesFamilyPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 6;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RequestObjectPropertiesFamilyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestObjectPropertiesFamilyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += ObjectData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestObjectPropertiesFamily ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CoarseLocationUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("coarselocationupdate_location")]
|
|
public class LocationBlock
|
|
{
|
|
public byte X;
|
|
public byte Y;
|
|
public byte Z;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 3;
|
|
}
|
|
}
|
|
|
|
public LocationBlock() { }
|
|
public LocationBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
X = (byte)bytes[i++];
|
|
Y = (byte)bytes[i++];
|
|
Z = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = X;
|
|
bytes[i++] = Y;
|
|
bytes[i++] = Z;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Location --" + Environment.NewLine;
|
|
output += "X: " + X.ToString() + "" + Environment.NewLine;
|
|
output += "Y: " + Y.ToString() + "" + Environment.NewLine;
|
|
output += "Z: " + Z.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("coarselocationupdate_index")]
|
|
public class IndexBlock
|
|
{
|
|
public short You;
|
|
public short Prey;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public IndexBlock() { }
|
|
public IndexBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
You = (short)(bytes[i++] + (bytes[i++] << 8));
|
|
Prey = (short)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(You % 256);
|
|
bytes[i++] = (byte)((You >> 8) % 256);
|
|
bytes[i++] = (byte)(Prey % 256);
|
|
bytes[i++] = (byte)((Prey >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Index --" + Environment.NewLine;
|
|
output += "You: " + You.ToString() + "" + Environment.NewLine;
|
|
output += "Prey: " + Prey.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CoarseLocationUpdate; } }
|
|
public LocationBlock[] Location;
|
|
public IndexBlock Index;
|
|
|
|
public CoarseLocationUpdatePacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 7;
|
|
Header.Reliable = true;
|
|
Location = new LocationBlock[0];
|
|
Index = new IndexBlock();
|
|
}
|
|
|
|
public CoarseLocationUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Location = new LocationBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Location[j] = new LocationBlock(bytes, ref i); }
|
|
Index = new IndexBlock(bytes, ref i);
|
|
}
|
|
|
|
public CoarseLocationUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Location = new LocationBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Location[j] = new LocationBlock(bytes, ref i); }
|
|
Index = new IndexBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += Index.Length;;
|
|
length++;
|
|
for (int j = 0; j < Location.Length; j++) { length += Location[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Location.Length;
|
|
for (int j = 0; j < Location.Length; j++) { Location[j].ToBytes(bytes, ref i); }
|
|
Index.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CoarseLocationUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < Location.Length; j++)
|
|
{
|
|
output += Location[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += Index.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CrossedRegionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("crossedregion_info")]
|
|
public class InfoBlock
|
|
{
|
|
public LLVector3 LookAt;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 24;
|
|
}
|
|
}
|
|
|
|
public InfoBlock() { }
|
|
public InfoBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
LookAt = new LLVector3(bytes, i); i += 12;
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Info --" + Environment.NewLine;
|
|
output += "LookAt: " + LookAt.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("crossedregion_regiondata")]
|
|
public class RegionDataBlock
|
|
{
|
|
private byte[] _seedcapability;
|
|
public byte[] SeedCapability
|
|
{
|
|
get { return _seedcapability; }
|
|
set
|
|
{
|
|
if (value == null) { _seedcapability = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _seedcapability = new byte[value.Length]; Array.Copy(value, _seedcapability, value.Length); }
|
|
}
|
|
}
|
|
public ushort SimPort;
|
|
public ulong RegionHandle;
|
|
public uint SimIP;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 14;
|
|
if (SeedCapability != null) { length += 2 + SeedCapability.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public RegionDataBlock() { }
|
|
public RegionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_seedcapability = new byte[length];
|
|
Array.Copy(bytes, i, _seedcapability, 0, length); i += length;
|
|
SimPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
SimIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(SeedCapability == null) { Console.WriteLine("Warning: SeedCapability is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(SeedCapability.Length % 256);
|
|
bytes[i++] = (byte)((SeedCapability.Length >> 8) % 256);
|
|
Array.Copy(SeedCapability, 0, bytes, i, SeedCapability.Length); i += SeedCapability.Length;
|
|
bytes[i++] = (byte)((SimPort >> 8) % 256);
|
|
bytes[i++] = (byte)(SimPort % 256);
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
bytes[i++] = (byte)(SimIP % 256);
|
|
bytes[i++] = (byte)((SimIP >> 8) % 256);
|
|
bytes[i++] = (byte)((SimIP >> 16) % 256);
|
|
bytes[i++] = (byte)((SimIP >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SeedCapability, "SeedCapability") + "" + Environment.NewLine;
|
|
output += "SimPort: " + SimPort.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output += "SimIP: " + SimIP.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("crossedregion_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CrossedRegion; } }
|
|
public InfoBlock Info;
|
|
public RegionDataBlock RegionData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public CrossedRegionPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 8;
|
|
Header.Reliable = true;
|
|
Info = new InfoBlock();
|
|
RegionData = new RegionDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public CrossedRegionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
Info = new InfoBlock(bytes, ref i);
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public CrossedRegionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Info = new InfoBlock(bytes, ref i);
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += Info.Length; length += RegionData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Info.ToBytes(bytes, ref i);
|
|
RegionData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CrossedRegion ---" + Environment.NewLine;
|
|
output += Info.ToString() + "" + Environment.NewLine;
|
|
output += RegionData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ConfirmEnableSimulatorPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("confirmenablesimulator_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ConfirmEnableSimulator; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ConfirmEnableSimulatorPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 9;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ConfirmEnableSimulatorPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ConfirmEnableSimulatorPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ConfirmEnableSimulator ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectPropertiesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectproperties_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public int OwnershipCost;
|
|
public ulong CreationDate;
|
|
public byte AggregatePermTexturesOwner;
|
|
private byte[] _sitname;
|
|
public byte[] SitName
|
|
{
|
|
get { return _sitname; }
|
|
set
|
|
{
|
|
if (value == null) { _sitname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _sitname = new byte[value.Length]; Array.Copy(value, _sitname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ObjectID;
|
|
public byte SaleType;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public uint Category;
|
|
public LLUUID FromTaskID;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public LLUUID CreatorID;
|
|
private byte[] _textureid;
|
|
public byte[] TextureID
|
|
{
|
|
get { return _textureid; }
|
|
set
|
|
{
|
|
if (value == null) { _textureid = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _textureid = new byte[value.Length]; Array.Copy(value, _textureid, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _touchname;
|
|
public byte[] TouchName
|
|
{
|
|
get { return _touchname; }
|
|
set
|
|
{
|
|
if (value == null) { _touchname = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _touchname = new byte[value.Length]; Array.Copy(value, _touchname, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID ItemID;
|
|
public byte AggregatePermTextures;
|
|
public LLUUID FolderID;
|
|
public short InventorySerial;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID LastOwnerID;
|
|
public byte AggregatePerms;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 174;
|
|
if (SitName != null) { length += 1 + SitName.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (TextureID != null) { length += 1 + TextureID.Length; }
|
|
if (TouchName != null) { length += 1 + TouchName.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
OwnershipCost = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CreationDate = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
AggregatePermTexturesOwner = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_sitname = new byte[length];
|
|
Array.Copy(bytes, i, _sitname, 0, length); i += length;
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
SaleType = (byte)bytes[i++];
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
FromTaskID = new LLUUID(bytes, i); i += 16;
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
CreatorID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_textureid = new byte[length];
|
|
Array.Copy(bytes, i, _textureid, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_touchname = new byte[length];
|
|
Array.Copy(bytes, i, _touchname, 0, length); i += length;
|
|
ItemID = new LLUUID(bytes, i); i += 16;
|
|
AggregatePermTextures = (byte)bytes[i++];
|
|
FolderID = new LLUUID(bytes, i); i += 16;
|
|
InventorySerial = (short)(bytes[i++] + (bytes[i++] << 8));
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
LastOwnerID = new LLUUID(bytes, i); i += 16;
|
|
AggregatePerms = (byte)bytes[i++];
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(OwnershipCost % 256);
|
|
bytes[i++] = (byte)((OwnershipCost >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnershipCost >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnershipCost >> 24) % 256);
|
|
bytes[i++] = (byte)(CreationDate % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 8) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 16) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 24) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 32) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 40) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 48) % 256);
|
|
bytes[i++] = (byte)((CreationDate >> 56) % 256);
|
|
bytes[i++] = AggregatePermTexturesOwner;
|
|
if(SitName == null) { Console.WriteLine("Warning: SitName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)SitName.Length;
|
|
Array.Copy(SitName, 0, bytes, i, SitName.Length); i += SitName.Length;
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(Category % 256);
|
|
bytes[i++] = (byte)((Category >> 8) % 256);
|
|
bytes[i++] = (byte)((Category >> 16) % 256);
|
|
bytes[i++] = (byte)((Category >> 24) % 256);
|
|
if(FromTaskID == null) { Console.WriteLine("Warning: FromTaskID is null, in " + this.GetType()); }
|
|
Array.Copy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
|
|
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TextureID == null) { Console.WriteLine("Warning: TextureID is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TextureID.Length;
|
|
Array.Copy(TextureID, 0, bytes, i, TextureID.Length); i += TextureID.Length;
|
|
if(TouchName == null) { Console.WriteLine("Warning: TouchName is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TouchName.Length;
|
|
Array.Copy(TouchName, 0, bytes, i, TouchName.Length); i += TouchName.Length;
|
|
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
|
|
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = AggregatePermTextures;
|
|
if(FolderID == null) { Console.WriteLine("Warning: FolderID is null, in " + this.GetType()); }
|
|
Array.Copy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(InventorySerial % 256);
|
|
bytes[i++] = (byte)((InventorySerial >> 8) % 256);
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
if(LastOwnerID == null) { Console.WriteLine("Warning: LastOwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(LastOwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = AggregatePerms;
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "OwnershipCost: " + OwnershipCost.ToString() + "" + Environment.NewLine;
|
|
output += "CreationDate: " + CreationDate.ToString() + "" + Environment.NewLine;
|
|
output += "AggregatePermTexturesOwner: " + AggregatePermTexturesOwner.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(SitName, "SitName") + "" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "FromTaskID: " + FromTaskID.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "CreatorID: " + CreatorID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextureID, "TextureID") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TouchName, "TouchName") + "" + Environment.NewLine;
|
|
output += "ItemID: " + ItemID.ToString() + "" + Environment.NewLine;
|
|
output += "AggregatePermTextures: " + AggregatePermTextures.ToString() + "" + Environment.NewLine;
|
|
output += "FolderID: " + FolderID.ToString() + "" + Environment.NewLine;
|
|
output += "InventorySerial: " + InventorySerial.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "LastOwnerID: " + LastOwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "AggregatePerms: " + AggregatePerms.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectProperties; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
|
|
public ObjectPropertiesPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 10;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
}
|
|
|
|
public ObjectPropertiesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ObjectPropertiesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectProperties ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectPropertiesFamilyPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectpropertiesfamily_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public int OwnershipCost;
|
|
public LLUUID ObjectID;
|
|
public byte SaleType;
|
|
public uint BaseMask;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public uint RequestFlags;
|
|
public uint Category;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public uint EveryoneMask;
|
|
private byte[] _description;
|
|
public byte[] Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
if (value == null) { _description = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _description = new byte[value.Length]; Array.Copy(value, _description, value.Length); }
|
|
}
|
|
}
|
|
public LLUUID LastOwnerID;
|
|
public uint NextOwnerMask;
|
|
public uint GroupMask;
|
|
public uint OwnerMask;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 101;
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Description != null) { length += 1 + Description.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
OwnershipCost = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
SaleType = (byte)bytes[i++];
|
|
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_description = new byte[length];
|
|
Array.Copy(bytes, i, _description, 0, length); i += length;
|
|
LastOwnerID = new LLUUID(bytes, i); i += 16;
|
|
NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(OwnershipCost % 256);
|
|
bytes[i++] = (byte)((OwnershipCost >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnershipCost >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnershipCost >> 24) % 256);
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = SaleType;
|
|
bytes[i++] = (byte)(BaseMask % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 8) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 16) % 256);
|
|
bytes[i++] = (byte)((BaseMask >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(RequestFlags % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((RequestFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(Category % 256);
|
|
bytes[i++] = (byte)((Category >> 8) % 256);
|
|
bytes[i++] = (byte)((Category >> 16) % 256);
|
|
bytes[i++] = (byte)((Category >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(EveryoneMask % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
|
|
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
|
|
if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Description.Length;
|
|
Array.Copy(Description, 0, bytes, i, Description.Length); i += Description.Length;
|
|
if(LastOwnerID == null) { Console.WriteLine("Warning: LastOwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(LastOwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(NextOwnerMask % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((NextOwnerMask >> 24) % 256);
|
|
bytes[i++] = (byte)(GroupMask % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupMask >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerMask % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerMask >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "OwnershipCost: " + OwnershipCost.ToString() + "" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "SaleType: " + SaleType.ToString() + "" + Environment.NewLine;
|
|
output += "BaseMask: " + BaseMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "RequestFlags: " + RequestFlags.ToString() + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "EveryoneMask: " + EveryoneMask.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Description, "Description") + "" + Environment.NewLine;
|
|
output += "LastOwnerID: " + LastOwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "" + Environment.NewLine;
|
|
output += "GroupMask: " + GroupMask.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerMask: " + OwnerMask.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectPropertiesFamily; } }
|
|
public ObjectDataBlock ObjectData;
|
|
|
|
public ObjectPropertiesFamilyPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 11;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock();
|
|
}
|
|
|
|
public ObjectPropertiesFamilyPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectPropertiesFamilyPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ObjectData = new ObjectDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += ObjectData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ObjectData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectPropertiesFamily ---" + Environment.NewLine;
|
|
output += ObjectData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelPropertiesRequestPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelpropertiesrequest_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public float East;
|
|
public float West;
|
|
public int SequenceID;
|
|
public bool SnapSelection;
|
|
public float North;
|
|
public float South;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 21;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
East = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
West = BitConverter.ToSingle(bytes, i); i += 4;
|
|
SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SnapSelection = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
North = BitConverter.ToSingle(bytes, i); i += 4;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
South = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(East);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(West);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(SequenceID % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 24) % 256);
|
|
bytes[i++] = (byte)((SnapSelection) ? 1 : 0);
|
|
ba = BitConverter.GetBytes(North);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
ba = BitConverter.GetBytes(South);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "East: " + East.ToString() + "" + Environment.NewLine;
|
|
output += "West: " + West.ToString() + "" + Environment.NewLine;
|
|
output += "SequenceID: " + SequenceID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapSelection: " + SnapSelection.ToString() + "" + Environment.NewLine;
|
|
output += "North: " + North.ToString() + "" + Environment.NewLine;
|
|
output += "South: " + South.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("parcelpropertiesrequest_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelPropertiesRequest; } }
|
|
public ParcelDataBlock ParcelData;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ParcelPropertiesRequestPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 12;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ParcelPropertiesRequestPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelPropertiesRequestPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += ParcelData.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelPropertiesRequest ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class GestureUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("gestureupdate_agentblock")]
|
|
public class AgentBlockBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public bool ToViewer;
|
|
private byte[] _filename;
|
|
public byte[] Filename
|
|
{
|
|
get { return _filename; }
|
|
set
|
|
{
|
|
if (value == null) { _filename = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _filename = new byte[value.Length]; Array.Copy(value, _filename, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 17;
|
|
if (Filename != null) { length += 1 + Filename.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AgentBlockBlock() { }
|
|
public AgentBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
ToViewer = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_filename = new byte[length];
|
|
Array.Copy(bytes, i, _filename, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((ToViewer) ? 1 : 0);
|
|
if(Filename == null) { Console.WriteLine("Warning: Filename is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Filename.Length;
|
|
Array.Copy(Filename, 0, bytes, i, Filename.Length); i += Filename.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentBlock --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "ToViewer: " + ToViewer.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Filename, "Filename") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.GestureUpdate; } }
|
|
public AgentBlockBlock AgentBlock;
|
|
|
|
public GestureUpdatePacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 14;
|
|
Header.Reliable = true;
|
|
AgentBlock = new AgentBlockBlock();
|
|
}
|
|
|
|
public GestureUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public GestureUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentBlock = new AgentBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += AgentBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- GestureUpdate ---" + Environment.NewLine;
|
|
output += AgentBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AttachedSoundPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("attachedsound_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public float Gain;
|
|
public LLUUID SoundID;
|
|
public LLUUID OwnerID;
|
|
public byte Flags;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 53;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Gain = BitConverter.ToSingle(bytes, i); i += 4;
|
|
SoundID = new LLUUID(bytes, i); i += 16;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
Flags = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Gain);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(SoundID == null) { Console.WriteLine("Warning: SoundID is null, in " + this.GetType()); }
|
|
Array.Copy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Flags;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Gain: " + Gain.ToString() + "" + Environment.NewLine;
|
|
output += "SoundID: " + SoundID.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AttachedSound; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public AttachedSoundPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 15;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public AttachedSoundPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public AttachedSoundPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AttachedSound ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AttachedSoundGainChangePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("attachedsoundgainchange_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public float Gain;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Gain = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Gain);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Gain: " + Gain.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AttachedSoundGainChange; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public AttachedSoundGainChangePacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 16;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public AttachedSoundGainChangePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public AttachedSoundGainChangePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AttachedSoundGainChange ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AttachedSoundCutoffRadiusPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("attachedsoundcutoffradius_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public float Radius;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Radius = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Radius);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Radius: " + Radius.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AttachedSoundCutoffRadius; } }
|
|
public DataBlockBlock DataBlock;
|
|
|
|
public AttachedSoundCutoffRadiusPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 17;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock();
|
|
}
|
|
|
|
public AttachedSoundCutoffRadiusPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public AttachedSoundCutoffRadiusPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataBlock = new DataBlockBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += DataBlock.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataBlock.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AttachedSoundCutoffRadius ---" + Environment.NewLine;
|
|
output += DataBlock.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class PreloadSoundPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("preloadsound_datablock")]
|
|
public class DataBlockBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLUUID SoundID;
|
|
public LLUUID OwnerID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 48;
|
|
}
|
|
}
|
|
|
|
public DataBlockBlock() { }
|
|
public DataBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
SoundID = new LLUUID(bytes, i); i += 16;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SoundID == null) { Console.WriteLine("Warning: SoundID is null, in " + this.GetType()); }
|
|
Array.Copy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataBlock --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "SoundID: " + SoundID.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.PreloadSound; } }
|
|
public DataBlockBlock[] DataBlock;
|
|
|
|
public PreloadSoundPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 18;
|
|
Header.Reliable = true;
|
|
DataBlock = new DataBlockBlock[0];
|
|
}
|
|
|
|
public PreloadSoundPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
DataBlock = new DataBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ DataBlock[j] = new DataBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public PreloadSoundPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
DataBlock = new DataBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ DataBlock[j] = new DataBlockBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < DataBlock.Length; j++) { length += DataBlock[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)DataBlock.Length;
|
|
for (int j = 0; j < DataBlock.Length; j++) { DataBlock[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- PreloadSound ---" + Environment.NewLine;
|
|
for (int j = 0; j < DataBlock.Length; j++)
|
|
{
|
|
output += DataBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ViewerEffectPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("viewereffect_effect")]
|
|
public class EffectBlock
|
|
{
|
|
public float Duration;
|
|
public LLUUID ID;
|
|
public byte Type;
|
|
public byte[] Color;
|
|
private byte[] _typedata;
|
|
public byte[] TypeData
|
|
{
|
|
get { return _typedata; }
|
|
set
|
|
{
|
|
if (value == null) { _typedata = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _typedata = new byte[value.Length]; Array.Copy(value, _typedata, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 25;
|
|
if (TypeData != null) { length += 1 + TypeData.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public EffectBlock() { }
|
|
public EffectBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Duration = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
Type = (byte)bytes[i++];
|
|
Color = new byte[4];
|
|
Array.Copy(bytes, i, Color, 0, 4); i += 4;
|
|
length = (ushort)bytes[i++];
|
|
_typedata = new byte[length];
|
|
Array.Copy(bytes, i, _typedata, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(Duration);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = Type;
|
|
Array.Copy(Color, 0, bytes, i, 4);i += 4;
|
|
if(TypeData == null) { Console.WriteLine("Warning: TypeData is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TypeData.Length;
|
|
Array.Copy(TypeData, 0, bytes, i, TypeData.Length); i += TypeData.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Effect --" + Environment.NewLine;
|
|
output += "Duration: " + Duration.ToString() + "" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Color, "Color") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TypeData, "TypeData") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ViewerEffect; } }
|
|
public EffectBlock[] Effect;
|
|
|
|
public ViewerEffectPacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 20;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
Effect = new EffectBlock[0];
|
|
}
|
|
|
|
public ViewerEffectPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
Effect = new EffectBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Effect[j] = new EffectBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ViewerEffectPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
Effect = new EffectBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ Effect[j] = new EffectBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < Effect.Length; j++) { length += Effect[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)Effect.Length;
|
|
for (int j = 0; j < Effect.Length; j++) { Effect[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ViewerEffect ---" + Environment.NewLine;
|
|
for (int j = 0; j < Effect.Length; j++)
|
|
{
|
|
output += Effect[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SetSunPhasePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("setsunphase_data")]
|
|
public class DataBlock
|
|
{
|
|
public float Phase;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public DataBlock() { }
|
|
public DataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Phase = BitConverter.ToSingle(bytes, i); i += 4;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(Phase);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Data --" + Environment.NewLine;
|
|
output += "Phase: " + Phase.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("setsunphase_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SetSunPhase; } }
|
|
public DataBlock Data;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public SetSunPhasePacket()
|
|
{
|
|
Header = new MediumHeader();
|
|
Header.ID = 21;
|
|
Header.Reliable = true;
|
|
Data = new DataBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public SetSunPhasePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new MediumHeader(bytes, ref i, ref packetEnd);
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SetSunPhasePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
Data = new DataBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 6;
|
|
length += Data.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
Data.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SetSunPhase ---" + Environment.NewLine;
|
|
output += Data.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class StartPingCheckPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("startpingcheck_pingid")]
|
|
public class PingIDBlock
|
|
{
|
|
public byte PingID;
|
|
public uint OldestUnacked;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 5;
|
|
}
|
|
}
|
|
|
|
public PingIDBlock() { }
|
|
public PingIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PingID = (byte)bytes[i++];
|
|
OldestUnacked = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = PingID;
|
|
bytes[i++] = (byte)(OldestUnacked % 256);
|
|
bytes[i++] = (byte)((OldestUnacked >> 8) % 256);
|
|
bytes[i++] = (byte)((OldestUnacked >> 16) % 256);
|
|
bytes[i++] = (byte)((OldestUnacked >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- PingID --" + Environment.NewLine;
|
|
output += "PingID: " + PingID.ToString() + "" + Environment.NewLine;
|
|
output += "OldestUnacked: " + OldestUnacked.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.StartPingCheck; } }
|
|
public PingIDBlock PingID;
|
|
|
|
public StartPingCheckPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 1;
|
|
Header.Reliable = true;
|
|
PingID = new PingIDBlock();
|
|
}
|
|
|
|
public StartPingCheckPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
PingID = new PingIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public StartPingCheckPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
PingID = new PingIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += PingID.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
PingID.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- StartPingCheck ---" + Environment.NewLine;
|
|
output += PingID.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CompletePingCheckPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("completepingcheck_pingid")]
|
|
public class PingIDBlock
|
|
{
|
|
public byte PingID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public PingIDBlock() { }
|
|
public PingIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
PingID = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = PingID;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- PingID --" + Environment.NewLine;
|
|
output += "PingID: " + PingID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CompletePingCheck; } }
|
|
public PingIDBlock PingID;
|
|
|
|
public CompletePingCheckPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 2;
|
|
Header.Reliable = true;
|
|
PingID = new PingIDBlock();
|
|
}
|
|
|
|
public CompletePingCheckPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
PingID = new PingIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public CompletePingCheckPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
PingID = new PingIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += PingID.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
PingID.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CompletePingCheck ---" + Environment.NewLine;
|
|
output += PingID.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint ControlFlags;
|
|
public LLVector3 CameraAtAxis;
|
|
public float Far;
|
|
public LLUUID AgentID;
|
|
public LLVector3 CameraCenter;
|
|
public LLVector3 CameraLeftAxis;
|
|
public LLQuaternion HeadRotation;
|
|
public LLUUID SessionID;
|
|
public LLVector3 CameraUpAxis;
|
|
public LLQuaternion BodyRotation;
|
|
public byte Flags;
|
|
public byte State;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 114;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ControlFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CameraAtAxis = new LLVector3(bytes, i); i += 12;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Far = BitConverter.ToSingle(bytes, i); i += 4;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
CameraCenter = new LLVector3(bytes, i); i += 12;
|
|
CameraLeftAxis = new LLVector3(bytes, i); i += 12;
|
|
HeadRotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
CameraUpAxis = new LLVector3(bytes, i); i += 12;
|
|
BodyRotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
Flags = (byte)bytes[i++];
|
|
State = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(ControlFlags % 256);
|
|
bytes[i++] = (byte)((ControlFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ControlFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ControlFlags >> 24) % 256);
|
|
Array.Copy(CameraAtAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
ba = BitConverter.GetBytes(Far);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(CameraCenter.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(CameraLeftAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(HeadRotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(CameraUpAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(BodyRotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = Flags;
|
|
bytes[i++] = State;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "ControlFlags: " + ControlFlags.ToString() + "" + Environment.NewLine;
|
|
output += "CameraAtAxis: " + CameraAtAxis.ToString() + "" + Environment.NewLine;
|
|
output += "Far: " + Far.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "CameraCenter: " + CameraCenter.ToString() + "" + Environment.NewLine;
|
|
output += "CameraLeftAxis: " + CameraLeftAxis.ToString() + "" + Environment.NewLine;
|
|
output += "HeadRotation: " + HeadRotation.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "CameraUpAxis: " + CameraUpAxis.ToString() + "" + Environment.NewLine;
|
|
output += "BodyRotation: " + BodyRotation.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "State: " + State.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentUpdate; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentUpdatePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 4;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentUpdate ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentAnimationPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentanimation_animationlist")]
|
|
public class AnimationListBlock
|
|
{
|
|
public LLUUID AnimID;
|
|
public bool StartAnim;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 17;
|
|
}
|
|
}
|
|
|
|
public AnimationListBlock() { }
|
|
public AnimationListBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AnimID = new LLUUID(bytes, i); i += 16;
|
|
StartAnim = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AnimID == null) { Console.WriteLine("Warning: AnimID is null, in " + this.GetType()); }
|
|
Array.Copy(AnimID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((StartAnim) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AnimationList --" + Environment.NewLine;
|
|
output += "AnimID: " + AnimID.ToString() + "" + Environment.NewLine;
|
|
output += "StartAnim: " + StartAnim.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentanimation_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentAnimation; } }
|
|
public AnimationListBlock[] AnimationList;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentAnimationPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 5;
|
|
Header.Reliable = true;
|
|
AnimationList = new AnimationListBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentAnimationPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
AnimationList = new AnimationListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationList[j] = new AnimationListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentAnimationPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
AnimationList = new AnimationListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationList[j] = new AnimationListBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < AnimationList.Length; j++) { length += AnimationList[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)AnimationList.Length;
|
|
for (int j = 0; j < AnimationList.Length; j++) { AnimationList[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentAnimation ---" + Environment.NewLine;
|
|
for (int j = 0; j < AnimationList.Length; j++)
|
|
{
|
|
output += AnimationList[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentRequestSitPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentrequestsit_targetobject")]
|
|
public class TargetObjectBlock
|
|
{
|
|
public LLUUID TargetID;
|
|
public LLVector3 Offset;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 28;
|
|
}
|
|
}
|
|
|
|
public TargetObjectBlock() { }
|
|
public TargetObjectBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TargetID = new LLUUID(bytes, i); i += 16;
|
|
Offset = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
|
|
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(Offset.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TargetObject --" + Environment.NewLine;
|
|
output += "TargetID: " + TargetID.ToString() + "" + Environment.NewLine;
|
|
output += "Offset: " + Offset.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("agentrequestsit_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentRequestSit; } }
|
|
public TargetObjectBlock TargetObject;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentRequestSitPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 6;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
TargetObject = new TargetObjectBlock();
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentRequestSitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
TargetObject = new TargetObjectBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentRequestSitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TargetObject = new TargetObjectBlock(bytes, ref i);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += TargetObject.Length; length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TargetObject.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentRequestSit ---" + Environment.NewLine;
|
|
output += TargetObject.ToString() + "" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentSitPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agentsit_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentSit; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public AgentSitPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 7;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public AgentSitPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentSitPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentSit ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class RequestImagePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("requestimage_requestimage")]
|
|
public class RequestImageBlock
|
|
{
|
|
public float DownloadPriority;
|
|
public sbyte DiscardLevel;
|
|
public byte Type;
|
|
public uint Packet;
|
|
public LLUUID Image;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 26;
|
|
}
|
|
}
|
|
|
|
public RequestImageBlock() { }
|
|
public RequestImageBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
DownloadPriority = BitConverter.ToSingle(bytes, i); i += 4;
|
|
DiscardLevel = (sbyte)bytes[i++];
|
|
Type = (byte)bytes[i++];
|
|
Packet = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Image = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
ba = BitConverter.GetBytes(DownloadPriority);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)DiscardLevel;
|
|
bytes[i++] = Type;
|
|
bytes[i++] = (byte)(Packet % 256);
|
|
bytes[i++] = (byte)((Packet >> 8) % 256);
|
|
bytes[i++] = (byte)((Packet >> 16) % 256);
|
|
bytes[i++] = (byte)((Packet >> 24) % 256);
|
|
if(Image == null) { Console.WriteLine("Warning: Image is null, in " + this.GetType()); }
|
|
Array.Copy(Image.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RequestImage --" + Environment.NewLine;
|
|
output += "DownloadPriority: " + DownloadPriority.ToString() + "" + Environment.NewLine;
|
|
output += "DiscardLevel: " + DiscardLevel.ToString() + "" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output += "Packet: " + Packet.ToString() + "" + Environment.NewLine;
|
|
output += "Image: " + Image.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("requestimage_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.RequestImage; } }
|
|
public RequestImageBlock[] RequestImage;
|
|
public AgentDataBlock AgentData;
|
|
|
|
public RequestImagePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 8;
|
|
Header.Reliable = true;
|
|
RequestImage = new RequestImageBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public RequestImagePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
RequestImage = new RequestImageBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RequestImage[j] = new RequestImageBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public RequestImagePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
RequestImage = new RequestImageBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ RequestImage[j] = new RequestImageBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < RequestImage.Length; j++) { length += RequestImage[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)RequestImage.Length;
|
|
for (int j = 0; j < RequestImage.Length; j++) { RequestImage[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- RequestImage ---" + Environment.NewLine;
|
|
for (int j = 0; j < RequestImage.Length; j++)
|
|
{
|
|
output += RequestImage[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ImageDataPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("imagedata_imageid")]
|
|
public class ImageIDBlock
|
|
{
|
|
public LLUUID ID;
|
|
public ushort Packets;
|
|
public uint Size;
|
|
public byte Codec;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 23;
|
|
}
|
|
}
|
|
|
|
public ImageIDBlock() { }
|
|
public ImageIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
Packets = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
Size = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Codec = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Packets % 256);
|
|
bytes[i++] = (byte)((Packets >> 8) % 256);
|
|
bytes[i++] = (byte)(Size % 256);
|
|
bytes[i++] = (byte)((Size >> 8) % 256);
|
|
bytes[i++] = (byte)((Size >> 16) % 256);
|
|
bytes[i++] = (byte)((Size >> 24) % 256);
|
|
bytes[i++] = Codec;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ImageID --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Packets: " + Packets.ToString() + "" + Environment.NewLine;
|
|
output += "Size: " + Size.ToString() + "" + Environment.NewLine;
|
|
output += "Codec: " + Codec.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("imagedata_imagedata")]
|
|
public class ImageDataBlock
|
|
{
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ImageDataBlock() { }
|
|
public ImageDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ImageData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ImageData; } }
|
|
public ImageIDBlock ImageID;
|
|
public ImageDataBlock ImageData;
|
|
|
|
public ImageDataPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 9;
|
|
Header.Reliable = true;
|
|
ImageID = new ImageIDBlock();
|
|
ImageData = new ImageDataBlock();
|
|
}
|
|
|
|
public ImageDataPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
ImageID = new ImageIDBlock(bytes, ref i);
|
|
ImageData = new ImageDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ImageDataPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ImageID = new ImageIDBlock(bytes, ref i);
|
|
ImageData = new ImageDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += ImageID.Length; length += ImageData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ImageID.ToBytes(bytes, ref i);
|
|
ImageData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ImageData ---" + Environment.NewLine;
|
|
output += ImageID.ToString() + "" + Environment.NewLine;
|
|
output += ImageData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ImagePacketPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("imagepacket_imageid")]
|
|
public class ImageIDBlock
|
|
{
|
|
public LLUUID ID;
|
|
public ushort Packet;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 18;
|
|
}
|
|
}
|
|
|
|
public ImageIDBlock() { }
|
|
public ImageIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
Packet = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Packet % 256);
|
|
bytes[i++] = (byte)((Packet >> 8) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ImageID --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Packet: " + Packet.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("imagepacket_imagedata")]
|
|
public class ImageDataBlock
|
|
{
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ImageDataBlock() { }
|
|
public ImageDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ImageData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ImagePacket; } }
|
|
public ImageIDBlock ImageID;
|
|
public ImageDataBlock ImageData;
|
|
|
|
public ImagePacketPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 10;
|
|
Header.Reliable = true;
|
|
ImageID = new ImageIDBlock();
|
|
ImageData = new ImageDataBlock();
|
|
}
|
|
|
|
public ImagePacketPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
ImageID = new ImageIDBlock(bytes, ref i);
|
|
ImageData = new ImageDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ImagePacketPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ImageID = new ImageIDBlock(bytes, ref i);
|
|
ImageData = new ImageDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += ImageID.Length; length += ImageData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ImageID.ToBytes(bytes, ref i);
|
|
ImageData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ImagePacket ---" + Environment.NewLine;
|
|
output += ImageID.ToString() + "" + Environment.NewLine;
|
|
output += ImageData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class LayerDataPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("layerdata_layerid")]
|
|
public class LayerIDBlock
|
|
{
|
|
public byte Type;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public LayerIDBlock() { }
|
|
public LayerIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Type = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = Type;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- LayerID --" + Environment.NewLine;
|
|
output += "Type: " + Type.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("layerdata_layerdata")]
|
|
public class LayerDataBlock
|
|
{
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public LayerDataBlock() { }
|
|
public LayerDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- LayerData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.LayerData; } }
|
|
public LayerIDBlock LayerID;
|
|
public LayerDataBlock LayerData;
|
|
|
|
public LayerDataPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 11;
|
|
Header.Reliable = true;
|
|
LayerID = new LayerIDBlock();
|
|
LayerData = new LayerDataBlock();
|
|
}
|
|
|
|
public LayerDataPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
LayerID = new LayerIDBlock(bytes, ref i);
|
|
LayerData = new LayerDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public LayerDataPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
LayerID = new LayerIDBlock(bytes, ref i);
|
|
LayerData = new LayerDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += LayerID.Length; length += LayerData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
LayerID.ToBytes(bytes, ref i);
|
|
LayerData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- LayerData ---" + Environment.NewLine;
|
|
output += LayerID.ToString() + "" + Environment.NewLine;
|
|
output += LayerData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectupdate_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ID;
|
|
public uint UpdateFlags;
|
|
private byte[] _objectdata;
|
|
public byte[] ObjectData
|
|
{
|
|
get { return _objectdata; }
|
|
set
|
|
{
|
|
if (value == null) { _objectdata = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _objectdata = new byte[value.Length]; Array.Copy(value, _objectdata, value.Length); }
|
|
}
|
|
}
|
|
public sbyte PathTwistBegin;
|
|
public uint CRC;
|
|
public LLVector3 JointPivot;
|
|
public byte PathEnd;
|
|
private byte[] _mediaurl;
|
|
public byte[] MediaURL
|
|
{
|
|
get { return _mediaurl; }
|
|
set
|
|
{
|
|
if (value == null) { _mediaurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _mediaurl = new byte[value.Length]; Array.Copy(value, _mediaurl, value.Length); }
|
|
}
|
|
}
|
|
public byte[] TextColor;
|
|
public byte ClickAction;
|
|
public byte ProfileBegin;
|
|
public sbyte PathRadiusOffset;
|
|
public float Gain;
|
|
public sbyte PathSkew;
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _textureanim;
|
|
public byte[] TextureAnim
|
|
{
|
|
get { return _textureanim; }
|
|
set
|
|
{
|
|
if (value == null) { _textureanim = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _textureanim = new byte[value.Length]; Array.Copy(value, _textureanim, value.Length); }
|
|
}
|
|
}
|
|
public uint ParentID;
|
|
private byte[] _text;
|
|
public byte[] Text
|
|
{
|
|
get { return _text; }
|
|
set
|
|
{
|
|
if (value == null) { _text = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _text = new byte[value.Length]; Array.Copy(value, _text, value.Length); }
|
|
}
|
|
}
|
|
public byte ProfileCurve;
|
|
public byte PathScaleX;
|
|
public byte PathScaleY;
|
|
public byte Material;
|
|
public LLUUID OwnerID;
|
|
private byte[] _extraparams;
|
|
public byte[] ExtraParams
|
|
{
|
|
get { return _extraparams; }
|
|
set
|
|
{
|
|
if (value == null) { _extraparams = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _extraparams = new byte[value.Length]; Array.Copy(value, _extraparams, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _namevalue;
|
|
public byte[] NameValue
|
|
{
|
|
get { return _namevalue; }
|
|
set
|
|
{
|
|
if (value == null) { _namevalue = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _namevalue = new byte[value.Length]; Array.Copy(value, _namevalue, value.Length); }
|
|
}
|
|
}
|
|
public byte PathShearX;
|
|
public byte PathShearY;
|
|
public sbyte PathTaperX;
|
|
public sbyte PathTaperY;
|
|
public float Radius;
|
|
public byte ProfileEnd;
|
|
public byte JointType;
|
|
public byte PathBegin;
|
|
private byte[] _psblock;
|
|
public byte[] PSBlock
|
|
{
|
|
get { return _psblock; }
|
|
set
|
|
{
|
|
if (value == null) { _psblock = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _psblock = new byte[value.Length]; Array.Copy(value, _psblock, value.Length); }
|
|
}
|
|
}
|
|
public byte PCode;
|
|
public LLUUID FullID;
|
|
public byte PathCurve;
|
|
public LLVector3 Scale;
|
|
public LLVector3 JointAxisOrAnchor;
|
|
public byte Flags;
|
|
public byte State;
|
|
public sbyte PathTwist;
|
|
public LLUUID Sound;
|
|
private byte[] _textureentry;
|
|
public byte[] TextureEntry
|
|
{
|
|
get { return _textureentry; }
|
|
set
|
|
{
|
|
if (value == null) { _textureentry = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _textureentry = new byte[value.Length]; Array.Copy(value, _textureentry, value.Length); }
|
|
}
|
|
}
|
|
public byte ProfileHollow;
|
|
public byte PathRevolutions;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 136;
|
|
if (ObjectData != null) { length += 1 + ObjectData.Length; }
|
|
if (MediaURL != null) { length += 1 + MediaURL.Length; }
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
if (TextureAnim != null) { length += 1 + TextureAnim.Length; }
|
|
if (Text != null) { length += 1 + Text.Length; }
|
|
if (ExtraParams != null) { length += 1 + ExtraParams.Length; }
|
|
if (NameValue != null) { length += 2 + NameValue.Length; }
|
|
if (PSBlock != null) { length += 1 + PSBlock.Length; }
|
|
if (TextureEntry != null) { length += 2 + TextureEntry.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
UpdateFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_objectdata = new byte[length];
|
|
Array.Copy(bytes, i, _objectdata, 0, length); i += length;
|
|
PathTwistBegin = (sbyte)bytes[i++];
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
JointPivot = new LLVector3(bytes, i); i += 12;
|
|
PathEnd = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_mediaurl = new byte[length];
|
|
Array.Copy(bytes, i, _mediaurl, 0, length); i += length;
|
|
TextColor = new byte[4];
|
|
Array.Copy(bytes, i, TextColor, 0, 4); i += 4;
|
|
ClickAction = (byte)bytes[i++];
|
|
ProfileBegin = (byte)bytes[i++];
|
|
PathRadiusOffset = (sbyte)bytes[i++];
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Gain = BitConverter.ToSingle(bytes, i); i += 4;
|
|
PathSkew = (sbyte)bytes[i++];
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
length = (ushort)bytes[i++];
|
|
_textureanim = new byte[length];
|
|
Array.Copy(bytes, i, _textureanim, 0, length); i += length;
|
|
ParentID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_text = new byte[length];
|
|
Array.Copy(bytes, i, _text, 0, length); i += length;
|
|
ProfileCurve = (byte)bytes[i++];
|
|
PathScaleX = (byte)bytes[i++];
|
|
PathScaleY = (byte)bytes[i++];
|
|
Material = (byte)bytes[i++];
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_extraparams = new byte[length];
|
|
Array.Copy(bytes, i, _extraparams, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_namevalue = new byte[length];
|
|
Array.Copy(bytes, i, _namevalue, 0, length); i += length;
|
|
PathShearX = (byte)bytes[i++];
|
|
PathShearY = (byte)bytes[i++];
|
|
PathTaperX = (sbyte)bytes[i++];
|
|
PathTaperY = (sbyte)bytes[i++];
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Radius = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ProfileEnd = (byte)bytes[i++];
|
|
JointType = (byte)bytes[i++];
|
|
PathBegin = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_psblock = new byte[length];
|
|
Array.Copy(bytes, i, _psblock, 0, length); i += length;
|
|
PCode = (byte)bytes[i++];
|
|
FullID = new LLUUID(bytes, i); i += 16;
|
|
PathCurve = (byte)bytes[i++];
|
|
Scale = new LLVector3(bytes, i); i += 12;
|
|
JointAxisOrAnchor = new LLVector3(bytes, i); i += 12;
|
|
Flags = (byte)bytes[i++];
|
|
State = (byte)bytes[i++];
|
|
PathTwist = (sbyte)bytes[i++];
|
|
Sound = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_textureentry = new byte[length];
|
|
Array.Copy(bytes, i, _textureentry, 0, length); i += length;
|
|
ProfileHollow = (byte)bytes[i++];
|
|
PathRevolutions = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
bytes[i++] = (byte)(UpdateFlags % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 24) % 256);
|
|
if(ObjectData == null) { Console.WriteLine("Warning: ObjectData is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
Array.Copy(ObjectData, 0, bytes, i, ObjectData.Length); i += ObjectData.Length;
|
|
bytes[i++] = (byte)PathTwistBegin;
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
Array.Copy(JointPivot.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = PathEnd;
|
|
if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MediaURL.Length;
|
|
Array.Copy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length;
|
|
Array.Copy(TextColor, 0, bytes, i, 4);i += 4;
|
|
bytes[i++] = ClickAction;
|
|
bytes[i++] = ProfileBegin;
|
|
bytes[i++] = (byte)PathRadiusOffset;
|
|
ba = BitConverter.GetBytes(Gain);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)PathSkew;
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
if(TextureAnim == null) { Console.WriteLine("Warning: TextureAnim is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)TextureAnim.Length;
|
|
Array.Copy(TextureAnim, 0, bytes, i, TextureAnim.Length); i += TextureAnim.Length;
|
|
bytes[i++] = (byte)(ParentID % 256);
|
|
bytes[i++] = (byte)((ParentID >> 8) % 256);
|
|
bytes[i++] = (byte)((ParentID >> 16) % 256);
|
|
bytes[i++] = (byte)((ParentID >> 24) % 256);
|
|
if(Text == null) { Console.WriteLine("Warning: Text is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Text.Length;
|
|
Array.Copy(Text, 0, bytes, i, Text.Length); i += Text.Length;
|
|
bytes[i++] = ProfileCurve;
|
|
bytes[i++] = PathScaleX;
|
|
bytes[i++] = PathScaleY;
|
|
bytes[i++] = Material;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(ExtraParams == null) { Console.WriteLine("Warning: ExtraParams is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)ExtraParams.Length;
|
|
Array.Copy(ExtraParams, 0, bytes, i, ExtraParams.Length); i += ExtraParams.Length;
|
|
if(NameValue == null) { Console.WriteLine("Warning: NameValue is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(NameValue.Length % 256);
|
|
bytes[i++] = (byte)((NameValue.Length >> 8) % 256);
|
|
Array.Copy(NameValue, 0, bytes, i, NameValue.Length); i += NameValue.Length;
|
|
bytes[i++] = PathShearX;
|
|
bytes[i++] = PathShearY;
|
|
bytes[i++] = (byte)PathTaperX;
|
|
bytes[i++] = (byte)PathTaperY;
|
|
ba = BitConverter.GetBytes(Radius);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = ProfileEnd;
|
|
bytes[i++] = JointType;
|
|
bytes[i++] = PathBegin;
|
|
if(PSBlock == null) { Console.WriteLine("Warning: PSBlock is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)PSBlock.Length;
|
|
Array.Copy(PSBlock, 0, bytes, i, PSBlock.Length); i += PSBlock.Length;
|
|
bytes[i++] = PCode;
|
|
if(FullID == null) { Console.WriteLine("Warning: FullID is null, in " + this.GetType()); }
|
|
Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = PathCurve;
|
|
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(JointAxisOrAnchor.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = Flags;
|
|
bytes[i++] = State;
|
|
bytes[i++] = (byte)PathTwist;
|
|
if(Sound == null) { Console.WriteLine("Warning: Sound is null, in " + this.GetType()); }
|
|
Array.Copy(Sound.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(TextureEntry == null) { Console.WriteLine("Warning: TextureEntry is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(TextureEntry.Length % 256);
|
|
bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
|
|
Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
|
|
bytes[i++] = ProfileHollow;
|
|
bytes[i++] = PathRevolutions;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "UpdateFlags: " + UpdateFlags.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ObjectData, "ObjectData") + "" + Environment.NewLine;
|
|
output += "PathTwistBegin: " + PathTwistBegin.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output += "JointPivot: " + JointPivot.ToString() + "" + Environment.NewLine;
|
|
output += "PathEnd: " + PathEnd.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MediaURL, "MediaURL") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextColor, "TextColor") + "" + Environment.NewLine;
|
|
output += "ClickAction: " + ClickAction.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileBegin: " + ProfileBegin.ToString() + "" + Environment.NewLine;
|
|
output += "PathRadiusOffset: " + PathRadiusOffset.ToString() + "" + Environment.NewLine;
|
|
output += "Gain: " + Gain.ToString() + "" + Environment.NewLine;
|
|
output += "PathSkew: " + PathSkew.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextureAnim, "TextureAnim") + "" + Environment.NewLine;
|
|
output += "ParentID: " + ParentID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Text, "Text") + "" + Environment.NewLine;
|
|
output += "ProfileCurve: " + ProfileCurve.ToString() + "" + Environment.NewLine;
|
|
output += "PathScaleX: " + PathScaleX.ToString() + "" + Environment.NewLine;
|
|
output += "PathScaleY: " + PathScaleY.ToString() + "" + Environment.NewLine;
|
|
output += "Material: " + Material.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(ExtraParams, "ExtraParams") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(NameValue, "NameValue") + "" + Environment.NewLine;
|
|
output += "PathShearX: " + PathShearX.ToString() + "" + Environment.NewLine;
|
|
output += "PathShearY: " + PathShearY.ToString() + "" + Environment.NewLine;
|
|
output += "PathTaperX: " + PathTaperX.ToString() + "" + Environment.NewLine;
|
|
output += "PathTaperY: " + PathTaperY.ToString() + "" + Environment.NewLine;
|
|
output += "Radius: " + Radius.ToString() + "" + Environment.NewLine;
|
|
output += "ProfileEnd: " + ProfileEnd.ToString() + "" + Environment.NewLine;
|
|
output += "JointType: " + JointType.ToString() + "" + Environment.NewLine;
|
|
output += "PathBegin: " + PathBegin.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(PSBlock, "PSBlock") + "" + Environment.NewLine;
|
|
output += "PCode: " + PCode.ToString() + "" + Environment.NewLine;
|
|
output += "FullID: " + FullID.ToString() + "" + Environment.NewLine;
|
|
output += "PathCurve: " + PathCurve.ToString() + "" + Environment.NewLine;
|
|
output += "Scale: " + Scale.ToString() + "" + Environment.NewLine;
|
|
output += "JointAxisOrAnchor: " + JointAxisOrAnchor.ToString() + "" + Environment.NewLine;
|
|
output += "Flags: " + Flags.ToString() + "" + Environment.NewLine;
|
|
output += "State: " + State.ToString() + "" + Environment.NewLine;
|
|
output += "PathTwist: " + PathTwist.ToString() + "" + Environment.NewLine;
|
|
output += "Sound: " + Sound.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "" + Environment.NewLine;
|
|
output += "ProfileHollow: " + ProfileHollow.ToString() + "" + Environment.NewLine;
|
|
output += "PathRevolutions: " + PathRevolutions.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectupdate_regiondata")]
|
|
public class RegionDataBlock
|
|
{
|
|
public ushort TimeDilation;
|
|
public ulong RegionHandle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 10;
|
|
}
|
|
}
|
|
|
|
public RegionDataBlock() { }
|
|
public RegionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TimeDilation % 256);
|
|
bytes[i++] = (byte)((TimeDilation >> 8) % 256);
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionData --" + Environment.NewLine;
|
|
output += "TimeDilation: " + TimeDilation.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectUpdate; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public RegionDataBlock RegionData;
|
|
|
|
public ObjectUpdatePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 12;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
RegionData = new RegionDataBlock();
|
|
}
|
|
|
|
public ObjectUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += RegionData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
RegionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += RegionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectUpdateCompressedPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectupdatecompressed_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint UpdateFlags;
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 4;
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
UpdateFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(UpdateFlags % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 24) % 256);
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "UpdateFlags: " + UpdateFlags.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectupdatecompressed_regiondata")]
|
|
public class RegionDataBlock
|
|
{
|
|
public ushort TimeDilation;
|
|
public ulong RegionHandle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 10;
|
|
}
|
|
}
|
|
|
|
public RegionDataBlock() { }
|
|
public RegionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TimeDilation % 256);
|
|
bytes[i++] = (byte)((TimeDilation >> 8) % 256);
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionData --" + Environment.NewLine;
|
|
output += "TimeDilation: " + TimeDilation.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectUpdateCompressed; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public RegionDataBlock RegionData;
|
|
|
|
public ObjectUpdateCompressedPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 13;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
RegionData = new RegionDataBlock();
|
|
}
|
|
|
|
public ObjectUpdateCompressedPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectUpdateCompressedPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += RegionData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
RegionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectUpdateCompressed ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += RegionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ObjectUpdateCachedPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("objectupdatecached_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ID;
|
|
public uint UpdateFlags;
|
|
public uint CRC;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
UpdateFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
bytes[i++] = (byte)(UpdateFlags % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((UpdateFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(CRC % 256);
|
|
bytes[i++] = (byte)((CRC >> 8) % 256);
|
|
bytes[i++] = (byte)((CRC >> 16) % 256);
|
|
bytes[i++] = (byte)((CRC >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "UpdateFlags: " + UpdateFlags.ToString() + "" + Environment.NewLine;
|
|
output += "CRC: " + CRC.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("objectupdatecached_regiondata")]
|
|
public class RegionDataBlock
|
|
{
|
|
public ushort TimeDilation;
|
|
public ulong RegionHandle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 10;
|
|
}
|
|
}
|
|
|
|
public RegionDataBlock() { }
|
|
public RegionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TimeDilation % 256);
|
|
bytes[i++] = (byte)((TimeDilation >> 8) % 256);
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionData --" + Environment.NewLine;
|
|
output += "TimeDilation: " + TimeDilation.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ObjectUpdateCached; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public RegionDataBlock RegionData;
|
|
|
|
public ObjectUpdateCachedPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 14;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
RegionData = new RegionDataBlock();
|
|
}
|
|
|
|
public ObjectUpdateCachedPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ObjectUpdateCachedPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += RegionData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
RegionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ObjectUpdateCached ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += RegionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ImprovedTerseObjectUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("improvedterseobjectupdate_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
private byte[] _textureentry;
|
|
public byte[] TextureEntry
|
|
{
|
|
get { return _textureentry; }
|
|
set
|
|
{
|
|
if (value == null) { _textureentry = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _textureentry = new byte[value.Length]; Array.Copy(value, _textureentry, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Data != null) { length += 1 + Data.Length; }
|
|
if (TextureEntry != null) { length += 2 + TextureEntry.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)bytes[i++];
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_textureentry = new byte[length];
|
|
Array.Copy(bytes, i, _textureentry, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Data.Length;
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
if(TextureEntry == null) { Console.WriteLine("Warning: TextureEntry is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(TextureEntry.Length % 256);
|
|
bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
|
|
Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("improvedterseobjectupdate_regiondata")]
|
|
public class RegionDataBlock
|
|
{
|
|
public ushort TimeDilation;
|
|
public ulong RegionHandle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 10;
|
|
}
|
|
}
|
|
|
|
public RegionDataBlock() { }
|
|
public RegionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(TimeDilation % 256);
|
|
bytes[i++] = (byte)((TimeDilation >> 8) % 256);
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionData --" + Environment.NewLine;
|
|
output += "TimeDilation: " + TimeDilation.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ImprovedTerseObjectUpdate; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
public RegionDataBlock RegionData;
|
|
|
|
public ImprovedTerseObjectUpdatePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 15;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
RegionData = new RegionDataBlock();
|
|
}
|
|
|
|
public ImprovedTerseObjectUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ImprovedTerseObjectUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += RegionData.Length;;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
RegionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ImprovedTerseObjectUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += RegionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class KillObjectPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("killobject_objectdata")]
|
|
public class ObjectDataBlock
|
|
{
|
|
public uint ID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public ObjectDataBlock() { }
|
|
public ObjectDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ObjectData --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.KillObject; } }
|
|
public ObjectDataBlock[] ObjectData;
|
|
|
|
public KillObjectPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 16;
|
|
Header.Reliable = true;
|
|
ObjectData = new ObjectDataBlock[0];
|
|
}
|
|
|
|
public KillObjectPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public KillObjectPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
ObjectData = new ObjectDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ ObjectData[j] = new ObjectDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
;
|
|
length++;
|
|
for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)ObjectData.Length;
|
|
for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- KillObject ---" + Environment.NewLine;
|
|
for (int j = 0; j < ObjectData.Length; j++)
|
|
{
|
|
output += ObjectData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AgentToNewRegionPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("agenttonewregion_regiondata")]
|
|
public class RegionDataBlock
|
|
{
|
|
public uint IP;
|
|
public LLUUID SessionID;
|
|
public ushort Port;
|
|
public ulong Handle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 30;
|
|
}
|
|
}
|
|
|
|
public RegionDataBlock() { }
|
|
public RegionDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
|
|
Handle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(IP % 256);
|
|
bytes[i++] = (byte)((IP >> 8) % 256);
|
|
bytes[i++] = (byte)((IP >> 16) % 256);
|
|
bytes[i++] = (byte)((IP >> 24) % 256);
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((Port >> 8) % 256);
|
|
bytes[i++] = (byte)(Port % 256);
|
|
bytes[i++] = (byte)(Handle % 256);
|
|
bytes[i++] = (byte)((Handle >> 8) % 256);
|
|
bytes[i++] = (byte)((Handle >> 16) % 256);
|
|
bytes[i++] = (byte)((Handle >> 24) % 256);
|
|
bytes[i++] = (byte)((Handle >> 32) % 256);
|
|
bytes[i++] = (byte)((Handle >> 40) % 256);
|
|
bytes[i++] = (byte)((Handle >> 48) % 256);
|
|
bytes[i++] = (byte)((Handle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- RegionData --" + Environment.NewLine;
|
|
output += "IP: " + IP.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "Port: " + Port.ToString() + "" + Environment.NewLine;
|
|
output += "Handle: " + Handle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AgentToNewRegion; } }
|
|
public RegionDataBlock RegionData;
|
|
|
|
public AgentToNewRegionPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 17;
|
|
Header.Reliable = true;
|
|
RegionData = new RegionDataBlock();
|
|
}
|
|
|
|
public AgentToNewRegionPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public AgentToNewRegionPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
RegionData = new RegionDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += RegionData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
RegionData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AgentToNewRegion ---" + Environment.NewLine;
|
|
output += RegionData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class TransferPacketPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("transferpacket_transferdata")]
|
|
public class TransferDataBlock
|
|
{
|
|
public LLUUID TransferID;
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
public int Packet;
|
|
public int ChannelType;
|
|
public int Status;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 28;
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public TransferDataBlock() { }
|
|
public TransferDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
TransferID = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
Packet = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
Status = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(TransferID == null) { Console.WriteLine("Warning: TransferID is null, in " + this.GetType()); }
|
|
Array.Copy(TransferID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
bytes[i++] = (byte)(Packet % 256);
|
|
bytes[i++] = (byte)((Packet >> 8) % 256);
|
|
bytes[i++] = (byte)((Packet >> 16) % 256);
|
|
bytes[i++] = (byte)((Packet >> 24) % 256);
|
|
bytes[i++] = (byte)(ChannelType % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 8) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 16) % 256);
|
|
bytes[i++] = (byte)((ChannelType >> 24) % 256);
|
|
bytes[i++] = (byte)(Status % 256);
|
|
bytes[i++] = (byte)((Status >> 8) % 256);
|
|
bytes[i++] = (byte)((Status >> 16) % 256);
|
|
bytes[i++] = (byte)((Status >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- TransferData --" + Environment.NewLine;
|
|
output += "TransferID: " + TransferID.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output += "Packet: " + Packet.ToString() + "" + Environment.NewLine;
|
|
output += "ChannelType: " + ChannelType.ToString() + "" + Environment.NewLine;
|
|
output += "Status: " + Status.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.TransferPacket; } }
|
|
public TransferDataBlock TransferData;
|
|
|
|
public TransferPacketPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 18;
|
|
Header.Reliable = true;
|
|
TransferData = new TransferDataBlock();
|
|
}
|
|
|
|
public TransferPacketPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
TransferData = new TransferDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public TransferPacketPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
TransferData = new TransferDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += TransferData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
TransferData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- TransferPacket ---" + Environment.NewLine;
|
|
output += TransferData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SendXferPacketPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("sendxferpacket_datapacket")]
|
|
public class DataPacketBlock
|
|
{
|
|
private byte[] _data;
|
|
public byte[] Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value == null) { _data = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _data = new byte[value.Length]; Array.Copy(value, _data, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (Data != null) { length += 2 + Data.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public DataPacketBlock() { }
|
|
public DataPacketBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_data = new byte[length];
|
|
Array.Copy(bytes, i, _data, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Data.Length % 256);
|
|
bytes[i++] = (byte)((Data.Length >> 8) % 256);
|
|
Array.Copy(Data, 0, bytes, i, Data.Length); i += Data.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- DataPacket --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Data, "Data") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("sendxferpacket_xferid")]
|
|
public class XferIDBlock
|
|
{
|
|
public ulong ID;
|
|
public uint Packet;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public XferIDBlock() { }
|
|
public XferIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
Packet = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
bytes[i++] = (byte)((ID >> 32) % 256);
|
|
bytes[i++] = (byte)((ID >> 40) % 256);
|
|
bytes[i++] = (byte)((ID >> 48) % 256);
|
|
bytes[i++] = (byte)((ID >> 56) % 256);
|
|
bytes[i++] = (byte)(Packet % 256);
|
|
bytes[i++] = (byte)((Packet >> 8) % 256);
|
|
bytes[i++] = (byte)((Packet >> 16) % 256);
|
|
bytes[i++] = (byte)((Packet >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- XferID --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Packet: " + Packet.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SendXferPacket; } }
|
|
public DataPacketBlock DataPacket;
|
|
public XferIDBlock XferID;
|
|
|
|
public SendXferPacketPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 19;
|
|
Header.Reliable = true;
|
|
DataPacket = new DataPacketBlock();
|
|
XferID = new XferIDBlock();
|
|
}
|
|
|
|
public SendXferPacketPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
DataPacket = new DataPacketBlock(bytes, ref i);
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public SendXferPacketPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
DataPacket = new DataPacketBlock(bytes, ref i);
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += DataPacket.Length; length += XferID.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
DataPacket.ToBytes(bytes, ref i);
|
|
XferID.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SendXferPacket ---" + Environment.NewLine;
|
|
output += DataPacket.ToString() + "" + Environment.NewLine;
|
|
output += XferID.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ConfirmXferPacketPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("confirmxferpacket_xferid")]
|
|
public class XferIDBlock
|
|
{
|
|
public ulong ID;
|
|
public uint Packet;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 12;
|
|
}
|
|
}
|
|
|
|
public XferIDBlock() { }
|
|
public XferIDBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
Packet = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ID % 256);
|
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
|
bytes[i++] = (byte)((ID >> 32) % 256);
|
|
bytes[i++] = (byte)((ID >> 40) % 256);
|
|
bytes[i++] = (byte)((ID >> 48) % 256);
|
|
bytes[i++] = (byte)((ID >> 56) % 256);
|
|
bytes[i++] = (byte)(Packet % 256);
|
|
bytes[i++] = (byte)((Packet >> 8) % 256);
|
|
bytes[i++] = (byte)((Packet >> 16) % 256);
|
|
bytes[i++] = (byte)((Packet >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- XferID --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output += "Packet: " + Packet.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ConfirmXferPacket; } }
|
|
public XferIDBlock XferID;
|
|
|
|
public ConfirmXferPacketPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 20;
|
|
Header.Reliable = true;
|
|
XferID = new XferIDBlock();
|
|
}
|
|
|
|
public ConfirmXferPacketPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public ConfirmXferPacketPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
XferID = new XferIDBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += XferID.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
XferID.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ConfirmXferPacket ---" + Environment.NewLine;
|
|
output += XferID.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarAnimationPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avataranimation_animationsourcelist")]
|
|
public class AnimationSourceListBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public AnimationSourceListBlock() { }
|
|
public AnimationSourceListBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AnimationSourceList --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avataranimation_sender")]
|
|
public class SenderBlock
|
|
{
|
|
public LLUUID ID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public SenderBlock() { }
|
|
public SenderBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- Sender --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avataranimation_animationlist")]
|
|
public class AnimationListBlock
|
|
{
|
|
public LLUUID AnimID;
|
|
public int AnimSequenceID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 20;
|
|
}
|
|
}
|
|
|
|
public AnimationListBlock() { }
|
|
public AnimationListBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AnimID = new LLUUID(bytes, i); i += 16;
|
|
AnimSequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(AnimID == null) { Console.WriteLine("Warning: AnimID is null, in " + this.GetType()); }
|
|
Array.Copy(AnimID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(AnimSequenceID % 256);
|
|
bytes[i++] = (byte)((AnimSequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((AnimSequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((AnimSequenceID >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AnimationList --" + Environment.NewLine;
|
|
output += "AnimID: " + AnimID.ToString() + "" + Environment.NewLine;
|
|
output += "AnimSequenceID: " + AnimSequenceID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarAnimation; } }
|
|
public AnimationSourceListBlock[] AnimationSourceList;
|
|
public SenderBlock Sender;
|
|
public AnimationListBlock[] AnimationList;
|
|
|
|
public AvatarAnimationPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 21;
|
|
Header.Reliable = true;
|
|
AnimationSourceList = new AnimationSourceListBlock[0];
|
|
Sender = new SenderBlock();
|
|
AnimationList = new AnimationListBlock[0];
|
|
}
|
|
|
|
public AvatarAnimationPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
AnimationSourceList = new AnimationSourceListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationSourceList[j] = new AnimationSourceListBlock(bytes, ref i); }
|
|
Sender = new SenderBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
AnimationList = new AnimationListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationList[j] = new AnimationListBlock(bytes, ref i); }
|
|
}
|
|
|
|
public AvatarAnimationPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
AnimationSourceList = new AnimationSourceListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationSourceList[j] = new AnimationSourceListBlock(bytes, ref i); }
|
|
Sender = new SenderBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
AnimationList = new AnimationListBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationList[j] = new AnimationListBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += Sender.Length;;
|
|
length++;
|
|
for (int j = 0; j < AnimationSourceList.Length; j++) { length += AnimationSourceList[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < AnimationList.Length; j++) { length += AnimationList[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)AnimationSourceList.Length;
|
|
for (int j = 0; j < AnimationSourceList.Length; j++) { AnimationSourceList[j].ToBytes(bytes, ref i); }
|
|
Sender.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)AnimationList.Length;
|
|
for (int j = 0; j < AnimationList.Length; j++) { AnimationList[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarAnimation ---" + Environment.NewLine;
|
|
for (int j = 0; j < AnimationSourceList.Length; j++)
|
|
{
|
|
output += AnimationSourceList[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += Sender.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < AnimationList.Length; j++)
|
|
{
|
|
output += AnimationList[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class AvatarSitResponsePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("avatarsitresponse_sittransform")]
|
|
public class SitTransformBlock
|
|
{
|
|
public bool AutoPilot;
|
|
public bool ForceMouselook;
|
|
public LLVector3 CameraEyeOffset;
|
|
public LLVector3 CameraAtOffset;
|
|
public LLVector3 SitPosition;
|
|
public LLQuaternion SitRotation;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 50;
|
|
}
|
|
}
|
|
|
|
public SitTransformBlock() { }
|
|
public SitTransformBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
AutoPilot = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
ForceMouselook = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
CameraEyeOffset = new LLVector3(bytes, i); i += 12;
|
|
CameraAtOffset = new LLVector3(bytes, i); i += 12;
|
|
SitPosition = new LLVector3(bytes, i); i += 12;
|
|
SitRotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)((AutoPilot) ? 1 : 0);
|
|
bytes[i++] = (byte)((ForceMouselook) ? 1 : 0);
|
|
Array.Copy(CameraEyeOffset.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(CameraAtOffset.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(SitPosition.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(SitRotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- SitTransform --" + Environment.NewLine;
|
|
output += "AutoPilot: " + AutoPilot.ToString() + "" + Environment.NewLine;
|
|
output += "ForceMouselook: " + ForceMouselook.ToString() + "" + Environment.NewLine;
|
|
output += "CameraEyeOffset: " + CameraEyeOffset.ToString() + "" + Environment.NewLine;
|
|
output += "CameraAtOffset: " + CameraAtOffset.ToString() + "" + Environment.NewLine;
|
|
output += "SitPosition: " + SitPosition.ToString() + "" + Environment.NewLine;
|
|
output += "SitRotation: " + SitRotation.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("avatarsitresponse_sitobject")]
|
|
public class SitObjectBlock
|
|
{
|
|
public LLUUID ID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public SitObjectBlock() { }
|
|
public SitObjectBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ID == null) { Console.WriteLine("Warning: ID is null, in " + this.GetType()); }
|
|
Array.Copy(ID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- SitObject --" + Environment.NewLine;
|
|
output += "ID: " + ID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.AvatarSitResponse; } }
|
|
public SitTransformBlock SitTransform;
|
|
public SitObjectBlock SitObject;
|
|
|
|
public AvatarSitResponsePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 22;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
SitTransform = new SitTransformBlock();
|
|
SitObject = new SitObjectBlock();
|
|
}
|
|
|
|
public AvatarSitResponsePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
SitTransform = new SitTransformBlock(bytes, ref i);
|
|
SitObject = new SitObjectBlock(bytes, ref i);
|
|
}
|
|
|
|
public AvatarSitResponsePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
SitTransform = new SitTransformBlock(bytes, ref i);
|
|
SitObject = new SitObjectBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += SitTransform.Length; length += SitObject.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
SitTransform.ToBytes(bytes, ref i);
|
|
SitObject.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- AvatarSitResponse ---" + Environment.NewLine;
|
|
output += SitTransform.ToString() + "" + Environment.NewLine;
|
|
output += SitObject.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class CameraConstraintPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("cameraconstraint_cameracollideplane")]
|
|
public class CameraCollidePlaneBlock
|
|
{
|
|
public LLVector4 Plane;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public CameraCollidePlaneBlock() { }
|
|
public CameraCollidePlaneBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
Plane = new LLVector4(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
Array.Copy(Plane.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- CameraCollidePlane --" + Environment.NewLine;
|
|
output += "Plane: " + Plane.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.CameraConstraint; } }
|
|
public CameraCollidePlaneBlock CameraCollidePlane;
|
|
|
|
public CameraConstraintPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 23;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
CameraCollidePlane = new CameraCollidePlaneBlock();
|
|
}
|
|
|
|
public CameraConstraintPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
CameraCollidePlane = new CameraCollidePlaneBlock(bytes, ref i);
|
|
}
|
|
|
|
public CameraConstraintPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
CameraCollidePlane = new CameraCollidePlaneBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += CameraCollidePlane.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
CameraCollidePlane.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- CameraConstraint ---" + Environment.NewLine;
|
|
output += CameraCollidePlane.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ParcelPropertiesPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("parcelproperties_parceldata")]
|
|
public class ParcelDataBlock
|
|
{
|
|
public bool ReservedNewbie;
|
|
public int GroupPrims;
|
|
public int SelectedPrims;
|
|
public LLUUID MediaID;
|
|
public LLVector3 UserLookAt;
|
|
public LLVector3 AABBMax;
|
|
public LLVector3 AABBMin;
|
|
public int RequestResult;
|
|
public int OwnerPrims;
|
|
public bool RegionPushOverride;
|
|
public bool RegionDenyAnonymous;
|
|
private byte[] _mediaurl;
|
|
public byte[] MediaURL
|
|
{
|
|
get { return _mediaurl; }
|
|
set
|
|
{
|
|
if (value == null) { _mediaurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _mediaurl = new byte[value.Length]; Array.Copy(value, _mediaurl, value.Length); }
|
|
}
|
|
}
|
|
public int LocalID;
|
|
public int SimWideMaxPrims;
|
|
public int TotalPrims;
|
|
public int OtherCount;
|
|
public bool IsGroupOwned;
|
|
public LLVector3 UserLocation;
|
|
public int MaxPrims;
|
|
private byte[] _name;
|
|
public byte[] Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (value == null) { _name = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
|
|
}
|
|
}
|
|
public int OtherCleanTime;
|
|
private byte[] _desc;
|
|
public byte[] Desc
|
|
{
|
|
get { return _desc; }
|
|
set
|
|
{
|
|
if (value == null) { _desc = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _desc = new byte[value.Length]; Array.Copy(value, _desc, value.Length); }
|
|
}
|
|
}
|
|
public int Area;
|
|
public int OtherPrims;
|
|
public bool RegionDenyIdentified;
|
|
public byte Category;
|
|
public int PublicCount;
|
|
public LLUUID GroupID;
|
|
public int SalePrice;
|
|
public LLUUID OwnerID;
|
|
public int SequenceID;
|
|
public bool RegionDenyTransacted;
|
|
public int SelfCount;
|
|
private byte[] _bitmap;
|
|
public byte[] Bitmap
|
|
{
|
|
get { return _bitmap; }
|
|
set
|
|
{
|
|
if (value == null) { _bitmap = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _bitmap = new byte[value.Length]; Array.Copy(value, _bitmap, value.Length); }
|
|
}
|
|
}
|
|
public byte Status;
|
|
public LLUUID SnapshotID;
|
|
public bool SnapSelection;
|
|
public byte LandingType;
|
|
public int SimWideTotalPrims;
|
|
public uint AuctionID;
|
|
public LLUUID AuthBuyerID;
|
|
public float PassHours;
|
|
public uint ParcelFlags;
|
|
public int PassPrice;
|
|
public int ClaimDate;
|
|
public byte MediaAutoScale;
|
|
private byte[] _musicurl;
|
|
public byte[] MusicURL
|
|
{
|
|
get { return _musicurl; }
|
|
set
|
|
{
|
|
if (value == null) { _musicurl = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _musicurl = new byte[value.Length]; Array.Copy(value, _musicurl, value.Length); }
|
|
}
|
|
}
|
|
public float ParcelPrimBonus;
|
|
public int ClaimPrice;
|
|
public int RentPrice;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 239;
|
|
if (MediaURL != null) { length += 1 + MediaURL.Length; }
|
|
if (Name != null) { length += 1 + Name.Length; }
|
|
if (Desc != null) { length += 1 + Desc.Length; }
|
|
if (Bitmap != null) { length += 2 + Bitmap.Length; }
|
|
if (MusicURL != null) { length += 1 + MusicURL.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public ParcelDataBlock() { }
|
|
public ParcelDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ReservedNewbie = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
GroupPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SelectedPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MediaID = new LLUUID(bytes, i); i += 16;
|
|
UserLookAt = new LLVector3(bytes, i); i += 12;
|
|
AABBMax = new LLVector3(bytes, i); i += 12;
|
|
AABBMin = new LLVector3(bytes, i); i += 12;
|
|
RequestResult = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionPushOverride = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
RegionDenyAnonymous = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
length = (ushort)bytes[i++];
|
|
_mediaurl = new byte[length];
|
|
Array.Copy(bytes, i, _mediaurl, 0, length); i += length;
|
|
LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
SimWideMaxPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
TotalPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OtherCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
UserLocation = new LLVector3(bytes, i); i += 12;
|
|
MaxPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_name = new byte[length];
|
|
Array.Copy(bytes, i, _name, 0, length); i += length;
|
|
OtherCleanTime = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)bytes[i++];
|
|
_desc = new byte[length];
|
|
Array.Copy(bytes, i, _desc, 0, length); i += length;
|
|
Area = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OtherPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionDenyIdentified = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
Category = (byte)bytes[i++];
|
|
PublicCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RegionDenyTransacted = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
SelfCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_bitmap = new byte[length];
|
|
Array.Copy(bytes, i, _bitmap, 0, length); i += length;
|
|
Status = (byte)bytes[i++];
|
|
SnapshotID = new LLUUID(bytes, i); i += 16;
|
|
SnapSelection = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
LandingType = (byte)bytes[i++];
|
|
SimWideTotalPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AuctionID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AuthBuyerID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
PassHours = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ParcelFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
PassPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ClaimDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
MediaAutoScale = (byte)bytes[i++];
|
|
length = (ushort)bytes[i++];
|
|
_musicurl = new byte[length];
|
|
Array.Copy(bytes, i, _musicurl, 0, length); i += length;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
ParcelPrimBonus = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ClaimPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
RentPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)((ReservedNewbie) ? 1 : 0);
|
|
bytes[i++] = (byte)(GroupPrims % 256);
|
|
bytes[i++] = (byte)((GroupPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupPrims >> 24) % 256);
|
|
bytes[i++] = (byte)(SelectedPrims % 256);
|
|
bytes[i++] = (byte)((SelectedPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((SelectedPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((SelectedPrims >> 24) % 256);
|
|
if(MediaID == null) { Console.WriteLine("Warning: MediaID is null, in " + this.GetType()); }
|
|
Array.Copy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(UserLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(AABBMax.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(AABBMin.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)(RequestResult % 256);
|
|
bytes[i++] = (byte)((RequestResult >> 8) % 256);
|
|
bytes[i++] = (byte)((RequestResult >> 16) % 256);
|
|
bytes[i++] = (byte)((RequestResult >> 24) % 256);
|
|
bytes[i++] = (byte)(OwnerPrims % 256);
|
|
bytes[i++] = (byte)((OwnerPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((OwnerPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((OwnerPrims >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionPushOverride) ? 1 : 0);
|
|
bytes[i++] = (byte)((RegionDenyAnonymous) ? 1 : 0);
|
|
if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MediaURL.Length;
|
|
Array.Copy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length;
|
|
bytes[i++] = (byte)(LocalID % 256);
|
|
bytes[i++] = (byte)((LocalID >> 8) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 16) % 256);
|
|
bytes[i++] = (byte)((LocalID >> 24) % 256);
|
|
bytes[i++] = (byte)(SimWideMaxPrims % 256);
|
|
bytes[i++] = (byte)((SimWideMaxPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((SimWideMaxPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((SimWideMaxPrims >> 24) % 256);
|
|
bytes[i++] = (byte)(TotalPrims % 256);
|
|
bytes[i++] = (byte)((TotalPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((TotalPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((TotalPrims >> 24) % 256);
|
|
bytes[i++] = (byte)(OtherCount % 256);
|
|
bytes[i++] = (byte)((OtherCount >> 8) % 256);
|
|
bytes[i++] = (byte)((OtherCount >> 16) % 256);
|
|
bytes[i++] = (byte)((OtherCount >> 24) % 256);
|
|
bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0);
|
|
Array.Copy(UserLocation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)(MaxPrims % 256);
|
|
bytes[i++] = (byte)((MaxPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((MaxPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((MaxPrims >> 24) % 256);
|
|
if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Name.Length;
|
|
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
|
|
bytes[i++] = (byte)(OtherCleanTime % 256);
|
|
bytes[i++] = (byte)((OtherCleanTime >> 8) % 256);
|
|
bytes[i++] = (byte)((OtherCleanTime >> 16) % 256);
|
|
bytes[i++] = (byte)((OtherCleanTime >> 24) % 256);
|
|
if(Desc == null) { Console.WriteLine("Warning: Desc is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Desc.Length;
|
|
Array.Copy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length;
|
|
bytes[i++] = (byte)(Area % 256);
|
|
bytes[i++] = (byte)((Area >> 8) % 256);
|
|
bytes[i++] = (byte)((Area >> 16) % 256);
|
|
bytes[i++] = (byte)((Area >> 24) % 256);
|
|
bytes[i++] = (byte)(OtherPrims % 256);
|
|
bytes[i++] = (byte)((OtherPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((OtherPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((OtherPrims >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionDenyIdentified) ? 1 : 0);
|
|
bytes[i++] = Category;
|
|
bytes[i++] = (byte)(PublicCount % 256);
|
|
bytes[i++] = (byte)((PublicCount >> 8) % 256);
|
|
bytes[i++] = (byte)((PublicCount >> 16) % 256);
|
|
bytes[i++] = (byte)((PublicCount >> 24) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SalePrice % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 8) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 16) % 256);
|
|
bytes[i++] = (byte)((SalePrice >> 24) % 256);
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(SequenceID % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 8) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 16) % 256);
|
|
bytes[i++] = (byte)((SequenceID >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionDenyTransacted) ? 1 : 0);
|
|
bytes[i++] = (byte)(SelfCount % 256);
|
|
bytes[i++] = (byte)((SelfCount >> 8) % 256);
|
|
bytes[i++] = (byte)((SelfCount >> 16) % 256);
|
|
bytes[i++] = (byte)((SelfCount >> 24) % 256);
|
|
if(Bitmap == null) { Console.WriteLine("Warning: Bitmap is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(Bitmap.Length % 256);
|
|
bytes[i++] = (byte)((Bitmap.Length >> 8) % 256);
|
|
Array.Copy(Bitmap, 0, bytes, i, Bitmap.Length); i += Bitmap.Length;
|
|
bytes[i++] = Status;
|
|
if(SnapshotID == null) { Console.WriteLine("Warning: SnapshotID is null, in " + this.GetType()); }
|
|
Array.Copy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((SnapSelection) ? 1 : 0);
|
|
bytes[i++] = LandingType;
|
|
bytes[i++] = (byte)(SimWideTotalPrims % 256);
|
|
bytes[i++] = (byte)((SimWideTotalPrims >> 8) % 256);
|
|
bytes[i++] = (byte)((SimWideTotalPrims >> 16) % 256);
|
|
bytes[i++] = (byte)((SimWideTotalPrims >> 24) % 256);
|
|
bytes[i++] = (byte)(AuctionID % 256);
|
|
bytes[i++] = (byte)((AuctionID >> 8) % 256);
|
|
bytes[i++] = (byte)((AuctionID >> 16) % 256);
|
|
bytes[i++] = (byte)((AuctionID >> 24) % 256);
|
|
if(AuthBuyerID == null) { Console.WriteLine("Warning: AuthBuyerID is null, in " + this.GetType()); }
|
|
Array.Copy(AuthBuyerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(PassHours);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(ParcelFlags % 256);
|
|
bytes[i++] = (byte)((ParcelFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ParcelFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ParcelFlags >> 24) % 256);
|
|
bytes[i++] = (byte)(PassPrice % 256);
|
|
bytes[i++] = (byte)((PassPrice >> 8) % 256);
|
|
bytes[i++] = (byte)((PassPrice >> 16) % 256);
|
|
bytes[i++] = (byte)((PassPrice >> 24) % 256);
|
|
bytes[i++] = (byte)(ClaimDate % 256);
|
|
bytes[i++] = (byte)((ClaimDate >> 8) % 256);
|
|
bytes[i++] = (byte)((ClaimDate >> 16) % 256);
|
|
bytes[i++] = (byte)((ClaimDate >> 24) % 256);
|
|
bytes[i++] = MediaAutoScale;
|
|
if(MusicURL == null) { Console.WriteLine("Warning: MusicURL is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)MusicURL.Length;
|
|
Array.Copy(MusicURL, 0, bytes, i, MusicURL.Length); i += MusicURL.Length;
|
|
ba = BitConverter.GetBytes(ParcelPrimBonus);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(ClaimPrice % 256);
|
|
bytes[i++] = (byte)((ClaimPrice >> 8) % 256);
|
|
bytes[i++] = (byte)((ClaimPrice >> 16) % 256);
|
|
bytes[i++] = (byte)((ClaimPrice >> 24) % 256);
|
|
bytes[i++] = (byte)(RentPrice % 256);
|
|
bytes[i++] = (byte)((RentPrice >> 8) % 256);
|
|
bytes[i++] = (byte)((RentPrice >> 16) % 256);
|
|
bytes[i++] = (byte)((RentPrice >> 24) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- ParcelData --" + Environment.NewLine;
|
|
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "" + Environment.NewLine;
|
|
output += "GroupPrims: " + GroupPrims.ToString() + "" + Environment.NewLine;
|
|
output += "SelectedPrims: " + SelectedPrims.ToString() + "" + Environment.NewLine;
|
|
output += "MediaID: " + MediaID.ToString() + "" + Environment.NewLine;
|
|
output += "UserLookAt: " + UserLookAt.ToString() + "" + Environment.NewLine;
|
|
output += "AABBMax: " + AABBMax.ToString() + "" + Environment.NewLine;
|
|
output += "AABBMin: " + AABBMin.ToString() + "" + Environment.NewLine;
|
|
output += "RequestResult: " + RequestResult.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerPrims: " + OwnerPrims.ToString() + "" + Environment.NewLine;
|
|
output += "RegionPushOverride: " + RegionPushOverride.ToString() + "" + Environment.NewLine;
|
|
output += "RegionDenyAnonymous: " + RegionDenyAnonymous.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MediaURL, "MediaURL") + "" + Environment.NewLine;
|
|
output += "LocalID: " + LocalID.ToString() + "" + Environment.NewLine;
|
|
output += "SimWideMaxPrims: " + SimWideMaxPrims.ToString() + "" + Environment.NewLine;
|
|
output += "TotalPrims: " + TotalPrims.ToString() + "" + Environment.NewLine;
|
|
output += "OtherCount: " + OtherCount.ToString() + "" + Environment.NewLine;
|
|
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "" + Environment.NewLine;
|
|
output += "UserLocation: " + UserLocation.ToString() + "" + Environment.NewLine;
|
|
output += "MaxPrims: " + MaxPrims.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Name, "Name") + "" + Environment.NewLine;
|
|
output += "OtherCleanTime: " + OtherCleanTime.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Desc, "Desc") + "" + Environment.NewLine;
|
|
output += "Area: " + Area.ToString() + "" + Environment.NewLine;
|
|
output += "OtherPrims: " + OtherPrims.ToString() + "" + Environment.NewLine;
|
|
output += "RegionDenyIdentified: " + RegionDenyIdentified.ToString() + "" + Environment.NewLine;
|
|
output += "Category: " + Category.ToString() + "" + Environment.NewLine;
|
|
output += "PublicCount: " + PublicCount.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "SalePrice: " + SalePrice.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "SequenceID: " + SequenceID.ToString() + "" + Environment.NewLine;
|
|
output += "RegionDenyTransacted: " + RegionDenyTransacted.ToString() + "" + Environment.NewLine;
|
|
output += "SelfCount: " + SelfCount.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Bitmap, "Bitmap") + "" + Environment.NewLine;
|
|
output += "Status: " + Status.ToString() + "" + Environment.NewLine;
|
|
output += "SnapshotID: " + SnapshotID.ToString() + "" + Environment.NewLine;
|
|
output += "SnapSelection: " + SnapSelection.ToString() + "" + Environment.NewLine;
|
|
output += "LandingType: " + LandingType.ToString() + "" + Environment.NewLine;
|
|
output += "SimWideTotalPrims: " + SimWideTotalPrims.ToString() + "" + Environment.NewLine;
|
|
output += "AuctionID: " + AuctionID.ToString() + "" + Environment.NewLine;
|
|
output += "AuthBuyerID: " + AuthBuyerID.ToString() + "" + Environment.NewLine;
|
|
output += "PassHours: " + PassHours.ToString() + "" + Environment.NewLine;
|
|
output += "ParcelFlags: " + ParcelFlags.ToString() + "" + Environment.NewLine;
|
|
output += "PassPrice: " + PassPrice.ToString() + "" + Environment.NewLine;
|
|
output += "ClaimDate: " + ClaimDate.ToString() + "" + Environment.NewLine;
|
|
output += "MediaAutoScale: " + MediaAutoScale.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(MusicURL, "MusicURL") + "" + Environment.NewLine;
|
|
output += "ParcelPrimBonus: " + ParcelPrimBonus.ToString() + "" + Environment.NewLine;
|
|
output += "ClaimPrice: " + ClaimPrice.ToString() + "" + Environment.NewLine;
|
|
output += "RentPrice: " + RentPrice.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ParcelProperties; } }
|
|
public ParcelDataBlock ParcelData;
|
|
|
|
public ParcelPropertiesPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 24;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
ParcelData = new ParcelDataBlock();
|
|
}
|
|
|
|
public ParcelPropertiesPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ParcelPropertiesPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
ParcelData = new ParcelDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += ParcelData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
ParcelData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ParcelProperties ---" + Environment.NewLine;
|
|
output += ParcelData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChildAgentUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("childagentupdate_visualparam")]
|
|
public class VisualParamBlock
|
|
{
|
|
public byte ParamValue;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public VisualParamBlock() { }
|
|
public VisualParamBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ParamValue = (byte)bytes[i++];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = ParamValue;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- VisualParam --" + Environment.NewLine;
|
|
output += "ParamValue: " + ParamValue.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("childagentupdate_granterblock")]
|
|
public class GranterBlockBlock
|
|
{
|
|
public LLUUID GranterID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 16;
|
|
}
|
|
}
|
|
|
|
public GranterBlockBlock() { }
|
|
public GranterBlockBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GranterID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(GranterID == null) { Console.WriteLine("Warning: GranterID is null, in " + this.GetType()); }
|
|
Array.Copy(GranterID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GranterBlock --" + Environment.NewLine;
|
|
output += "GranterID: " + GranterID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("childagentupdate_animationdata")]
|
|
public class AnimationDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public LLUUID Animation;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
public AnimationDataBlock() { }
|
|
public AnimationDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
Animation = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Animation == null) { Console.WriteLine("Warning: Animation is null, in " + this.GetType()); }
|
|
Array.Copy(Animation.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AnimationData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Animation: " + Animation.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("childagentupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint ViewerCircuitCode;
|
|
public uint ControlFlags;
|
|
public float Far;
|
|
public LLUUID AgentID;
|
|
public bool ChangedGrid;
|
|
public LLQuaternion HeadRotation;
|
|
public LLUUID SessionID;
|
|
public LLVector3 LeftAxis;
|
|
public LLVector3 Size;
|
|
public byte GodLevel;
|
|
public ulong RegionHandle;
|
|
public byte AgentAccess;
|
|
public LLVector3 AgentVel;
|
|
public LLVector3 AgentPos;
|
|
public LLUUID PreyAgent;
|
|
private byte[] _throttles;
|
|
public byte[] Throttles
|
|
{
|
|
get { return _throttles; }
|
|
set
|
|
{
|
|
if (value == null) { _throttles = null; return; }
|
|
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
else { _throttles = new byte[value.Length]; Array.Copy(value, _throttles, value.Length); }
|
|
}
|
|
}
|
|
public LLVector3 UpAxis;
|
|
private byte[] _agenttextures;
|
|
public byte[] AgentTextures
|
|
{
|
|
get { return _agenttextures; }
|
|
set
|
|
{
|
|
if (value == null) { _agenttextures = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _agenttextures = new byte[value.Length]; Array.Copy(value, _agenttextures, value.Length); }
|
|
}
|
|
}
|
|
public LLVector3 AtAxis;
|
|
public LLVector3 Center;
|
|
public LLQuaternion BodyRotation;
|
|
public float Aspect;
|
|
public bool AlwaysRun;
|
|
public float EnergyLevel;
|
|
public uint LocomotionState;
|
|
public LLUUID ActiveGroupID;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 208;
|
|
if (Throttles != null) { length += 1 + Throttles.Length; }
|
|
if (AgentTextures != null) { length += 2 + AgentTextures.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
ViewerCircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ControlFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Far = BitConverter.ToSingle(bytes, i); i += 4;
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
ChangedGrid = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
HeadRotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
LeftAxis = new LLVector3(bytes, i); i += 12;
|
|
Size = new LLVector3(bytes, i); i += 12;
|
|
GodLevel = (byte)bytes[i++];
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
AgentAccess = (byte)bytes[i++];
|
|
AgentVel = new LLVector3(bytes, i); i += 12;
|
|
AgentPos = new LLVector3(bytes, i); i += 12;
|
|
PreyAgent = new LLUUID(bytes, i); i += 16;
|
|
length = (ushort)bytes[i++];
|
|
_throttles = new byte[length];
|
|
Array.Copy(bytes, i, _throttles, 0, length); i += length;
|
|
UpAxis = new LLVector3(bytes, i); i += 12;
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_agenttextures = new byte[length];
|
|
Array.Copy(bytes, i, _agenttextures, 0, length); i += length;
|
|
AtAxis = new LLVector3(bytes, i); i += 12;
|
|
Center = new LLVector3(bytes, i); i += 12;
|
|
BodyRotation = new LLQuaternion(bytes, i, true); i += 12;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Aspect = BitConverter.ToSingle(bytes, i); i += 4;
|
|
AlwaysRun = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
EnergyLevel = BitConverter.ToSingle(bytes, i); i += 4;
|
|
LocomotionState = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
ActiveGroupID = new LLUUID(bytes, i); i += 16;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
bytes[i++] = (byte)(ViewerCircuitCode % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256);
|
|
bytes[i++] = (byte)(ControlFlags % 256);
|
|
bytes[i++] = (byte)((ControlFlags >> 8) % 256);
|
|
bytes[i++] = (byte)((ControlFlags >> 16) % 256);
|
|
bytes[i++] = (byte)((ControlFlags >> 24) % 256);
|
|
ba = BitConverter.GetBytes(Far);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((ChangedGrid) ? 1 : 0);
|
|
Array.Copy(HeadRotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Size.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = GodLevel;
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
bytes[i++] = AgentAccess;
|
|
Array.Copy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(AgentPos.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(PreyAgent == null) { Console.WriteLine("Warning: PreyAgent is null, in " + this.GetType()); }
|
|
Array.Copy(PreyAgent.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(Throttles == null) { Console.WriteLine("Warning: Throttles is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)Throttles.Length;
|
|
Array.Copy(Throttles, 0, bytes, i, Throttles.Length); i += Throttles.Length;
|
|
Array.Copy(UpAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
if(AgentTextures == null) { Console.WriteLine("Warning: AgentTextures is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(AgentTextures.Length % 256);
|
|
bytes[i++] = (byte)((AgentTextures.Length >> 8) % 256);
|
|
Array.Copy(AgentTextures, 0, bytes, i, AgentTextures.Length); i += AgentTextures.Length;
|
|
Array.Copy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Center.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(BodyRotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
ba = BitConverter.GetBytes(Aspect);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)((AlwaysRun) ? 1 : 0);
|
|
ba = BitConverter.GetBytes(EnergyLevel);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
bytes[i++] = (byte)(LocomotionState % 256);
|
|
bytes[i++] = (byte)((LocomotionState >> 8) % 256);
|
|
bytes[i++] = (byte)((LocomotionState >> 16) % 256);
|
|
bytes[i++] = (byte)((LocomotionState >> 24) % 256);
|
|
if(ActiveGroupID == null) { Console.WriteLine("Warning: ActiveGroupID is null, in " + this.GetType()); }
|
|
Array.Copy(ActiveGroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "" + Environment.NewLine;
|
|
output += "ControlFlags: " + ControlFlags.ToString() + "" + Environment.NewLine;
|
|
output += "Far: " + Far.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "ChangedGrid: " + ChangedGrid.ToString() + "" + Environment.NewLine;
|
|
output += "HeadRotation: " + HeadRotation.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "LeftAxis: " + LeftAxis.ToString() + "" + Environment.NewLine;
|
|
output += "Size: " + Size.ToString() + "" + Environment.NewLine;
|
|
output += "GodLevel: " + GodLevel.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output += "AgentAccess: " + AgentAccess.ToString() + "" + Environment.NewLine;
|
|
output += "AgentVel: " + AgentVel.ToString() + "" + Environment.NewLine;
|
|
output += "AgentPos: " + AgentPos.ToString() + "" + Environment.NewLine;
|
|
output += "PreyAgent: " + PreyAgent.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(Throttles, "Throttles") + "" + Environment.NewLine;
|
|
output += "UpAxis: " + UpAxis.ToString() + "" + Environment.NewLine;
|
|
output += Helpers.FieldToString(AgentTextures, "AgentTextures") + "" + Environment.NewLine;
|
|
output += "AtAxis: " + AtAxis.ToString() + "" + Environment.NewLine;
|
|
output += "Center: " + Center.ToString() + "" + Environment.NewLine;
|
|
output += "BodyRotation: " + BodyRotation.ToString() + "" + Environment.NewLine;
|
|
output += "Aspect: " + Aspect.ToString() + "" + Environment.NewLine;
|
|
output += "AlwaysRun: " + AlwaysRun.ToString() + "" + Environment.NewLine;
|
|
output += "EnergyLevel: " + EnergyLevel.ToString() + "" + Environment.NewLine;
|
|
output += "LocomotionState: " + LocomotionState.ToString() + "" + Environment.NewLine;
|
|
output += "ActiveGroupID: " + ActiveGroupID.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("childagentupdate_groupdata")]
|
|
public class GroupDataBlock
|
|
{
|
|
public ulong GroupPowers;
|
|
public LLUUID GroupID;
|
|
public bool AcceptNotices;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 25;
|
|
}
|
|
}
|
|
|
|
public GroupDataBlock() { }
|
|
public GroupDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
GroupPowers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
GroupID = new LLUUID(bytes, i); i += 16;
|
|
AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(GroupPowers % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 8) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 16) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 24) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 32) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 40) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 48) % 256);
|
|
bytes[i++] = (byte)((GroupPowers >> 56) % 256);
|
|
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
|
|
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((AcceptNotices) ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- GroupData --" + Environment.NewLine;
|
|
output += "GroupPowers: " + GroupPowers.ToString() + "" + Environment.NewLine;
|
|
output += "GroupID: " + GroupID.ToString() + "" + Environment.NewLine;
|
|
output += "AcceptNotices: " + AcceptNotices.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
/// <exclude/>
|
|
[XmlType("childagentupdate_nvpairdata")]
|
|
public class NVPairDataBlock
|
|
{
|
|
private byte[] _nvpairs;
|
|
public byte[] NVPairs
|
|
{
|
|
get { return _nvpairs; }
|
|
set
|
|
{
|
|
if (value == null) { _nvpairs = null; return; }
|
|
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
|
|
else { _nvpairs = new byte[value.Length]; Array.Copy(value, _nvpairs, value.Length); }
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
int length = 0;
|
|
if (NVPairs != null) { length += 2 + NVPairs.Length; }
|
|
return length;
|
|
}
|
|
}
|
|
|
|
public NVPairDataBlock() { }
|
|
public NVPairDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
int length;
|
|
try
|
|
{
|
|
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
|
|
_nvpairs = new byte[length];
|
|
Array.Copy(bytes, i, _nvpairs, 0, length); i += length;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
if(NVPairs == null) { Console.WriteLine("Warning: NVPairs is null, in " + this.GetType()); }
|
|
bytes[i++] = (byte)(NVPairs.Length % 256);
|
|
bytes[i++] = (byte)((NVPairs.Length >> 8) % 256);
|
|
Array.Copy(NVPairs, 0, bytes, i, NVPairs.Length); i += NVPairs.Length;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- NVPairData --" + Environment.NewLine;
|
|
output += Helpers.FieldToString(NVPairs, "NVPairs") + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChildAgentUpdate; } }
|
|
public VisualParamBlock[] VisualParam;
|
|
public GranterBlockBlock[] GranterBlock;
|
|
public AnimationDataBlock[] AnimationData;
|
|
public AgentDataBlock AgentData;
|
|
public GroupDataBlock[] GroupData;
|
|
public NVPairDataBlock[] NVPairData;
|
|
|
|
public ChildAgentUpdatePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 26;
|
|
Header.Reliable = true;
|
|
Header.Zerocoded = true;
|
|
VisualParam = new VisualParamBlock[0];
|
|
GranterBlock = new GranterBlockBlock[0];
|
|
AnimationData = new AnimationDataBlock[0];
|
|
AgentData = new AgentDataBlock();
|
|
GroupData = new GroupDataBlock[0];
|
|
NVPairData = new NVPairDataBlock[0];
|
|
}
|
|
|
|
public ChildAgentUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
int count = (int)bytes[i++];
|
|
VisualParam = new VisualParamBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VisualParam[j] = new VisualParamBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
GranterBlock = new GranterBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GranterBlock[j] = new GranterBlockBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
AnimationData = new AnimationDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationData[j] = new AnimationDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
NVPairData = new NVPairDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ NVPairData[j] = new NVPairDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public ChildAgentUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
int count = (int)bytes[i++];
|
|
VisualParam = new VisualParamBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ VisualParam[j] = new VisualParamBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
GranterBlock = new GranterBlockBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GranterBlock[j] = new GranterBlockBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
AnimationData = new AnimationDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ AnimationData[j] = new AnimationDataBlock(bytes, ref i); }
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
count = (int)bytes[i++];
|
|
GroupData = new GroupDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ GroupData[j] = new GroupDataBlock(bytes, ref i); }
|
|
count = (int)bytes[i++];
|
|
NVPairData = new NVPairDataBlock[count];
|
|
for (int j = 0; j < count; j++)
|
|
{ NVPairData[j] = new NVPairDataBlock(bytes, ref i); }
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += AgentData.Length;;
|
|
length++;
|
|
for (int j = 0; j < VisualParam.Length; j++) { length += VisualParam[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < GranterBlock.Length; j++) { length += GranterBlock[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < AnimationData.Length; j++) { length += AnimationData[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < GroupData.Length; j++) { length += GroupData[j].Length; }
|
|
length++;
|
|
for (int j = 0; j < NVPairData.Length; j++) { length += NVPairData[j].Length; }
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)VisualParam.Length;
|
|
for (int j = 0; j < VisualParam.Length; j++) { VisualParam[j].ToBytes(bytes, ref i); }
|
|
bytes[i++] = (byte)GranterBlock.Length;
|
|
for (int j = 0; j < GranterBlock.Length; j++) { GranterBlock[j].ToBytes(bytes, ref i); }
|
|
bytes[i++] = (byte)AnimationData.Length;
|
|
for (int j = 0; j < AnimationData.Length; j++) { AnimationData[j].ToBytes(bytes, ref i); }
|
|
AgentData.ToBytes(bytes, ref i);
|
|
bytes[i++] = (byte)GroupData.Length;
|
|
for (int j = 0; j < GroupData.Length; j++) { GroupData[j].ToBytes(bytes, ref i); }
|
|
bytes[i++] = (byte)NVPairData.Length;
|
|
for (int j = 0; j < NVPairData.Length; j++) { NVPairData[j].ToBytes(bytes, ref i); }
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChildAgentUpdate ---" + Environment.NewLine;
|
|
for (int j = 0; j < VisualParam.Length; j++)
|
|
{
|
|
output += VisualParam[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
for (int j = 0; j < GranterBlock.Length; j++)
|
|
{
|
|
output += GranterBlock[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
for (int j = 0; j < AnimationData.Length; j++)
|
|
{
|
|
output += AnimationData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
for (int j = 0; j < GroupData.Length; j++)
|
|
{
|
|
output += GroupData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
for (int j = 0; j < NVPairData.Length; j++)
|
|
{
|
|
output += NVPairData[j].ToString() + "" + Environment.NewLine;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChildAgentAlivePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("childagentalive_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint ViewerCircuitCode;
|
|
public LLUUID AgentID;
|
|
public LLUUID SessionID;
|
|
public ulong RegionHandle;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 44;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ViewerCircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ViewerCircuitCode % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChildAgentAlive; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ChildAgentAlivePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 27;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ChildAgentAlivePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChildAgentAlivePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChildAgentAlive ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class ChildAgentPositionUpdatePacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("childagentpositionupdate_agentdata")]
|
|
public class AgentDataBlock
|
|
{
|
|
public uint ViewerCircuitCode;
|
|
public LLUUID AgentID;
|
|
public bool ChangedGrid;
|
|
public LLUUID SessionID;
|
|
public LLVector3 LeftAxis;
|
|
public LLVector3 Size;
|
|
public ulong RegionHandle;
|
|
public LLVector3 AgentVel;
|
|
public LLVector3 AgentPos;
|
|
public LLVector3 UpAxis;
|
|
public LLVector3 AtAxis;
|
|
public LLVector3 Center;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 129;
|
|
}
|
|
}
|
|
|
|
public AgentDataBlock() { }
|
|
public AgentDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ViewerCircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
AgentID = new LLUUID(bytes, i); i += 16;
|
|
ChangedGrid = (bytes[i++] != 0) ? (bool)true : (bool)false;
|
|
SessionID = new LLUUID(bytes, i); i += 16;
|
|
LeftAxis = new LLVector3(bytes, i); i += 12;
|
|
Size = new LLVector3(bytes, i); i += 12;
|
|
RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
AgentVel = new LLVector3(bytes, i); i += 12;
|
|
AgentPos = new LLVector3(bytes, i); i += 12;
|
|
UpAxis = new LLVector3(bytes, i); i += 12;
|
|
AtAxis = new LLVector3(bytes, i); i += 12;
|
|
Center = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
bytes[i++] = (byte)(ViewerCircuitCode % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256);
|
|
bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256);
|
|
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
|
|
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)((ChangedGrid) ? 1 : 0);
|
|
if(SessionID == null) { Console.WriteLine("Warning: SessionID is null, in " + this.GetType()); }
|
|
Array.Copy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
Array.Copy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Size.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
bytes[i++] = (byte)(RegionHandle % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 8) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 16) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 24) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 32) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 40) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 48) % 256);
|
|
bytes[i++] = (byte)((RegionHandle >> 56) % 256);
|
|
Array.Copy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(AgentPos.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(UpAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
Array.Copy(Center.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- AgentData --" + Environment.NewLine;
|
|
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "" + Environment.NewLine;
|
|
output += "AgentID: " + AgentID.ToString() + "" + Environment.NewLine;
|
|
output += "ChangedGrid: " + ChangedGrid.ToString() + "" + Environment.NewLine;
|
|
output += "SessionID: " + SessionID.ToString() + "" + Environment.NewLine;
|
|
output += "LeftAxis: " + LeftAxis.ToString() + "" + Environment.NewLine;
|
|
output += "Size: " + Size.ToString() + "" + Environment.NewLine;
|
|
output += "RegionHandle: " + RegionHandle.ToString() + "" + Environment.NewLine;
|
|
output += "AgentVel: " + AgentVel.ToString() + "" + Environment.NewLine;
|
|
output += "AgentPos: " + AgentPos.ToString() + "" + Environment.NewLine;
|
|
output += "UpAxis: " + UpAxis.ToString() + "" + Environment.NewLine;
|
|
output += "AtAxis: " + AtAxis.ToString() + "" + Environment.NewLine;
|
|
output += "Center: " + Center.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.ChildAgentPositionUpdate; } }
|
|
public AgentDataBlock AgentData;
|
|
|
|
public ChildAgentPositionUpdatePacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 28;
|
|
Header.Reliable = true;
|
|
AgentData = new AgentDataBlock();
|
|
}
|
|
|
|
public ChildAgentPositionUpdatePacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public ChildAgentPositionUpdatePacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
AgentData = new AgentDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += AgentData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
AgentData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- ChildAgentPositionUpdate ---" + Environment.NewLine;
|
|
output += AgentData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
/// <exclude/>
|
|
public class SoundTriggerPacket : Packet
|
|
{
|
|
/// <exclude/>
|
|
[XmlType("soundtrigger_sounddata")]
|
|
public class SoundDataBlock
|
|
{
|
|
public LLUUID ObjectID;
|
|
public float Gain;
|
|
public LLUUID ParentID;
|
|
public LLUUID SoundID;
|
|
public LLUUID OwnerID;
|
|
public ulong Handle;
|
|
public LLVector3 Position;
|
|
|
|
[XmlIgnore]
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return 88;
|
|
}
|
|
}
|
|
|
|
public SoundDataBlock() { }
|
|
public SoundDataBlock(byte[] bytes, ref int i)
|
|
{
|
|
try
|
|
{
|
|
ObjectID = new LLUUID(bytes, i); i += 16;
|
|
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
|
|
Gain = BitConverter.ToSingle(bytes, i); i += 4;
|
|
ParentID = new LLUUID(bytes, i); i += 16;
|
|
SoundID = new LLUUID(bytes, i); i += 16;
|
|
OwnerID = new LLUUID(bytes, i); i += 16;
|
|
Handle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));
|
|
Position = new LLVector3(bytes, i); i += 12;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw new MalformedDataException();
|
|
}
|
|
}
|
|
|
|
public void ToBytes(byte[] bytes, ref int i)
|
|
{
|
|
byte[] ba;
|
|
if(ObjectID == null) { Console.WriteLine("Warning: ObjectID is null, in " + this.GetType()); }
|
|
Array.Copy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
ba = BitConverter.GetBytes(Gain);
|
|
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
|
|
Array.Copy(ba, 0, bytes, i, 4); i += 4;
|
|
if(ParentID == null) { Console.WriteLine("Warning: ParentID is null, in " + this.GetType()); }
|
|
Array.Copy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(SoundID == null) { Console.WriteLine("Warning: SoundID is null, in " + this.GetType()); }
|
|
Array.Copy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
|
|
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
|
bytes[i++] = (byte)(Handle % 256);
|
|
bytes[i++] = (byte)((Handle >> 8) % 256);
|
|
bytes[i++] = (byte)((Handle >> 16) % 256);
|
|
bytes[i++] = (byte)((Handle >> 24) % 256);
|
|
bytes[i++] = (byte)((Handle >> 32) % 256);
|
|
bytes[i++] = (byte)((Handle >> 40) % 256);
|
|
bytes[i++] = (byte)((Handle >> 48) % 256);
|
|
bytes[i++] = (byte)((Handle >> 56) % 256);
|
|
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "-- SoundData --" + Environment.NewLine;
|
|
output += "ObjectID: " + ObjectID.ToString() + "" + Environment.NewLine;
|
|
output += "Gain: " + Gain.ToString() + "" + Environment.NewLine;
|
|
output += "ParentID: " + ParentID.ToString() + "" + Environment.NewLine;
|
|
output += "SoundID: " + SoundID.ToString() + "" + Environment.NewLine;
|
|
output += "OwnerID: " + OwnerID.ToString() + "" + Environment.NewLine;
|
|
output += "Handle: " + Handle.ToString() + "" + Environment.NewLine;
|
|
output += "Position: " + Position.ToString() + "" + Environment.NewLine;
|
|
output = output.Trim();
|
|
return output;
|
|
}
|
|
}
|
|
|
|
private Header header;
|
|
public override Header Header { get { return header; } set { header = value; } }
|
|
public override PacketType Type { get { return PacketType.SoundTrigger; } }
|
|
public SoundDataBlock SoundData;
|
|
|
|
public SoundTriggerPacket()
|
|
{
|
|
Header = new HighHeader();
|
|
Header.ID = 31;
|
|
Header.Reliable = true;
|
|
SoundData = new SoundDataBlock();
|
|
}
|
|
|
|
public SoundTriggerPacket(byte[] bytes, ref int i)
|
|
{
|
|
int packetEnd = bytes.Length - 1;
|
|
Header = new HighHeader(bytes, ref i, ref packetEnd);
|
|
SoundData = new SoundDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public SoundTriggerPacket(Header head, byte[] bytes, ref int i)
|
|
{
|
|
Header = head;
|
|
SoundData = new SoundDataBlock(bytes, ref i);
|
|
}
|
|
|
|
public override byte[] ToBytes()
|
|
{
|
|
int length = 5;
|
|
length += SoundData.Length;;
|
|
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
byte[] bytes = new byte[length];
|
|
int i = 0;
|
|
header.ToBytes(bytes, ref i);
|
|
SoundData.ToBytes(bytes, ref i);
|
|
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
return bytes;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string output = "--- SoundTrigger ---" + Environment.NewLine;
|
|
output += SoundData.ToString() + "" + Environment.NewLine;
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
}
|