Files
libremetaverse/libsecondlife-cs/_Packets_.cs

95224 lines
3.5 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 libsecondlife;
namespace libsecondlife.Packets
{
/// <summary>
/// Thrown when a packet could not be successfully deserialized
/// </summary>
public class MalformedDataException : ApplicationException
{
/// <summary>
///
/// </summary>
public MalformedDataException() { }
/// <summary>
///
/// </summary>
/// <param name="Message"></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>
public abstract class Header
{
/// <summary>The raw header data, does not include appended ACKs</summary>
public byte[] Data;
/// <summary></summary>
public byte Flags
{
get { return Data[0]; }
set { Data[0] = value; }
}
/// <summary></summary>
public bool Reliable
{
get { return (Data[0] & Helpers.MSG_RELIABLE) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_RELIABLE; } else { Data[0] -= (byte)Helpers.MSG_RELIABLE; } }
}
/// <summary></summary>
public bool Resent
{
get { return (Data[0] & Helpers.MSG_RESENT) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_RESENT; } else { Data[0] -= (byte)Helpers.MSG_RESENT; } }
}
/// <summary></summary>
public bool Zerocoded
{
get { return (Data[0] & Helpers.MSG_ZEROCODED) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_ZEROCODED; } else { Data[0] -= (byte)Helpers.MSG_ZEROCODED; } }
}
/// <summary></summary>
public bool AppendedAcks
{
get { return (Data[0] & Helpers.MSG_APPENDED_ACKS) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_APPENDED_ACKS; } else { Data[0] -= (byte)Helpers.MSG_APPENDED_ACKS; } }
}
/// <summary></summary>
public ushort Sequence
{
get { return (ushort)((Data[2] << 8) + Data[3]); }
set { Data[2] = (byte)(value >> 8); Data[3] = (byte)(value % 256); }
}
/// <summary></summary>
public abstract ushort ID { get; set; }
/// <summary></summary>
public abstract PacketFrequency Frequency { get; }
/// <summary></summary>
public abstract void ToBytes(byte[] bytes, ref int i);
/// <summary></summary>
public uint[] AckList;
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="i"></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] = (ushort)((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,
AddCircuitCode,
UseCircuitCode,
LogControl,
RelayLogControl,
LogMessages,
SimulatorAssign,
SpaceServerSimulatorTimeMessage,
AvatarTextureUpdate,
SimulatorMapUpdate,
SimulatorSetMap,
SubscribeLoad,
UnsubscribeLoad,
SimulatorStart,
SimulatorReady,
TelehubInfo,
SimulatorPresentAtLocation,
SimulatorLoad,
SimulatorShutdownRequest,
RegionPresenceRequestByRegionID,
RegionPresenceRequestByHandle,
RegionPresenceResponse,
RecordAgentPresence,
EraseAgentPresence,
AgentPresenceRequest,
AgentPresenceResponse,
UpdateSimulator,
TrackAgentSession,
ClearAgentSessions,
LogDwellTime,
FeatureDisabled,
LogFailedMoneyTransaction,
UserReportInternal,
SetSimStatusInDatabase,
SetSimPresenceInDatabase,
EconomyDataRequest,
EconomyData,
AvatarPickerRequest,
AvatarPickerRequestBackend,
AvatarPickerReply,
PlacesQuery,
PlacesReply,
DirFindQuery,
DirFindQueryBackend,
DirPlacesQuery,
DirPlacesQueryBackend,
DirPlacesReply,
DirPeopleQuery,
DirPeopleQueryBackend,
DirPeopleReply,
DirEventsReply,
DirGroupsQuery,
DirGroupsQueryBackend,
DirGroupsReply,
DirClassifiedQuery,
DirClassifiedQueryBackend,
DirClassifiedReply,
AvatarClassifiedReply,
ClassifiedInfoRequest,
ClassifiedInfoReply,
ClassifiedInfoUpdate,
ClassifiedDelete,
ClassifiedGodDelete,
DirPicksQuery,
DirPicksQueryBackend,
DirPicksReply,
DirLandQuery,
DirLandQueryBackend,
DirLandReply,
DirPopularQuery,
DirPopularQueryBackend,
DirPopularReply,
ParcelInfoRequest,
ParcelInfoReply,
ParcelObjectOwnersRequest,
OnlineStatusRequest,
OnlineStatusReply,
ParcelObjectOwnersReply,
GroupNoticesListRequest,
GroupNoticesListReply,
GroupNoticeRequest,
GroupNoticeAdd,
GroupNoticeDelete,
TeleportRequest,
TeleportLocationRequest,
TeleportLocal,
TeleportLandmarkRequest,
TeleportProgress,
DataAgentAccessRequest,
DataAgentAccessReply,
DataHomeLocationRequest,
DataHomeLocationReply,
SpaceLocationTeleportRequest,
SpaceLocationTeleportReply,
TeleportFinish,
StartLure,
TeleportLureRequest,
TeleportCancel,
CompleteLure,
TeleportStart,
TeleportFailed,
LeaderBoardRequest,
LeaderBoardData,
RegisterNewAgent,
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,
GrantModification,
RevokeModification,
RequestGrantedProxies,
GrantedProxies,
AddModifyAbility,
RemoveModifyAbility,
ViewerStats,
ScriptAnswerYes,
UserReport,
AlertMessage,
AgentAlertMessage,
MeanCollisionAlert,
ViewerFrozenMessage,
HealthMessage,
ChatFromSimulator,
SimStats,
RequestRegionInfo,
RegionInfo,
GodUpdateRegionInfo,
NearestLandingRegionRequest,
NearestLandingRegionReply,
NearestLandingRegionUpdated,
TeleportLandingStatusChanged,
RegionHandshake,
RegionHandshakeReply,
SimulatorViewerTimeMessage,
EnableSimulator,
DisableSimulator,
TransferRequest,
TransferInfo,
TransferAbort,
TransferPriority,
RequestXfer,
AbortXfer,
RequestAvatarInfo,
AvatarAppearance,
SetFollowCamProperties,
ClearFollowCamProperties,
RequestPayPrice,
PayPriceReply,
KickUser,
KickUserAck,
GodKickUser,
SystemKickUser,
EjectUser,
FreezeUser,
AvatarPropertiesRequest,
AvatarPropertiesRequestBackend,
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,
RequestParcelTransfer,
UpdateParcel,
RemoveParcel,
MergeParcel,
LogParcelChanges,
CheckParcelSales,
ParcelSales,
ParcelGodMarkAsContent,
ParcelGodReserveForNewbie,
ViewerStartAuction,
StartAuction,
ConfirmAuctionStart,
CompleteAuction,
CancelAuction,
CheckParcelAuctions,
ParcelAuctions,
UUIDNameRequest,
UUIDNameReply,
UUIDGroupNameRequest,
UUIDGroupNameReply,
ChatPass,
ChildAgentDying,
ChildAgentUnknown,
KillChildAgents,
GetScriptRunning,
ScriptRunningReply,
SetScriptRunning,
ScriptReset,
ScriptSensorRequest,
ScriptSensorReply,
CompleteAgentMovement,
AgentMovementComplete,
LogLogin,
ConnectAgentToUserserver,
ConnectToUserserver,
DataServerLogout,
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,
TransferInventory,
TransferInventoryAck,
RequestFriendship,
AcceptFriendship,
DeclineFriendship,
FormFriendship,
TerminateFriendship,
OfferCallingCard,
AcceptCallingCard,
DeclineCallingCard,
RezScript,
CreateInventoryItem,
CreateLandmarkForEvent,
EventLocationRequest,
EventLocationReply,
RegionHandleRequest,
RegionIDAndHandleReply,
MoneyTransferRequest,
MoneyTransferBackend,
BulkMoneyTransfer,
AdjustBalance,
MoneyBalanceRequest,
MoneyBalanceReply,
RoutedMoneyBalanceReply,
MoneyHistoryRequest,
MoneyHistoryReply,
MoneySummaryRequest,
MoneySummaryReply,
MoneyDetailsRequest,
MoneyDetailsReply,
MoneyTransactionsRequest,
MoneyTransactionsReply,
GestureRequest,
ActivateGestures,
DeactivateGestures,
InventoryUpdate,
MuteListUpdate,
UseCachedMuteList,
UserLoginLocationReply,
UserSimLocationReply,
UserListReply,
OnlineNotification,
OfflineNotification,
SetStartLocationRequest,
SetStartLocation,
UserLoginLocationRequest,
SpaceLoginLocationReply,
NetTest,
SetCPURatio,
SimCrashed,
SimulatorPauseState,
SimulatorThrottleSettings,
NameValuePair,
RemoveNameValuePair,
GetNameValuePair,
UpdateAttachment,
RemoveAttachment,
AssetUploadRequest,
AssetUploadComplete,
ReputationAgentAssign,
ReputationIndividualRequest,
ReputationIndividualReply,
EmailMessageRequest,
EmailMessageReply,
ScriptDataRequest,
ScriptDataReply,
CreateGroupRequest,
CreateGroupReply,
UpdateGroupInfo,
GroupRoleChanges,
JoinGroupRequest,
JoinGroupReply,
EjectGroupMemberRequest,
EjectGroupMemberReply,
LeaveGroupRequest,
LeaveGroupReply,
InviteGroupRequest,
InviteGroupResponse,
GroupProfileRequest,
GroupProfileReply,
GroupAccountSummaryRequest,
GroupAccountSummaryReply,
GroupAccountDetailsRequest,
GroupAccountDetailsReply,
GroupAccountTransactionsRequest,
GroupAccountTransactionsReply,
GroupActiveProposalsRequest,
GroupActiveProposalItemReply,
GroupVoteHistoryRequest,
GroupVoteHistoryItemReply,
StartGroupProposal,
GroupProposalBallot,
TallyVotes,
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,
LogTextMessage,
CreateTrustedCircuit,
DenyTrustedCircuit,
RezSingleAttachmentFromInv,
RezMultipleAttachmentsFromInv,
DetachAttachmentIntoInv,
CreateNewOutfitAttachments,
UserInfoRequest,
UserInfoReply,
UpdateUserInfo,
GodExpungeUser,
StartExpungeProcess,
StartExpungeProcessAck,
StartParcelRename,
StartParcelRenameAck,
BulkParcelRename,
ParcelRename,
StartParcelRemove,
StartParcelRemoveAck,
BulkParcelRemove,
InitiateUpload,
InitiateDownload,
SystemMessage,
MapLayerRequest,
MapLayerReply,
MapBlockRequest,
MapNameRequest,
MapBlockReply,
MapItemRequest,
MapItemReply,
SendPostcard,
RpcChannelRequest,
RpcChannelReply,
RpcScriptRequestInbound,
RpcScriptRequestInboundForward,
RpcScriptReplyInbound,
MailTaskSimRequest,
MailTaskSimReply,
ScriptMailRegistration,
ParcelMediaCommandMessage,
ParcelMediaUpdate,
LandStatRequest,
LandStatReply,
SecuredTemplateChecksumRequest,
PacketAck,
OpenCircuit,
CloseCircuit,
TemplateChecksumRequest,
TemplateChecksumReply,
ClosestSimulator,
ObjectAdd,
MultipleObjectUpdate,
RequestMultipleObjects,
ObjectPosition,
RequestObjectPropertiesFamily,
CoarseLocationUpdate,
CrossedRegion,
ConfirmEnableSimulator,
ObjectProperties,
ObjectPropertiesFamily,
ParcelPropertiesRequest,
SimStatus,
GestureUpdate,
AttachedSound,
AttachedSoundGainChange,
AttachedSoundCutoffRadius,
PreloadSound,
InternalScriptMail,
ViewerEffect,
SetSunPhase,
StartPingCheck,
CompletePingCheck,
NeighborList,
MovedIntoSimulator,
AgentUpdate,
AgentAnimation,
AgentRequestSit,
AgentSit,
RequestImage,
ImageData,
ImagePacket,
LayerData,
ObjectUpdate,
ObjectUpdateCompressed,
ObjectUpdateCached,
ImprovedTerseObjectUpdate,
KillObject,
AgentToNewRegion,
TransferPacket,
SendXferPacket,
ConfirmXferPacket,
AvatarAnimation,
AvatarSitResponse,
CameraConstraint,
ParcelProperties,
EdgeDataPacket,
ChildAgentUpdate,
ChildAgentAlive,
ChildAgentPositionUpdate,
PassObject,
AtomicPassObject,
SoundTrigger,
}
public abstract class Packet
{
public abstract Header Header { get; set; }
public abstract PacketType Type { get; }
public int TickCount;
public abstract byte[] ToBytes();
public static PacketType GetType(ushort id, PacketFrequency frequency)
{
switch (frequency)
{
case PacketFrequency.Low:
switch (id)
{
case 1: return PacketType.TestMessage;
case 2: return PacketType.AddCircuitCode;
case 3: return PacketType.UseCircuitCode;
case 4: return PacketType.LogControl;
case 5: return PacketType.RelayLogControl;
case 6: return PacketType.LogMessages;
case 7: return PacketType.SimulatorAssign;
case 8: return PacketType.SpaceServerSimulatorTimeMessage;
case 9: return PacketType.AvatarTextureUpdate;
case 10: return PacketType.SimulatorMapUpdate;
case 11: return PacketType.SimulatorSetMap;
case 12: return PacketType.SubscribeLoad;
case 13: return PacketType.UnsubscribeLoad;
case 14: return PacketType.SimulatorStart;
case 15: return PacketType.SimulatorReady;
case 16: return PacketType.TelehubInfo;
case 17: return PacketType.SimulatorPresentAtLocation;
case 18: return PacketType.SimulatorLoad;
case 19: return PacketType.SimulatorShutdownRequest;
case 20: return PacketType.RegionPresenceRequestByRegionID;
case 21: return PacketType.RegionPresenceRequestByHandle;
case 22: return PacketType.RegionPresenceResponse;
case 23: return PacketType.RecordAgentPresence;
case 24: return PacketType.EraseAgentPresence;
case 25: return PacketType.AgentPresenceRequest;
case 26: return PacketType.AgentPresenceResponse;
case 27: return PacketType.UpdateSimulator;
case 28: return PacketType.TrackAgentSession;
case 29: return PacketType.ClearAgentSessions;
case 30: return PacketType.LogDwellTime;
case 31: return PacketType.FeatureDisabled;
case 32: return PacketType.LogFailedMoneyTransaction;
case 33: return PacketType.UserReportInternal;
case 34: return PacketType.SetSimStatusInDatabase;
case 35: return PacketType.SetSimPresenceInDatabase;
case 36: return PacketType.EconomyDataRequest;
case 37: return PacketType.EconomyData;
case 38: return PacketType.AvatarPickerRequest;
case 39: return PacketType.AvatarPickerRequestBackend;
case 40: return PacketType.AvatarPickerReply;
case 41: return PacketType.PlacesQuery;
case 42: return PacketType.PlacesReply;
case 43: return PacketType.DirFindQuery;
case 44: return PacketType.DirFindQueryBackend;
case 45: return PacketType.DirPlacesQuery;
case 46: return PacketType.DirPlacesQueryBackend;
case 47: return PacketType.DirPlacesReply;
case 48: return PacketType.DirPeopleQuery;
case 49: return PacketType.DirPeopleQueryBackend;
case 50: return PacketType.DirPeopleReply;
case 51: return PacketType.DirEventsReply;
case 52: return PacketType.DirGroupsQuery;
case 53: return PacketType.DirGroupsQueryBackend;
case 54: return PacketType.DirGroupsReply;
case 55: return PacketType.DirClassifiedQuery;
case 56: return PacketType.DirClassifiedQueryBackend;
case 57: return PacketType.DirClassifiedReply;
case 58: return PacketType.AvatarClassifiedReply;
case 59: return PacketType.ClassifiedInfoRequest;
case 60: return PacketType.ClassifiedInfoReply;
case 61: return PacketType.ClassifiedInfoUpdate;
case 62: return PacketType.ClassifiedDelete;
case 63: return PacketType.ClassifiedGodDelete;
case 64: return PacketType.DirPicksQuery;
case 65: return PacketType.DirPicksQueryBackend;
case 66: return PacketType.DirPicksReply;
case 67: return PacketType.DirLandQuery;
case 68: return PacketType.DirLandQueryBackend;
case 69: return PacketType.DirLandReply;
case 70: return PacketType.DirPopularQuery;
case 71: return PacketType.DirPopularQueryBackend;
case 72: return PacketType.DirPopularReply;
case 73: return PacketType.ParcelInfoRequest;
case 74: return PacketType.ParcelInfoReply;
case 75: return PacketType.ParcelObjectOwnersRequest;
case 76: return PacketType.OnlineStatusRequest;
case 77: return PacketType.OnlineStatusReply;
case 78: return PacketType.ParcelObjectOwnersReply;
case 79: return PacketType.GroupNoticesListRequest;
case 80: return PacketType.GroupNoticesListReply;
case 81: return PacketType.GroupNoticeRequest;
case 82: return PacketType.GroupNoticeAdd;
case 83: return PacketType.GroupNoticeDelete;
case 84: return PacketType.TeleportRequest;
case 85: return PacketType.TeleportLocationRequest;
case 86: return PacketType.TeleportLocal;
case 87: return PacketType.TeleportLandmarkRequest;
case 88: return PacketType.TeleportProgress;
case 89: return PacketType.DataAgentAccessRequest;
case 90: return PacketType.DataAgentAccessReply;
case 91: return PacketType.DataHomeLocationRequest;
case 92: return PacketType.DataHomeLocationReply;
case 93: return PacketType.SpaceLocationTeleportRequest;
case 94: return PacketType.SpaceLocationTeleportReply;
case 95: return PacketType.TeleportFinish;
case 96: return PacketType.StartLure;
case 97: return PacketType.TeleportLureRequest;
case 98: return PacketType.TeleportCancel;
case 99: return PacketType.CompleteLure;
case 100: return PacketType.TeleportStart;
case 101: return PacketType.TeleportFailed;
case 102: return PacketType.LeaderBoardRequest;
case 103: return PacketType.LeaderBoardData;
case 104: return PacketType.RegisterNewAgent;
case 105: return PacketType.Undo;
case 106: return PacketType.Redo;
case 107: return PacketType.UndoLand;
case 108: return PacketType.RedoLand;
case 109: return PacketType.AgentPause;
case 110: return PacketType.AgentResume;
case 111: return PacketType.ChatFromViewer;
case 112: return PacketType.AgentThrottle;
case 113: return PacketType.AgentFOV;
case 114: return PacketType.AgentHeightWidth;
case 115: return PacketType.AgentSetAppearance;
case 116: return PacketType.AgentQuit;
case 117: return PacketType.AgentQuitCopy;
case 118: return PacketType.ImageNotInDatabase;
case 119: return PacketType.RebakeAvatarTextures;
case 120: return PacketType.SetAlwaysRun;
case 121: return PacketType.ObjectDelete;
case 122: return PacketType.ObjectDuplicate;
case 123: return PacketType.ObjectDuplicateOnRay;
case 124: return PacketType.ObjectScale;
case 125: return PacketType.ObjectRotation;
case 126: return PacketType.ObjectFlagUpdate;
case 127: return PacketType.ObjectClickAction;
case 128: return PacketType.ObjectImage;
case 129: return PacketType.ObjectMaterial;
case 130: return PacketType.ObjectShape;
case 131: return PacketType.ObjectExtraParams;
case 132: return PacketType.ObjectOwner;
case 133: return PacketType.ObjectGroup;
case 134: return PacketType.ObjectBuy;
case 135: return PacketType.BuyObjectInventory;
case 136: return PacketType.DerezContainer;
case 137: return PacketType.ObjectPermissions;
case 138: return PacketType.ObjectSaleInfo;
case 139: return PacketType.ObjectName;
case 140: return PacketType.ObjectDescription;
case 141: return PacketType.ObjectCategory;
case 142: return PacketType.ObjectSelect;
case 143: return PacketType.ObjectDeselect;
case 144: return PacketType.ObjectAttach;
case 145: return PacketType.ObjectDetach;
case 146: return PacketType.ObjectDrop;
case 147: return PacketType.ObjectLink;
case 148: return PacketType.ObjectDelink;
case 149: return PacketType.ObjectHinge;
case 150: return PacketType.ObjectDehinge;
case 151: return PacketType.ObjectGrab;
case 152: return PacketType.ObjectGrabUpdate;
case 153: return PacketType.ObjectDeGrab;
case 154: return PacketType.ObjectSpinStart;
case 155: return PacketType.ObjectSpinUpdate;
case 156: return PacketType.ObjectSpinStop;
case 157: return PacketType.ObjectExportSelected;
case 158: return PacketType.ObjectImport;
case 159: return PacketType.ModifyLand;
case 160: return PacketType.VelocityInterpolateOn;
case 161: return PacketType.VelocityInterpolateOff;
case 162: return PacketType.StateSave;
case 163: return PacketType.ReportAutosaveCrash;
case 164: return PacketType.SimWideDeletes;
case 165: return PacketType.TrackAgent;
case 166: return PacketType.GrantModification;
case 167: return PacketType.RevokeModification;
case 168: return PacketType.RequestGrantedProxies;
case 169: return PacketType.GrantedProxies;
case 170: return PacketType.AddModifyAbility;
case 171: return PacketType.RemoveModifyAbility;
case 172: return PacketType.ViewerStats;
case 173: return PacketType.ScriptAnswerYes;
case 174: return PacketType.UserReport;
case 175: return PacketType.AlertMessage;
case 176: return PacketType.AgentAlertMessage;
case 177: return PacketType.MeanCollisionAlert;
case 178: return PacketType.ViewerFrozenMessage;
case 179: return PacketType.HealthMessage;
case 180: return PacketType.ChatFromSimulator;
case 181: return PacketType.SimStats;
case 182: return PacketType.RequestRegionInfo;
case 183: return PacketType.RegionInfo;
case 184: return PacketType.GodUpdateRegionInfo;
case 185: return PacketType.NearestLandingRegionRequest;
case 186: return PacketType.NearestLandingRegionReply;
case 187: return PacketType.NearestLandingRegionUpdated;
case 188: return PacketType.TeleportLandingStatusChanged;
case 189: return PacketType.RegionHandshake;
case 190: return PacketType.RegionHandshakeReply;
case 191: return PacketType.SimulatorViewerTimeMessage;
case 192: return PacketType.EnableSimulator;
case 193: return PacketType.DisableSimulator;
case 194: return PacketType.TransferRequest;
case 195: return PacketType.TransferInfo;
case 196: return PacketType.TransferAbort;
case 197: return PacketType.TransferPriority;
case 198: return PacketType.RequestXfer;
case 199: return PacketType.AbortXfer;
case 200: return PacketType.RequestAvatarInfo;
case 201: return PacketType.AvatarAppearance;
case 202: return PacketType.SetFollowCamProperties;
case 203: return PacketType.ClearFollowCamProperties;
case 204: return PacketType.RequestPayPrice;
case 205: return PacketType.PayPriceReply;
case 206: return PacketType.KickUser;
case 207: return PacketType.KickUserAck;
case 208: return PacketType.GodKickUser;
case 209: return PacketType.SystemKickUser;
case 210: return PacketType.EjectUser;
case 211: return PacketType.FreezeUser;
case 212: return PacketType.AvatarPropertiesRequest;
case 213: return PacketType.AvatarPropertiesRequestBackend;
case 214: return PacketType.AvatarPropertiesReply;
case 215: return PacketType.AvatarInterestsReply;
case 216: return PacketType.AvatarGroupsReply;
case 217: return PacketType.AvatarPropertiesUpdate;
case 218: return PacketType.AvatarInterestsUpdate;
case 219: return PacketType.AvatarStatisticsReply;
case 220: return PacketType.AvatarNotesReply;
case 221: return PacketType.AvatarNotesUpdate;
case 222: return PacketType.AvatarPicksReply;
case 223: return PacketType.EventInfoRequest;
case 224: return PacketType.EventInfoReply;
case 225: return PacketType.EventNotificationAddRequest;
case 226: return PacketType.EventNotificationRemoveRequest;
case 227: return PacketType.EventGodDelete;
case 228: return PacketType.PickInfoRequest;
case 229: return PacketType.PickInfoReply;
case 230: return PacketType.PickInfoUpdate;
case 231: return PacketType.PickDelete;
case 232: return PacketType.PickGodDelete;
case 233: return PacketType.ScriptQuestion;
case 234: return PacketType.ScriptControlChange;
case 235: return PacketType.ScriptDialog;
case 236: return PacketType.ScriptDialogReply;
case 237: return PacketType.ForceScriptControlRelease;
case 238: return PacketType.RevokePermissions;
case 239: return PacketType.LoadURL;
case 240: return PacketType.ScriptTeleportRequest;
case 241: return PacketType.ParcelOverlay;
case 242: return PacketType.ParcelPropertiesRequestByID;
case 243: return PacketType.ParcelPropertiesUpdate;
case 244: return PacketType.ParcelReturnObjects;
case 245: return PacketType.ParcelSetOtherCleanTime;
case 246: return PacketType.ParcelDisableObjects;
case 247: return PacketType.ParcelSelectObjects;
case 248: return PacketType.EstateCovenantRequest;
case 249: return PacketType.EstateCovenantReply;
case 250: return PacketType.ForceObjectSelect;
case 251: return PacketType.ParcelBuyPass;
case 252: return PacketType.ParcelDeedToGroup;
case 253: return PacketType.ParcelReclaim;
case 254: return PacketType.ParcelClaim;
case 255: return PacketType.ParcelJoin;
case 256: return PacketType.ParcelDivide;
case 257: return PacketType.ParcelRelease;
case 258: return PacketType.ParcelBuy;
case 259: return PacketType.ParcelGodForceOwner;
case 260: return PacketType.ParcelAccessListRequest;
case 261: return PacketType.ParcelAccessListReply;
case 262: return PacketType.ParcelAccessListUpdate;
case 263: return PacketType.ParcelDwellRequest;
case 264: return PacketType.ParcelDwellReply;
case 265: return PacketType.RequestParcelTransfer;
case 266: return PacketType.UpdateParcel;
case 267: return PacketType.RemoveParcel;
case 268: return PacketType.MergeParcel;
case 269: return PacketType.LogParcelChanges;
case 270: return PacketType.CheckParcelSales;
case 271: return PacketType.ParcelSales;
case 272: return PacketType.ParcelGodMarkAsContent;
case 273: return PacketType.ParcelGodReserveForNewbie;
case 274: return PacketType.ViewerStartAuction;
case 275: return PacketType.StartAuction;
case 276: return PacketType.ConfirmAuctionStart;
case 277: return PacketType.CompleteAuction;
case 278: return PacketType.CancelAuction;
case 279: return PacketType.CheckParcelAuctions;
case 280: return PacketType.ParcelAuctions;
case 281: return PacketType.UUIDNameRequest;
case 282: return PacketType.UUIDNameReply;
case 283: return PacketType.UUIDGroupNameRequest;
case 284: return PacketType.UUIDGroupNameReply;
case 285: return PacketType.ChatPass;
case 286: return PacketType.ChildAgentDying;
case 287: return PacketType.ChildAgentUnknown;
case 288: return PacketType.KillChildAgents;
case 289: return PacketType.GetScriptRunning;
case 290: return PacketType.ScriptRunningReply;
case 291: return PacketType.SetScriptRunning;
case 292: return PacketType.ScriptReset;
case 293: return PacketType.ScriptSensorRequest;
case 294: return PacketType.ScriptSensorReply;
case 295: return PacketType.CompleteAgentMovement;
case 296: return PacketType.AgentMovementComplete;
case 297: return PacketType.LogLogin;
case 298: return PacketType.ConnectAgentToUserserver;
case 299: return PacketType.ConnectToUserserver;
case 300: return PacketType.DataServerLogout;
case 301: return PacketType.LogoutRequest;
case 302: return PacketType.FinalizeLogout;
case 303: return PacketType.LogoutReply;
case 304: return PacketType.LogoutDemand;
case 305: return PacketType.ImprovedInstantMessage;
case 306: return PacketType.RetrieveInstantMessages;
case 307: return PacketType.DequeueInstantMessages;
case 308: return PacketType.FindAgent;
case 309: return PacketType.RequestGodlikePowers;
case 310: return PacketType.GrantGodlikePowers;
case 311: return PacketType.GodlikeMessage;
case 312: return PacketType.EstateOwnerMessage;
case 313: return PacketType.GenericMessage;
case 314: return PacketType.MuteListRequest;
case 315: return PacketType.UpdateMuteListEntry;
case 316: return PacketType.RemoveMuteListEntry;
case 317: return PacketType.CopyInventoryFromNotecard;
case 318: return PacketType.UpdateInventoryItem;
case 319: return PacketType.UpdateCreateInventoryItem;
case 320: return PacketType.MoveInventoryItem;
case 321: return PacketType.CopyInventoryItem;
case 322: return PacketType.RemoveInventoryItem;
case 323: return PacketType.ChangeInventoryItemFlags;
case 324: return PacketType.SaveAssetIntoInventory;
case 325: return PacketType.CreateInventoryFolder;
case 326: return PacketType.UpdateInventoryFolder;
case 327: return PacketType.MoveInventoryFolder;
case 328: return PacketType.RemoveInventoryFolder;
case 329: return PacketType.FetchInventoryDescendents;
case 330: return PacketType.InventoryDescendents;
case 331: return PacketType.FetchInventory;
case 332: return PacketType.FetchInventoryReply;
case 333: return PacketType.BulkUpdateInventory;
case 334: return PacketType.RequestInventoryAsset;
case 335: return PacketType.InventoryAssetResponse;
case 336: return PacketType.RemoveInventoryObjects;
case 337: return PacketType.PurgeInventoryDescendents;
case 338: return PacketType.UpdateTaskInventory;
case 339: return PacketType.RemoveTaskInventory;
case 340: return PacketType.MoveTaskInventory;
case 341: return PacketType.RequestTaskInventory;
case 342: return PacketType.ReplyTaskInventory;
case 343: return PacketType.DeRezObject;
case 344: return PacketType.DeRezAck;
case 345: return PacketType.RezObject;
case 346: return PacketType.RezObjectFromNotecard;
case 347: return PacketType.DeclineInventory;
case 348: return PacketType.TransferInventory;
case 349: return PacketType.TransferInventoryAck;
case 350: return PacketType.RequestFriendship;
case 351: return PacketType.AcceptFriendship;
case 352: return PacketType.DeclineFriendship;
case 353: return PacketType.FormFriendship;
case 354: return PacketType.TerminateFriendship;
case 355: return PacketType.OfferCallingCard;
case 356: return PacketType.AcceptCallingCard;
case 357: return PacketType.DeclineCallingCard;
case 358: return PacketType.RezScript;
case 359: return PacketType.CreateInventoryItem;
case 360: return PacketType.CreateLandmarkForEvent;
case 361: return PacketType.EventLocationRequest;
case 362: return PacketType.EventLocationReply;
case 363: return PacketType.RegionHandleRequest;
case 364: return PacketType.RegionIDAndHandleReply;
case 365: return PacketType.MoneyTransferRequest;
case 366: return PacketType.MoneyTransferBackend;
case 367: return PacketType.BulkMoneyTransfer;
case 368: return PacketType.AdjustBalance;
case 369: return PacketType.MoneyBalanceRequest;
case 370: return PacketType.MoneyBalanceReply;
case 371: return PacketType.RoutedMoneyBalanceReply;
case 372: return PacketType.MoneyHistoryRequest;
case 373: return PacketType.MoneyHistoryReply;
case 374: return PacketType.MoneySummaryRequest;
case 375: return PacketType.MoneySummaryReply;
case 376: return PacketType.MoneyDetailsRequest;
case 377: return PacketType.MoneyDetailsReply;
case 378: return PacketType.MoneyTransactionsRequest;
case 379: return PacketType.MoneyTransactionsReply;
case 380: return PacketType.GestureRequest;
case 381: return PacketType.ActivateGestures;
case 382: return PacketType.DeactivateGestures;
case 383: return PacketType.InventoryUpdate;
case 384: return PacketType.MuteListUpdate;
case 385: return PacketType.UseCachedMuteList;
case 386: return PacketType.UserLoginLocationReply;
case 387: return PacketType.UserSimLocationReply;
case 388: return PacketType.UserListReply;
case 389: return PacketType.OnlineNotification;
case 390: return PacketType.OfflineNotification;
case 391: return PacketType.SetStartLocationRequest;
case 392: return PacketType.SetStartLocation;
case 393: return PacketType.UserLoginLocationRequest;
case 394: return PacketType.SpaceLoginLocationReply;
case 395: return PacketType.NetTest;
case 396: return PacketType.SetCPURatio;
case 397: return PacketType.SimCrashed;
case 398: return PacketType.SimulatorPauseState;
case 399: return PacketType.SimulatorThrottleSettings;
case 400: return PacketType.NameValuePair;
case 401: return PacketType.RemoveNameValuePair;
case 402: return PacketType.GetNameValuePair;
case 403: return PacketType.UpdateAttachment;
case 404: return PacketType.RemoveAttachment;
case 405: return PacketType.AssetUploadRequest;
case 406: return PacketType.AssetUploadComplete;
case 407: return PacketType.ReputationAgentAssign;
case 408: return PacketType.ReputationIndividualRequest;
case 409: return PacketType.ReputationIndividualReply;
case 410: return PacketType.EmailMessageRequest;
case 411: return PacketType.EmailMessageReply;
case 412: return PacketType.ScriptDataRequest;
case 413: return PacketType.ScriptDataReply;
case 414: return PacketType.CreateGroupRequest;
case 415: return PacketType.CreateGroupReply;
case 416: return PacketType.UpdateGroupInfo;
case 417: return PacketType.GroupRoleChanges;
case 418: return PacketType.JoinGroupRequest;
case 419: return PacketType.JoinGroupReply;
case 420: return PacketType.EjectGroupMemberRequest;
case 421: return PacketType.EjectGroupMemberReply;
case 422: return PacketType.LeaveGroupRequest;
case 423: return PacketType.LeaveGroupReply;
case 424: return PacketType.InviteGroupRequest;
case 425: return PacketType.InviteGroupResponse;
case 426: return PacketType.GroupProfileRequest;
case 427: return PacketType.GroupProfileReply;
case 428: return PacketType.GroupAccountSummaryRequest;
case 429: return PacketType.GroupAccountSummaryReply;
case 430: return PacketType.GroupAccountDetailsRequest;
case 431: return PacketType.GroupAccountDetailsReply;
case 432: return PacketType.GroupAccountTransactionsRequest;
case 433: return PacketType.GroupAccountTransactionsReply;
case 434: return PacketType.GroupActiveProposalsRequest;
case 435: return PacketType.GroupActiveProposalItemReply;
case 436: return PacketType.GroupVoteHistoryRequest;
case 437: return PacketType.GroupVoteHistoryItemReply;
case 438: return PacketType.StartGroupProposal;
case 439: return PacketType.GroupProposalBallot;
case 440: return PacketType.TallyVotes;
case 441: return PacketType.GroupMembersRequest;
case 442: return PacketType.GroupMembersReply;
case 443: return PacketType.ActivateGroup;
case 444: return PacketType.SetGroupContribution;
case 445: return PacketType.SetGroupAcceptNotices;
case 446: return PacketType.GroupRoleDataRequest;
case 447: return PacketType.GroupRoleDataReply;
case 448: return PacketType.GroupRoleMembersRequest;
case 449: return PacketType.GroupRoleMembersReply;
case 450: return PacketType.GroupTitlesRequest;
case 451: return PacketType.GroupTitlesReply;
case 452: return PacketType.GroupTitleUpdate;
case 453: return PacketType.GroupRoleUpdate;
case 454: return PacketType.LiveHelpGroupRequest;
case 455: return PacketType.LiveHelpGroupReply;
case 456: return PacketType.AgentWearablesRequest;
case 457: return PacketType.AgentWearablesUpdate;
case 458: return PacketType.AgentIsNowWearing;
case 459: return PacketType.AgentCachedTexture;
case 460: return PacketType.AgentCachedTextureResponse;
case 461: return PacketType.AgentDataUpdateRequest;
case 462: return PacketType.AgentDataUpdate;
case 463: return PacketType.GroupDataUpdate;
case 464: return PacketType.AgentGroupDataUpdate;
case 465: return PacketType.AgentDropGroup;
case 466: return PacketType.LogTextMessage;
case 467: return PacketType.CreateTrustedCircuit;
case 468: return PacketType.DenyTrustedCircuit;
case 469: return PacketType.RezSingleAttachmentFromInv;
case 470: return PacketType.RezMultipleAttachmentsFromInv;
case 471: return PacketType.DetachAttachmentIntoInv;
case 472: return PacketType.CreateNewOutfitAttachments;
case 473: return PacketType.UserInfoRequest;
case 474: return PacketType.UserInfoReply;
case 475: return PacketType.UpdateUserInfo;
case 476: return PacketType.GodExpungeUser;
case 477: return PacketType.StartExpungeProcess;
case 478: return PacketType.StartExpungeProcessAck;
case 479: return PacketType.StartParcelRename;
case 480: return PacketType.StartParcelRenameAck;
case 481: return PacketType.BulkParcelRename;
case 482: return PacketType.ParcelRename;
case 483: return PacketType.StartParcelRemove;
case 484: return PacketType.StartParcelRemoveAck;
case 485: return PacketType.BulkParcelRemove;
case 486: return PacketType.InitiateUpload;
case 487: return PacketType.InitiateDownload;
case 488: return PacketType.SystemMessage;
case 489: return PacketType.MapLayerRequest;
case 490: return PacketType.MapLayerReply;
case 491: return PacketType.MapBlockRequest;
case 492: return PacketType.MapNameRequest;
case 493: return PacketType.MapBlockReply;
case 494: return PacketType.MapItemRequest;
case 495: return PacketType.MapItemReply;
case 496: return PacketType.SendPostcard;
case 497: return PacketType.RpcChannelRequest;
case 498: return PacketType.RpcChannelReply;
case 499: return PacketType.RpcScriptRequestInbound;
case 500: return PacketType.RpcScriptRequestInboundForward;
case 501: return PacketType.RpcScriptReplyInbound;
case 502: return PacketType.MailTaskSimRequest;
case 503: return PacketType.MailTaskSimReply;
case 504: return PacketType.ScriptMailRegistration;
case 505: return PacketType.ParcelMediaCommandMessage;
case 506: return PacketType.ParcelMediaUpdate;
case 507: return PacketType.LandStatRequest;
case 508: 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 1: return PacketType.ClosestSimulator;
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 13: return PacketType.SimStatus;
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 19: return PacketType.InternalScriptMail;
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 3: return PacketType.NeighborList;
case 4: return PacketType.MovedIntoSimulator;
case 5: return PacketType.AgentUpdate;
case 6: return PacketType.AgentAnimation;
case 7: return PacketType.AgentRequestSit;
case 8: return PacketType.AgentSit;
case 9: return PacketType.RequestImage;
case 10: return PacketType.ImageData;
case 11: return PacketType.ImagePacket;
case 12: return PacketType.LayerData;
case 13: return PacketType.ObjectUpdate;
case 14: return PacketType.ObjectUpdateCompressed;
case 15: return PacketType.ObjectUpdateCached;
case 16: return PacketType.ImprovedTerseObjectUpdate;
case 17: return PacketType.KillObject;
case 18: return PacketType.AgentToNewRegion;
case 19: return PacketType.TransferPacket;
case 20: return PacketType.SendXferPacket;
case 21: return PacketType.ConfirmXferPacket;
case 22: return PacketType.AvatarAnimation;
case 23: return PacketType.AvatarSitResponse;
case 24: return PacketType.CameraConstraint;
case 25: return PacketType.ParcelProperties;
case 26: return PacketType.EdgeDataPacket;
case 27: return PacketType.ChildAgentUpdate;
case 28: return PacketType.ChildAgentAlive;
case 29: return PacketType.ChildAgentPositionUpdate;
case 30: return PacketType.PassObject;
case 31: return PacketType.AtomicPassObject;
case 32: return PacketType.SoundTrigger;
}
break;
}
return PacketType.Default;
}
public static Packet BuildPacket(byte[] bytes, ref int packetEnd)
{
ushort id;
int i = 0;
Header header = Header.BuildHeader(bytes, ref i, ref packetEnd);
if (header.Zerocoded)
{
byte[] zeroBuffer = new byte[8192];
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 2: return new AddCircuitCodePacket(header, bytes, ref i);
case 3: return new UseCircuitCodePacket(header, bytes, ref i);
case 4: return new LogControlPacket(header, bytes, ref i);
case 5: return new RelayLogControlPacket(header, bytes, ref i);
case 6: return new LogMessagesPacket(header, bytes, ref i);
case 7: return new SimulatorAssignPacket(header, bytes, ref i);
case 8: return new SpaceServerSimulatorTimeMessagePacket(header, bytes, ref i);
case 9: return new AvatarTextureUpdatePacket(header, bytes, ref i);
case 10: return new SimulatorMapUpdatePacket(header, bytes, ref i);
case 11: return new SimulatorSetMapPacket(header, bytes, ref i);
case 12: return new SubscribeLoadPacket(header, bytes, ref i);
case 13: return new UnsubscribeLoadPacket(header, bytes, ref i);
case 14: return new SimulatorStartPacket(header, bytes, ref i);
case 15: return new SimulatorReadyPacket(header, bytes, ref i);
case 16: return new TelehubInfoPacket(header, bytes, ref i);
case 17: return new SimulatorPresentAtLocationPacket(header, bytes, ref i);
case 18: return new SimulatorLoadPacket(header, bytes, ref i);
case 19: return new SimulatorShutdownRequestPacket(header, bytes, ref i);
case 20: return new RegionPresenceRequestByRegionIDPacket(header, bytes, ref i);
case 21: return new RegionPresenceRequestByHandlePacket(header, bytes, ref i);
case 22: return new RegionPresenceResponsePacket(header, bytes, ref i);
case 23: return new RecordAgentPresencePacket(header, bytes, ref i);
case 24: return new EraseAgentPresencePacket(header, bytes, ref i);
case 25: return new AgentPresenceRequestPacket(header, bytes, ref i);
case 26: return new AgentPresenceResponsePacket(header, bytes, ref i);
case 27: return new UpdateSimulatorPacket(header, bytes, ref i);
case 28: return new TrackAgentSessionPacket(header, bytes, ref i);
case 29: return new ClearAgentSessionsPacket(header, bytes, ref i);
case 30: return new LogDwellTimePacket(header, bytes, ref i);
case 31: return new FeatureDisabledPacket(header, bytes, ref i);
case 32: return new LogFailedMoneyTransactionPacket(header, bytes, ref i);
case 33: return new UserReportInternalPacket(header, bytes, ref i);
case 34: return new SetSimStatusInDatabasePacket(header, bytes, ref i);
case 35: return new SetSimPresenceInDatabasePacket(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 39: return new AvatarPickerRequestBackendPacket(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 44: return new DirFindQueryBackendPacket(header, bytes, ref i);
case 45: return new DirPlacesQueryPacket(header, bytes, ref i);
case 46: return new DirPlacesQueryBackendPacket(header, bytes, ref i);
case 47: return new DirPlacesReplyPacket(header, bytes, ref i);
case 48: return new DirPeopleQueryPacket(header, bytes, ref i);
case 49: return new DirPeopleQueryBackendPacket(header, bytes, ref i);
case 50: return new DirPeopleReplyPacket(header, bytes, ref i);
case 51: return new DirEventsReplyPacket(header, bytes, ref i);
case 52: return new DirGroupsQueryPacket(header, bytes, ref i);
case 53: return new DirGroupsQueryBackendPacket(header, bytes, ref i);
case 54: return new DirGroupsReplyPacket(header, bytes, ref i);
case 55: return new DirClassifiedQueryPacket(header, bytes, ref i);
case 56: return new DirClassifiedQueryBackendPacket(header, bytes, ref i);
case 57: return new DirClassifiedReplyPacket(header, bytes, ref i);
case 58: return new AvatarClassifiedReplyPacket(header, bytes, ref i);
case 59: return new ClassifiedInfoRequestPacket(header, bytes, ref i);
case 60: return new ClassifiedInfoReplyPacket(header, bytes, ref i);
case 61: return new ClassifiedInfoUpdatePacket(header, bytes, ref i);
case 62: return new ClassifiedDeletePacket(header, bytes, ref i);
case 63: return new ClassifiedGodDeletePacket(header, bytes, ref i);
case 64: return new DirPicksQueryPacket(header, bytes, ref i);
case 65: return new DirPicksQueryBackendPacket(header, bytes, ref i);
case 66: return new DirPicksReplyPacket(header, bytes, ref i);
case 67: return new DirLandQueryPacket(header, bytes, ref i);
case 68: return new DirLandQueryBackendPacket(header, bytes, ref i);
case 69: return new DirLandReplyPacket(header, bytes, ref i);
case 70: return new DirPopularQueryPacket(header, bytes, ref i);
case 71: return new DirPopularQueryBackendPacket(header, bytes, ref i);
case 72: return new DirPopularReplyPacket(header, bytes, ref i);
case 73: return new ParcelInfoRequestPacket(header, bytes, ref i);
case 74: return new ParcelInfoReplyPacket(header, bytes, ref i);
case 75: return new ParcelObjectOwnersRequestPacket(header, bytes, ref i);
case 76: return new OnlineStatusRequestPacket(header, bytes, ref i);
case 77: return new OnlineStatusReplyPacket(header, bytes, ref i);
case 78: return new ParcelObjectOwnersReplyPacket(header, bytes, ref i);
case 79: return new GroupNoticesListRequestPacket(header, bytes, ref i);
case 80: return new GroupNoticesListReplyPacket(header, bytes, ref i);
case 81: return new GroupNoticeRequestPacket(header, bytes, ref i);
case 82: return new GroupNoticeAddPacket(header, bytes, ref i);
case 83: return new GroupNoticeDeletePacket(header, bytes, ref i);
case 84: return new TeleportRequestPacket(header, bytes, ref i);
case 85: return new TeleportLocationRequestPacket(header, bytes, ref i);
case 86: return new TeleportLocalPacket(header, bytes, ref i);
case 87: return new TeleportLandmarkRequestPacket(header, bytes, ref i);
case 88: return new TeleportProgressPacket(header, bytes, ref i);
case 89: return new DataAgentAccessRequestPacket(header, bytes, ref i);
case 90: return new DataAgentAccessReplyPacket(header, bytes, ref i);
case 91: return new DataHomeLocationRequestPacket(header, bytes, ref i);
case 92: return new DataHomeLocationReplyPacket(header, bytes, ref i);
case 93: return new SpaceLocationTeleportRequestPacket(header, bytes, ref i);
case 94: return new SpaceLocationTeleportReplyPacket(header, bytes, ref i);
case 95: return new TeleportFinishPacket(header, bytes, ref i);
case 96: return new StartLurePacket(header, bytes, ref i);
case 97: return new TeleportLureRequestPacket(header, bytes, ref i);
case 98: return new TeleportCancelPacket(header, bytes, ref i);
case 99: return new CompleteLurePacket(header, bytes, ref i);
case 100: return new TeleportStartPacket(header, bytes, ref i);
case 101: return new TeleportFailedPacket(header, bytes, ref i);
case 102: return new LeaderBoardRequestPacket(header, bytes, ref i);
case 103: return new LeaderBoardDataPacket(header, bytes, ref i);
case 104: return new RegisterNewAgentPacket(header, bytes, ref i);
case 105: return new UndoPacket(header, bytes, ref i);
case 106: return new RedoPacket(header, bytes, ref i);
case 107: return new UndoLandPacket(header, bytes, ref i);
case 108: return new RedoLandPacket(header, bytes, ref i);
case 109: return new AgentPausePacket(header, bytes, ref i);
case 110: return new AgentResumePacket(header, bytes, ref i);
case 111: return new ChatFromViewerPacket(header, bytes, ref i);
case 112: return new AgentThrottlePacket(header, bytes, ref i);
case 113: return new AgentFOVPacket(header, bytes, ref i);
case 114: return new AgentHeightWidthPacket(header, bytes, ref i);
case 115: return new AgentSetAppearancePacket(header, bytes, ref i);
case 116: return new AgentQuitPacket(header, bytes, ref i);
case 117: return new AgentQuitCopyPacket(header, bytes, ref i);
case 118: return new ImageNotInDatabasePacket(header, bytes, ref i);
case 119: return new RebakeAvatarTexturesPacket(header, bytes, ref i);
case 120: return new SetAlwaysRunPacket(header, bytes, ref i);
case 121: return new ObjectDeletePacket(header, bytes, ref i);
case 122: return new ObjectDuplicatePacket(header, bytes, ref i);
case 123: return new ObjectDuplicateOnRayPacket(header, bytes, ref i);
case 124: return new ObjectScalePacket(header, bytes, ref i);
case 125: return new ObjectRotationPacket(header, bytes, ref i);
case 126: return new ObjectFlagUpdatePacket(header, bytes, ref i);
case 127: return new ObjectClickActionPacket(header, bytes, ref i);
case 128: return new ObjectImagePacket(header, bytes, ref i);
case 129: return new ObjectMaterialPacket(header, bytes, ref i);
case 130: return new ObjectShapePacket(header, bytes, ref i);
case 131: return new ObjectExtraParamsPacket(header, bytes, ref i);
case 132: return new ObjectOwnerPacket(header, bytes, ref i);
case 133: return new ObjectGroupPacket(header, bytes, ref i);
case 134: return new ObjectBuyPacket(header, bytes, ref i);
case 135: return new BuyObjectInventoryPacket(header, bytes, ref i);
case 136: return new DerezContainerPacket(header, bytes, ref i);
case 137: return new ObjectPermissionsPacket(header, bytes, ref i);
case 138: return new ObjectSaleInfoPacket(header, bytes, ref i);
case 139: return new ObjectNamePacket(header, bytes, ref i);
case 140: return new ObjectDescriptionPacket(header, bytes, ref i);
case 141: return new ObjectCategoryPacket(header, bytes, ref i);
case 142: return new ObjectSelectPacket(header, bytes, ref i);
case 143: return new ObjectDeselectPacket(header, bytes, ref i);
case 144: return new ObjectAttachPacket(header, bytes, ref i);
case 145: return new ObjectDetachPacket(header, bytes, ref i);
case 146: return new ObjectDropPacket(header, bytes, ref i);
case 147: return new ObjectLinkPacket(header, bytes, ref i);
case 148: return new ObjectDelinkPacket(header, bytes, ref i);
case 149: return new ObjectHingePacket(header, bytes, ref i);
case 150: return new ObjectDehingePacket(header, bytes, ref i);
case 151: return new ObjectGrabPacket(header, bytes, ref i);
case 152: return new ObjectGrabUpdatePacket(header, bytes, ref i);
case 153: return new ObjectDeGrabPacket(header, bytes, ref i);
case 154: return new ObjectSpinStartPacket(header, bytes, ref i);
case 155: return new ObjectSpinUpdatePacket(header, bytes, ref i);
case 156: return new ObjectSpinStopPacket(header, bytes, ref i);
case 157: return new ObjectExportSelectedPacket(header, bytes, ref i);
case 158: return new ObjectImportPacket(header, bytes, ref i);
case 159: return new ModifyLandPacket(header, bytes, ref i);
case 160: return new VelocityInterpolateOnPacket(header, bytes, ref i);
case 161: return new VelocityInterpolateOffPacket(header, bytes, ref i);
case 162: return new StateSavePacket(header, bytes, ref i);
case 163: return new ReportAutosaveCrashPacket(header, bytes, ref i);
case 164: return new SimWideDeletesPacket(header, bytes, ref i);
case 165: return new TrackAgentPacket(header, bytes, ref i);
case 166: return new GrantModificationPacket(header, bytes, ref i);
case 167: return new RevokeModificationPacket(header, bytes, ref i);
case 168: return new RequestGrantedProxiesPacket(header, bytes, ref i);
case 169: return new GrantedProxiesPacket(header, bytes, ref i);
case 170: return new AddModifyAbilityPacket(header, bytes, ref i);
case 171: return new RemoveModifyAbilityPacket(header, bytes, ref i);
case 172: return new ViewerStatsPacket(header, bytes, ref i);
case 173: return new ScriptAnswerYesPacket(header, bytes, ref i);
case 174: return new UserReportPacket(header, bytes, ref i);
case 175: return new AlertMessagePacket(header, bytes, ref i);
case 176: return new AgentAlertMessagePacket(header, bytes, ref i);
case 177: return new MeanCollisionAlertPacket(header, bytes, ref i);
case 178: return new ViewerFrozenMessagePacket(header, bytes, ref i);
case 179: return new HealthMessagePacket(header, bytes, ref i);
case 180: return new ChatFromSimulatorPacket(header, bytes, ref i);
case 181: return new SimStatsPacket(header, bytes, ref i);
case 182: return new RequestRegionInfoPacket(header, bytes, ref i);
case 183: return new RegionInfoPacket(header, bytes, ref i);
case 184: return new GodUpdateRegionInfoPacket(header, bytes, ref i);
case 185: return new NearestLandingRegionRequestPacket(header, bytes, ref i);
case 186: return new NearestLandingRegionReplyPacket(header, bytes, ref i);
case 187: return new NearestLandingRegionUpdatedPacket(header, bytes, ref i);
case 188: return new TeleportLandingStatusChangedPacket(header, bytes, ref i);
case 189: return new RegionHandshakePacket(header, bytes, ref i);
case 190: return new RegionHandshakeReplyPacket(header, bytes, ref i);
case 191: return new SimulatorViewerTimeMessagePacket(header, bytes, ref i);
case 192: return new EnableSimulatorPacket(header, bytes, ref i);
case 193: return new DisableSimulatorPacket(header, bytes, ref i);
case 194: return new TransferRequestPacket(header, bytes, ref i);
case 195: return new TransferInfoPacket(header, bytes, ref i);
case 196: return new TransferAbortPacket(header, bytes, ref i);
case 197: return new TransferPriorityPacket(header, bytes, ref i);
case 198: return new RequestXferPacket(header, bytes, ref i);
case 199: return new AbortXferPacket(header, bytes, ref i);
case 200: return new RequestAvatarInfoPacket(header, bytes, ref i);
case 201: return new AvatarAppearancePacket(header, bytes, ref i);
case 202: return new SetFollowCamPropertiesPacket(header, bytes, ref i);
case 203: return new ClearFollowCamPropertiesPacket(header, bytes, ref i);
case 204: return new RequestPayPricePacket(header, bytes, ref i);
case 205: return new PayPriceReplyPacket(header, bytes, ref i);
case 206: return new KickUserPacket(header, bytes, ref i);
case 207: return new KickUserAckPacket(header, bytes, ref i);
case 208: return new GodKickUserPacket(header, bytes, ref i);
case 209: return new SystemKickUserPacket(header, bytes, ref i);
case 210: return new EjectUserPacket(header, bytes, ref i);
case 211: return new FreezeUserPacket(header, bytes, ref i);
case 212: return new AvatarPropertiesRequestPacket(header, bytes, ref i);
case 213: return new AvatarPropertiesRequestBackendPacket(header, bytes, ref i);
case 214: return new AvatarPropertiesReplyPacket(header, bytes, ref i);
case 215: return new AvatarInterestsReplyPacket(header, bytes, ref i);
case 216: return new AvatarGroupsReplyPacket(header, bytes, ref i);
case 217: return new AvatarPropertiesUpdatePacket(header, bytes, ref i);
case 218: return new AvatarInterestsUpdatePacket(header, bytes, ref i);
case 219: return new AvatarStatisticsReplyPacket(header, bytes, ref i);
case 220: return new AvatarNotesReplyPacket(header, bytes, ref i);
case 221: return new AvatarNotesUpdatePacket(header, bytes, ref i);
case 222: return new AvatarPicksReplyPacket(header, bytes, ref i);
case 223: return new EventInfoRequestPacket(header, bytes, ref i);
case 224: return new EventInfoReplyPacket(header, bytes, ref i);
case 225: return new EventNotificationAddRequestPacket(header, bytes, ref i);
case 226: return new EventNotificationRemoveRequestPacket(header, bytes, ref i);
case 227: return new EventGodDeletePacket(header, bytes, ref i);
case 228: return new PickInfoRequestPacket(header, bytes, ref i);
case 229: return new PickInfoReplyPacket(header, bytes, ref i);
case 230: return new PickInfoUpdatePacket(header, bytes, ref i);
case 231: return new PickDeletePacket(header, bytes, ref i);
case 232: return new PickGodDeletePacket(header, bytes, ref i);
case 233: return new ScriptQuestionPacket(header, bytes, ref i);
case 234: return new ScriptControlChangePacket(header, bytes, ref i);
case 235: return new ScriptDialogPacket(header, bytes, ref i);
case 236: return new ScriptDialogReplyPacket(header, bytes, ref i);
case 237: return new ForceScriptControlReleasePacket(header, bytes, ref i);
case 238: return new RevokePermissionsPacket(header, bytes, ref i);
case 239: return new LoadURLPacket(header, bytes, ref i);
case 240: return new ScriptTeleportRequestPacket(header, bytes, ref i);
case 241: return new ParcelOverlayPacket(header, bytes, ref i);
case 242: return new ParcelPropertiesRequestByIDPacket(header, bytes, ref i);
case 243: return new ParcelPropertiesUpdatePacket(header, bytes, ref i);
case 244: return new ParcelReturnObjectsPacket(header, bytes, ref i);
case 245: return new ParcelSetOtherCleanTimePacket(header, bytes, ref i);
case 246: return new ParcelDisableObjectsPacket(header, bytes, ref i);
case 247: return new ParcelSelectObjectsPacket(header, bytes, ref i);
case 248: return new EstateCovenantRequestPacket(header, bytes, ref i);
case 249: return new EstateCovenantReplyPacket(header, bytes, ref i);
case 250: return new ForceObjectSelectPacket(header, bytes, ref i);
case 251: return new ParcelBuyPassPacket(header, bytes, ref i);
case 252: return new ParcelDeedToGroupPacket(header, bytes, ref i);
case 253: return new ParcelReclaimPacket(header, bytes, ref i);
case 254: return new ParcelClaimPacket(header, bytes, ref i);
case 255: return new ParcelJoinPacket(header, bytes, ref i);
case 256: return new ParcelDividePacket(header, bytes, ref i);
case 257: return new ParcelReleasePacket(header, bytes, ref i);
case 258: return new ParcelBuyPacket(header, bytes, ref i);
case 259: return new ParcelGodForceOwnerPacket(header, bytes, ref i);
case 260: return new ParcelAccessListRequestPacket(header, bytes, ref i);
case 261: return new ParcelAccessListReplyPacket(header, bytes, ref i);
case 262: return new ParcelAccessListUpdatePacket(header, bytes, ref i);
case 263: return new ParcelDwellRequestPacket(header, bytes, ref i);
case 264: return new ParcelDwellReplyPacket(header, bytes, ref i);
case 265: return new RequestParcelTransferPacket(header, bytes, ref i);
case 266: return new UpdateParcelPacket(header, bytes, ref i);
case 267: return new RemoveParcelPacket(header, bytes, ref i);
case 268: return new MergeParcelPacket(header, bytes, ref i);
case 269: return new LogParcelChangesPacket(header, bytes, ref i);
case 270: return new CheckParcelSalesPacket(header, bytes, ref i);
case 271: return new ParcelSalesPacket(header, bytes, ref i);
case 272: return new ParcelGodMarkAsContentPacket(header, bytes, ref i);
case 273: return new ParcelGodReserveForNewbiePacket(header, bytes, ref i);
case 274: return new ViewerStartAuctionPacket(header, bytes, ref i);
case 275: return new StartAuctionPacket(header, bytes, ref i);
case 276: return new ConfirmAuctionStartPacket(header, bytes, ref i);
case 277: return new CompleteAuctionPacket(header, bytes, ref i);
case 278: return new CancelAuctionPacket(header, bytes, ref i);
case 279: return new CheckParcelAuctionsPacket(header, bytes, ref i);
case 280: return new ParcelAuctionsPacket(header, bytes, ref i);
case 281: return new UUIDNameRequestPacket(header, bytes, ref i);
case 282: return new UUIDNameReplyPacket(header, bytes, ref i);
case 283: return new UUIDGroupNameRequestPacket(header, bytes, ref i);
case 284: return new UUIDGroupNameReplyPacket(header, bytes, ref i);
case 285: return new ChatPassPacket(header, bytes, ref i);
case 286: return new ChildAgentDyingPacket(header, bytes, ref i);
case 287: return new ChildAgentUnknownPacket(header, bytes, ref i);
case 288: return new KillChildAgentsPacket(header, bytes, ref i);
case 289: return new GetScriptRunningPacket(header, bytes, ref i);
case 290: return new ScriptRunningReplyPacket(header, bytes, ref i);
case 291: return new SetScriptRunningPacket(header, bytes, ref i);
case 292: return new ScriptResetPacket(header, bytes, ref i);
case 293: return new ScriptSensorRequestPacket(header, bytes, ref i);
case 294: return new ScriptSensorReplyPacket(header, bytes, ref i);
case 295: return new CompleteAgentMovementPacket(header, bytes, ref i);
case 296: return new AgentMovementCompletePacket(header, bytes, ref i);
case 297: return new LogLoginPacket(header, bytes, ref i);
case 298: return new ConnectAgentToUserserverPacket(header, bytes, ref i);
case 299: return new ConnectToUserserverPacket(header, bytes, ref i);
case 300: return new DataServerLogoutPacket(header, bytes, ref i);
case 301: return new LogoutRequestPacket(header, bytes, ref i);
case 302: return new FinalizeLogoutPacket(header, bytes, ref i);
case 303: return new LogoutReplyPacket(header, bytes, ref i);
case 304: return new LogoutDemandPacket(header, bytes, ref i);
case 305: return new ImprovedInstantMessagePacket(header, bytes, ref i);
case 306: return new RetrieveInstantMessagesPacket(header, bytes, ref i);
case 307: return new DequeueInstantMessagesPacket(header, bytes, ref i);
case 308: return new FindAgentPacket(header, bytes, ref i);
case 309: return new RequestGodlikePowersPacket(header, bytes, ref i);
case 310: return new GrantGodlikePowersPacket(header, bytes, ref i);
case 311: return new GodlikeMessagePacket(header, bytes, ref i);
case 312: return new EstateOwnerMessagePacket(header, bytes, ref i);
case 313: return new GenericMessagePacket(header, bytes, ref i);
case 314: return new MuteListRequestPacket(header, bytes, ref i);
case 315: return new UpdateMuteListEntryPacket(header, bytes, ref i);
case 316: return new RemoveMuteListEntryPacket(header, bytes, ref i);
case 317: return new CopyInventoryFromNotecardPacket(header, bytes, ref i);
case 318: return new UpdateInventoryItemPacket(header, bytes, ref i);
case 319: return new UpdateCreateInventoryItemPacket(header, bytes, ref i);
case 320: return new MoveInventoryItemPacket(header, bytes, ref i);
case 321: return new CopyInventoryItemPacket(header, bytes, ref i);
case 322: return new RemoveInventoryItemPacket(header, bytes, ref i);
case 323: return new ChangeInventoryItemFlagsPacket(header, bytes, ref i);
case 324: return new SaveAssetIntoInventoryPacket(header, bytes, ref i);
case 325: return new CreateInventoryFolderPacket(header, bytes, ref i);
case 326: return new UpdateInventoryFolderPacket(header, bytes, ref i);
case 327: return new MoveInventoryFolderPacket(header, bytes, ref i);
case 328: return new RemoveInventoryFolderPacket(header, bytes, ref i);
case 329: return new FetchInventoryDescendentsPacket(header, bytes, ref i);
case 330: return new InventoryDescendentsPacket(header, bytes, ref i);
case 331: return new FetchInventoryPacket(header, bytes, ref i);
case 332: return new FetchInventoryReplyPacket(header, bytes, ref i);
case 333: return new BulkUpdateInventoryPacket(header, bytes, ref i);
case 334: return new RequestInventoryAssetPacket(header, bytes, ref i);
case 335: return new InventoryAssetResponsePacket(header, bytes, ref i);
case 336: return new RemoveInventoryObjectsPacket(header, bytes, ref i);
case 337: return new PurgeInventoryDescendentsPacket(header, bytes, ref i);
case 338: return new UpdateTaskInventoryPacket(header, bytes, ref i);
case 339: return new RemoveTaskInventoryPacket(header, bytes, ref i);
case 340: return new MoveTaskInventoryPacket(header, bytes, ref i);
case 341: return new RequestTaskInventoryPacket(header, bytes, ref i);
case 342: return new ReplyTaskInventoryPacket(header, bytes, ref i);
case 343: return new DeRezObjectPacket(header, bytes, ref i);
case 344: return new DeRezAckPacket(header, bytes, ref i);
case 345: return new RezObjectPacket(header, bytes, ref i);
case 346: return new RezObjectFromNotecardPacket(header, bytes, ref i);
case 347: return new DeclineInventoryPacket(header, bytes, ref i);
case 348: return new TransferInventoryPacket(header, bytes, ref i);
case 349: return new TransferInventoryAckPacket(header, bytes, ref i);
case 350: return new RequestFriendshipPacket(header, bytes, ref i);
case 351: return new AcceptFriendshipPacket(header, bytes, ref i);
case 352: return new DeclineFriendshipPacket(header, bytes, ref i);
case 353: return new FormFriendshipPacket(header, bytes, ref i);
case 354: return new TerminateFriendshipPacket(header, bytes, ref i);
case 355: return new OfferCallingCardPacket(header, bytes, ref i);
case 356: return new AcceptCallingCardPacket(header, bytes, ref i);
case 357: return new DeclineCallingCardPacket(header, bytes, ref i);
case 358: return new RezScriptPacket(header, bytes, ref i);
case 359: return new CreateInventoryItemPacket(header, bytes, ref i);
case 360: return new CreateLandmarkForEventPacket(header, bytes, ref i);
case 361: return new EventLocationRequestPacket(header, bytes, ref i);
case 362: return new EventLocationReplyPacket(header, bytes, ref i);
case 363: return new RegionHandleRequestPacket(header, bytes, ref i);
case 364: return new RegionIDAndHandleReplyPacket(header, bytes, ref i);
case 365: return new MoneyTransferRequestPacket(header, bytes, ref i);
case 366: return new MoneyTransferBackendPacket(header, bytes, ref i);
case 367: return new BulkMoneyTransferPacket(header, bytes, ref i);
case 368: return new AdjustBalancePacket(header, bytes, ref i);
case 369: return new MoneyBalanceRequestPacket(header, bytes, ref i);
case 370: return new MoneyBalanceReplyPacket(header, bytes, ref i);
case 371: return new RoutedMoneyBalanceReplyPacket(header, bytes, ref i);
case 372: return new MoneyHistoryRequestPacket(header, bytes, ref i);
case 373: return new MoneyHistoryReplyPacket(header, bytes, ref i);
case 374: return new MoneySummaryRequestPacket(header, bytes, ref i);
case 375: return new MoneySummaryReplyPacket(header, bytes, ref i);
case 376: return new MoneyDetailsRequestPacket(header, bytes, ref i);
case 377: return new MoneyDetailsReplyPacket(header, bytes, ref i);
case 378: return new MoneyTransactionsRequestPacket(header, bytes, ref i);
case 379: return new MoneyTransactionsReplyPacket(header, bytes, ref i);
case 380: return new GestureRequestPacket(header, bytes, ref i);
case 381: return new ActivateGesturesPacket(header, bytes, ref i);
case 382: return new DeactivateGesturesPacket(header, bytes, ref i);
case 383: return new InventoryUpdatePacket(header, bytes, ref i);
case 384: return new MuteListUpdatePacket(header, bytes, ref i);
case 385: return new UseCachedMuteListPacket(header, bytes, ref i);
case 386: return new UserLoginLocationReplyPacket(header, bytes, ref i);
case 387: return new UserSimLocationReplyPacket(header, bytes, ref i);
case 388: return new UserListReplyPacket(header, bytes, ref i);
case 389: return new OnlineNotificationPacket(header, bytes, ref i);
case 390: return new OfflineNotificationPacket(header, bytes, ref i);
case 391: return new SetStartLocationRequestPacket(header, bytes, ref i);
case 392: return new SetStartLocationPacket(header, bytes, ref i);
case 393: return new UserLoginLocationRequestPacket(header, bytes, ref i);
case 394: return new SpaceLoginLocationReplyPacket(header, bytes, ref i);
case 395: return new NetTestPacket(header, bytes, ref i);
case 396: return new SetCPURatioPacket(header, bytes, ref i);
case 397: return new SimCrashedPacket(header, bytes, ref i);
case 398: return new SimulatorPauseStatePacket(header, bytes, ref i);
case 399: return new SimulatorThrottleSettingsPacket(header, bytes, ref i);
case 400: return new NameValuePairPacket(header, bytes, ref i);
case 401: return new RemoveNameValuePairPacket(header, bytes, ref i);
case 402: return new GetNameValuePairPacket(header, bytes, ref i);
case 403: return new UpdateAttachmentPacket(header, bytes, ref i);
case 404: return new RemoveAttachmentPacket(header, bytes, ref i);
case 405: return new AssetUploadRequestPacket(header, bytes, ref i);
case 406: return new AssetUploadCompletePacket(header, bytes, ref i);
case 407: return new ReputationAgentAssignPacket(header, bytes, ref i);
case 408: return new ReputationIndividualRequestPacket(header, bytes, ref i);
case 409: return new ReputationIndividualReplyPacket(header, bytes, ref i);
case 410: return new EmailMessageRequestPacket(header, bytes, ref i);
case 411: return new EmailMessageReplyPacket(header, bytes, ref i);
case 412: return new ScriptDataRequestPacket(header, bytes, ref i);
case 413: return new ScriptDataReplyPacket(header, bytes, ref i);
case 414: return new CreateGroupRequestPacket(header, bytes, ref i);
case 415: return new CreateGroupReplyPacket(header, bytes, ref i);
case 416: return new UpdateGroupInfoPacket(header, bytes, ref i);
case 417: return new GroupRoleChangesPacket(header, bytes, ref i);
case 418: return new JoinGroupRequestPacket(header, bytes, ref i);
case 419: return new JoinGroupReplyPacket(header, bytes, ref i);
case 420: return new EjectGroupMemberRequestPacket(header, bytes, ref i);
case 421: return new EjectGroupMemberReplyPacket(header, bytes, ref i);
case 422: return new LeaveGroupRequestPacket(header, bytes, ref i);
case 423: return new LeaveGroupReplyPacket(header, bytes, ref i);
case 424: return new InviteGroupRequestPacket(header, bytes, ref i);
case 425: return new InviteGroupResponsePacket(header, bytes, ref i);
case 426: return new GroupProfileRequestPacket(header, bytes, ref i);
case 427: return new GroupProfileReplyPacket(header, bytes, ref i);
case 428: return new GroupAccountSummaryRequestPacket(header, bytes, ref i);
case 429: return new GroupAccountSummaryReplyPacket(header, bytes, ref i);
case 430: return new GroupAccountDetailsRequestPacket(header, bytes, ref i);
case 431: return new GroupAccountDetailsReplyPacket(header, bytes, ref i);
case 432: return new GroupAccountTransactionsRequestPacket(header, bytes, ref i);
case 433: return new GroupAccountTransactionsReplyPacket(header, bytes, ref i);
case 434: return new GroupActiveProposalsRequestPacket(header, bytes, ref i);
case 435: return new GroupActiveProposalItemReplyPacket(header, bytes, ref i);
case 436: return new GroupVoteHistoryRequestPacket(header, bytes, ref i);
case 437: return new GroupVoteHistoryItemReplyPacket(header, bytes, ref i);
case 438: return new StartGroupProposalPacket(header, bytes, ref i);
case 439: return new GroupProposalBallotPacket(header, bytes, ref i);
case 440: return new TallyVotesPacket(header, bytes, ref i);
case 441: return new GroupMembersRequestPacket(header, bytes, ref i);
case 442: return new GroupMembersReplyPacket(header, bytes, ref i);
case 443: return new ActivateGroupPacket(header, bytes, ref i);
case 444: return new SetGroupContributionPacket(header, bytes, ref i);
case 445: return new SetGroupAcceptNoticesPacket(header, bytes, ref i);
case 446: return new GroupRoleDataRequestPacket(header, bytes, ref i);
case 447: return new GroupRoleDataReplyPacket(header, bytes, ref i);
case 448: return new GroupRoleMembersRequestPacket(header, bytes, ref i);
case 449: return new GroupRoleMembersReplyPacket(header, bytes, ref i);
case 450: return new GroupTitlesRequestPacket(header, bytes, ref i);
case 451: return new GroupTitlesReplyPacket(header, bytes, ref i);
case 452: return new GroupTitleUpdatePacket(header, bytes, ref i);
case 453: return new GroupRoleUpdatePacket(header, bytes, ref i);
case 454: return new LiveHelpGroupRequestPacket(header, bytes, ref i);
case 455: return new LiveHelpGroupReplyPacket(header, bytes, ref i);
case 456: return new AgentWearablesRequestPacket(header, bytes, ref i);
case 457: return new AgentWearablesUpdatePacket(header, bytes, ref i);
case 458: return new AgentIsNowWearingPacket(header, bytes, ref i);
case 459: return new AgentCachedTexturePacket(header, bytes, ref i);
case 460: return new AgentCachedTextureResponsePacket(header, bytes, ref i);
case 461: return new AgentDataUpdateRequestPacket(header, bytes, ref i);
case 462: return new AgentDataUpdatePacket(header, bytes, ref i);
case 463: return new GroupDataUpdatePacket(header, bytes, ref i);
case 464: return new AgentGroupDataUpdatePacket(header, bytes, ref i);
case 465: return new AgentDropGroupPacket(header, bytes, ref i);
case 466: return new LogTextMessagePacket(header, bytes, ref i);
case 467: return new CreateTrustedCircuitPacket(header, bytes, ref i);
case 468: return new DenyTrustedCircuitPacket(header, bytes, ref i);
case 469: return new RezSingleAttachmentFromInvPacket(header, bytes, ref i);
case 470: return new RezMultipleAttachmentsFromInvPacket(header, bytes, ref i);
case 471: return new DetachAttachmentIntoInvPacket(header, bytes, ref i);
case 472: return new CreateNewOutfitAttachmentsPacket(header, bytes, ref i);
case 473: return new UserInfoRequestPacket(header, bytes, ref i);
case 474: return new UserInfoReplyPacket(header, bytes, ref i);
case 475: return new UpdateUserInfoPacket(header, bytes, ref i);
case 476: return new GodExpungeUserPacket(header, bytes, ref i);
case 477: return new StartExpungeProcessPacket(header, bytes, ref i);
case 478: return new StartExpungeProcessAckPacket(header, bytes, ref i);
case 479: return new StartParcelRenamePacket(header, bytes, ref i);
case 480: return new StartParcelRenameAckPacket(header, bytes, ref i);
case 481: return new BulkParcelRenamePacket(header, bytes, ref i);
case 482: return new ParcelRenamePacket(header, bytes, ref i);
case 483: return new StartParcelRemovePacket(header, bytes, ref i);
case 484: return new StartParcelRemoveAckPacket(header, bytes, ref i);
case 485: return new BulkParcelRemovePacket(header, bytes, ref i);
case 486: return new InitiateUploadPacket(header, bytes, ref i);
case 487: return new InitiateDownloadPacket(header, bytes, ref i);
case 488: return new SystemMessagePacket(header, bytes, ref i);
case 489: return new MapLayerRequestPacket(header, bytes, ref i);
case 490: return new MapLayerReplyPacket(header, bytes, ref i);
case 491: return new MapBlockRequestPacket(header, bytes, ref i);
case 492: return new MapNameRequestPacket(header, bytes, ref i);
case 493: return new MapBlockReplyPacket(header, bytes, ref i);
case 494: return new MapItemRequestPacket(header, bytes, ref i);
case 495: return new MapItemReplyPacket(header, bytes, ref i);
case 496: return new SendPostcardPacket(header, bytes, ref i);
case 497: return new RpcChannelRequestPacket(header, bytes, ref i);
case 498: return new RpcChannelReplyPacket(header, bytes, ref i);
case 499: return new RpcScriptRequestInboundPacket(header, bytes, ref i);
case 500: return new RpcScriptRequestInboundForwardPacket(header, bytes, ref i);
case 501: return new RpcScriptReplyInboundPacket(header, bytes, ref i);
case 502: return new MailTaskSimRequestPacket(header, bytes, ref i);
case 503: return new MailTaskSimReplyPacket(header, bytes, ref i);
case 504: return new ScriptMailRegistrationPacket(header, bytes, ref i);
case 505: return new ParcelMediaCommandMessagePacket(header, bytes, ref i);
case 506: return new ParcelMediaUpdatePacket(header, bytes, ref i);
case 507: return new LandStatRequestPacket(header, bytes, ref i);
case 508: 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 1: return new ClosestSimulatorPacket(header, bytes, ref i);
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 13: return new SimStatusPacket(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 19: return new InternalScriptMailPacket(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 3: return new NeighborListPacket(header, bytes, ref i);
case 4: return new MovedIntoSimulatorPacket(header, bytes, ref i);
case 5: return new AgentUpdatePacket(header, bytes, ref i);
case 6: return new AgentAnimationPacket(header, bytes, ref i);
case 7: return new AgentRequestSitPacket(header, bytes, ref i);
case 8: return new AgentSitPacket(header, bytes, ref i);
case 9: return new RequestImagePacket(header, bytes, ref i);
case 10: return new ImageDataPacket(header, bytes, ref i);
case 11: return new ImagePacketPacket(header, bytes, ref i);
case 12: return new LayerDataPacket(header, bytes, ref i);
case 13: return new ObjectUpdatePacket(header, bytes, ref i);
case 14: return new ObjectUpdateCompressedPacket(header, bytes, ref i);
case 15: return new ObjectUpdateCachedPacket(header, bytes, ref i);
case 16: return new ImprovedTerseObjectUpdatePacket(header, bytes, ref i);
case 17: return new KillObjectPacket(header, bytes, ref i);
case 18: return new AgentToNewRegionPacket(header, bytes, ref i);
case 19: return new TransferPacketPacket(header, bytes, ref i);
case 20: return new SendXferPacketPacket(header, bytes, ref i);
case 21: return new ConfirmXferPacketPacket(header, bytes, ref i);
case 22: return new AvatarAnimationPacket(header, bytes, ref i);
case 23: return new AvatarSitResponsePacket(header, bytes, ref i);
case 24: return new CameraConstraintPacket(header, bytes, ref i);
case 25: return new ParcelPropertiesPacket(header, bytes, ref i);
case 26: return new EdgeDataPacketPacket(header, bytes, ref i);
case 27: return new ChildAgentUpdatePacket(header, bytes, ref i);
case 28: return new ChildAgentAlivePacket(header, bytes, ref i);
case 29: return new ChildAgentPositionUpdatePacket(header, bytes, ref i);
case 30: return new PassObjectPacket(header, bytes, ref i);
case 31: return new AtomicPassObjectPacket(header, bytes, ref i);
case 32: return new SoundTriggerPacket(header, bytes, ref i);
}
}
throw new MalformedDataException("Unknown packet ID");
}
}
/// <exclude/>
public class TestMessagePacket : Packet
{
/// <exclude/>
public class TestBlock1Block
{
public uint Test1;
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 --\n";
output += "Test1: " + Test1.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class NeighborBlockBlock
{
public uint Test0;
public uint Test1;
public uint Test2;
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 --\n";
output += "Test0: " + Test0.ToString() + "\n";
output += "Test1: " + Test1.ToString() + "\n";
output += "Test2: " + Test2.ToString() + "\n";
output = 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 ---\n";
output += TestBlock1.ToString() + "\n";
for (int j = 0; j < 4; j++)
{
output += NeighborBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AddCircuitCodePacket : Packet
{
/// <exclude/>
public class CircuitCodeBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint Code;
public int Length
{
get
{
return 36;
}
}
public CircuitCodeBlock() { }
public CircuitCodeBlock(byte[] bytes, ref int i)
{
try
{
AgentID = 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(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)(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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Code: " + Code.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AddCircuitCode; } }
public CircuitCodeBlock CircuitCode;
public AddCircuitCodePacket()
{
Header = new LowHeader();
Header.ID = 2;
Header.Reliable = true;
CircuitCode = new CircuitCodeBlock();
}
public AddCircuitCodePacket(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 AddCircuitCodePacket(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 = "--- AddCircuitCode ---\n";
output += CircuitCode.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UseCircuitCodePacket : Packet
{
/// <exclude/>
public class CircuitCodeBlock
{
public LLUUID ID;
public LLUUID SessionID;
public uint Code;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Code: " + Code.ToString() + "\n";
output = 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 ---\n";
output += CircuitCode.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogControlPacket : Packet
{
/// <exclude/>
public class OptionsBlock
{
public uint Mask;
public bool Time;
public bool RemoteInfos;
public bool Location;
public byte Level;
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 --\n";
output += "Mask: " + Mask.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "RemoteInfos: " + RemoteInfos.ToString() + "\n";
output += "Location: " + Location.ToString() + "\n";
output += "Level: " + Level.ToString() + "\n";
output = 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 ---\n";
output += Options.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RelayLogControlPacket : Packet
{
/// <exclude/>
public class OptionsBlock
{
public uint Mask;
public bool Time;
public bool RemoteInfos;
public bool Location;
public byte Level;
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 --\n";
output += "Mask: " + Mask.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "RemoteInfos: " + RemoteInfos.ToString() + "\n";
output += "Location: " + Location.ToString() + "\n";
output += "Level: " + Level.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RelayLogControl; } }
public OptionsBlock Options;
public RelayLogControlPacket()
{
Header = new LowHeader();
Header.ID = 5;
Header.Reliable = true;
Options = new OptionsBlock();
}
public RelayLogControlPacket(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 RelayLogControlPacket(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 = "--- RelayLogControl ---\n";
output += Options.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogMessagesPacket : Packet
{
/// <exclude/>
public class OptionsBlock
{
public bool Enable;
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 --\n";
output += "Enable: " + Enable.ToString() + "\n";
output = 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 ---\n";
output += Options.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimulatorAssignPacket : Packet
{
/// <exclude/>
public class RegionInfoBlock
{
public uint IP;
public uint SecPerDay;
public float MetersPerGrid;
public ulong UsecSinceStart;
public ushort Port;
public uint SecPerYear;
public int GridsPerEdge;
public ulong Handle;
public LLVector3 SunAngVelocity;
public LLVector3 SunDirection;
public int Length
{
get
{
return 62;
}
}
public RegionInfoBlock() { }
public RegionInfoBlock(byte[] bytes, ref int i)
{
try
{
IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
SecPerDay = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
MetersPerGrid = BitConverter.ToSingle(bytes, i); i += 4;
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));
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
SecPerYear = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridsPerEdge = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
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));
SunAngVelocity = new LLVector3(bytes, i); i += 12;
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)(IP % 256);
bytes[i++] = (byte)((IP >> 8) % 256);
bytes[i++] = (byte)((IP >> 16) % 256);
bytes[i++] = (byte)((IP >> 24) % 256);
bytes[i++] = (byte)(SecPerDay % 256);
bytes[i++] = (byte)((SecPerDay >> 8) % 256);
bytes[i++] = (byte)((SecPerDay >> 16) % 256);
bytes[i++] = (byte)((SecPerDay >> 24) % 256);
ba = BitConverter.GetBytes(MetersPerGrid);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
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)((Port >> 8) % 256);
bytes[i++] = (byte)(Port % 256);
bytes[i++] = (byte)(SecPerYear % 256);
bytes[i++] = (byte)((SecPerYear >> 8) % 256);
bytes[i++] = (byte)((SecPerYear >> 16) % 256);
bytes[i++] = (byte)((SecPerYear >> 24) % 256);
bytes[i++] = (byte)(GridsPerEdge % 256);
bytes[i++] = (byte)((GridsPerEdge >> 8) % 256);
bytes[i++] = (byte)((GridsPerEdge >> 16) % 256);
bytes[i++] = (byte)((GridsPerEdge >> 24) % 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);
if(SunAngVelocity == null) { Console.WriteLine("Warning: SunAngVelocity is null, in " + this.GetType()); }
Array.Copy(SunAngVelocity.GetBytes(), 0, bytes, i, 12); i += 12;
if(SunDirection == null) { Console.WriteLine("Warning: SunDirection is null, in " + this.GetType()); }
Array.Copy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- RegionInfo --\n";
output += "IP: " + IP.ToString() + "\n";
output += "SecPerDay: " + SecPerDay.ToString() + "\n";
output += "MetersPerGrid: " + MetersPerGrid.ToString() + "\n";
output += "UsecSinceStart: " + UsecSinceStart.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "SecPerYear: " + SecPerYear.ToString() + "\n";
output += "GridsPerEdge: " + GridsPerEdge.ToString() + "\n";
output += "Handle: " + Handle.ToString() + "\n";
output += "SunAngVelocity: " + SunAngVelocity.ToString() + "\n";
output += "SunDirection: " + SunDirection.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class NeighborBlockBlock
{
public uint IP;
public ushort PublicPort;
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 ushort Port;
public byte SimAccess;
public uint PublicIP;
public int Length
{
get
{
int length = 13;
if (Name != null) { length += 1 + Name.Length; }
return length;
}
}
public NeighborBlockBlock() { }
public NeighborBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
PublicPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
length = (ushort)bytes[i++];
_name = new byte[length];
Array.Copy(bytes, i, _name, 0, length); i += length;
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
SimAccess = (byte)bytes[i++];
PublicIP = (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)(IP % 256);
bytes[i++] = (byte)((IP >> 8) % 256);
bytes[i++] = (byte)((IP >> 16) % 256);
bytes[i++] = (byte)((IP >> 24) % 256);
bytes[i++] = (byte)((PublicPort >> 8) % 256);
bytes[i++] = (byte)(PublicPort % 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)((Port >> 8) % 256);
bytes[i++] = (byte)(Port % 256);
bytes[i++] = SimAccess;
bytes[i++] = (byte)(PublicIP % 256);
bytes[i++] = (byte)((PublicIP >> 8) % 256);
bytes[i++] = (byte)((PublicIP >> 16) % 256);
bytes[i++] = (byte)((PublicIP >> 24) % 256);
}
public override string ToString()
{
string output = "-- NeighborBlock --\n";
output += "IP: " + IP.ToString() + "\n";
output += "PublicPort: " + PublicPort.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "PublicIP: " + PublicIP.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorAssign; } }
public RegionInfoBlock RegionInfo;
public NeighborBlockBlock[] NeighborBlock;
public SimulatorAssignPacket()
{
Header = new LowHeader();
Header.ID = 7;
Header.Reliable = true;
Header.Zerocoded = true;
RegionInfo = new RegionInfoBlock();
NeighborBlock = new NeighborBlockBlock[4];
}
public SimulatorAssignPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
RegionInfo = new RegionInfoBlock(bytes, ref i);
NeighborBlock = new NeighborBlockBlock[4];
for (int j = 0; j < 4; j++)
{ NeighborBlock[j] = new NeighborBlockBlock(bytes, ref i); }
}
public SimulatorAssignPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
RegionInfo = new RegionInfoBlock(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 += RegionInfo.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);
RegionInfo.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 = "--- SimulatorAssign ---\n";
output += RegionInfo.ToString() + "\n";
for (int j = 0; j < 4; j++)
{
output += NeighborBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SpaceServerSimulatorTimeMessagePacket : Packet
{
/// <exclude/>
public class TimeInfoBlock
{
public uint SecPerDay;
public ulong UsecSinceStart;
public uint SecPerYear;
public LLVector3 SunAngVelocity;
public float SunPhase;
public LLVector3 SunDirection;
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);
if(SunAngVelocity == null) { Console.WriteLine("Warning: SunAngVelocity is null, in " + this.GetType()); }
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;
if(SunDirection == null) { Console.WriteLine("Warning: SunDirection is null, in " + this.GetType()); }
Array.Copy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- TimeInfo --\n";
output += "SecPerDay: " + SecPerDay.ToString() + "\n";
output += "UsecSinceStart: " + UsecSinceStart.ToString() + "\n";
output += "SecPerYear: " + SecPerYear.ToString() + "\n";
output += "SunAngVelocity: " + SunAngVelocity.ToString() + "\n";
output += "SunPhase: " + SunPhase.ToString() + "\n";
output += "SunDirection: " + SunDirection.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SpaceServerSimulatorTimeMessage; } }
public TimeInfoBlock TimeInfo;
public SpaceServerSimulatorTimeMessagePacket()
{
Header = new LowHeader();
Header.ID = 8;
Header.Reliable = true;
TimeInfo = new TimeInfoBlock();
}
public SpaceServerSimulatorTimeMessagePacket(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 SpaceServerSimulatorTimeMessagePacket(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 = "--- SpaceServerSimulatorTimeMessage ---\n";
output += TimeInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarTextureUpdatePacket : Packet
{
/// <exclude/>
public class WearableDataBlock
{
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); }
}
}
public LLUUID CacheID;
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
{
TextureIndex = (byte)bytes[i++];
length = (ushort)bytes[i++];
_hostname = new byte[length];
Array.Copy(bytes, i, _hostname, 0, length); i += length;
CacheID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
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;
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 --\n";
output += "TextureIndex: " + TextureIndex.ToString() + "\n";
output += Helpers.FieldToString(HostName, "HostName") + "\n";
output += "CacheID: " + CacheID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TextureDataBlock
{
public LLUUID TextureID;
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 --\n";
output += "TextureID: " + TextureID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public bool TexturesChanged;
public LLUUID AgentID;
public int Length
{
get
{
return 17;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
try
{
TexturesChanged = (bytes[i++] != 0) ? (bool)true : (bool)false;
AgentID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((TexturesChanged) ? 1 : 0);
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 --\n";
output += "TexturesChanged: " + TexturesChanged.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AvatarTextureUpdate; } }
public WearableDataBlock[] WearableData;
public TextureDataBlock[] TextureData;
public AgentDataBlock AgentData;
public AvatarTextureUpdatePacket()
{
Header = new LowHeader();
Header.ID = 9;
Header.Reliable = true;
Header.Zerocoded = true;
WearableData = new WearableDataBlock[0];
TextureData = new TextureDataBlock[0];
AgentData = new AgentDataBlock();
}
public AvatarTextureUpdatePacket(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); }
count = (int)bytes[i++];
TextureData = new TextureDataBlock[count];
for (int j = 0; j < count; j++)
{ TextureData[j] = new TextureDataBlock(bytes, ref i); }
AgentData = new AgentDataBlock(bytes, ref i);
}
public AvatarTextureUpdatePacket(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); }
count = (int)bytes[i++];
TextureData = new TextureDataBlock[count];
for (int j = 0; j < count; j++)
{ TextureData[j] = new TextureDataBlock(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; }
length++;
for (int j = 0; j < TextureData.Length; j++) { length += TextureData[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); }
bytes[i++] = (byte)TextureData.Length;
for (int j = 0; j < TextureData.Length; j++) { TextureData[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 = "--- AvatarTextureUpdate ---\n";
for (int j = 0; j < WearableData.Length; j++)
{
output += WearableData[j].ToString() + "\n";
}
for (int j = 0; j < TextureData.Length; j++)
{
output += TextureData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimulatorMapUpdatePacket : Packet
{
/// <exclude/>
public class MapDataBlock
{
public uint Flags;
public int Length
{
get
{
return 4;
}
}
public MapDataBlock() { }
public MapDataBlock(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 = "-- MapData --\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorMapUpdate; } }
public MapDataBlock MapData;
public SimulatorMapUpdatePacket()
{
Header = new LowHeader();
Header.ID = 10;
Header.Reliable = true;
MapData = new MapDataBlock();
}
public SimulatorMapUpdatePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
MapData = new MapDataBlock(bytes, ref i);
}
public SimulatorMapUpdatePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
MapData = new MapDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += MapData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
MapData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimulatorMapUpdate ---\n";
output += MapData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimulatorSetMapPacket : Packet
{
/// <exclude/>
public class MapDataBlock
{
public LLUUID MapImage;
public int Type;
public ulong RegionHandle;
public int Length
{
get
{
return 28;
}
}
public MapDataBlock() { }
public MapDataBlock(byte[] bytes, ref int i)
{
try
{
MapImage = new LLUUID(bytes, i); i += 16;
Type = (int)(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));
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(MapImage == null) { Console.WriteLine("Warning: MapImage is null, in " + this.GetType()); }
Array.Copy(MapImage.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);
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 = "-- MapData --\n";
output += "MapImage: " + MapImage.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorSetMap; } }
public MapDataBlock MapData;
public SimulatorSetMapPacket()
{
Header = new LowHeader();
Header.ID = 11;
Header.Reliable = true;
MapData = new MapDataBlock();
}
public SimulatorSetMapPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
MapData = new MapDataBlock(bytes, ref i);
}
public SimulatorSetMapPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
MapData = new MapDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += MapData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
MapData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimulatorSetMap ---\n";
output += MapData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SubscribeLoadPacket : Packet
{
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SubscribeLoad; } }
public SubscribeLoadPacket()
{
Header = new LowHeader();
Header.ID = 12;
Header.Reliable = true;
}
public SubscribeLoadPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
}
public SubscribeLoadPacket(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 = "--- SubscribeLoad ---\n";
return output;
}
}
/// <exclude/>
public class UnsubscribeLoadPacket : Packet
{
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UnsubscribeLoad; } }
public UnsubscribeLoadPacket()
{
Header = new LowHeader();
Header.ID = 13;
Header.Reliable = true;
}
public UnsubscribeLoadPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
}
public UnsubscribeLoadPacket(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 = "--- UnsubscribeLoad ---\n";
return output;
}
}
/// <exclude/>
public class SimulatorStartPacket : Packet
{
/// <exclude/>
public class PositionSuggestionBlock
{
public bool Ignore;
public int GridX;
public int GridY;
public int Length
{
get
{
return 9;
}
}
public PositionSuggestionBlock() { }
public PositionSuggestionBlock(byte[] bytes, ref int i)
{
try
{
Ignore = (bytes[i++] != 0) ? (bool)true : (bool)false;
GridX = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridY = (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)((Ignore) ? 1 : 0);
bytes[i++] = (byte)(GridX % 256);
bytes[i++] = (byte)((GridX >> 8) % 256);
bytes[i++] = (byte)((GridX >> 16) % 256);
bytes[i++] = (byte)((GridX >> 24) % 256);
bytes[i++] = (byte)(GridY % 256);
bytes[i++] = (byte)((GridY >> 8) % 256);
bytes[i++] = (byte)((GridY >> 16) % 256);
bytes[i++] = (byte)((GridY >> 24) % 256);
}
public override string ToString()
{
string output = "-- PositionSuggestion --\n";
output += "Ignore: " + Ignore.ToString() + "\n";
output += "GridX: " + GridX.ToString() + "\n";
output += "GridY: " + GridY.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ControlPortBlock
{
public ushort PublicPort;
public ushort Port;
public uint PublicIP;
public int Length
{
get
{
return 8;
}
}
public ControlPortBlock() { }
public ControlPortBlock(byte[] bytes, ref int i)
{
try
{
PublicPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
PublicIP = (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)((PublicPort >> 8) % 256);
bytes[i++] = (byte)(PublicPort % 256);
bytes[i++] = (byte)((Port >> 8) % 256);
bytes[i++] = (byte)(Port % 256);
bytes[i++] = (byte)(PublicIP % 256);
bytes[i++] = (byte)((PublicIP >> 8) % 256);
bytes[i++] = (byte)((PublicIP >> 16) % 256);
bytes[i++] = (byte)((PublicIP >> 24) % 256);
}
public override string ToString()
{
string output = "-- ControlPort --\n";
output += "PublicPort: " + PublicPort.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "PublicIP: " + PublicIP.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorStart; } }
public PositionSuggestionBlock PositionSuggestion;
public ControlPortBlock ControlPort;
public SimulatorStartPacket()
{
Header = new LowHeader();
Header.ID = 14;
Header.Reliable = true;
PositionSuggestion = new PositionSuggestionBlock();
ControlPort = new ControlPortBlock();
}
public SimulatorStartPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
PositionSuggestion = new PositionSuggestionBlock(bytes, ref i);
ControlPort = new ControlPortBlock(bytes, ref i);
}
public SimulatorStartPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
PositionSuggestion = new PositionSuggestionBlock(bytes, ref i);
ControlPort = new ControlPortBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += PositionSuggestion.Length; length += ControlPort.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
PositionSuggestion.ToBytes(bytes, ref i);
ControlPort.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimulatorStart ---\n";
output += PositionSuggestion.ToString() + "\n";
output += ControlPort.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimulatorReadyPacket : Packet
{
/// <exclude/>
public class TelehubBlockBlock
{
public bool HasTelehub;
public LLVector3 TelehubPos;
public int Length
{
get
{
return 13;
}
}
public TelehubBlockBlock() { }
public TelehubBlockBlock(byte[] bytes, ref int i)
{
try
{
HasTelehub = (bytes[i++] != 0) ? (bool)true : (bool)false;
TelehubPos = new LLVector3(bytes, i); i += 12;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((HasTelehub) ? 1 : 0);
if(TelehubPos == null) { Console.WriteLine("Warning: TelehubPos is null, in " + this.GetType()); }
Array.Copy(TelehubPos.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- TelehubBlock --\n";
output += "HasTelehub: " + HasTelehub.ToString() + "\n";
output += "TelehubPos: " + TelehubPos.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SimulatorBlockBlock
{
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 LLUUID RegionID;
public byte SimAccess;
public uint ParentEstateID;
public uint EstateID;
public int Length
{
get
{
int length = 29;
if (SimName != null) { length += 1 + SimName.Length; }
return length;
}
}
public SimulatorBlockBlock() { }
public SimulatorBlockBlock(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;
RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
RegionID = new LLUUID(bytes, i); i += 16;
SimAccess = (byte)bytes[i++];
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)
{
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);
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = SimAccess;
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 = "-- SimulatorBlock --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "RegionFlags: " + RegionFlags.ToString() + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "ParentEstateID: " + ParentEstateID.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorReady; } }
public TelehubBlockBlock TelehubBlock;
public SimulatorBlockBlock SimulatorBlock;
public SimulatorReadyPacket()
{
Header = new LowHeader();
Header.ID = 15;
Header.Reliable = true;
Header.Zerocoded = true;
TelehubBlock = new TelehubBlockBlock();
SimulatorBlock = new SimulatorBlockBlock();
}
public SimulatorReadyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
TelehubBlock = new TelehubBlockBlock(bytes, ref i);
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
}
public SimulatorReadyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
TelehubBlock = new TelehubBlockBlock(bytes, ref i);
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TelehubBlock.Length; length += SimulatorBlock.Length;;
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);
SimulatorBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimulatorReady ---\n";
output += TelehubBlock.ToString() + "\n";
output += SimulatorBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TelehubInfoPacket : Packet
{
/// <exclude/>
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;
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;
if(TelehubPos == null) { Console.WriteLine("Warning: TelehubPos is null, in " + this.GetType()); }
Array.Copy(TelehubPos.GetBytes(), 0, bytes, i, 12); i += 12;
if(TelehubRot == null) { Console.WriteLine("Warning: TelehubRot is null, in " + this.GetType()); }
Array.Copy(TelehubRot.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- TelehubBlock --\n";
output += Helpers.FieldToString(ObjectName, "ObjectName") + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "TelehubPos: " + TelehubPos.ToString() + "\n";
output += "TelehubRot: " + TelehubRot.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SpawnPointBlockBlock
{
public LLVector3 SpawnPointPos;
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)
{
if(SpawnPointPos == null) { Console.WriteLine("Warning: SpawnPointPos is null, in " + this.GetType()); }
Array.Copy(SpawnPointPos.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- SpawnPointBlock --\n";
output += "SpawnPointPos: " + SpawnPointPos.ToString() + "\n";
output = 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 ---\n";
output += TelehubBlock.ToString() + "\n";
for (int j = 0; j < SpawnPointBlock.Length; j++)
{
output += SpawnPointBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SimulatorPresentAtLocationPacket : Packet
{
/// <exclude/>
public class TelehubBlockBlock
{
public bool HasTelehub;
public LLVector3 TelehubPos;
public int Length
{
get
{
return 13;
}
}
public TelehubBlockBlock() { }
public TelehubBlockBlock(byte[] bytes, ref int i)
{
try
{
HasTelehub = (bytes[i++] != 0) ? (bool)true : (bool)false;
TelehubPos = new LLVector3(bytes, i); i += 12;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((HasTelehub) ? 1 : 0);
if(TelehubPos == null) { Console.WriteLine("Warning: TelehubPos is null, in " + this.GetType()); }
Array.Copy(TelehubPos.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- TelehubBlock --\n";
output += "HasTelehub: " + HasTelehub.ToString() + "\n";
output += "TelehubPos: " + TelehubPos.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SimulatorBlockBlock
{
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 LLUUID RegionID;
public byte SimAccess;
public uint ParentEstateID;
public uint EstateID;
public int Length
{
get
{
int length = 29;
if (SimName != null) { length += 1 + SimName.Length; }
return length;
}
}
public SimulatorBlockBlock() { }
public SimulatorBlockBlock(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;
RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
RegionID = new LLUUID(bytes, i); i += 16;
SimAccess = (byte)bytes[i++];
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)
{
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);
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = SimAccess;
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 = "-- SimulatorBlock --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "RegionFlags: " + RegionFlags.ToString() + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "ParentEstateID: " + ParentEstateID.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SimulatorPublicHostBlockBlock
{
public ushort Port;
public uint SimulatorIP;
public uint GridX;
public uint GridY;
public int Length
{
get
{
return 14;
}
}
public SimulatorPublicHostBlockBlock() { }
public SimulatorPublicHostBlockBlock(byte[] bytes, ref int i)
{
try
{
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
SimulatorIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridX = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridY = (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)((Port >> 8) % 256);
bytes[i++] = (byte)(Port % 256);
bytes[i++] = (byte)(SimulatorIP % 256);
bytes[i++] = (byte)((SimulatorIP >> 8) % 256);
bytes[i++] = (byte)((SimulatorIP >> 16) % 256);
bytes[i++] = (byte)((SimulatorIP >> 24) % 256);
bytes[i++] = (byte)(GridX % 256);
bytes[i++] = (byte)((GridX >> 8) % 256);
bytes[i++] = (byte)((GridX >> 16) % 256);
bytes[i++] = (byte)((GridX >> 24) % 256);
bytes[i++] = (byte)(GridY % 256);
bytes[i++] = (byte)((GridY >> 8) % 256);
bytes[i++] = (byte)((GridY >> 16) % 256);
bytes[i++] = (byte)((GridY >> 24) % 256);
}
public override string ToString()
{
string output = "-- SimulatorPublicHostBlock --\n";
output += "Port: " + Port.ToString() + "\n";
output += "SimulatorIP: " + SimulatorIP.ToString() + "\n";
output += "GridX: " + GridX.ToString() + "\n";
output += "GridY: " + GridY.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class NeighborBlockBlock
{
public uint IP;
public ushort Port;
public int Length
{
get
{
return 6;
}
}
public NeighborBlockBlock() { }
public NeighborBlockBlock(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 = "-- NeighborBlock --\n";
output += "IP: " + IP.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorPresentAtLocation; } }
public TelehubBlockBlock[] TelehubBlock;
public SimulatorBlockBlock SimulatorBlock;
public SimulatorPublicHostBlockBlock SimulatorPublicHostBlock;
public NeighborBlockBlock[] NeighborBlock;
public SimulatorPresentAtLocationPacket()
{
Header = new LowHeader();
Header.ID = 17;
Header.Reliable = true;
TelehubBlock = new TelehubBlockBlock[0];
SimulatorBlock = new SimulatorBlockBlock();
SimulatorPublicHostBlock = new SimulatorPublicHostBlockBlock();
NeighborBlock = new NeighborBlockBlock[4];
}
public SimulatorPresentAtLocationPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
TelehubBlock = new TelehubBlockBlock[count];
for (int j = 0; j < count; j++)
{ TelehubBlock[j] = new TelehubBlockBlock(bytes, ref i); }
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
SimulatorPublicHostBlock = new SimulatorPublicHostBlockBlock(bytes, ref i);
NeighborBlock = new NeighborBlockBlock[4];
for (int j = 0; j < 4; j++)
{ NeighborBlock[j] = new NeighborBlockBlock(bytes, ref i); }
}
public SimulatorPresentAtLocationPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
TelehubBlock = new TelehubBlockBlock[count];
for (int j = 0; j < count; j++)
{ TelehubBlock[j] = new TelehubBlockBlock(bytes, ref i); }
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
SimulatorPublicHostBlock = new SimulatorPublicHostBlockBlock(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 += SimulatorBlock.Length; length += SimulatorPublicHostBlock.Length;;
length++;
for (int j = 0; j < TelehubBlock.Length; j++) { length += TelehubBlock[j].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);
bytes[i++] = (byte)TelehubBlock.Length;
for (int j = 0; j < TelehubBlock.Length; j++) { TelehubBlock[j].ToBytes(bytes, ref i); }
SimulatorBlock.ToBytes(bytes, ref i);
SimulatorPublicHostBlock.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 = "--- SimulatorPresentAtLocation ---\n";
for (int j = 0; j < TelehubBlock.Length; j++)
{
output += TelehubBlock[j].ToString() + "\n";
}
output += SimulatorBlock.ToString() + "\n";
output += SimulatorPublicHostBlock.ToString() + "\n";
for (int j = 0; j < 4; j++)
{
output += NeighborBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SimulatorLoadPacket : Packet
{
/// <exclude/>
public class SimulatorLoadBlock
{
public bool CanAcceptAgents;
public float TimeDilation;
public int AgentCount;
public int Length
{
get
{
return 9;
}
}
public SimulatorLoadBlock() { }
public SimulatorLoadBlock(byte[] bytes, ref int i)
{
try
{
CanAcceptAgents = (bytes[i++] != 0) ? (bool)true : (bool)false;
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
TimeDilation = BitConverter.ToSingle(bytes, i); i += 4;
AgentCount = (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)((CanAcceptAgents) ? 1 : 0);
ba = BitConverter.GetBytes(TimeDilation);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
bytes[i++] = (byte)(AgentCount % 256);
bytes[i++] = (byte)((AgentCount >> 8) % 256);
bytes[i++] = (byte)((AgentCount >> 16) % 256);
bytes[i++] = (byte)((AgentCount >> 24) % 256);
}
public override string ToString()
{
string output = "-- SimulatorLoad --\n";
output += "CanAcceptAgents: " + CanAcceptAgents.ToString() + "\n";
output += "TimeDilation: " + TimeDilation.ToString() + "\n";
output += "AgentCount: " + AgentCount.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentListBlock
{
public byte X;
public byte Y;
public uint CircuitCode;
public int Length
{
get
{
return 6;
}
}
public AgentListBlock() { }
public AgentListBlock(byte[] bytes, ref int i)
{
try
{
X = (byte)bytes[i++];
Y = (byte)bytes[i++];
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)
{
bytes[i++] = X;
bytes[i++] = Y;
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 = "-- AgentList --\n";
output += "X: " + X.ToString() + "\n";
output += "Y: " + Y.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorLoad; } }
public SimulatorLoadBlock SimulatorLoad;
public AgentListBlock[] AgentList;
public SimulatorLoadPacket()
{
Header = new LowHeader();
Header.ID = 18;
Header.Reliable = true;
SimulatorLoad = new SimulatorLoadBlock();
AgentList = new AgentListBlock[0];
}
public SimulatorLoadPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
SimulatorLoad = new SimulatorLoadBlock(bytes, ref i);
int count = (int)bytes[i++];
AgentList = new AgentListBlock[count];
for (int j = 0; j < count; j++)
{ AgentList[j] = new AgentListBlock(bytes, ref i); }
}
public SimulatorLoadPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
SimulatorLoad = new SimulatorLoadBlock(bytes, ref i);
int count = (int)bytes[i++];
AgentList = new AgentListBlock[count];
for (int j = 0; j < count; j++)
{ AgentList[j] = new AgentListBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
length += SimulatorLoad.Length;;
length++;
for (int j = 0; j < AgentList.Length; j++) { length += AgentList[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);
SimulatorLoad.ToBytes(bytes, ref i);
bytes[i++] = (byte)AgentList.Length;
for (int j = 0; j < AgentList.Length; j++) { AgentList[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimulatorLoad ---\n";
output += SimulatorLoad.ToString() + "\n";
for (int j = 0; j < AgentList.Length; j++)
{
output += AgentList[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SimulatorShutdownRequestPacket : Packet
{
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorShutdownRequest; } }
public SimulatorShutdownRequestPacket()
{
Header = new LowHeader();
Header.ID = 19;
Header.Reliable = true;
}
public SimulatorShutdownRequestPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
}
public SimulatorShutdownRequestPacket(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 = "--- SimulatorShutdownRequest ---\n";
return output;
}
}
/// <exclude/>
public class RegionPresenceRequestByRegionIDPacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public LLUUID RegionID;
public int Length
{
get
{
return 16;
}
}
public RegionDataBlock() { }
public RegionDataBlock(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 = "-- RegionData --\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RegionPresenceRequestByRegionID; } }
public RegionDataBlock[] RegionData;
public RegionPresenceRequestByRegionIDPacket()
{
Header = new LowHeader();
Header.ID = 20;
Header.Reliable = true;
RegionData = new RegionDataBlock[0];
}
public RegionPresenceRequestByRegionIDPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public RegionPresenceRequestByRegionIDPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < RegionData.Length; j++) { length += RegionData[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)RegionData.Length;
for (int j = 0; j < RegionData.Length; j++) { RegionData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RegionPresenceRequestByRegionID ---\n";
for (int j = 0; j < RegionData.Length; j++)
{
output += RegionData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class RegionPresenceRequestByHandlePacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public ulong RegionHandle;
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 --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RegionPresenceRequestByHandle; } }
public RegionDataBlock[] RegionData;
public RegionPresenceRequestByHandlePacket()
{
Header = new LowHeader();
Header.ID = 21;
Header.Reliable = true;
RegionData = new RegionDataBlock[0];
}
public RegionPresenceRequestByHandlePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public RegionPresenceRequestByHandlePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < RegionData.Length; j++) { length += RegionData[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)RegionData.Length;
for (int j = 0; j < RegionData.Length; j++) { RegionData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RegionPresenceRequestByHandle ---\n";
for (int j = 0; j < RegionData.Length; j++)
{
output += RegionData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class RegionPresenceResponsePacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public double ValidUntil;
public uint InternalRegionIP;
public uint ExternalRegionIP;
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 RegionID;
public ulong RegionHandle;
public ushort RegionPort;
public int Length
{
get
{
int length = 42;
if (Message != null) { length += 1 + Message.Length; }
return length;
}
}
public RegionDataBlock() { }
public RegionDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8);
ValidUntil = BitConverter.ToDouble(bytes, i); i += 8;
InternalRegionIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ExternalRegionIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
length = (ushort)bytes[i++];
_message = new byte[length];
Array.Copy(bytes, i, _message, 0, length); i += length;
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));
RegionPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
byte[] ba;
ba = BitConverter.GetBytes(ValidUntil);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); }
Array.Copy(ba, 0, bytes, i, 8); i += 8;
bytes[i++] = (byte)(InternalRegionIP % 256);
bytes[i++] = (byte)((InternalRegionIP >> 8) % 256);
bytes[i++] = (byte)((InternalRegionIP >> 16) % 256);
bytes[i++] = (byte)((InternalRegionIP >> 24) % 256);
bytes[i++] = (byte)(ExternalRegionIP % 256);
bytes[i++] = (byte)((ExternalRegionIP >> 8) % 256);
bytes[i++] = (byte)((ExternalRegionIP >> 16) % 256);
bytes[i++] = (byte)((ExternalRegionIP >> 24) % 256);
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(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);
bytes[i++] = (byte)((RegionPort >> 8) % 256);
bytes[i++] = (byte)(RegionPort % 256);
}
public override string ToString()
{
string output = "-- RegionData --\n";
output += "ValidUntil: " + ValidUntil.ToString() + "\n";
output += "InternalRegionIP: " + InternalRegionIP.ToString() + "\n";
output += "ExternalRegionIP: " + ExternalRegionIP.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "RegionPort: " + RegionPort.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RegionPresenceResponse; } }
public RegionDataBlock[] RegionData;
public RegionPresenceResponsePacket()
{
Header = new LowHeader();
Header.ID = 22;
Header.Reliable = true;
Header.Zerocoded = true;
RegionData = new RegionDataBlock[0];
}
public RegionPresenceResponsePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public RegionPresenceResponsePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < RegionData.Length; j++) { length += RegionData[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)RegionData.Length;
for (int j = 0; j < RegionData.Length; j++) { RegionData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RegionPresenceResponse ---\n";
for (int j = 0; j < RegionData.Length; j++)
{
output += RegionData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class RecordAgentPresencePacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public LLUUID RegionID;
public int Length
{
get
{
return 16;
}
}
public RegionDataBlock() { }
public RegionDataBlock(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 = "-- RegionData --\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public short LocalX;
public short LocalY;
public int Status;
public LLUUID SecureSessionID;
public uint EstateID;
public int TimeToLive;
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;
LocalX = (short)(bytes[i++] + (bytes[i++] << 8));
LocalY = (short)(bytes[i++] + (bytes[i++] << 8));
Status = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
SecureSessionID = new LLUUID(bytes, i); i += 16;
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
TimeToLive = (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)(LocalX % 256);
bytes[i++] = (byte)((LocalX >> 8) % 256);
bytes[i++] = (byte)(LocalY % 256);
bytes[i++] = (byte)((LocalY >> 8) % 256);
bytes[i++] = (byte)(Status % 256);
bytes[i++] = (byte)((Status >> 8) % 256);
bytes[i++] = (byte)((Status >> 16) % 256);
bytes[i++] = (byte)((Status >> 24) % 256);
if(SecureSessionID == null) { Console.WriteLine("Warning: SecureSessionID is null, in " + this.GetType()); }
Array.Copy(SecureSessionID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = (byte)(EstateID % 256);
bytes[i++] = (byte)((EstateID >> 8) % 256);
bytes[i++] = (byte)((EstateID >> 16) % 256);
bytes[i++] = (byte)((EstateID >> 24) % 256);
bytes[i++] = (byte)(TimeToLive % 256);
bytes[i++] = (byte)((TimeToLive >> 8) % 256);
bytes[i++] = (byte)((TimeToLive >> 16) % 256);
bytes[i++] = (byte)((TimeToLive >> 24) % 256);
}
public override string ToString()
{
string output = "-- AgentData --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "LocalX: " + LocalX.ToString() + "\n";
output += "LocalY: " + LocalY.ToString() + "\n";
output += "Status: " + Status.ToString() + "\n";
output += "SecureSessionID: " + SecureSessionID.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output += "TimeToLive: " + TimeToLive.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RecordAgentPresence; } }
public RegionDataBlock RegionData;
public AgentDataBlock[] AgentData;
public RecordAgentPresencePacket()
{
Header = new LowHeader();
Header.ID = 23;
Header.Reliable = true;
RegionData = new RegionDataBlock();
AgentData = new AgentDataBlock[0];
}
public RecordAgentPresencePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
RegionData = new RegionDataBlock(bytes, ref i);
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public RecordAgentPresencePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
RegionData = new RegionDataBlock(bytes, ref i);
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
length += RegionData.Length;;
length++;
for (int j = 0; j < AgentData.Length; j++) { length += AgentData[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);
RegionData.ToBytes(bytes, ref i);
bytes[i++] = (byte)AgentData.Length;
for (int j = 0; j < AgentData.Length; j++) { AgentData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RecordAgentPresence ---\n";
output += RegionData.ToString() + "\n";
for (int j = 0; j < AgentData.Length; j++)
{
output += AgentData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class EraseAgentPresencePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.EraseAgentPresence; } }
public AgentDataBlock[] AgentData;
public EraseAgentPresencePacket()
{
Header = new LowHeader();
Header.ID = 24;
Header.Reliable = true;
AgentData = new AgentDataBlock[0];
}
public EraseAgentPresencePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public EraseAgentPresencePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < AgentData.Length; j++) { length += AgentData[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)AgentData.Length;
for (int j = 0; j < AgentData.Length; j++) { AgentData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- EraseAgentPresence ---\n";
for (int j = 0; j < AgentData.Length; j++)
{
output += AgentData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AgentPresenceRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AgentPresenceRequest; } }
public AgentDataBlock[] AgentData;
public AgentPresenceRequestPacket()
{
Header = new LowHeader();
Header.ID = 25;
Header.Reliable = true;
AgentData = new AgentDataBlock[0];
}
public AgentPresenceRequestPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public AgentPresenceRequestPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < AgentData.Length; j++) { length += AgentData[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)AgentData.Length;
for (int j = 0; j < AgentData.Length; j++) { AgentData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- AgentPresenceRequest ---\n";
for (int j = 0; j < AgentData.Length; j++)
{
output += AgentData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AgentPresenceResponsePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public double ValidUntil;
public uint RegionIP;
public ushort RegionPort;
public uint EstateID;
public int Length
{
get
{
return 34;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8);
ValidUntil = BitConverter.ToDouble(bytes, i); i += 8;
RegionIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
RegionPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
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;
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
ba = BitConverter.GetBytes(ValidUntil);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); }
Array.Copy(ba, 0, bytes, i, 8); i += 8;
bytes[i++] = (byte)(RegionIP % 256);
bytes[i++] = (byte)((RegionIP >> 8) % 256);
bytes[i++] = (byte)((RegionIP >> 16) % 256);
bytes[i++] = (byte)((RegionIP >> 24) % 256);
bytes[i++] = (byte)((RegionPort >> 8) % 256);
bytes[i++] = (byte)(RegionPort % 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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "ValidUntil: " + ValidUntil.ToString() + "\n";
output += "RegionIP: " + RegionIP.ToString() + "\n";
output += "RegionPort: " + RegionPort.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AgentPresenceResponse; } }
public AgentDataBlock[] AgentData;
public AgentPresenceResponsePacket()
{
Header = new LowHeader();
Header.ID = 26;
Header.Reliable = true;
AgentData = new AgentDataBlock[0];
}
public AgentPresenceResponsePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public AgentPresenceResponsePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
AgentData = new AgentDataBlock[count];
for (int j = 0; j < count; j++)
{ AgentData[j] = new AgentDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < AgentData.Length; j++) { length += AgentData[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)AgentData.Length;
for (int j = 0; j < AgentData.Length; j++) { AgentData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- AgentPresenceResponse ---\n";
for (int j = 0; j < AgentData.Length; j++)
{
output += AgentData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class UpdateSimulatorPacket : Packet
{
/// <exclude/>
public class SimulatorInfoBlock
{
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 RegionID;
public byte SimAccess;
public uint EstateID;
public int Length
{
get
{
int length = 21;
if (SimName != null) { length += 1 + SimName.Length; }
return length;
}
}
public SimulatorInfoBlock() { }
public SimulatorInfoBlock(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;
RegionID = new LLUUID(bytes, i); i += 16;
SimAccess = (byte)bytes[i++];
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(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(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = SimAccess;
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 = "-- SimulatorInfo --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UpdateSimulator; } }
public SimulatorInfoBlock SimulatorInfo;
public UpdateSimulatorPacket()
{
Header = new LowHeader();
Header.ID = 27;
Header.Reliable = true;
SimulatorInfo = new SimulatorInfoBlock();
}
public UpdateSimulatorPacket(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 UpdateSimulatorPacket(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 = "--- UpdateSimulator ---\n";
output += SimulatorInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TrackAgentSessionPacket : Packet
{
/// <exclude/>
public class SessionInfoBlock
{
public double GlobalX;
public double GlobalY;
public LLUUID SessionID;
public ushort ViewerPort;
public uint ViewerIP;
public int Length
{
get
{
return 38;
}
}
public SessionInfoBlock() { }
public SessionInfoBlock(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;
SessionID = new LLUUID(bytes, i); i += 16;
ViewerPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
ViewerIP = (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(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;
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)((ViewerPort >> 8) % 256);
bytes[i++] = (byte)(ViewerPort % 256);
bytes[i++] = (byte)(ViewerIP % 256);
bytes[i++] = (byte)((ViewerIP >> 8) % 256);
bytes[i++] = (byte)((ViewerIP >> 16) % 256);
bytes[i++] = (byte)((ViewerIP >> 24) % 256);
}
public override string ToString()
{
string output = "-- SessionInfo --\n";
output += "GlobalX: " + GlobalX.ToString() + "\n";
output += "GlobalY: " + GlobalY.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "ViewerPort: " + ViewerPort.ToString() + "\n";
output += "ViewerIP: " + ViewerIP.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionDataBlock
{
public float RegionX;
public float RegionY;
public uint SpaceIP;
public uint AgentCount;
public uint EstateID;
public int Length
{
get
{
return 20;
}
}
public RegionDataBlock() { }
public RegionDataBlock(byte[] bytes, ref int i)
{
try
{
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
RegionX = BitConverter.ToSingle(bytes, i); i += 4;
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
RegionY = BitConverter.ToSingle(bytes, i); i += 4;
SpaceIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
AgentCount = (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(RegionX);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
ba = BitConverter.GetBytes(RegionY);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
bytes[i++] = (byte)(SpaceIP % 256);
bytes[i++] = (byte)((SpaceIP >> 8) % 256);
bytes[i++] = (byte)((SpaceIP >> 16) % 256);
bytes[i++] = (byte)((SpaceIP >> 24) % 256);
bytes[i++] = (byte)(AgentCount % 256);
bytes[i++] = (byte)((AgentCount >> 8) % 256);
bytes[i++] = (byte)((AgentCount >> 16) % 256);
bytes[i++] = (byte)((AgentCount >> 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 = "-- RegionData --\n";
output += "RegionX: " + RegionX.ToString() + "\n";
output += "RegionY: " + RegionY.ToString() + "\n";
output += "SpaceIP: " + SpaceIP.ToString() + "\n";
output += "AgentCount: " + AgentCount.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.TrackAgentSession; } }
public SessionInfoBlock[] SessionInfo;
public RegionDataBlock RegionData;
public TrackAgentSessionPacket()
{
Header = new LowHeader();
Header.ID = 28;
Header.Reliable = true;
SessionInfo = new SessionInfoBlock[0];
RegionData = new RegionDataBlock();
}
public TrackAgentSessionPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
SessionInfo = new SessionInfoBlock[count];
for (int j = 0; j < count; j++)
{ SessionInfo[j] = new SessionInfoBlock(bytes, ref i); }
RegionData = new RegionDataBlock(bytes, ref i);
}
public TrackAgentSessionPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
SessionInfo = new SessionInfoBlock[count];
for (int j = 0; j < count; j++)
{ SessionInfo[j] = new SessionInfoBlock(bytes, ref i); }
RegionData = new RegionDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += RegionData.Length;;
length++;
for (int j = 0; j < SessionInfo.Length; j++) { length += SessionInfo[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)SessionInfo.Length;
for (int j = 0; j < SessionInfo.Length; j++) { SessionInfo[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 = "--- TrackAgentSession ---\n";
for (int j = 0; j < SessionInfo.Length; j++)
{
output += SessionInfo[j].ToString() + "\n";
}
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClearAgentSessionsPacket : Packet
{
/// <exclude/>
public class RegionInfoBlock
{
public uint RegionX;
public uint RegionY;
public uint SpaceIP;
public int Length
{
get
{
return 12;
}
}
public RegionInfoBlock() { }
public RegionInfoBlock(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));
SpaceIP = (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)(SpaceIP % 256);
bytes[i++] = (byte)((SpaceIP >> 8) % 256);
bytes[i++] = (byte)((SpaceIP >> 16) % 256);
bytes[i++] = (byte)((SpaceIP >> 24) % 256);
}
public override string ToString()
{
string output = "-- RegionInfo --\n";
output += "RegionX: " + RegionX.ToString() + "\n";
output += "RegionY: " + RegionY.ToString() + "\n";
output += "SpaceIP: " + SpaceIP.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ClearAgentSessions; } }
public RegionInfoBlock RegionInfo;
public ClearAgentSessionsPacket()
{
Header = new LowHeader();
Header.ID = 29;
Header.Reliable = true;
RegionInfo = new RegionInfoBlock();
}
public ClearAgentSessionsPacket(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 ClearAgentSessionsPacket(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 = "--- ClearAgentSessions ---\n";
output += RegionInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogDwellTimePacket : Packet
{
/// <exclude/>
public class DwellInfoBlock
{
public float Duration;
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 AgentID;
public uint RegionX;
public uint RegionY;
public LLUUID SessionID;
public int Length
{
get
{
int length = 44;
if (SimName != null) { length += 1 + SimName.Length; }
return length;
}
}
public DwellInfoBlock() { }
public DwellInfoBlock(byte[] bytes, ref int i)
{
int length;
try
{
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
Duration = BitConverter.ToSingle(bytes, i); i += 4;
length = (ushort)bytes[i++];
_simname = new byte[length];
Array.Copy(bytes, i, _simname, 0, length); i += length;
AgentID = new LLUUID(bytes, i); i += 16;
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));
SessionID = new LLUUID(bytes, i); i += 16;
}
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(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(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
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);
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 = "-- DwellInfo --\n";
output += "Duration: " + Duration.ToString() + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RegionX: " + RegionX.ToString() + "\n";
output += "RegionY: " + RegionY.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.LogDwellTime; } }
public DwellInfoBlock DwellInfo;
public LogDwellTimePacket()
{
Header = new LowHeader();
Header.ID = 30;
Header.Reliable = true;
DwellInfo = new DwellInfoBlock();
}
public LogDwellTimePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
DwellInfo = new DwellInfoBlock(bytes, ref i);
}
public LogDwellTimePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
DwellInfo = new DwellInfoBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += DwellInfo.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
DwellInfo.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- LogDwellTime ---\n";
output += DwellInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class FeatureDisabledPacket : Packet
{
/// <exclude/>
public class FailureInfoBlock
{
public LLUUID AgentID;
private byte[] _errormessage;
public byte[] ErrorMessage
{
get { return _errormessage; }
set
{
if (value == null) { _errormessage = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _errormessage = new byte[value.Length]; Array.Copy(value, _errormessage, value.Length); }
}
}
public LLUUID TransactionID;
public int Length
{
get
{
int length = 32;
if (ErrorMessage != null) { length += 1 + ErrorMessage.Length; }
return length;
}
}
public FailureInfoBlock() { }
public FailureInfoBlock(byte[] bytes, ref int i)
{
int length;
try
{
AgentID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_errormessage = new byte[length];
Array.Copy(bytes, i, _errormessage, 0, length); i += length;
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(ErrorMessage == null) { Console.WriteLine("Warning: ErrorMessage is null, in " + this.GetType()); }
bytes[i++] = (byte)ErrorMessage.Length;
Array.Copy(ErrorMessage, 0, bytes, i, ErrorMessage.Length); i += ErrorMessage.Length;
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 = "-- FailureInfo --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(ErrorMessage, "ErrorMessage") + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.FeatureDisabled; } }
public FailureInfoBlock FailureInfo;
public FeatureDisabledPacket()
{
Header = new LowHeader();
Header.ID = 31;
Header.Reliable = true;
FailureInfo = new FailureInfoBlock();
}
public FeatureDisabledPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
FailureInfo = new FailureInfoBlock(bytes, ref i);
}
public FeatureDisabledPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
FailureInfo = new FailureInfoBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += FailureInfo.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
FailureInfo.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- FeatureDisabled ---\n";
output += FailureInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogFailedMoneyTransactionPacket : Packet
{
/// <exclude/>
public class TransactionDataBlock
{
public byte FailureType;
public LLUUID DestID;
public int Amount;
public uint SimulatorIP;
public byte Flags;
public uint GridX;
public uint GridY;
public LLUUID SourceID;
public LLUUID TransactionID;
public uint TransactionTime;
public int TransactionType;
public int Length
{
get
{
return 74;
}
}
public TransactionDataBlock() { }
public TransactionDataBlock(byte[] bytes, ref int i)
{
try
{
FailureType = (byte)bytes[i++];
DestID = new LLUUID(bytes, i); i += 16;
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
SimulatorIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Flags = (byte)bytes[i++];
GridX = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridY = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
SourceID = new LLUUID(bytes, i); i += 16;
TransactionID = new LLUUID(bytes, i); i += 16;
TransactionTime = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
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++] = FailureType;
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);
bytes[i++] = (byte)(SimulatorIP % 256);
bytes[i++] = (byte)((SimulatorIP >> 8) % 256);
bytes[i++] = (byte)((SimulatorIP >> 16) % 256);
bytes[i++] = (byte)((SimulatorIP >> 24) % 256);
bytes[i++] = Flags;
bytes[i++] = (byte)(GridX % 256);
bytes[i++] = (byte)((GridX >> 8) % 256);
bytes[i++] = (byte)((GridX >> 16) % 256);
bytes[i++] = (byte)((GridX >> 24) % 256);
bytes[i++] = (byte)(GridY % 256);
bytes[i++] = (byte)((GridY >> 8) % 256);
bytes[i++] = (byte)((GridY >> 16) % 256);
bytes[i++] = (byte)((GridY >> 24) % 256);
if(SourceID == null) { Console.WriteLine("Warning: SourceID is null, in " + this.GetType()); }
Array.Copy(SourceID.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;
bytes[i++] = (byte)(TransactionTime % 256);
bytes[i++] = (byte)((TransactionTime >> 8) % 256);
bytes[i++] = (byte)((TransactionTime >> 16) % 256);
bytes[i++] = (byte)((TransactionTime >> 24) % 256);
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 = "-- TransactionData --\n";
output += "FailureType: " + FailureType.ToString() + "\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output += "SimulatorIP: " + SimulatorIP.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "GridX: " + GridX.ToString() + "\n";
output += "GridY: " + GridY.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "TransactionTime: " + TransactionTime.ToString() + "\n";
output += "TransactionType: " + TransactionType.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.LogFailedMoneyTransaction; } }
public TransactionDataBlock TransactionData;
public LogFailedMoneyTransactionPacket()
{
Header = new LowHeader();
Header.ID = 32;
Header.Reliable = true;
TransactionData = new TransactionDataBlock();
}
public LogFailedMoneyTransactionPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
TransactionData = new TransactionDataBlock(bytes, ref i);
}
public LogFailedMoneyTransactionPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
TransactionData = new TransactionDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
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);
TransactionData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- LogFailedMoneyTransaction ---\n";
output += TransactionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserReportInternalPacket : Packet
{
/// <exclude/>
public class MeanCollisionBlock
{
public float Mag;
public uint Time;
public LLUUID Perp;
public byte Type;
public int Length
{
get
{
return 25;
}
}
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++];
}
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;
}
public override string ToString()
{
string output = "-- MeanCollision --\n";
output += "Mag: " + Mag.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "Perp: " + Perp.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ReportDataBlock
{
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 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 LLVector3 AgentPosition;
public byte Category;
public LLUUID OwnerID;
public LLUUID CreatorID;
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 LLUUID ReporterID;
public byte ReportType;
public LLUUID ScreenshotID;
public LLUUID LastOwnerID;
public LLVector3 ViewerPosition;
public int Length
{
get
{
int length = 122;
if (SimName != null) { length += 1 + SimName.Length; }
if (Details != null) { length += 2 + Details.Length; }
if (VersionString != null) { length += 1 + VersionString.Length; }
if (Summary != null) { length += 1 + Summary.Length; }
return length;
}
}
public ReportDataBlock() { }
public ReportDataBlock(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;
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;
AgentPosition = new LLVector3(bytes, i); i += 12;
Category = (byte)bytes[i++];
OwnerID = new LLUUID(bytes, i); i += 16;
CreatorID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_summary = new byte[length];
Array.Copy(bytes, i, _summary, 0, length); i += length;
ReporterID = new LLUUID(bytes, i); i += 16;
ReportType = (byte)bytes[i++];
ScreenshotID = new LLUUID(bytes, i); i += 16;
LastOwnerID = new LLUUID(bytes, i); i += 16;
ViewerPosition = new LLVector3(bytes, i); i += 12;
}
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(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(AgentPosition == null) { Console.WriteLine("Warning: AgentPosition is null, in " + this.GetType()); }
Array.Copy(AgentPosition.GetBytes(), 0, bytes, i, 12); i += 12;
bytes[i++] = Category;
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(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;
if(ReporterID == null) { Console.WriteLine("Warning: ReporterID is null, in " + this.GetType()); }
Array.Copy(ReporterID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = ReportType;
if(ScreenshotID == null) { Console.WriteLine("Warning: ScreenshotID is null, in " + this.GetType()); }
Array.Copy(ScreenshotID.GetBytes(), 0, bytes, i, 16); i += 16;
if(LastOwnerID == null) { Console.WriteLine("Warning: LastOwnerID is null, in " + this.GetType()); }
Array.Copy(LastOwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
if(ViewerPosition == null) { Console.WriteLine("Warning: ViewerPosition is null, in " + this.GetType()); }
Array.Copy(ViewerPosition.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ReportData --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(Details, "Details") + "\n";
output += Helpers.FieldToString(VersionString, "VersionString") + "\n";
output += "AgentPosition: " + AgentPosition.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += Helpers.FieldToString(Summary, "Summary") + "\n";
output += "ReporterID: " + ReporterID.ToString() + "\n";
output += "ReportType: " + ReportType.ToString() + "\n";
output += "ScreenshotID: " + ScreenshotID.ToString() + "\n";
output += "LastOwnerID: " + LastOwnerID.ToString() + "\n";
output += "ViewerPosition: " + ViewerPosition.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UserReportInternal; } }
public MeanCollisionBlock[] MeanCollision;
public ReportDataBlock ReportData;
public UserReportInternalPacket()
{
Header = new LowHeader();
Header.ID = 33;
Header.Reliable = true;
Header.Zerocoded = true;
MeanCollision = new MeanCollisionBlock[0];
ReportData = new ReportDataBlock();
}
public UserReportInternalPacket(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); }
ReportData = new ReportDataBlock(bytes, ref i);
}
public UserReportInternalPacket(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); }
ReportData = new ReportDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += ReportData.Length;;
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); }
ReportData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- UserReportInternal ---\n";
for (int j = 0; j < MeanCollision.Length; j++)
{
output += MeanCollision[j].ToString() + "\n";
}
output += ReportData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetSimStatusInDatabasePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int X;
public int Y;
public int PID;
public LLUUID RegionID;
private byte[] _status;
public byte[] Status
{
get { return _status; }
set
{
if (value == null) { _status = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _status = new byte[value.Length]; Array.Copy(value, _status, value.Length); }
}
}
public int AgentCount;
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); }
}
}
public int TimeToLive;
public int Length
{
get
{
int length = 36;
if (Status != null) { length += 1 + Status.Length; }
if (HostName != null) { length += 1 + HostName.Length; }
return length;
}
}
public DataBlock() { }
public DataBlock(byte[] bytes, ref int i)
{
int length;
try
{
X = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Y = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
PID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
RegionID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_status = new byte[length];
Array.Copy(bytes, i, _status, 0, length); i += length;
AgentCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
length = (ushort)bytes[i++];
_hostname = new byte[length];
Array.Copy(bytes, i, _hostname, 0, length); i += length;
TimeToLive = (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);
bytes[i++] = (byte)(PID % 256);
bytes[i++] = (byte)((PID >> 8) % 256);
bytes[i++] = (byte)((PID >> 16) % 256);
bytes[i++] = (byte)((PID >> 24) % 256);
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
if(Status == null) { Console.WriteLine("Warning: Status is null, in " + this.GetType()); }
bytes[i++] = (byte)Status.Length;
Array.Copy(Status, 0, bytes, i, Status.Length); i += Status.Length;
bytes[i++] = (byte)(AgentCount % 256);
bytes[i++] = (byte)((AgentCount >> 8) % 256);
bytes[i++] = (byte)((AgentCount >> 16) % 256);
bytes[i++] = (byte)((AgentCount >> 24) % 256);
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;
bytes[i++] = (byte)(TimeToLive % 256);
bytes[i++] = (byte)((TimeToLive >> 8) % 256);
bytes[i++] = (byte)((TimeToLive >> 16) % 256);
bytes[i++] = (byte)((TimeToLive >> 24) % 256);
}
public override string ToString()
{
string output = "-- Data --\n";
output += "X: " + X.ToString() + "\n";
output += "Y: " + Y.ToString() + "\n";
output += "PID: " + PID.ToString() + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += Helpers.FieldToString(Status, "Status") + "\n";
output += "AgentCount: " + AgentCount.ToString() + "\n";
output += Helpers.FieldToString(HostName, "HostName") + "\n";
output += "TimeToLive: " + TimeToLive.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SetSimStatusInDatabase; } }
public DataBlock Data;
public SetSimStatusInDatabasePacket()
{
Header = new LowHeader();
Header.ID = 34;
Header.Reliable = true;
Data = new DataBlock();
}
public SetSimStatusInDatabasePacket(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 SetSimStatusInDatabasePacket(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 = "--- SetSimStatusInDatabase ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetSimPresenceInDatabasePacket : Packet
{
/// <exclude/>
public class SimDataBlock
{
public int PID;
public LLUUID RegionID;
private byte[] _status;
public byte[] Status
{
get { return _status; }
set
{
if (value == null) { _status = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _status = new byte[value.Length]; Array.Copy(value, _status, value.Length); }
}
}
public int AgentCount;
public uint GridX;
public uint GridY;
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); }
}
}
public int TimeToLive;
public int Length
{
get
{
int length = 36;
if (Status != null) { length += 1 + Status.Length; }
if (HostName != null) { length += 1 + HostName.Length; }
return length;
}
}
public SimDataBlock() { }
public SimDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
PID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
RegionID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_status = new byte[length];
Array.Copy(bytes, i, _status, 0, length); i += length;
AgentCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridX = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridY = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
length = (ushort)bytes[i++];
_hostname = new byte[length];
Array.Copy(bytes, i, _hostname, 0, length); i += length;
TimeToLive = (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);
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
Array.Copy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16;
if(Status == null) { Console.WriteLine("Warning: Status is null, in " + this.GetType()); }
bytes[i++] = (byte)Status.Length;
Array.Copy(Status, 0, bytes, i, Status.Length); i += Status.Length;
bytes[i++] = (byte)(AgentCount % 256);
bytes[i++] = (byte)((AgentCount >> 8) % 256);
bytes[i++] = (byte)((AgentCount >> 16) % 256);
bytes[i++] = (byte)((AgentCount >> 24) % 256);
bytes[i++] = (byte)(GridX % 256);
bytes[i++] = (byte)((GridX >> 8) % 256);
bytes[i++] = (byte)((GridX >> 16) % 256);
bytes[i++] = (byte)((GridX >> 24) % 256);
bytes[i++] = (byte)(GridY % 256);
bytes[i++] = (byte)((GridY >> 8) % 256);
bytes[i++] = (byte)((GridY >> 16) % 256);
bytes[i++] = (byte)((GridY >> 24) % 256);
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;
bytes[i++] = (byte)(TimeToLive % 256);
bytes[i++] = (byte)((TimeToLive >> 8) % 256);
bytes[i++] = (byte)((TimeToLive >> 16) % 256);
bytes[i++] = (byte)((TimeToLive >> 24) % 256);
}
public override string ToString()
{
string output = "-- SimData --\n";
output += "PID: " + PID.ToString() + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += Helpers.FieldToString(Status, "Status") + "\n";
output += "AgentCount: " + AgentCount.ToString() + "\n";
output += "GridX: " + GridX.ToString() + "\n";
output += "GridY: " + GridY.ToString() + "\n";
output += Helpers.FieldToString(HostName, "HostName") + "\n";
output += "TimeToLive: " + TimeToLive.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SetSimPresenceInDatabase; } }
public SimDataBlock SimData;
public SetSimPresenceInDatabasePacket()
{
Header = new LowHeader();
Header.ID = 35;
Header.Reliable = true;
SimData = new SimDataBlock();
}
public SetSimPresenceInDatabasePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
SimData = new SimDataBlock(bytes, ref i);
}
public SetSimPresenceInDatabasePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
SimData = new SimDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += SimData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
SimData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SetSimPresenceInDatabase ---\n";
output += SimData.ToString() + "\n";
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 ---\n";
return output;
}
}
/// <exclude/>
public class EconomyDataPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "PriceParcelClaimFactor: " + PriceParcelClaimFactor.ToString() + "\n";
output += "ObjectCapacity: " + ObjectCapacity.ToString() + "\n";
output += "EnergyEfficiency: " + EnergyEfficiency.ToString() + "\n";
output += "ObjectCount: " + ObjectCount.ToString() + "\n";
output += "TeleportPriceExponent: " + TeleportPriceExponent.ToString() + "\n";
output += "PriceGroupCreate: " + PriceGroupCreate.ToString() + "\n";
output += "PriceObjectRent: " + PriceObjectRent.ToString() + "\n";
output += "PricePublicObjectDelete: " + PricePublicObjectDelete.ToString() + "\n";
output += "PriceEnergyUnit: " + PriceEnergyUnit.ToString() + "\n";
output += "TeleportMinPrice: " + TeleportMinPrice.ToString() + "\n";
output += "PricePublicObjectDecay: " + PricePublicObjectDecay.ToString() + "\n";
output += "PriceObjectClaim: " + PriceObjectClaim.ToString() + "\n";
output += "PriceParcelClaim: " + PriceParcelClaim.ToString() + "\n";
output += "PriceObjectScaleFactor: " + PriceObjectScaleFactor.ToString() + "\n";
output += "PriceRentLight: " + PriceRentLight.ToString() + "\n";
output += "PriceParcelRent: " + PriceParcelRent.ToString() + "\n";
output += "PriceUpload: " + PriceUpload.ToString() + "\n";
output = 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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarPickerRequestPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID QueryID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = 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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarPickerRequestBackendPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public byte GodLevel;
public LLUUID QueryID;
public int Length
{
get
{
return 49;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
SessionID = new LLUUID(bytes, i); i += 16;
GodLevel = (byte)bytes[i++];
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;
bytes[i++] = GodLevel;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GodLevel: " + GodLevel.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AvatarPickerRequestBackend; } }
public DataBlock Data;
public AgentDataBlock AgentData;
public AvatarPickerRequestBackendPacket()
{
Header = new LowHeader();
Header.ID = 39;
Header.Reliable = true;
Data = new DataBlock();
AgentData = new AgentDataBlock();
}
public AvatarPickerRequestBackendPacket(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 AvatarPickerRequestBackendPacket(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 = "--- AvatarPickerRequestBackend ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarPickerReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(LastName, "LastName") + "\n";
output += Helpers.FieldToString(FirstName, "FirstName") + "\n";
output += "AvatarID: " + AvatarID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID QueryID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PlacesQueryPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID QueryID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TransactionDataBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = 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 ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
output += TransactionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PlacesReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "BillableArea: " + BillableArea.ToString() + "\n";
output += "ActualArea: " + ActualArea.ToString() + "\n";
output += "GlobalX: " + GlobalX.ToString() + "\n";
output += "GlobalY: " + GlobalY.ToString() + "\n";
output += "GlobalZ: " + GlobalZ.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "Price: " + Price.ToString() + "\n";
output += "Dwell: " + Dwell.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID QueryID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TransactionDataBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < QueryData.Length; j++)
{
output += QueryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += TransactionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirFindQueryPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "QueryStart: " + QueryStart.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirFindQueryBackendPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public uint SpaceIP;
public bool Godlike;
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); }
}
}
public uint EstateID;
public int Length
{
get
{
int length = 33;
if (QueryText != null) { length += 1 + QueryText.Length; }
return length;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
SpaceIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
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;
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)
{
bytes[i++] = (byte)(SpaceIP % 256);
bytes[i++] = (byte)((SpaceIP >> 8) % 256);
bytes[i++] = (byte)((SpaceIP >> 16) % 256);
bytes[i++] = (byte)((SpaceIP >> 24) % 256);
bytes[i++] = (byte)((Godlike) ? 1 : 0);
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;
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 = "-- QueryData --\n";
output += "SpaceIP: " + SpaceIP.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "QueryStart: " + QueryStart.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirFindQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirFindQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 44;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirFindQueryBackendPacket(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 DirFindQueryBackendPacket(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 = "--- DirFindQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPlacesQueryPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "QueryStart: " + QueryStart.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPlacesQueryBackendPacket : Packet
{
/// <exclude/>
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 bool Godlike;
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); }
}
}
public uint EstateID;
public int Length
{
get
{
int length = 30;
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;
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
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;
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(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)((Godlike) ? 1 : 0);
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;
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 = "-- QueryData --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "QueryStart: " + QueryStart.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirPlacesQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirPlacesQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 46;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirPlacesQueryBackendPacket(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 DirPlacesQueryBackendPacket(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 = "--- DirPlacesQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPlacesReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "\n";
output += "ForSale: " + ForSale.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Auction: " + Auction.ToString() + "\n";
output += "Dwell: " + Dwell.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
for (int j = 0; j < QueryData.Length; j++)
{
output += QueryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPeopleQueryPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public uint SkillFlags;
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 QueryID;
public byte Online;
private byte[] _reputation;
public byte[] Reputation
{
get { return _reputation; }
set
{
if (value == null) { _reputation = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _reputation = new byte[value.Length]; Array.Copy(value, _reputation, value.Length); }
}
}
private byte[] _distance;
public byte[] Distance
{
get { return _distance; }
set
{
if (value == null) { _distance = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _distance = new byte[value.Length]; Array.Copy(value, _distance, value.Length); }
}
}
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); }
}
}
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); }
}
}
public uint WantToFlags;
public int Length
{
get
{
int length = 25;
if (Name != null) { length += 1 + Name.Length; }
if (Reputation != null) { length += 1 + Reputation.Length; }
if (Distance != null) { length += 1 + Distance.Length; }
if (Group != null) { length += 1 + Group.Length; }
if (QueryText != null) { length += 1 + QueryText.Length; }
return length;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
SkillFlags = (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;
QueryID = new LLUUID(bytes, i); i += 16;
Online = (byte)bytes[i++];
length = (ushort)bytes[i++];
_reputation = new byte[length];
Array.Copy(bytes, i, _reputation, 0, length); i += length;
length = (ushort)bytes[i++];
_distance = new byte[length];
Array.Copy(bytes, i, _distance, 0, length); i += length;
length = (ushort)bytes[i++];
_group = new byte[length];
Array.Copy(bytes, i, _group, 0, length); i += length;
length = (ushort)bytes[i++];
_querytext = new byte[length];
Array.Copy(bytes, i, _querytext, 0, length); i += length;
WantToFlags = (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)(SkillFlags % 256);
bytes[i++] = (byte)((SkillFlags >> 8) % 256);
bytes[i++] = (byte)((SkillFlags >> 16) % 256);
bytes[i++] = (byte)((SkillFlags >> 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(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = Online;
if(Reputation == null) { Console.WriteLine("Warning: Reputation is null, in " + this.GetType()); }
bytes[i++] = (byte)Reputation.Length;
Array.Copy(Reputation, 0, bytes, i, Reputation.Length); i += Reputation.Length;
if(Distance == null) { Console.WriteLine("Warning: Distance is null, in " + this.GetType()); }
bytes[i++] = (byte)Distance.Length;
Array.Copy(Distance, 0, bytes, i, Distance.Length); i += Distance.Length;
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;
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;
bytes[i++] = (byte)(WantToFlags % 256);
bytes[i++] = (byte)((WantToFlags >> 8) % 256);
bytes[i++] = (byte)((WantToFlags >> 16) % 256);
bytes[i++] = (byte)((WantToFlags >> 24) % 256);
}
public override string ToString()
{
string output = "-- QueryData --\n";
output += "SkillFlags: " + SkillFlags.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Online: " + Online.ToString() + "\n";
output += Helpers.FieldToString(Reputation, "Reputation") + "\n";
output += Helpers.FieldToString(Distance, "Distance") + "\n";
output += Helpers.FieldToString(Group, "Group") + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output += "WantToFlags: " + WantToFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirPeopleQuery; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirPeopleQueryPacket()
{
Header = new LowHeader();
Header.ID = 48;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirPeopleQueryPacket(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 DirPeopleQueryPacket(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 = "--- DirPeopleQuery ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPeopleQueryBackendPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public uint SpaceIP;
public bool Godlike;
public uint SkillFlags;
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 QueryID;
public byte Online;
private byte[] _reputation;
public byte[] Reputation
{
get { return _reputation; }
set
{
if (value == null) { _reputation = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _reputation = new byte[value.Length]; Array.Copy(value, _reputation, value.Length); }
}
}
private byte[] _distance;
public byte[] Distance
{
get { return _distance; }
set
{
if (value == null) { _distance = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _distance = new byte[value.Length]; Array.Copy(value, _distance, value.Length); }
}
}
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); }
}
}
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); }
}
}
public uint EstateID;
public uint WantToFlags;
public int Length
{
get
{
int length = 34;
if (Name != null) { length += 1 + Name.Length; }
if (Reputation != null) { length += 1 + Reputation.Length; }
if (Distance != null) { length += 1 + Distance.Length; }
if (Group != null) { length += 1 + Group.Length; }
if (QueryText != null) { length += 1 + QueryText.Length; }
return length;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
SpaceIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
SkillFlags = (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;
QueryID = new LLUUID(bytes, i); i += 16;
Online = (byte)bytes[i++];
length = (ushort)bytes[i++];
_reputation = new byte[length];
Array.Copy(bytes, i, _reputation, 0, length); i += length;
length = (ushort)bytes[i++];
_distance = new byte[length];
Array.Copy(bytes, i, _distance, 0, length); i += length;
length = (ushort)bytes[i++];
_group = new byte[length];
Array.Copy(bytes, i, _group, 0, length); i += length;
length = (ushort)bytes[i++];
_querytext = new byte[length];
Array.Copy(bytes, i, _querytext, 0, length); i += length;
EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
WantToFlags = (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)(SpaceIP % 256);
bytes[i++] = (byte)((SpaceIP >> 8) % 256);
bytes[i++] = (byte)((SpaceIP >> 16) % 256);
bytes[i++] = (byte)((SpaceIP >> 24) % 256);
bytes[i++] = (byte)((Godlike) ? 1 : 0);
bytes[i++] = (byte)(SkillFlags % 256);
bytes[i++] = (byte)((SkillFlags >> 8) % 256);
bytes[i++] = (byte)((SkillFlags >> 16) % 256);
bytes[i++] = (byte)((SkillFlags >> 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(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = Online;
if(Reputation == null) { Console.WriteLine("Warning: Reputation is null, in " + this.GetType()); }
bytes[i++] = (byte)Reputation.Length;
Array.Copy(Reputation, 0, bytes, i, Reputation.Length); i += Reputation.Length;
if(Distance == null) { Console.WriteLine("Warning: Distance is null, in " + this.GetType()); }
bytes[i++] = (byte)Distance.Length;
Array.Copy(Distance, 0, bytes, i, Distance.Length); i += Distance.Length;
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;
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;
bytes[i++] = (byte)(EstateID % 256);
bytes[i++] = (byte)((EstateID >> 8) % 256);
bytes[i++] = (byte)((EstateID >> 16) % 256);
bytes[i++] = (byte)((EstateID >> 24) % 256);
bytes[i++] = (byte)(WantToFlags % 256);
bytes[i++] = (byte)((WantToFlags >> 8) % 256);
bytes[i++] = (byte)((WantToFlags >> 16) % 256);
bytes[i++] = (byte)((WantToFlags >> 24) % 256);
}
public override string ToString()
{
string output = "-- QueryData --\n";
output += "SpaceIP: " + SpaceIP.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "SkillFlags: " + SkillFlags.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Online: " + Online.ToString() + "\n";
output += Helpers.FieldToString(Reputation, "Reputation") + "\n";
output += Helpers.FieldToString(Distance, "Distance") + "\n";
output += Helpers.FieldToString(Group, "Group") + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output += "WantToFlags: " + WantToFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirPeopleQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirPeopleQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 49;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirPeopleQueryBackendPacket(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 DirPeopleQueryBackendPacket(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 = "--- DirPeopleQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPeopleReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(LastName, "LastName") + "\n";
output += Helpers.FieldToString(FirstName, "FirstName") + "\n";
output += "Online: " + Online.ToString() + "\n";
output += "Reputation: " + Reputation.ToString() + "\n";
output += Helpers.FieldToString(Group, "Group") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 50;
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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirEventsReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Date, "Date") + "\n";
output += "EventID: " + EventID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "EventFlags: " + EventFlags.ToString() + "\n";
output += "UnixTime: " + UnixTime.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 51;
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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirGroupsQueryPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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); }
}
}
public int Length
{
get
{
int length = 16;
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;
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;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirGroupsQuery; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirGroupsQueryPacket()
{
Header = new LowHeader();
Header.ID = 52;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirGroupsQueryPacket(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 DirGroupsQueryPacket(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 = "--- DirGroupsQuery ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirGroupsQueryBackendPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public bool Godlike;
public LLUUID QueryID;
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); }
}
}
public uint EstateID;
public int Length
{
get
{
int length = 21;
if (QueryText != null) { length += 1 + QueryText.Length; }
return length;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
QueryID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_querytext = new byte[length];
Array.Copy(bytes, i, _querytext, 0, length); i += length;
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)
{
bytes[i++] = (byte)((Godlike) ? 1 : 0);
if(QueryID == null) { Console.WriteLine("Warning: QueryID is null, in " + this.GetType()); }
Array.Copy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16;
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;
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 = "-- QueryData --\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirGroupsQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirGroupsQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 53;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirGroupsQueryBackendPacket(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 DirGroupsQueryBackendPacket(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 = "--- DirGroupsQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirGroupsReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "Members: " + Members.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "MembershipFee: " + MembershipFee.ToString() + "\n";
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "\n";
output += Helpers.FieldToString(GroupName, "GroupName") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 54;
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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirClassifiedQueryPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
public uint 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); }
}
}
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;
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));
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);
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 55;
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 ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirClassifiedQueryBackendPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public bool Godlike;
public LLUUID QueryID;
public uint 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); }
}
}
public uint EstateID;
public int Length
{
get
{
int length = 29;
if (QueryText != null) { length += 1 + QueryText.Length; }
return length;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
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));
length = (ushort)bytes[i++];
_querytext = new byte[length];
Array.Copy(bytes, i, _querytext, 0, length); i += length;
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)
{
bytes[i++] = (byte)((Godlike) ? 1 : 0);
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);
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;
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 = "-- QueryData --\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirClassifiedQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirClassifiedQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 56;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirClassifiedQueryBackendPacket(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 DirClassifiedQueryBackendPacket(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 = "--- DirClassifiedQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirClassifiedReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ClassifiedFlags: " + ClassifiedFlags.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "ClassifiedID: " + ClassifiedID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "PriceForListing: " + PriceForListing.ToString() + "\n";
output += "ExpirationDate: " + ExpirationDate.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 57;
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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarClassifiedReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "ClassifiedID: " + ClassifiedID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID TargetID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output = 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 = 58;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClassifiedInfoRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ClassifiedID;
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 --\n";
output += "ClassifiedID: " + ClassifiedID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 59;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClassifiedInfoReplyPacket : Packet
{
/// <exclude/>
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;
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;
if(PosGlobal == null) { Console.WriteLine("Warning: PosGlobal is null, in " + this.GetType()); }
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 --\n";
output += "ClassifiedFlags: " + ClassifiedFlags.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "ClassifiedID: " + ClassifiedID.ToString() + "\n";
output += "PosGlobal: " + PosGlobal.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += Helpers.FieldToString(ParcelName, "ParcelName") + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "PriceForListing: " + PriceForListing.ToString() + "\n";
output += "ExpirationDate: " + ExpirationDate.ToString() + "\n";
output += "ParentEstate: " + ParentEstate.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 60;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClassifiedInfoUpdatePacket : Packet
{
/// <exclude/>
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;
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;
if(PosGlobal == null) { Console.WriteLine("Warning: PosGlobal is null, in " + this.GetType()); }
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 --\n";
output += "ClassifiedFlags: " + ClassifiedFlags.ToString() + "\n";
output += "ClassifiedID: " + ClassifiedID.ToString() + "\n";
output += "PosGlobal: " + PosGlobal.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "PriceForListing: " + PriceForListing.ToString() + "\n";
output += "ParentEstate: " + ParentEstate.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 61;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClassifiedDeletePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ClassifiedID;
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 --\n";
output += "ClassifiedID: " + ClassifiedID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 62;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClassifiedGodDeletePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ClassifiedID;
public LLUUID QueryID;
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 --\n";
output += "ClassifiedID: " + ClassifiedID.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 63;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPicksQueryPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
public uint QueryFlags;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 64;
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 ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPicksQueryBackendPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public bool Godlike;
public LLUUID QueryID;
public uint QueryFlags;
public uint EstateID;
public int Length
{
get
{
return 25;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
try
{
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
QueryID = new LLUUID(bytes, i); i += 16;
QueryFlags = (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)
{
bytes[i++] = (byte)((Godlike) ? 1 : 0);
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)(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 = "-- QueryData --\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirPicksQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirPicksQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 65;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirPicksQueryBackendPacket(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 DirPicksQueryBackendPacket(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 = "--- DirPicksQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPicksReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "Enabled: " + Enabled.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "PickID: " + PickID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 66;
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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirLandQueryPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public bool ReservedNewbie;
public bool ForSale;
public LLUUID QueryID;
public bool Auction;
public uint QueryFlags;
public int Length
{
get
{
return 23;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
try
{
ReservedNewbie = (bytes[i++] != 0) ? (bool)true : (bool)false;
ForSale = (bytes[i++] != 0) ? (bool)true : (bool)false;
QueryID = new LLUUID(bytes, i); i += 16;
Auction = (bytes[i++] != 0) ? (bool)true : (bool)false;
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)
{
bytes[i++] = (byte)((ReservedNewbie) ? 1 : 0);
bytes[i++] = (byte)((ForSale) ? 1 : 0);
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)((Auction) ? 1 : 0);
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 --\n";
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "\n";
output += "ForSale: " + ForSale.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Auction: " + Auction.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 67;
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 ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirLandQueryBackendPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public bool ReservedNewbie;
public bool ForSale;
public bool Godlike;
public LLUUID QueryID;
public bool Auction;
public uint QueryFlags;
public uint EstateID;
public int Length
{
get
{
return 28;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
try
{
ReservedNewbie = (bytes[i++] != 0) ? (bool)true : (bool)false;
ForSale = (bytes[i++] != 0) ? (bool)true : (bool)false;
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
QueryID = new LLUUID(bytes, i); i += 16;
Auction = (bytes[i++] != 0) ? (bool)true : (bool)false;
QueryFlags = (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)
{
bytes[i++] = (byte)((ReservedNewbie) ? 1 : 0);
bytes[i++] = (byte)((ForSale) ? 1 : 0);
bytes[i++] = (byte)((Godlike) ? 1 : 0);
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)((Auction) ? 1 : 0);
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)(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 = "-- QueryData --\n";
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "\n";
output += "ForSale: " + ForSale.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "Auction: " + Auction.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirLandQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirLandQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 68;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirLandQueryBackendPacket(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 DirLandQueryBackendPacket(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 = "--- DirLandQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirLandReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "\n";
output += "ActualArea: " + ActualArea.ToString() + "\n";
output += "ForSale: " + ForSale.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Auction: " + Auction.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 69;
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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPopularQueryPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
public uint QueryFlags;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 70;
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 ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPopularQueryBackendPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public bool Godlike;
public LLUUID QueryID;
public uint QueryFlags;
public uint EstateID;
public int Length
{
get
{
return 25;
}
}
public QueryDataBlock() { }
public QueryDataBlock(byte[] bytes, ref int i)
{
try
{
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
QueryID = new LLUUID(bytes, i); i += 16;
QueryFlags = (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)
{
bytes[i++] = (byte)((Godlike) ? 1 : 0);
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)(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 = "-- QueryData --\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DirPopularQueryBackend; } }
public QueryDataBlock QueryData;
public AgentDataBlock AgentData;
public DirPopularQueryBackendPacket()
{
Header = new LowHeader();
Header.ID = 71;
Header.Reliable = true;
Header.Zerocoded = true;
QueryData = new QueryDataBlock();
AgentData = new AgentDataBlock();
}
public DirPopularQueryBackendPacket(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 DirPopularQueryBackendPacket(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 = "--- DirPopularQueryBackend ---\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DirPopularReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Dwell: " + Dwell.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 72;
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 ---\n";
for (int j = 0; j < QueryReplies.Length; j++)
{
output += QueryReplies[j].ToString() + "\n";
}
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelInfoRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ParcelID;
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 --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 73;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelInfoReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "BillableArea: " + BillableArea.ToString() + "\n";
output += "ActualArea: " + ActualArea.ToString() + "\n";
output += "GlobalX: " + GlobalX.ToString() + "\n";
output += "GlobalY: " + GlobalY.ToString() + "\n";
output += "GlobalZ: " + GlobalZ.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "AuctionID: " + AuctionID.ToString() + "\n";
output += "Dwell: " + Dwell.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 74;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelObjectOwnersRequestPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 75;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class OnlineStatusRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ID;
public int Length
{
get
{
return 16;
}
}
public DataBlock() { }
public DataBlock(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 = "-- Data --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public uint SpaceIP;
public bool Godlike;
public LLUUID QueryID;
public uint EstateID;
public int Length
{
get
{
return 41;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
SpaceIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false;
QueryID = new LLUUID(bytes, i); i += 16;
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;
bytes[i++] = (byte)(SpaceIP % 256);
bytes[i++] = (byte)((SpaceIP >> 8) % 256);
bytes[i++] = (byte)((SpaceIP >> 16) % 256);
bytes[i++] = (byte)((SpaceIP >> 24) % 256);
bytes[i++] = (byte)((Godlike) ? 1 : 0);
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)(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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SpaceIP: " + SpaceIP.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.OnlineStatusRequest; } }
public DataBlock[] Data;
public AgentDataBlock AgentData;
public OnlineStatusRequestPacket()
{
Header = new LowHeader();
Header.ID = 76;
Header.Reliable = true;
Data = new DataBlock[0];
AgentData = new AgentDataBlock();
}
public OnlineStatusRequestPacket(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 OnlineStatusRequestPacket(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 = "--- OnlineStatusRequest ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class OnlineStatusReplyPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ID;
public int Length
{
get
{
return 16;
}
}
public DataBlock() { }
public DataBlock(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 = "-- Data --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID QueryID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.OnlineStatusReply; } }
public DataBlock[] Data;
public AgentDataBlock AgentData;
public OnlineStatusReplyPacket()
{
Header = new LowHeader();
Header.ID = 77;
Header.Reliable = true;
Header.Zerocoded = true;
Data = new DataBlock[0];
AgentData = new AgentDataBlock();
}
public OnlineStatusReplyPacket(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 OnlineStatusReplyPacket(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 = "--- OnlineStatusReply ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelObjectOwnersReplyPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public bool OnlineStatus;
public bool IsGroupOwned;
public LLUUID OwnerID;
public int Count;
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 --\n";
output += "OnlineStatus: " + OnlineStatus.ToString() + "\n";
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "Count: " + Count.ToString() + "\n";
output = 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 = 78;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class GroupNoticesListRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 79;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupNoticesListReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "Timestamp: " + Timestamp.ToString() + "\n";
output += Helpers.FieldToString(Subject, "Subject") + "\n";
output += "HasAttachment: " + HasAttachment.ToString() + "\n";
output += "NoticeID: " + NoticeID.ToString() + "\n";
output += Helpers.FieldToString(FromName, "FromName") + "\n";
output += "AssetType: " + AssetType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 80;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupNoticeRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID GroupNoticeID;
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 --\n";
output += "GroupNoticeID: " + GroupNoticeID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 81;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupNoticeAddPacket : Packet
{
/// <exclude/>
public class MessageBlockBlock
{
public LLUUID ID;
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 Dialog;
public LLUUID ToGroupID;
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); }
}
}
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 int Length
{
get
{
int length = 33;
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;
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_message = new byte[length];
Array.Copy(bytes, i, _message, 0, length); i += length;
Dialog = (byte)bytes[i++];
ToGroupID = new LLUUID(bytes, i); i += 16;
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_binarybucket = new byte[length];
Array.Copy(bytes, i, _binarybucket, 0, length); i += length;
length = (ushort)bytes[i++];
_fromagentname = new byte[length];
Array.Copy(bytes, i, _fromagentname, 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(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++] = Dialog;
if(ToGroupID == null) { Console.WriteLine("Warning: ToGroupID is null, in " + this.GetType()); }
Array.Copy(ToGroupID.GetBytes(), 0, bytes, i, 16); i += 16;
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;
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;
}
public override string ToString()
{
string output = "-- MessageBlock --\n";
output += "ID: " + ID.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "Dialog: " + Dialog.ToString() + "\n";
output += "ToGroupID: " + ToGroupID.ToString() + "\n";
output += Helpers.FieldToString(BinaryBucket, "BinaryBucket") + "\n";
output += Helpers.FieldToString(FromAgentName, "FromAgentName") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.GroupNoticeAdd; } }
public MessageBlockBlock MessageBlock;
public AgentDataBlock AgentData;
public GroupNoticeAddPacket()
{
Header = new LowHeader();
Header.ID = 82;
Header.Reliable = true;
MessageBlock = new MessageBlockBlock();
AgentData = new AgentDataBlock();
}
public GroupNoticeAddPacket(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 GroupNoticeAddPacket(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 = "--- GroupNoticeAdd ---\n";
output += MessageBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupNoticeDeletePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID GroupNoticeID;
public LLUUID GroupID;
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 --\n";
output += "GroupNoticeID: " + GroupNoticeID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 83;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportRequestPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID RegionID;
public LLVector3 LookAt;
public LLVector3 Position;
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;
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Info --\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 84;
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 ---\n";
output += Info.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportLocationRequestPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public ulong RegionHandle;
public LLVector3 LookAt;
public LLVector3 Position;
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);
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Info --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 85;
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 ---\n";
output += Info.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportLocalPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public uint LocationID;
public LLVector3 LookAt;
public uint TeleportFlags;
public LLVector3 Position;
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);
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
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);
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Info --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = 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 = 86;
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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportLandmarkRequestPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID LandmarkID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "LandmarkID: " + LandmarkID.ToString() + "\n";
output = 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 = 87;
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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportProgressPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 88;
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 ---\n";
output += Info.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DataAgentAccessRequestPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLVector3 LocationPos;
public LLUUID AgentID;
public ulong RegionHandle;
public uint LocationID;
public LLVector3 LocationLookAt;
public uint EstateID;
public int Length
{
get
{
return 56;
}
}
public InfoBlock() { }
public InfoBlock(byte[] bytes, ref int i)
{
try
{
LocationPos = new LLVector3(bytes, i); i += 12;
AgentID = 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));
LocationID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
LocationLookAt = new LLVector3(bytes, i); i += 12;
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(LocationPos == null) { Console.WriteLine("Warning: LocationPos is null, in " + this.GetType()); }
Array.Copy(LocationPos.GetBytes(), 0, bytes, i, 12); i += 12;
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)(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);
if(LocationLookAt == null) { Console.WriteLine("Warning: LocationLookAt is null, in " + this.GetType()); }
Array.Copy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
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 = "-- Info --\n";
output += "LocationPos: " + LocationPos.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "LocationLookAt: " + LocationLookAt.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DataAgentAccessRequest; } }
public InfoBlock Info;
public DataAgentAccessRequestPacket()
{
Header = new LowHeader();
Header.ID = 89;
Header.Reliable = true;
Info = new InfoBlock();
}
public DataAgentAccessRequestPacket(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 DataAgentAccessRequestPacket(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 = "--- DataAgentAccessRequest ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DataAgentAccessReplyPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public int Length
{
get
{
return 16;
}
}
public InfoBlock() { }
public InfoBlock(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 = "-- Info --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DataAgentAccessReply; } }
public InfoBlock Info;
public DataAgentAccessReplyPacket()
{
Header = new LowHeader();
Header.ID = 90;
Header.Reliable = true;
Info = new InfoBlock();
}
public DataAgentAccessReplyPacket(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 DataAgentAccessReplyPacket(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 = "--- DataAgentAccessReply ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DataHomeLocationRequestPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public int Length
{
get
{
return 16;
}
}
public InfoBlock() { }
public InfoBlock(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 = "-- Info --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DataHomeLocationRequest; } }
public InfoBlock Info;
public DataHomeLocationRequestPacket()
{
Header = new LowHeader();
Header.ID = 91;
Header.Reliable = true;
Header.Zerocoded = true;
Info = new InfoBlock();
}
public DataHomeLocationRequestPacket(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 DataHomeLocationRequestPacket(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 = "--- DataHomeLocationRequest ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DataHomeLocationReplyPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public ulong RegionHandle;
public LLVector3 LookAt;
public LLVector3 Position;
public int Length
{
get
{
return 48;
}
}
public InfoBlock() { }
public InfoBlock(byte[] bytes, ref int i)
{
try
{
AgentID = 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));
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(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
Array.Copy(AgentID.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);
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Info --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DataHomeLocationReply; } }
public InfoBlock Info;
public DataHomeLocationReplyPacket()
{
Header = new LowHeader();
Header.ID = 92;
Header.Reliable = true;
Info = new InfoBlock();
}
public DataHomeLocationReplyPacket(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 DataHomeLocationReplyPacket(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 = "--- DataHomeLocationReply ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SpaceLocationTeleportRequestPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public byte TravelAccess;
public LLUUID SessionID;
public ulong RegionHandle;
public uint CircuitCode;
public LLVector3 LookAt;
public uint ParentEstateID;
public uint TeleportFlags;
public LLVector3 Position;
public int Length
{
get
{
return 77;
}
}
public InfoBlock() { }
public InfoBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
TravelAccess = (byte)bytes[i++];
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));
CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
LookAt = new LLVector3(bytes, i); i += 12;
ParentEstateID = (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));
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++] = TravelAccess;
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);
bytes[i++] = (byte)(CircuitCode % 256);
bytes[i++] = (byte)((CircuitCode >> 8) % 256);
bytes[i++] = (byte)((CircuitCode >> 16) % 256);
bytes[i++] = (byte)((CircuitCode >> 24) % 256);
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
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)(TeleportFlags % 256);
bytes[i++] = (byte)((TeleportFlags >> 8) % 256);
bytes[i++] = (byte)((TeleportFlags >> 16) % 256);
bytes[i++] = (byte)((TeleportFlags >> 24) % 256);
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Info --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "TravelAccess: " + TravelAccess.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "ParentEstateID: " + ParentEstateID.ToString() + "\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SpaceLocationTeleportRequest; } }
public InfoBlock Info;
public SpaceLocationTeleportRequestPacket()
{
Header = new LowHeader();
Header.ID = 93;
Header.Reliable = true;
Info = new InfoBlock();
}
public SpaceLocationTeleportRequestPacket(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 SpaceLocationTeleportRequestPacket(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 = "--- SpaceLocationTeleportRequest ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SpaceLocationTeleportReplyPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
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 AgentID;
public ushort SimPort;
public ulong RegionHandle;
public uint LocationID;
public byte SimAccess;
public LLVector3 LookAt;
public uint SimIP;
public uint TeleportFlags;
public LLVector3 Position;
public int Length
{
get
{
int length = 63;
if (SimName != null) { length += 1 + SimName.Length; }
return length;
}
}
public InfoBlock() { }
public InfoBlock(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;
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++];
LookAt = new LLVector3(bytes, i); i += 12;
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));
Position = new LLVector3(bytes, i); i += 12;
}
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(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;
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
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);
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Info --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SimPort: " + SimPort.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "SimIP: " + SimIP.ToString() + "\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SpaceLocationTeleportReply; } }
public InfoBlock Info;
public SpaceLocationTeleportReplyPacket()
{
Header = new LowHeader();
Header.ID = 94;
Header.Reliable = true;
Info = new InfoBlock();
}
public SpaceLocationTeleportReplyPacket(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 SpaceLocationTeleportReplyPacket(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 = "--- SpaceLocationTeleportReply ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportFinishPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(SeedCapability, "SeedCapability") + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SimPort: " + SimPort.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "SimIP: " + SimIP.ToString() + "\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output = 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 = 95;
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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class StartLurePacket : Packet
{
/// <exclude/>
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 LLUUID TargetID;
public byte LureType;
public int Length
{
get
{
int length = 17;
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;
TargetID = new LLUUID(bytes, i); i += 16;
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;
if(TargetID == null) { Console.WriteLine("Warning: TargetID is null, in " + this.GetType()); }
Array.Copy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = LureType;
}
public override string ToString()
{
string output = "-- Info --\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output += "LureType: " + LureType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 AgentDataBlock AgentData;
public StartLurePacket()
{
Header = new LowHeader();
Header.ID = 96;
Header.Reliable = true;
Info = new InfoBlock();
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);
AgentData = new AgentDataBlock(bytes, ref i);
}
public StartLurePacket(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 = "--- StartLure ---\n";
output += Info.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportLureRequestPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID LureID;
public uint TeleportFlags;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "LureID: " + LureID.ToString() + "\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output = 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 = 97;
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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportCancelPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 98;
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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CompleteLurePacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLUUID AgentID;
public byte TravelAccess;
public LLUUID SessionID;
public uint CircuitCode;
public LLUUID LureID;
public uint ParentEstateID;
public uint TeleportFlags;
public int Length
{
get
{
return 61;
}
}
public InfoBlock() { }
public InfoBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
TravelAccess = (byte)bytes[i++];
SessionID = new LLUUID(bytes, i); i += 16;
CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
LureID = new LLUUID(bytes, i); i += 16;
ParentEstateID = (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(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = TravelAccess;
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);
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)(ParentEstateID % 256);
bytes[i++] = (byte)((ParentEstateID >> 8) % 256);
bytes[i++] = (byte)((ParentEstateID >> 16) % 256);
bytes[i++] = (byte)((ParentEstateID >> 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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "TravelAccess: " + TravelAccess.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output += "LureID: " + LureID.ToString() + "\n";
output += "ParentEstateID: " + ParentEstateID.ToString() + "\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.CompleteLure; } }
public InfoBlock Info;
public CompleteLurePacket()
{
Header = new LowHeader();
Header.ID = 99;
Header.Reliable = true;
Info = new InfoBlock();
}
public CompleteLurePacket(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 CompleteLurePacket(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 = "--- CompleteLure ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportStartPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public uint TeleportFlags;
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 --\n";
output += "TeleportFlags: " + TeleportFlags.ToString() + "\n";
output = 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 = 100;
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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportFailedPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(Reason, "Reason") + "\n";
output = 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 = 101;
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 ---\n";
output += Info.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LeaderBoardRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public int Type;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output = 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 = 102;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LeaderBoardDataPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(TimeString, "TimeString") + "\n";
output += "MaxPlace: " + MaxPlace.ToString() + "\n";
output += "MinPlace: " + MinPlace.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class EntryBlock
{
public LLUUID ID;
public byte[] Name;
public int Sequence;
public int Place;
public int Score;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Sequence: " + Sequence.ToString() + "\n";
output += "Place: " + Place.ToString() + "\n";
output += "Score: " + Score.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 103;
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 ---\n";
output += BoardData.ToString() + "\n";
for (int j = 0; j < Entry.Length; j++)
{
output += Entry[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RegisterNewAgentPacket : Packet
{
/// <exclude/>
public class HelloBlockBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Godlike;
public uint LocationID;
public int Length
{
get
{
return 37;
}
}
public HelloBlockBlock() { }
public HelloBlockBlock(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;
LocationID = (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)(LocationID % 256);
bytes[i++] = (byte)((LocationID >> 8) % 256);
bytes[i++] = (byte)((LocationID >> 16) % 256);
bytes[i++] = (byte)((LocationID >> 24) % 256);
}
public override string ToString()
{
string output = "-- HelloBlock --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RegisterNewAgent; } }
public HelloBlockBlock HelloBlock;
public RegisterNewAgentPacket()
{
Header = new LowHeader();
Header.ID = 104;
Header.Reliable = true;
HelloBlock = new HelloBlockBlock();
}
public RegisterNewAgentPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
HelloBlock = new HelloBlockBlock(bytes, ref i);
}
public RegisterNewAgentPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
HelloBlock = new HelloBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += HelloBlock.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
HelloBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RegisterNewAgent ---\n";
output += HelloBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UndoPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 105;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RedoPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 106;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UndoLandPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 107;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RedoLandPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 108;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentPausePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public uint SerialNum;
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "SerialNum: " + SerialNum.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 109;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentResumePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public uint SerialNum;
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "SerialNum: " + SerialNum.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 110;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ChatFromViewerPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "Channel: " + Channel.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "Type: " + Type.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 111;
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 ---\n";
output += ChatData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentThrottlePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "GenCounter: " + GenCounter.ToString() + "\n";
output += Helpers.FieldToString(Throttles, "Throttles") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint CircuitCode;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output = 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 = 112;
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 ---\n";
output += Throttle.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentFOVPacket : Packet
{
/// <exclude/>
public class FOVBlockBlock
{
public uint GenCounter;
public float VerticalAngle;
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 --\n";
output += "GenCounter: " + GenCounter.ToString() + "\n";
output += "VerticalAngle: " + VerticalAngle.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint CircuitCode;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output = 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 = 113;
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 ---\n";
output += FOVBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentHeightWidthPacket : Packet
{
/// <exclude/>
public class HeightWidthBlockBlock
{
public uint GenCounter;
public ushort Height;
public ushort Width;
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 --\n";
output += "GenCounter: " + GenCounter.ToString() + "\n";
output += "Height: " + Height.ToString() + "\n";
output += "Width: " + Width.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint CircuitCode;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output = 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 = 114;
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 ---\n";
output += HeightWidthBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentSetAppearancePacket : Packet
{
/// <exclude/>
public class VisualParamBlock
{
public byte ParamValue;
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 --\n";
output += "ParamValue: " + ParamValue.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class WearableDataBlock
{
public byte TextureIndex;
public LLUUID CacheID;
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 --\n";
output += "TextureIndex: " + TextureIndex.ToString() + "\n";
output += "CacheID: " + CacheID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public uint SerialNum;
public LLUUID AgentID;
public LLUUID SessionID;
public LLVector3 Size;
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;
if(Size == null) { Console.WriteLine("Warning: Size is null, in " + this.GetType()); }
Array.Copy(Size.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- AgentData --\n";
output += "SerialNum: " + SerialNum.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Size: " + Size.ToString() + "\n";
output = 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 = 115;
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 ---\n";
for (int j = 0; j < VisualParam.Length; j++)
{
output += VisualParam[j].ToString() + "\n";
}
output += ObjectData.ToString() + "\n";
for (int j = 0; j < WearableData.Length; j++)
{
output += WearableData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentQuitPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 116;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentQuitCopyPacket : Packet
{
/// <exclude/>
public class FuseBlockBlock
{
public uint ViewerCircuitCode;
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 --\n";
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 117;
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 ---\n";
output += FuseBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ImageNotInDatabasePacket : Packet
{
/// <exclude/>
public class ImageIDBlock
{
public LLUUID ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = 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 = 118;
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 ---\n";
output += ImageID.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RebakeAvatarTexturesPacket : Packet
{
/// <exclude/>
public class TextureDataBlock
{
public LLUUID TextureID;
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 --\n";
output += "TextureID: " + TextureID.ToString() + "\n";
output = 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 = 119;
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 ---\n";
output += TextureData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetAlwaysRunPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool AlwaysRun;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "AlwaysRun: " + AlwaysRun.ToString() + "\n";
output = 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 = 120;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDeletePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Force;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Force: " + Force.ToString() + "\n";
output = 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 = 121;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDuplicatePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SharedDataBlock
{
public uint DuplicateFlags;
public LLVector3 Offset;
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);
if(Offset == null) { Console.WriteLine("Warning: Offset is null, in " + this.GetType()); }
Array.Copy(Offset.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- SharedData --\n";
output += "DuplicateFlags: " + DuplicateFlags.ToString() + "\n";
output += "Offset: " + Offset.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 122;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += SharedData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDuplicateOnRayPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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;
if(RayStart == null) { Console.WriteLine("Warning: RayStart is null, in " + this.GetType()); }
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);
if(RayEnd == null) { Console.WriteLine("Warning: RayEnd is null, in " + this.GetType()); }
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "DuplicateFlags: " + DuplicateFlags.ToString() + "\n";
output += "CopyRotates: " + CopyRotates.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "RayStart: " + RayStart.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "\n";
output += "RayEnd: " + RayEnd.ToString() + "\n";
output += "BypassRaycast: " + BypassRaycast.ToString() + "\n";
output += "CopyCenters: " + CopyCenters.ToString() + "\n";
output += "RayTargetID: " + RayTargetID.ToString() + "\n";
output = 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 = 123;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectScalePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
public LLVector3 Scale;
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);
if(Scale == null) { Console.WriteLine("Warning: Scale is null, in " + this.GetType()); }
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ObjectData --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += "Scale: " + Scale.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 124;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectRotationPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
public LLQuaternion Rotation;
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);
if(Rotation == null) { Console.WriteLine("Warning: Rotation is null, in " + this.GetType()); }
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ObjectData --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += "Rotation: " + Rotation.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 125;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectFlagUpdatePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool IsTemporary;
public uint ObjectLocalID;
public bool UsePhysics;
public bool CastsShadows;
public bool IsPhantom;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "IsTemporary: " + IsTemporary.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += "UsePhysics: " + UsePhysics.ToString() + "\n";
output += "CastsShadows: " + CastsShadows.ToString() + "\n";
output += "IsPhantom: " + IsPhantom.ToString() + "\n";
output = 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 = 126;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectClickActionPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public byte ClickAction;
public uint ObjectLocalID;
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 --\n";
output += "ClickAction: " + ClickAction.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 127;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectImagePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(MediaURL, "MediaURL") + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 128;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectMaterialPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public byte Material;
public uint ObjectLocalID;
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 --\n";
output += "Material: " + Material.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 129;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectShapePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "PathTwistBegin: " + PathTwistBegin.ToString() + "\n";
output += "PathEnd: " + PathEnd.ToString() + "\n";
output += "ProfileBegin: " + ProfileBegin.ToString() + "\n";
output += "PathRadiusOffset: " + PathRadiusOffset.ToString() + "\n";
output += "PathSkew: " + PathSkew.ToString() + "\n";
output += "ProfileCurve: " + ProfileCurve.ToString() + "\n";
output += "PathScaleX: " + PathScaleX.ToString() + "\n";
output += "PathScaleY: " + PathScaleY.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += "PathShearX: " + PathShearX.ToString() + "\n";
output += "PathShearY: " + PathShearY.ToString() + "\n";
output += "PathTaperX: " + PathTaperX.ToString() + "\n";
output += "PathTaperY: " + PathTaperY.ToString() + "\n";
output += "ProfileEnd: " + ProfileEnd.ToString() + "\n";
output += "PathBegin: " + PathBegin.ToString() + "\n";
output += "PathCurve: " + PathCurve.ToString() + "\n";
output += "PathTwist: " + PathTwist.ToString() + "\n";
output += "ProfileHollow: " + ProfileHollow.ToString() + "\n";
output += "PathRevolutions: " + PathRevolutions.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 130;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectExtraParamsPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ParamInUse: " + ParamInUse.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += Helpers.FieldToString(ParamData, "ParamData") + "\n";
output += "ParamSize: " + ParamSize.ToString() + "\n";
output += "ParamType: " + ParamType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 131;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectOwnerPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class HeaderDataBlock
{
public LLUUID GroupID;
public LLUUID OwnerID;
public bool Override;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "Override: " + Override.ToString() + "\n";
output = 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 = 132;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += HeaderData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectGroupPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 133;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectBuyPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public byte SaleType;
public int SalePrice;
public uint ObjectLocalID;
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 --\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
public LLUUID CategoryID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "CategoryID: " + CategoryID.ToString() + "\n";
output = 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 = 134;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class BuyObjectInventoryPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ObjectID;
public LLUUID ItemID;
public LLUUID FolderID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 135;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DerezContainerPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ObjectID;
public bool Delete;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Delete: " + Delete.ToString() + "\n";
output = 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 = 136;
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 ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectPermissionsPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public byte Set;
public uint Mask;
public uint ObjectLocalID;
public byte Field;
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 --\n";
output += "Set: " + Set.ToString() + "\n";
output += "Mask: " + Mask.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += "Field: " + Field.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class HeaderDataBlock
{
public bool Override;
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 --\n";
output += "Override: " + Override.ToString() + "\n";
output = 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 = 137;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += HeaderData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectSaleInfoPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint LocalID;
public byte SaleType;
public int SalePrice;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 138;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectNamePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 139;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDescriptionPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 140;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectCategoryPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint LocalID;
public uint Category;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 141;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectSelectPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 142;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDeselectPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 143;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectAttachPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
public LLQuaternion Rotation;
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);
if(Rotation == null) { Console.WriteLine("Warning: Rotation is null, in " + this.GetType()); }
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ObjectData --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += "Rotation: " + Rotation.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public byte AttachmentPoint;
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AttachmentPoint: " + AttachmentPoint.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 144;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDetachPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 145;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDropPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 146;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectLinkPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 147;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDelinkPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 148;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectHingePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class JointTypeBlock
{
public byte Type;
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 --\n";
output += "Type: " + Type.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 149;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += JointType.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDehingePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 150;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectGrabPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLVector3 GrabOffset;
public uint LocalID;
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)
{
if(GrabOffset == null) { Console.WriteLine("Warning: GrabOffset is null, in " + this.GetType()); }
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 --\n";
output += "GrabOffset: " + GrabOffset.ToString() + "\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 151;
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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectGrabUpdatePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint TimeSinceLast;
public LLUUID ObjectID;
public LLVector3 GrabOffsetInitial;
public LLVector3 GrabPosition;
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;
if(GrabOffsetInitial == null) { Console.WriteLine("Warning: GrabOffsetInitial is null, in " + this.GetType()); }
Array.Copy(GrabOffsetInitial.GetBytes(), 0, bytes, i, 12); i += 12;
if(GrabPosition == null) { Console.WriteLine("Warning: GrabPosition is null, in " + this.GetType()); }
Array.Copy(GrabPosition.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ObjectData --\n";
output += "TimeSinceLast: " + TimeSinceLast.ToString() + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "GrabOffsetInitial: " + GrabOffsetInitial.ToString() + "\n";
output += "GrabPosition: " + GrabPosition.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 152;
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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectDeGrabPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 153;
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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectSpinStartPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 154;
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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectSpinUpdatePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
public LLQuaternion Rotation;
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;
if(Rotation == null) { Console.WriteLine("Warning: Rotation is null, in " + this.GetType()); }
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ObjectData --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Rotation: " + Rotation.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 155;
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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectSpinStopPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 156;
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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectExportSelectedPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID RequestID;
public short VolumeDetail;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "VolumeDetail: " + VolumeDetail.ToString() + "\n";
output = 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 = 157;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectImportPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID FolderID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(ObjectName, "ObjectName") + "\n";
output += "FileID: " + FileID.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output = 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 = 158;
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 ---\n";
output += AgentData.ToString() + "\n";
output += AssetData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ModifyLandPacket : Packet
{
/// <exclude/>
public class ModifyBlockBlock
{
public byte BrushSize;
public float Seconds;
public float Height;
public byte Action;
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 --\n";
output += "BrushSize: " + BrushSize.ToString() + "\n";
output += "Seconds: " + Seconds.ToString() + "\n";
output += "Height: " + Height.ToString() + "\n";
output += "Action: " + Action.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public float East;
public float West;
public float North;
public float South;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "East: " + East.ToString() + "\n";
output += "West: " + West.ToString() + "\n";
output += "North: " + North.ToString() + "\n";
output += "South: " + South.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 159;
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 ---\n";
output += ModifyBlock.ToString() + "\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class VelocityInterpolateOnPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 160;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class VelocityInterpolateOffPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 161;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class StateSavePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Filename, "Filename") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 162;
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 ---\n";
output += DataBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ReportAutosaveCrashPacket : Packet
{
/// <exclude/>
public class AutosaveDataBlock
{
public int PID;
public int Status;
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 --\n";
output += "PID: " + PID.ToString() + "\n";
output += "Status: " + Status.ToString() + "\n";
output = 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 = 163;
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 ---\n";
output += AutosaveData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimWideDeletesPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID TargetID;
public uint Flags;
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 --\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 164;
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 ---\n";
output += DataBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TrackAgentPacket : Packet
{
/// <exclude/>
public class TargetDataBlock
{
public LLUUID PreyID;
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 --\n";
output += "PreyID: " + PreyID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 165;
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 ---\n";
output += TargetData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GrantModificationPacket : Packet
{
/// <exclude/>
public class EmpoweredBlockBlock
{
public LLUUID EmpoweredID;
public int Length
{
get
{
return 16;
}
}
public EmpoweredBlockBlock() { }
public EmpoweredBlockBlock(byte[] bytes, ref int i)
{
try
{
EmpoweredID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(EmpoweredID == null) { Console.WriteLine("Warning: EmpoweredID is null, in " + this.GetType()); }
Array.Copy(EmpoweredID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- EmpoweredBlock --\n";
output += "EmpoweredID: " + EmpoweredID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
private byte[] _grantername;
public byte[] GranterName
{
get { return _grantername; }
set
{
if (value == null) { _grantername = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _grantername = new byte[value.Length]; Array.Copy(value, _grantername, value.Length); }
}
}
public LLUUID SessionID;
public int Length
{
get
{
int length = 32;
if (GranterName != null) { length += 1 + GranterName.Length; }
return length;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
AgentID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_grantername = new byte[length];
Array.Copy(bytes, i, _grantername, 0, length); i += length;
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(GranterName == null) { Console.WriteLine("Warning: GranterName is null, in " + this.GetType()); }
bytes[i++] = (byte)GranterName.Length;
Array.Copy(GranterName, 0, bytes, i, GranterName.Length); i += GranterName.Length;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(GranterName, "GranterName") + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.GrantModification; } }
public EmpoweredBlockBlock[] EmpoweredBlock;
public AgentDataBlock AgentData;
public GrantModificationPacket()
{
Header = new LowHeader();
Header.ID = 166;
Header.Reliable = true;
EmpoweredBlock = new EmpoweredBlockBlock[0];
AgentData = new AgentDataBlock();
}
public GrantModificationPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
EmpoweredBlock = new EmpoweredBlockBlock[count];
for (int j = 0; j < count; j++)
{ EmpoweredBlock[j] = new EmpoweredBlockBlock(bytes, ref i); }
AgentData = new AgentDataBlock(bytes, ref i);
}
public GrantModificationPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
EmpoweredBlock = new EmpoweredBlockBlock[count];
for (int j = 0; j < count; j++)
{ EmpoweredBlock[j] = new EmpoweredBlockBlock(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 < EmpoweredBlock.Length; j++) { length += EmpoweredBlock[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)EmpoweredBlock.Length;
for (int j = 0; j < EmpoweredBlock.Length; j++) { EmpoweredBlock[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 = "--- GrantModification ---\n";
for (int j = 0; j < EmpoweredBlock.Length; j++)
{
output += EmpoweredBlock[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RevokeModificationPacket : Packet
{
/// <exclude/>
public class RevokedBlockBlock
{
public LLUUID RevokedID;
public int Length
{
get
{
return 16;
}
}
public RevokedBlockBlock() { }
public RevokedBlockBlock(byte[] bytes, ref int i)
{
try
{
RevokedID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(RevokedID == null) { Console.WriteLine("Warning: RevokedID is null, in " + this.GetType()); }
Array.Copy(RevokedID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- RevokedBlock --\n";
output += "RevokedID: " + RevokedID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
private byte[] _grantername;
public byte[] GranterName
{
get { return _grantername; }
set
{
if (value == null) { _grantername = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _grantername = new byte[value.Length]; Array.Copy(value, _grantername, value.Length); }
}
}
public LLUUID SessionID;
public int Length
{
get
{
int length = 32;
if (GranterName != null) { length += 1 + GranterName.Length; }
return length;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
AgentID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_grantername = new byte[length];
Array.Copy(bytes, i, _grantername, 0, length); i += length;
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(GranterName == null) { Console.WriteLine("Warning: GranterName is null, in " + this.GetType()); }
bytes[i++] = (byte)GranterName.Length;
Array.Copy(GranterName, 0, bytes, i, GranterName.Length); i += GranterName.Length;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(GranterName, "GranterName") + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RevokeModification; } }
public RevokedBlockBlock[] RevokedBlock;
public AgentDataBlock AgentData;
public RevokeModificationPacket()
{
Header = new LowHeader();
Header.ID = 167;
Header.Reliable = true;
RevokedBlock = new RevokedBlockBlock[0];
AgentData = new AgentDataBlock();
}
public RevokeModificationPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
RevokedBlock = new RevokedBlockBlock[count];
for (int j = 0; j < count; j++)
{ RevokedBlock[j] = new RevokedBlockBlock(bytes, ref i); }
AgentData = new AgentDataBlock(bytes, ref i);
}
public RevokeModificationPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
RevokedBlock = new RevokedBlockBlock[count];
for (int j = 0; j < count; j++)
{ RevokedBlock[j] = new RevokedBlockBlock(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 < RevokedBlock.Length; j++) { length += RevokedBlock[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)RevokedBlock.Length;
for (int j = 0; j < RevokedBlock.Length; j++) { RevokedBlock[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 = "--- RevokeModification ---\n";
for (int j = 0; j < RevokedBlock.Length; j++)
{
output += RevokedBlock[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestGrantedProxiesPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RequestGrantedProxies; } }
public AgentDataBlock AgentData;
public RequestGrantedProxiesPacket()
{
Header = new LowHeader();
Header.ID = 168;
Header.Reliable = true;
AgentData = new AgentDataBlock();
}
public RequestGrantedProxiesPacket(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 RequestGrantedProxiesPacket(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 = "--- RequestGrantedProxies ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GrantedProxiesPacket : Packet
{
/// <exclude/>
public class EmpoweredBlockBlock
{
public LLUUID EmpoweredID;
public int Length
{
get
{
return 16;
}
}
public EmpoweredBlockBlock() { }
public EmpoweredBlockBlock(byte[] bytes, ref int i)
{
try
{
EmpoweredID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(EmpoweredID == null) { Console.WriteLine("Warning: EmpoweredID is null, in " + this.GetType()); }
Array.Copy(EmpoweredID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- EmpoweredBlock --\n";
output += "EmpoweredID: " + EmpoweredID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GranterBlockBlock
{
public LLUUID GranterID;
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 --\n";
output += "GranterID: " + GranterID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.GrantedProxies; } }
public EmpoweredBlockBlock[] EmpoweredBlock;
public GranterBlockBlock[] GranterBlock;
public AgentDataBlock AgentData;
public GrantedProxiesPacket()
{
Header = new LowHeader();
Header.ID = 169;
Header.Reliable = true;
EmpoweredBlock = new EmpoweredBlockBlock[0];
GranterBlock = new GranterBlockBlock[0];
AgentData = new AgentDataBlock();
}
public GrantedProxiesPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
EmpoweredBlock = new EmpoweredBlockBlock[count];
for (int j = 0; j < count; j++)
{ EmpoweredBlock[j] = new EmpoweredBlockBlock(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); }
AgentData = new AgentDataBlock(bytes, ref i);
}
public GrantedProxiesPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
EmpoweredBlock = new EmpoweredBlockBlock[count];
for (int j = 0; j < count; j++)
{ EmpoweredBlock[j] = new EmpoweredBlockBlock(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); }
AgentData = new AgentDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += AgentData.Length;;
length++;
for (int j = 0; j < EmpoweredBlock.Length; j++) { length += EmpoweredBlock[j].Length; }
length++;
for (int j = 0; j < GranterBlock.Length; j++) { length += GranterBlock[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)EmpoweredBlock.Length;
for (int j = 0; j < EmpoweredBlock.Length; j++) { EmpoweredBlock[j].ToBytes(bytes, ref i); }
bytes[i++] = (byte)GranterBlock.Length;
for (int j = 0; j < GranterBlock.Length; j++) { GranterBlock[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 = "--- GrantedProxies ---\n";
for (int j = 0; j < EmpoweredBlock.Length; j++)
{
output += EmpoweredBlock[j].ToString() + "\n";
}
for (int j = 0; j < GranterBlock.Length; j++)
{
output += GranterBlock[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AddModifyAbilityPacket : Packet
{
/// <exclude/>
public class TargetBlockBlock
{
public uint TargetIP;
public ushort TargetPort;
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 --\n";
output += "TargetIP: " + TargetIP.ToString() + "\n";
output += "TargetPort: " + TargetPort.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GranterBlockBlock
{
public LLUUID GranterID;
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 --\n";
output += "GranterID: " + GranterID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AddModifyAbility; } }
public TargetBlockBlock TargetBlock;
public GranterBlockBlock[] GranterBlock;
public AgentBlockBlock AgentBlock;
public AddModifyAbilityPacket()
{
Header = new LowHeader();
Header.ID = 170;
Header.Reliable = true;
Header.Zerocoded = true;
TargetBlock = new TargetBlockBlock();
GranterBlock = new GranterBlockBlock[0];
AgentBlock = new AgentBlockBlock();
}
public AddModifyAbilityPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
TargetBlock = new TargetBlockBlock(bytes, ref i);
int count = (int)bytes[i++];
GranterBlock = new GranterBlockBlock[count];
for (int j = 0; j < count; j++)
{ GranterBlock[j] = new GranterBlockBlock(bytes, ref i); }
AgentBlock = new AgentBlockBlock(bytes, ref i);
}
public AddModifyAbilityPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
TargetBlock = new TargetBlockBlock(bytes, ref i);
int count = (int)bytes[i++];
GranterBlock = new GranterBlockBlock[count];
for (int j = 0; j < count; j++)
{ GranterBlock[j] = new GranterBlockBlock(bytes, ref i); }
AgentBlock = new AgentBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TargetBlock.Length; length += AgentBlock.Length;;
length++;
for (int j = 0; j < GranterBlock.Length; j++) { length += GranterBlock[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);
TargetBlock.ToBytes(bytes, ref i);
bytes[i++] = (byte)GranterBlock.Length;
for (int j = 0; j < GranterBlock.Length; j++) { GranterBlock[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 = "--- AddModifyAbility ---\n";
output += TargetBlock.ToString() + "\n";
for (int j = 0; j < GranterBlock.Length; j++)
{
output += GranterBlock[j].ToString() + "\n";
}
output += AgentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveModifyAbilityPacket : Packet
{
/// <exclude/>
public class TargetBlockBlock
{
public uint TargetIP;
public ushort TargetPort;
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 --\n";
output += "TargetIP: " + TargetIP.ToString() + "\n";
output += "TargetPort: " + TargetPort.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID AgentID;
public LLUUID RevokerID;
public int Length
{
get
{
return 32;
}
}
public AgentBlockBlock() { }
public AgentBlockBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
RevokerID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref 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(RevokerID == null) { Console.WriteLine("Warning: RevokerID is null, in " + this.GetType()); }
Array.Copy(RevokerID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- AgentBlock --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RevokerID: " + RevokerID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RemoveModifyAbility; } }
public TargetBlockBlock TargetBlock;
public AgentBlockBlock AgentBlock;
public RemoveModifyAbilityPacket()
{
Header = new LowHeader();
Header.ID = 171;
Header.Reliable = true;
TargetBlock = new TargetBlockBlock();
AgentBlock = new AgentBlockBlock();
}
public RemoveModifyAbilityPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
TargetBlock = new TargetBlockBlock(bytes, ref i);
AgentBlock = new AgentBlockBlock(bytes, ref i);
}
public RemoveModifyAbilityPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
TargetBlock = new TargetBlockBlock(bytes, ref i);
AgentBlock = new AgentBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TargetBlock.Length; 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);
TargetBlock.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 = "--- RemoveModifyAbility ---\n";
output += TargetBlock.ToString() + "\n";
output += AgentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ViewerStatsPacket : Packet
{
/// <exclude/>
public class DownloadTotalsBlock
{
public uint Objects;
public uint Textures;
public uint World;
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 --\n";
output += "Objects: " + Objects.ToString() + "\n";
output += "Textures: " + Textures.ToString() + "\n";
output += "World: " + World.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class MiscStatsBlock
{
public uint Type;
public double Value;
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 --\n";
output += "Type: " + Type.ToString() + "\n";
output += "Value: " + Value.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class NetStatsBlock
{
public uint Packets;
public uint Savings;
public uint Compressed;
public uint Bytes;
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 --\n";
output += "Packets: " + Packets.ToString() + "\n";
output += "Savings: " + Savings.ToString() + "\n";
output += "Compressed: " + Compressed.ToString() + "\n";
output += "Bytes: " + Bytes.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class FailStatsBlock
{
public uint FailedResends;
public uint Invalid;
public uint SendPacket;
public uint Dropped;
public uint OffCircuit;
public uint Resent;
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 --\n";
output += "FailedResends: " + FailedResends.ToString() + "\n";
output += "Invalid: " + Invalid.ToString() + "\n";
output += "SendPacket: " + SendPacket.ToString() + "\n";
output += "Dropped: " + Dropped.ToString() + "\n";
output += "OffCircuit: " + OffCircuit.ToString() + "\n";
output += "Resent: " + Resent.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public uint IP;
public float FPS;
public LLUUID AgentID;
public int RegionsVisited;
public LLUUID SessionID;
public float Ping;
public float RunTime;
public double MetersTraveled;
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); }
}
}
public int Length
{
get
{
int length = 68;
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));
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;
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);
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;
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 --\n";
output += "IP: " + IP.ToString() + "\n";
output += "FPS: " + FPS.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RegionsVisited: " + RegionsVisited.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Ping: " + Ping.ToString() + "\n";
output += "RunTime: " + RunTime.ToString() + "\n";
output += "MetersTraveled: " + MetersTraveled.ToString() + "\n";
output += Helpers.FieldToString(SysCPU, "SysCPU") + "\n";
output += Helpers.FieldToString(SysGPU, "SysGPU") + "\n";
output += "SysRAM: " + SysRAM.ToString() + "\n";
output += "StartTime: " + StartTime.ToString() + "\n";
output += Helpers.FieldToString(SysOS, "SysOS") + "\n";
output = 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 = 172;
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 ---\n";
output += DownloadTotals.ToString() + "\n";
for (int j = 0; j < MiscStats.Length; j++)
{
output += MiscStats[j].ToString() + "\n";
}
for (int j = 0; j < 2; j++)
{
output += NetStats[j].ToString() + "\n";
}
output += FailStats.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptAnswerYesPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID TaskID;
public LLUUID ItemID;
public int Questions;
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 --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "Questions: " + Questions.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 173;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserReportPacket : Packet
{
/// <exclude/>
public class MeanCollisionBlock
{
public float Mag;
public uint Time;
public LLUUID Perp;
public byte Type;
public int Length
{
get
{
return 25;
}
}
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++];
}
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;
}
public override string ToString()
{
string output = "-- MeanCollision --\n";
output += "Mag: " + Mag.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "Perp: " + Perp.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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 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 ScreenshotID;
public LLVector3 Position;
public int Length
{
get
{
int length = 47;
if (Details != null) { length += 2 + Details.Length; }
if (VersionString != null) { length += 1 + VersionString.Length; }
if (Summary != null) { length += 1 + Summary.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;
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++];
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;
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(ScreenshotID == null) { Console.WriteLine("Warning: ScreenshotID is null, in " + this.GetType()); }
Array.Copy(ScreenshotID.GetBytes(), 0, bytes, i, 16); i += 16;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ReportData --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(Details, "Details") + "\n";
output += Helpers.FieldToString(VersionString, "VersionString") + "\n";
output += "CheckFlags: " + CheckFlags.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += Helpers.FieldToString(Summary, "Summary") + "\n";
output += "ReportType: " + ReportType.ToString() + "\n";
output += "ScreenshotID: " + ScreenshotID.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 MeanCollisionBlock[] MeanCollision;
public ReportDataBlock ReportData;
public AgentDataBlock AgentData;
public UserReportPacket()
{
Header = new LowHeader();
Header.ID = 174;
Header.Reliable = true;
Header.Zerocoded = true;
MeanCollision = new MeanCollisionBlock[0];
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);
int count = (int)bytes[i++];
MeanCollision = new MeanCollisionBlock[count];
for (int j = 0; j < count; j++)
{ MeanCollision[j] = new MeanCollisionBlock(bytes, ref i); }
ReportData = new ReportDataBlock(bytes, ref i);
AgentData = new AgentDataBlock(bytes, ref i);
}
public UserReportPacket(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); }
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;;
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); }
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 ---\n";
for (int j = 0; j < MeanCollision.Length; j++)
{
output += MeanCollision[j].ToString() + "\n";
}
output += ReportData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AlertMessagePacket : Packet
{
/// <exclude/>
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 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 --\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output = 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 = 175;
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 ---\n";
output += AlertData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentAlertMessagePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "Modal: " + Modal.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 176;
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 ---\n";
output += AlertData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MeanCollisionAlertPacket : Packet
{
/// <exclude/>
public class MeanCollisionBlock
{
public float Mag;
public uint Time;
public LLUUID Perp;
public byte Type;
public LLUUID Victim;
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 --\n";
output += "Mag: " + Mag.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "Perp: " + Perp.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "Victim: " + Victim.ToString() + "\n";
output = 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 = 177;
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 ---\n";
for (int j = 0; j < MeanCollision.Length; j++)
{
output += MeanCollision[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ViewerFrozenMessagePacket : Packet
{
/// <exclude/>
public class FrozenDataBlock
{
public bool Data;
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 --\n";
output += "Data: " + Data.ToString() + "\n";
output = 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 = 178;
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 ---\n";
output += FrozenData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class HealthMessagePacket : Packet
{
/// <exclude/>
public class HealthDataBlock
{
public float Health;
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 --\n";
output += "Health: " + Health.ToString() + "\n";
output = 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 = 179;
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 ---\n";
output += HealthData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ChatFromSimulatorPacket : Packet
{
/// <exclude/>
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;
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;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ChatData --\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "Audible: " + Audible.ToString() + "\n";
output += "ChatType: " + ChatType.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += Helpers.FieldToString(FromName, "FromName") + "\n";
output += "SourceType: " + SourceType.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = 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 = 180;
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 ---\n";
output += ChatData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimStatsPacket : Packet
{
/// <exclude/>
public class StatBlock
{
public float StatValue;
public uint StatID;
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 --\n";
output += "StatValue: " + StatValue.ToString() + "\n";
output += "StatID: " + StatID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionBlock
{
public uint RegionX;
public uint RegionY;
public uint RegionFlags;
public uint ObjectCapacity;
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 --\n";
output += "RegionX: " + RegionX.ToString() + "\n";
output += "RegionY: " + RegionY.ToString() + "\n";
output += "RegionFlags: " + RegionFlags.ToString() + "\n";
output += "ObjectCapacity: " + ObjectCapacity.ToString() + "\n";
output = 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 = 181;
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 ---\n";
for (int j = 0; j < Stat.Length; j++)
{
output += Stat[j].ToString() + "\n";
}
output += Region.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestRegionInfoPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 182;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RegionInfoPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "BillableFactor: " + BillableFactor.ToString() + "\n";
output += "ObjectBonusFactor: " + ObjectBonusFactor.ToString() + "\n";
output += "RedirectGridX: " + RedirectGridX.ToString() + "\n";
output += "RedirectGridY: " + RedirectGridY.ToString() + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "PricePerMeter: " + PricePerMeter.ToString() + "\n";
output += "RegionFlags: " + RegionFlags.ToString() + "\n";
output += "WaterHeight: " + WaterHeight.ToString() + "\n";
output += "UseEstateSun: " + UseEstateSun.ToString() + "\n";
output += "SunHour: " + SunHour.ToString() + "\n";
output += "MaxAgents: " + MaxAgents.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "TerrainLowerLimit: " + TerrainLowerLimit.ToString() + "\n";
output += "ParentEstateID: " + ParentEstateID.ToString() + "\n";
output += "TerrainRaiseLimit: " + TerrainRaiseLimit.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 183;
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 ---\n";
output += RegionInfo.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GodUpdateRegionInfoPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "BillableFactor: " + BillableFactor.ToString() + "\n";
output += "RedirectGridX: " + RedirectGridX.ToString() + "\n";
output += "RedirectGridY: " + RedirectGridY.ToString() + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "PricePerMeter: " + PricePerMeter.ToString() + "\n";
output += "RegionFlags: " + RegionFlags.ToString() + "\n";
output += "ParentEstateID: " + ParentEstateID.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 184;
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 ---\n";
output += RegionInfo.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class NearestLandingRegionRequestPacket : Packet
{
/// <exclude/>
public class RequestingRegionDataBlock
{
public ulong RegionHandle;
public int Length
{
get
{
return 8;
}
}
public RequestingRegionDataBlock() { }
public RequestingRegionDataBlock(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 = "-- RequestingRegionData --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.NearestLandingRegionRequest; } }
public RequestingRegionDataBlock RequestingRegionData;
public NearestLandingRegionRequestPacket()
{
Header = new LowHeader();
Header.ID = 185;
Header.Reliable = true;
RequestingRegionData = new RequestingRegionDataBlock();
}
public NearestLandingRegionRequestPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
RequestingRegionData = new RequestingRegionDataBlock(bytes, ref i);
}
public NearestLandingRegionRequestPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
RequestingRegionData = new RequestingRegionDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += RequestingRegionData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
RequestingRegionData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- NearestLandingRegionRequest ---\n";
output += RequestingRegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class NearestLandingRegionReplyPacket : Packet
{
/// <exclude/>
public class LandingRegionDataBlock
{
public ulong RegionHandle;
public int Length
{
get
{
return 8;
}
}
public LandingRegionDataBlock() { }
public LandingRegionDataBlock(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 = "-- LandingRegionData --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.NearestLandingRegionReply; } }
public LandingRegionDataBlock LandingRegionData;
public NearestLandingRegionReplyPacket()
{
Header = new LowHeader();
Header.ID = 186;
Header.Reliable = true;
LandingRegionData = new LandingRegionDataBlock();
}
public NearestLandingRegionReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
LandingRegionData = new LandingRegionDataBlock(bytes, ref i);
}
public NearestLandingRegionReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
LandingRegionData = new LandingRegionDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += LandingRegionData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
LandingRegionData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- NearestLandingRegionReply ---\n";
output += LandingRegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class NearestLandingRegionUpdatedPacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public ulong RegionHandle;
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 --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = 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 = 187;
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 ---\n";
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TeleportLandingStatusChangedPacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public ulong RegionHandle;
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 --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.TeleportLandingStatusChanged; } }
public RegionDataBlock RegionData;
public TeleportLandingStatusChangedPacket()
{
Header = new LowHeader();
Header.ID = 188;
Header.Reliable = true;
RegionData = new RegionDataBlock();
}
public TeleportLandingStatusChangedPacket(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 TeleportLandingStatusChangedPacket(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 = "--- TeleportLandingStatusChanged ---\n";
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RegionHandshakePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "BillableFactor: " + BillableFactor.ToString() + "\n";
output += "TerrainHeightRange00: " + TerrainHeightRange00.ToString() + "\n";
output += "TerrainHeightRange01: " + TerrainHeightRange01.ToString() + "\n";
output += "TerrainHeightRange10: " + TerrainHeightRange10.ToString() + "\n";
output += "TerrainHeightRange11: " + TerrainHeightRange11.ToString() + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "RegionFlags: " + RegionFlags.ToString() + "\n";
output += "TerrainStartHeight00: " + TerrainStartHeight00.ToString() + "\n";
output += "TerrainStartHeight01: " + TerrainStartHeight01.ToString() + "\n";
output += "TerrainStartHeight10: " + TerrainStartHeight10.ToString() + "\n";
output += "TerrainStartHeight11: " + TerrainStartHeight11.ToString() + "\n";
output += "WaterHeight: " + WaterHeight.ToString() + "\n";
output += "SimOwner: " + SimOwner.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "TerrainBase0: " + TerrainBase0.ToString() + "\n";
output += "TerrainBase1: " + TerrainBase1.ToString() + "\n";
output += "TerrainBase2: " + TerrainBase2.ToString() + "\n";
output += "TerrainBase3: " + TerrainBase3.ToString() + "\n";
output += "TerrainDetail0: " + TerrainDetail0.ToString() + "\n";
output += "TerrainDetail1: " + TerrainDetail1.ToString() + "\n";
output += "TerrainDetail2: " + TerrainDetail2.ToString() + "\n";
output += "TerrainDetail3: " + TerrainDetail3.ToString() + "\n";
output += "IsEstateManager: " + IsEstateManager.ToString() + "\n";
output += "CacheID: " + CacheID.ToString() + "\n";
output = 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 = 189;
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 ---\n";
output += RegionInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RegionHandshakeReplyPacket : Packet
{
/// <exclude/>
public class RegionInfoBlock
{
public uint Flags;
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 --\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 190;
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 ---\n";
output += RegionInfo.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimulatorViewerTimeMessagePacket : Packet
{
/// <exclude/>
public class TimeInfoBlock
{
public uint SecPerDay;
public ulong UsecSinceStart;
public uint SecPerYear;
public LLVector3 SunAngVelocity;
public float SunPhase;
public LLVector3 SunDirection;
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);
if(SunAngVelocity == null) { Console.WriteLine("Warning: SunAngVelocity is null, in " + this.GetType()); }
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;
if(SunDirection == null) { Console.WriteLine("Warning: SunDirection is null, in " + this.GetType()); }
Array.Copy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- TimeInfo --\n";
output += "SecPerDay: " + SecPerDay.ToString() + "\n";
output += "UsecSinceStart: " + UsecSinceStart.ToString() + "\n";
output += "SecPerYear: " + SecPerYear.ToString() + "\n";
output += "SunAngVelocity: " + SunAngVelocity.ToString() + "\n";
output += "SunPhase: " + SunPhase.ToString() + "\n";
output += "SunDirection: " + SunDirection.ToString() + "\n";
output = 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 = 191;
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 ---\n";
output += TimeInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EnableSimulatorPacket : Packet
{
/// <exclude/>
public class SimulatorInfoBlock
{
public uint IP;
public ushort Port;
public ulong Handle;
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 --\n";
output += "IP: " + IP.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "Handle: " + Handle.ToString() + "\n";
output = 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 = 192;
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 ---\n";
output += SimulatorInfo.ToString() + "\n";
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 = 193;
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 ---\n";
return output;
}
}
/// <exclude/>
public class TransferRequestPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "TransferID: " + TransferID.ToString() + "\n";
output += Helpers.FieldToString(Params, "Params") + "\n";
output += "ChannelType: " + ChannelType.ToString() + "\n";
output += "SourceType: " + SourceType.ToString() + "\n";
output += "Priority: " + Priority.ToString() + "\n";
output = 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 = 194;
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 ---\n";
output += TransferInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TransferInfoPacket : Packet
{
/// <exclude/>
public class TransferInfoBlock
{
public LLUUID TransferID;
public int Size;
public int ChannelType;
public int TargetType;
public int Status;
public int Length
{
get
{
return 32;
}
}
public TransferInfoBlock() { }
public TransferInfoBlock(byte[] bytes, ref int i)
{
try
{
TransferID = new LLUUID(bytes, i); i += 16;
Size = (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));
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);
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 --\n";
output += "TransferID: " + TransferID.ToString() + "\n";
output += "Size: " + Size.ToString() + "\n";
output += "ChannelType: " + ChannelType.ToString() + "\n";
output += "TargetType: " + TargetType.ToString() + "\n";
output += "Status: " + Status.ToString() + "\n";
output = 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 = 195;
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 ---\n";
output += TransferInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TransferAbortPacket : Packet
{
/// <exclude/>
public class TransferInfoBlock
{
public LLUUID TransferID;
public int ChannelType;
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 --\n";
output += "TransferID: " + TransferID.ToString() + "\n";
output += "ChannelType: " + ChannelType.ToString() + "\n";
output = 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 = 196;
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 ---\n";
output += TransferInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TransferPriorityPacket : Packet
{
/// <exclude/>
public class TransferInfoBlock
{
public LLUUID TransferID;
public int ChannelType;
public float Priority;
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 --\n";
output += "TransferID: " + TransferID.ToString() + "\n";
output += "ChannelType: " + ChannelType.ToString() + "\n";
output += "Priority: " + Priority.ToString() + "\n";
output = 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 = 197;
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 ---\n";
output += TransferInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestXferPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "UseBigPackets: " + UseBigPackets.ToString() + "\n";
output += "DeleteOnCompletion: " + DeleteOnCompletion.ToString() + "\n";
output += "FilePath: " + FilePath.ToString() + "\n";
output += Helpers.FieldToString(Filename, "Filename") + "\n";
output += "VFileID: " + VFileID.ToString() + "\n";
output += "VFileType: " + VFileType.ToString() + "\n";
output = 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 = 198;
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 ---\n";
output += XferID.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AbortXferPacket : Packet
{
/// <exclude/>
public class XferIDBlock
{
public ulong ID;
public int Result;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Result: " + Result.ToString() + "\n";
output = 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 = 199;
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 ---\n";
output += XferID.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestAvatarInfoPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID FullID;
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 --\n";
output += "FullID: " + FullID.ToString() + "\n";
output = 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 = 200;
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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarAppearancePacket : Packet
{
/// <exclude/>
public class VisualParamBlock
{
public byte ParamValue;
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 --\n";
output += "ParamValue: " + ParamValue.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SenderBlock
{
public LLUUID ID;
public bool IsTrial;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "IsTrial: " + IsTrial.ToString() + "\n";
output = 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 = 201;
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 ---\n";
for (int j = 0; j < VisualParam.Length; j++)
{
output += VisualParam[j].ToString() + "\n";
}
output += ObjectData.ToString() + "\n";
output += Sender.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetFollowCamPropertiesPacket : Packet
{
/// <exclude/>
public class CameraPropertyBlock
{
public int Type;
public float Value;
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 --\n";
output += "Type: " + Type.ToString() + "\n";
output += "Value: " + Value.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = 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 = 202;
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 ---\n";
for (int j = 0; j < CameraProperty.Length; j++)
{
output += CameraProperty[j].ToString() + "\n";
}
output += ObjectData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClearFollowCamPropertiesPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = 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 = 203;
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 ---\n";
output += ObjectData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestPayPricePacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = 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 = 204;
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 ---\n";
output += ObjectData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PayPriceReplyPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
public int DefaultPayPrice;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "DefaultPayPrice: " + DefaultPayPrice.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ButtonDataBlock
{
public int PayButton;
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 --\n";
output += "PayButton: " + PayButton.ToString() + "\n";
output = 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 = 205;
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 ---\n";
output += ObjectData.ToString() + "\n";
for (int j = 0; j < ButtonData.Length; j++)
{
output += ButtonData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class KickUserPacket : Packet
{
/// <exclude/>
public class TargetBlockBlock
{
public uint TargetIP;
public ushort TargetPort;
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 --\n";
output += "TargetIP: " + TargetIP.ToString() + "\n";
output += "TargetPort: " + TargetPort.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += Helpers.FieldToString(Reason, "Reason") + "\n";
output = 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 = 206;
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 ---\n";
output += TargetBlock.ToString() + "\n";
output += UserInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class KickUserAckPacket : Packet
{
/// <exclude/>
public class UserInfoBlock
{
public LLUUID SessionID;
public uint Flags;
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 --\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 = 207;
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 ---\n";
output += UserInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GodKickUserPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GodSessionID: " + GodSessionID.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(Reason, "Reason") + "\n";
output += "KickFlags: " + KickFlags.ToString() + "\n";
output += "GodID: " + GodID.ToString() + "\n";
output = 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 = 208;
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 ---\n";
output += UserInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SystemKickUserPacket : Packet
{
/// <exclude/>
public class AgentInfoBlock
{
public LLUUID AgentID;
public int Length
{
get
{
return 16;
}
}
public AgentInfoBlock() { }
public AgentInfoBlock(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 = "-- AgentInfo --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SystemKickUser; } }
public AgentInfoBlock[] AgentInfo;
public SystemKickUserPacket()
{
Header = new LowHeader();
Header.ID = 209;
Header.Reliable = true;
AgentInfo = new AgentInfoBlock[0];
}
public SystemKickUserPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
AgentInfo = new AgentInfoBlock[count];
for (int j = 0; j < count; j++)
{ AgentInfo[j] = new AgentInfoBlock(bytes, ref i); }
}
public SystemKickUserPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
AgentInfo = new AgentInfoBlock[count];
for (int j = 0; j < count; j++)
{ AgentInfo[j] = new AgentInfoBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < AgentInfo.Length; j++) { length += AgentInfo[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)AgentInfo.Length;
for (int j = 0; j < AgentInfo.Length; j++) { AgentInfo[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SystemKickUser ---\n";
for (int j = 0; j < AgentInfo.Length; j++)
{
output += AgentInfo[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class EjectUserPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID TargetID;
public uint Flags;
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 --\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 210;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class FreezeUserPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID TargetID;
public uint Flags;
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 --\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 211;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarPropertiesRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID AvatarID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "AvatarID: " + AvatarID.ToString() + "\n";
output = 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 = 212;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarPropertiesRequestBackendPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public byte GodLevel;
public bool WebProfilesDisabled;
public LLUUID AvatarID;
public int Length
{
get
{
return 34;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
GodLevel = (byte)bytes[i++];
WebProfilesDisabled = (bytes[i++] != 0) ? (bool)true : (bool)false;
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;
bytes[i++] = GodLevel;
bytes[i++] = (byte)((WebProfilesDisabled) ? 1 : 0);
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GodLevel: " + GodLevel.ToString() + "\n";
output += "WebProfilesDisabled: " + WebProfilesDisabled.ToString() + "\n";
output += "AvatarID: " + AvatarID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AvatarPropertiesRequestBackend; } }
public AgentDataBlock AgentData;
public AvatarPropertiesRequestBackendPacket()
{
Header = new LowHeader();
Header.ID = 213;
Header.Reliable = true;
AgentData = new AgentDataBlock();
}
public AvatarPropertiesRequestBackendPacket(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 AvatarPropertiesRequestBackendPacket(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 = "--- AvatarPropertiesRequestBackend ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarPropertiesReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "PartnerID: " + PartnerID.ToString() + "\n";
output += Helpers.FieldToString(AboutText, "AboutText") + "\n";
output += "Transacted: " + Transacted.ToString() + "\n";
output += Helpers.FieldToString(CharterMember, "CharterMember") + "\n";
output += Helpers.FieldToString(FLAboutText, "FLAboutText") + "\n";
output += "ImageID: " + ImageID.ToString() + "\n";
output += "FLImageID: " + FLImageID.ToString() + "\n";
output += "AllowPublish: " + AllowPublish.ToString() + "\n";
output += Helpers.FieldToString(ProfileURL, "ProfileURL") + "\n";
output += "Identified: " + Identified.ToString() + "\n";
output += Helpers.FieldToString(BornOn, "BornOn") + "\n";
output += "MaturePublish: " + MaturePublish.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID AvatarID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "AvatarID: " + AvatarID.ToString() + "\n";
output = 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 = 214;
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 ---\n";
output += PropertiesData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarInterestsReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "WantToMask: " + WantToMask.ToString() + "\n";
output += Helpers.FieldToString(WantToText, "WantToText") + "\n";
output += "SkillsMask: " + SkillsMask.ToString() + "\n";
output += Helpers.FieldToString(SkillsText, "SkillsText") + "\n";
output += Helpers.FieldToString(LanguagesText, "LanguagesText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID AvatarID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "AvatarID: " + AvatarID.ToString() + "\n";
output = 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 = 215;
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 ---\n";
output += PropertiesData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarGroupsReplyPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID AvatarID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "AvatarID: " + AvatarID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(GroupTitle, "GroupTitle") + "\n";
output += "GroupPowers: " + GroupPowers.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "GroupInsigniaID: " + GroupInsigniaID.ToString() + "\n";
output += "AcceptNotices: " + AcceptNotices.ToString() + "\n";
output += Helpers.FieldToString(GroupName, "GroupName") + "\n";
output = 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 = 216;
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 ---\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < GroupData.Length; j++)
{
output += GroupData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AvatarPropertiesUpdatePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(AboutText, "AboutText") + "\n";
output += Helpers.FieldToString(FLAboutText, "FLAboutText") + "\n";
output += "ImageID: " + ImageID.ToString() + "\n";
output += "FLImageID: " + FLImageID.ToString() + "\n";
output += "AllowPublish: " + AllowPublish.ToString() + "\n";
output += Helpers.FieldToString(ProfileURL, "ProfileURL") + "\n";
output += "MaturePublish: " + MaturePublish.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 217;
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 ---\n";
output += PropertiesData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarInterestsUpdatePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "WantToMask: " + WantToMask.ToString() + "\n";
output += Helpers.FieldToString(WantToText, "WantToText") + "\n";
output += "SkillsMask: " + SkillsMask.ToString() + "\n";
output += Helpers.FieldToString(SkillsText, "SkillsText") + "\n";
output += Helpers.FieldToString(LanguagesText, "LanguagesText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 218;
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 ---\n";
output += PropertiesData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarStatisticsReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Negative: " + Negative.ToString() + "\n";
output += "Positive: " + Positive.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AvatarDataBlock
{
public LLUUID AvatarID;
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 --\n";
output += "AvatarID: " + AvatarID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 219;
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 ---\n";
for (int j = 0; j < StatisticsData.Length; j++)
{
output += StatisticsData[j].ToString() + "\n";
}
output += AvatarData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarNotesReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output += Helpers.FieldToString(Notes, "Notes") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 220;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarNotesUpdatePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output += Helpers.FieldToString(Notes, "Notes") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 221;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarPicksReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(PickName, "PickName") + "\n";
output += "PickID: " + PickID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID TargetID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output = 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 = 222;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EventInfoRequestPacket : Packet
{
/// <exclude/>
public class EventDataBlock
{
public uint EventID;
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 --\n";
output += "EventID: " + EventID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 223;
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 ---\n";
output += EventData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EventInfoReplyPacket : Packet
{
/// <exclude/>
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;
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;
if(GlobalPos == null) { Console.WriteLine("Warning: GlobalPos is null, in " + this.GetType()); }
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 --\n";
output += "Duration: " + Duration.ToString() + "\n";
output += "DateUTC: " + DateUTC.ToString() + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "GlobalPos: " + GlobalPos.ToString() + "\n";
output += Helpers.FieldToString(Creator, "Creator") + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Date, "Date") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += "EventID: " + EventID.ToString() + "\n";
output += Helpers.FieldToString(Category, "Category") + "\n";
output += "EventFlags: " + EventFlags.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output += "Cover: " + Cover.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 224;
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 ---\n";
output += EventData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EventNotificationAddRequestPacket : Packet
{
/// <exclude/>
public class EventDataBlock
{
public uint EventID;
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 --\n";
output += "EventID: " + EventID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 225;
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 ---\n";
output += EventData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EventNotificationRemoveRequestPacket : Packet
{
/// <exclude/>
public class EventDataBlock
{
public uint EventID;
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 --\n";
output += "EventID: " + EventID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 226;
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 ---\n";
output += EventData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EventGodDeletePacket : Packet
{
/// <exclude/>
public class EventDataBlock
{
public uint EventID;
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 --\n";
output += "EventID: " + EventID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "QueryFlags: " + QueryFlags.ToString() + "\n";
output += "QueryStart: " + QueryStart.ToString() + "\n";
output += Helpers.FieldToString(QueryText, "QueryText") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 227;
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 ---\n";
output += EventData.ToString() + "\n";
output += QueryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PickInfoRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID PickID;
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 --\n";
output += "PickID: " + PickID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 228;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PickInfoReplyPacket : Packet
{
/// <exclude/>
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;
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);
if(PosGlobal == null) { Console.WriteLine("Warning: PosGlobal is null, in " + this.GetType()); }
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 --\n";
output += Helpers.FieldToString(OriginalName, "OriginalName") + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "Enabled: " + Enabled.ToString() + "\n";
output += "PosGlobal: " + PosGlobal.ToString() + "\n";
output += "TopPick: " + TopPick.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += Helpers.FieldToString(User, "User") + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "PickID: " + PickID.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "SortOrder: " + SortOrder.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 229;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PickInfoUpdatePacket : Packet
{
/// <exclude/>
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;
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);
if(PosGlobal == null) { Console.WriteLine("Warning: PosGlobal is null, in " + this.GetType()); }
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 --\n";
output += "Enabled: " + Enabled.ToString() + "\n";
output += "PosGlobal: " + PosGlobal.ToString() + "\n";
output += "TopPick: " + TopPick.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "PickID: " + PickID.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "SortOrder: " + SortOrder.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 230;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PickDeletePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID PickID;
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 --\n";
output += "PickID: " + PickID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 231;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PickGodDeletePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID QueryID;
public LLUUID PickID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "PickID: " + PickID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 232;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptQuestionPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(ObjectName, "ObjectName") + "\n";
output += Helpers.FieldToString(ObjectOwner, "ObjectOwner") + "\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "Questions: " + Questions.ToString() + "\n";
output = 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 = 233;
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 ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptControlChangePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public bool PassToAgent;
public uint Controls;
public bool TakeControls;
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 --\n";
output += "PassToAgent: " + PassToAgent.ToString() + "\n";
output += "Controls: " + Controls.ToString() + "\n";
output += "TakeControls: " + TakeControls.ToString() + "\n";
output = 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 = 234;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ScriptDialogPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(ObjectName, "ObjectName") + "\n";
output += "ImageID: " + ImageID.ToString() + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += Helpers.FieldToString(LastName, "LastName") + "\n";
output += Helpers.FieldToString(FirstName, "FirstName") + "\n";
output += "ChatChannel: " + ChatChannel.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(ButtonLabel, "ButtonLabel") + "\n";
output = 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 = 235;
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 ---\n";
output += Data.ToString() + "\n";
for (int j = 0; j < Buttons.Length; j++)
{
output += Buttons[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ScriptDialogReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(ButtonLabel, "ButtonLabel") + "\n";
output += "ButtonIndex: " + ButtonIndex.ToString() + "\n";
output += "ChatChannel: " + ChatChannel.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 236;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ForceScriptControlReleasePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 237;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RevokePermissionsPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public uint ObjectPermissions;
public LLUUID ObjectID;
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 --\n";
output += "ObjectPermissions: " + ObjectPermissions.ToString() + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 238;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LoadURLPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(URL, "URL") + "\n";
output += Helpers.FieldToString(ObjectName, "ObjectName") + "\n";
output += "OwnerIsGroup: " + OwnerIsGroup.ToString() + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output = 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 = 239;
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 ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptTeleportRequestPacket : Packet
{
/// <exclude/>
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;
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;
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
if(SimPosition == null) { Console.WriteLine("Warning: SimPosition is null, in " + this.GetType()); }
Array.Copy(SimPosition.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Data --\n";
output += Helpers.FieldToString(ObjectName, "ObjectName") + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "SimPosition: " + SimPosition.ToString() + "\n";
output = 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 = 240;
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 ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelOverlayPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output += "SequenceID: " + SequenceID.ToString() + "\n";
output = 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 = 241;
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 ---\n";
output += ParcelData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelPropertiesRequestByIDPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public int SequenceID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "SequenceID: " + SequenceID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 242;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelPropertiesUpdatePacket : Packet
{
/// <exclude/>
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); }
}
}
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;
if(UserLookAt == null) { Console.WriteLine("Warning: UserLookAt is null, in " + this.GetType()); }
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);
if(UserLocation == null) { Console.WriteLine("Warning: UserLocation is null, in " + this.GetType()); }
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 --\n";
output += "MediaID: " + MediaID.ToString() + "\n";
output += "UserLookAt: " + UserLookAt.ToString() + "\n";
output += Helpers.FieldToString(MediaURL, "MediaURL") + "\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "UserLocation: " + UserLocation.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "LandingType: " + LandingType.ToString() + "\n";
output += "AuthBuyerID: " + AuthBuyerID.ToString() + "\n";
output += "PassHours: " + PassHours.ToString() + "\n";
output += "ParcelFlags: " + ParcelFlags.ToString() + "\n";
output += "PassPrice: " + PassPrice.ToString() + "\n";
output += "MediaAutoScale: " + MediaAutoScale.ToString() + "\n";
output += Helpers.FieldToString(MusicURL, "MusicURL") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 243;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelReturnObjectsPacket : Packet
{
/// <exclude/>
public class TaskIDsBlock
{
public LLUUID TaskID;
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 --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public uint ReturnType;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "ReturnType: " + ReturnType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class OwnerIDsBlock
{
public LLUUID OwnerID;
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 --\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output = 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 = 244;
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 ---\n";
for (int j = 0; j < TaskIDs.Length; j++)
{
output += TaskIDs[j].ToString() + "\n";
}
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < OwnerIDs.Length; j++)
{
output += OwnerIDs[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ParcelSetOtherCleanTimePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public int OtherCleanTime;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "OtherCleanTime: " + OtherCleanTime.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 245;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelDisableObjectsPacket : Packet
{
/// <exclude/>
public class TaskIDsBlock
{
public LLUUID TaskID;
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 --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public uint ReturnType;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "ReturnType: " + ReturnType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class OwnerIDsBlock
{
public LLUUID OwnerID;
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 --\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output = 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 = 246;
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 ---\n";
for (int j = 0; j < TaskIDs.Length; j++)
{
output += TaskIDs[j].ToString() + "\n";
}
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < OwnerIDs.Length; j++)
{
output += OwnerIDs[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ParcelSelectObjectsPacket : Packet
{
/// <exclude/>
public class ReturnIDsBlock
{
public LLUUID ReturnID;
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 --\n";
output += "ReturnID: " + ReturnID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public uint ReturnType;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "ReturnType: " + ReturnType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 247;
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 ---\n";
for (int j = 0; j < ReturnIDs.Length; j++)
{
output += ReturnIDs[j].ToString() + "\n";
}
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EstateCovenantRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 248;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EstateCovenantReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "CovenantID: " + CovenantID.ToString() + "\n";
output += "CovenantTimestamp: " + CovenantTimestamp.ToString() + "\n";
output += Helpers.FieldToString(EstateName, "EstateName") + "\n";
output += "EstateOwnerID: " + EstateOwnerID.ToString() + "\n";
output = 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 = 249;
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 ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ForceObjectSelectPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public uint LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class HeaderBlock
{
public bool ResetList;
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 --\n";
output += "ResetList: " + ResetList.ToString() + "\n";
output = 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 = 250;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += _Header.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelBuyPassPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 251;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelDeedToGroupPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
public LLUUID GroupID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 252;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelReclaimPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 253;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelClaimPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public bool IsGroupOwned;
public LLUUID GroupID;
public bool Final;
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 --\n";
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "Final: " + Final.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ParcelDataBlock
{
public float East;
public float West;
public float North;
public float South;
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 --\n";
output += "East: " + East.ToString() + "\n";
output += "West: " + West.ToString() + "\n";
output += "North: " + North.ToString() + "\n";
output += "South: " + South.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 254;
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 ---\n";
output += Data.ToString() + "\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelJoinPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public float East;
public float West;
public float North;
public float South;
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 --\n";
output += "East: " + East.ToString() + "\n";
output += "West: " + West.ToString() + "\n";
output += "North: " + North.ToString() + "\n";
output += "South: " + South.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 255;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelDividePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public float East;
public float West;
public float North;
public float South;
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 --\n";
output += "East: " + East.ToString() + "\n";
output += "West: " + West.ToString() + "\n";
output += "North: " + North.ToString() + "\n";
output += "South: " + South.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 256;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelReleasePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 257;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelBuyPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public bool RemoveContribution;
public int LocalID;
public bool IsGroupOwned;
public LLUUID GroupID;
public bool Final;
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 --\n";
output += "RemoveContribution: " + RemoveContribution.ToString() + "\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "Final: " + Final.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 258;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelGodForceOwnerPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
public LLUUID OwnerID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 259;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelAccessListRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
public int SequenceID;
public uint Flags;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "SequenceID: " + SequenceID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 260;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelAccessListReplyPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID AgentID;
public int LocalID;
public int SequenceID;
public uint Flags;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "SequenceID: " + SequenceID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ListBlock
{
public LLUUID ID;
public int Time;
public uint Flags;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 = 261;
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 ---\n";
output += Data.ToString() + "\n";
for (int j = 0; j < List.Length; j++)
{
output += List[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ParcelAccessListUpdatePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
public int Sections;
public int SequenceID;
public uint Flags;
public LLUUID TransactionID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "Sections: " + Sections.ToString() + "\n";
output += "SequenceID: " + SequenceID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ListBlock
{
public LLUUID ID;
public int Time;
public uint Flags;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 262;
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 ---\n";
output += Data.ToString() + "\n";
for (int j = 0; j < List.Length; j++)
{
output += List[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelDwellRequestPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
public LLUUID ParcelID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 263;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelDwellReplyPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int LocalID;
public LLUUID ParcelID;
public float Dwell;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "Dwell: " + Dwell.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 264;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestParcelTransferPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public bool ReservedNewbie;
public int BillableArea;
public int ActualArea;
public LLUUID OwnerID;
public LLUUID DestID;
public int Amount;
public byte Flags;
public bool Final;
public LLUUID SourceID;
public LLUUID TransactionID;
public uint TransactionTime;
public int TransactionType;
public int Length
{
get
{
return 87;
}
}
public DataBlock() { }
public DataBlock(byte[] bytes, ref int i)
{
try
{
ReservedNewbie = (bytes[i++] != 0) ? (bool)true : (bool)false;
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));
OwnerID = new LLUUID(bytes, i); i += 16;
DestID = new LLUUID(bytes, i); i += 16;
Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Flags = (byte)bytes[i++];
Final = (bytes[i++] != 0) ? (bool)true : (bool)false;
SourceID = new LLUUID(bytes, i); i += 16;
TransactionID = new LLUUID(bytes, i); i += 16;
TransactionTime = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
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++] = (byte)((ReservedNewbie) ? 1 : 0);
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);
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
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);
bytes[i++] = Flags;
bytes[i++] = (byte)((Final) ? 1 : 0);
if(SourceID == null) { Console.WriteLine("Warning: SourceID is null, in " + this.GetType()); }
Array.Copy(SourceID.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;
bytes[i++] = (byte)(TransactionTime % 256);
bytes[i++] = (byte)((TransactionTime >> 8) % 256);
bytes[i++] = (byte)((TransactionTime >> 16) % 256);
bytes[i++] = (byte)((TransactionTime >> 24) % 256);
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 = "-- Data --\n";
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "\n";
output += "BillableArea: " + BillableArea.ToString() + "\n";
output += "ActualArea: " + ActualArea.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "Final: " + Final.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "TransactionTime: " + TransactionTime.ToString() + "\n";
output += "TransactionType: " + TransactionType.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RequestParcelTransfer; } }
public DataBlock Data;
public RequestParcelTransferPacket()
{
Header = new LowHeader();
Header.ID = 265;
Header.Reliable = true;
Header.Zerocoded = true;
Data = new DataBlock();
}
public RequestParcelTransferPacket(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 RequestParcelTransferPacket(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 = "--- RequestParcelTransfer ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateParcelPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public bool ReservedNewbie;
public bool GroupOwned;
public float RegionX;
public float RegionY;
public bool AllowPublish;
public int BillableArea;
public bool ShowDir;
public int ActualArea;
public LLUUID ParcelID;
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); }
}
}
public ulong RegionHandle;
public byte Category;
public LLUUID AuthorizedBuyerID;
public int SalePrice;
public LLUUID OwnerID;
public bool IsForSale;
public byte Status;
public LLUUID SnapshotID;
public bool MaturePublish;
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[] _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 int Length
{
get
{
int length = 112;
if (Name != null) { length += 1 + Name.Length; }
if (Description != null) { length += 1 + Description.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;
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
RegionX = BitConverter.ToSingle(bytes, i); i += 4;
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
RegionY = BitConverter.ToSingle(bytes, i); i += 4;
AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
BillableArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ShowDir = (bytes[i++] != 0) ? (bool)true : (bool)false;
ActualArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ParcelID = new LLUUID(bytes, i); i += 16;
UserLocation = new LLVector3(bytes, i); i += 12;
length = (ushort)bytes[i++];
_name = new byte[length];
Array.Copy(bytes, i, _name, 0, length); i += length;
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));
Category = (byte)bytes[i++];
AuthorizedBuyerID = 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;
IsForSale = (bytes[i++] != 0) ? (bool)true : (bool)false;
Status = (byte)bytes[i++];
SnapshotID = new LLUUID(bytes, i); i += 16;
MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false;
length = (ushort)bytes[i++];
_description = new byte[length];
Array.Copy(bytes, i, _description, 0, length); i += length;
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;
bytes[i++] = (byte)((ReservedNewbie) ? 1 : 0);
bytes[i++] = (byte)((GroupOwned) ? 1 : 0);
ba = BitConverter.GetBytes(RegionX);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
ba = BitConverter.GetBytes(RegionY);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
bytes[i++] = (byte)((AllowPublish) ? 1 : 0);
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)((ShowDir) ? 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);
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
if(UserLocation == null) { Console.WriteLine("Warning: UserLocation is null, in " + this.GetType()); }
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;
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++] = Category;
if(AuthorizedBuyerID == null) { Console.WriteLine("Warning: AuthorizedBuyerID is null, in " + this.GetType()); }
Array.Copy(AuthorizedBuyerID.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)((IsForSale) ? 1 : 0);
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)((MaturePublish) ? 1 : 0);
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(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 --\n";
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "RegionX: " + RegionX.ToString() + "\n";
output += "RegionY: " + RegionY.ToString() + "\n";
output += "AllowPublish: " + AllowPublish.ToString() + "\n";
output += "BillableArea: " + BillableArea.ToString() + "\n";
output += "ShowDir: " + ShowDir.ToString() + "\n";
output += "ActualArea: " + ActualArea.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "UserLocation: " + UserLocation.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "AuthorizedBuyerID: " + AuthorizedBuyerID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "IsForSale: " + IsForSale.ToString() + "\n";
output += "Status: " + Status.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "MaturePublish: " + MaturePublish.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += Helpers.FieldToString(MusicURL, "MusicURL") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UpdateParcel; } }
public ParcelDataBlock ParcelData;
public UpdateParcelPacket()
{
Header = new LowHeader();
Header.ID = 266;
Header.Reliable = true;
Header.Zerocoded = true;
ParcelData = new ParcelDataBlock();
}
public UpdateParcelPacket(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 UpdateParcelPacket(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 = "--- UpdateParcel ---\n";
output += ParcelData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveParcelPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public LLUUID ParcelID;
public int Length
{
get
{
return 16;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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 = "-- ParcelData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RemoveParcel; } }
public ParcelDataBlock[] ParcelData;
public RemoveParcelPacket()
{
Header = new LowHeader();
Header.ID = 267;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public RemoveParcelPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public RemoveParcelPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RemoveParcel ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class MergeParcelPacket : Packet
{
/// <exclude/>
public class MasterParcelDataBlock
{
public LLUUID MasterID;
public int Length
{
get
{
return 16;
}
}
public MasterParcelDataBlock() { }
public MasterParcelDataBlock(byte[] bytes, ref int i)
{
try
{
MasterID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(MasterID == null) { Console.WriteLine("Warning: MasterID is null, in " + this.GetType()); }
Array.Copy(MasterID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- MasterParcelData --\n";
output += "MasterID: " + MasterID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SlaveParcelDataBlock
{
public LLUUID SlaveID;
public int Length
{
get
{
return 16;
}
}
public SlaveParcelDataBlock() { }
public SlaveParcelDataBlock(byte[] bytes, ref int i)
{
try
{
SlaveID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(SlaveID == null) { Console.WriteLine("Warning: SlaveID is null, in " + this.GetType()); }
Array.Copy(SlaveID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- SlaveParcelData --\n";
output += "SlaveID: " + SlaveID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.MergeParcel; } }
public MasterParcelDataBlock MasterParcelData;
public SlaveParcelDataBlock[] SlaveParcelData;
public MergeParcelPacket()
{
Header = new LowHeader();
Header.ID = 268;
Header.Reliable = true;
MasterParcelData = new MasterParcelDataBlock();
SlaveParcelData = new SlaveParcelDataBlock[0];
}
public MergeParcelPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
MasterParcelData = new MasterParcelDataBlock(bytes, ref i);
int count = (int)bytes[i++];
SlaveParcelData = new SlaveParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ SlaveParcelData[j] = new SlaveParcelDataBlock(bytes, ref i); }
}
public MergeParcelPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
MasterParcelData = new MasterParcelDataBlock(bytes, ref i);
int count = (int)bytes[i++];
SlaveParcelData = new SlaveParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ SlaveParcelData[j] = new SlaveParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
length += MasterParcelData.Length;;
length++;
for (int j = 0; j < SlaveParcelData.Length; j++) { length += SlaveParcelData[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);
MasterParcelData.ToBytes(bytes, ref i);
bytes[i++] = (byte)SlaveParcelData.Length;
for (int j = 0; j < SlaveParcelData.Length; j++) { SlaveParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- MergeParcel ---\n";
output += MasterParcelData.ToString() + "\n";
for (int j = 0; j < SlaveParcelData.Length; j++)
{
output += SlaveParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class LogParcelChangesPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int ActualArea;
public LLUUID ParcelID;
public bool IsOwnerGroup;
public LLUUID OwnerID;
public sbyte Action;
public LLUUID TransactionID;
public int Length
{
get
{
return 54;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(byte[] bytes, ref int i)
{
try
{
ActualArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ParcelID = new LLUUID(bytes, i); i += 16;
IsOwnerGroup = (bytes[i++] != 0) ? (bool)true : (bool)false;
OwnerID = new LLUUID(bytes, i); i += 16;
Action = (sbyte)bytes[i++];
TransactionID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)(ActualArea % 256);
bytes[i++] = (byte)((ActualArea >> 8) % 256);
bytes[i++] = (byte)((ActualArea >> 16) % 256);
bytes[i++] = (byte)((ActualArea >> 24) % 256);
if(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = (byte)((IsOwnerGroup) ? 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)Action;
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 = "-- ParcelData --\n";
output += "ActualArea: " + ActualArea.ToString() + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "IsOwnerGroup: " + IsOwnerGroup.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "Action: " + Action.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionDataBlock
{
public ulong RegionHandle;
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 --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.LogParcelChanges; } }
public ParcelDataBlock[] ParcelData;
public RegionDataBlock RegionData;
public AgentDataBlock AgentData;
public LogParcelChangesPacket()
{
Header = new LowHeader();
Header.ID = 269;
Header.Reliable = true;
Header.Zerocoded = true;
ParcelData = new ParcelDataBlock[0];
RegionData = new RegionDataBlock();
AgentData = new AgentDataBlock();
}
public LogParcelChangesPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
RegionData = new RegionDataBlock(bytes, ref i);
AgentData = new AgentDataBlock(bytes, ref i);
}
public LogParcelChangesPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
RegionData = new RegionDataBlock(bytes, ref i);
AgentData = new AgentDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += RegionData.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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].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 = "--- LogParcelChanges ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
output += RegionData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CheckParcelSalesPacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public ulong RegionHandle;
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 --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.CheckParcelSales; } }
public RegionDataBlock[] RegionData;
public CheckParcelSalesPacket()
{
Header = new LowHeader();
Header.ID = 270;
Header.Reliable = true;
RegionData = new RegionDataBlock[0];
}
public CheckParcelSalesPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public CheckParcelSalesPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < RegionData.Length; j++) { length += RegionData[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)RegionData.Length;
for (int j = 0; j < RegionData.Length; j++) { RegionData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- CheckParcelSales ---\n";
for (int j = 0; j < RegionData.Length; j++)
{
output += RegionData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ParcelSalesPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public LLUUID ParcelID;
public LLUUID BuyerID;
public int Length
{
get
{
return 32;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(byte[] bytes, ref int i)
{
try
{
ParcelID = new LLUUID(bytes, i); i += 16;
BuyerID = 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;
if(BuyerID == null) { Console.WriteLine("Warning: BuyerID is null, in " + this.GetType()); }
Array.Copy(BuyerID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- ParcelData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "BuyerID: " + BuyerID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ParcelSales; } }
public ParcelDataBlock[] ParcelData;
public ParcelSalesPacket()
{
Header = new LowHeader();
Header.ID = 271;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public ParcelSalesPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public ParcelSalesPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- ParcelSales ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ParcelGodMarkAsContentPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 272;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelGodReserveForNewbiePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public LLUUID SnapshotID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 273;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ViewerStartAuctionPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public int LocalID;
public LLUUID SnapshotID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 274;
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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class StartAuctionPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
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 LLUUID SnapshotID;
public int Length
{
get
{
int length = 32;
if (Name != null) { length += 1 + Name.Length; }
return length;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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;
SnapshotID = 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;
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(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 --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.StartAuction; } }
public ParcelDataBlock ParcelData;
public AgentDataBlock AgentData;
public StartAuctionPacket()
{
Header = new LowHeader();
Header.ID = 275;
Header.Reliable = true;
ParcelData = new ParcelDataBlock();
AgentData = new AgentDataBlock();
}
public StartAuctionPacket(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 StartAuctionPacket(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 = "--- StartAuction ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ConfirmAuctionStartPacket : Packet
{
/// <exclude/>
public class AuctionDataBlock
{
public LLUUID ParcelID;
public uint AuctionID;
public int Length
{
get
{
return 20;
}
}
public AuctionDataBlock() { }
public AuctionDataBlock(byte[] bytes, ref int i)
{
try
{
ParcelID = new LLUUID(bytes, i); i += 16;
AuctionID = (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(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
Array.Copy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = (byte)(AuctionID % 256);
bytes[i++] = (byte)((AuctionID >> 8) % 256);
bytes[i++] = (byte)((AuctionID >> 16) % 256);
bytes[i++] = (byte)((AuctionID >> 24) % 256);
}
public override string ToString()
{
string output = "-- AuctionData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "AuctionID: " + AuctionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ConfirmAuctionStart; } }
public AuctionDataBlock AuctionData;
public ConfirmAuctionStartPacket()
{
Header = new LowHeader();
Header.ID = 276;
Header.Reliable = true;
AuctionData = new AuctionDataBlock();
}
public ConfirmAuctionStartPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
AuctionData = new AuctionDataBlock(bytes, ref i);
}
public ConfirmAuctionStartPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
AuctionData = new AuctionDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += AuctionData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
AuctionData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- ConfirmAuctionStart ---\n";
output += AuctionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CompleteAuctionPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public LLUUID ParcelID;
public int Length
{
get
{
return 16;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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 = "-- ParcelData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.CompleteAuction; } }
public ParcelDataBlock[] ParcelData;
public CompleteAuctionPacket()
{
Header = new LowHeader();
Header.ID = 277;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public CompleteAuctionPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public CompleteAuctionPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- CompleteAuction ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class CancelAuctionPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public LLUUID ParcelID;
public int Length
{
get
{
return 16;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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 = "-- ParcelData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.CancelAuction; } }
public ParcelDataBlock[] ParcelData;
public CancelAuctionPacket()
{
Header = new LowHeader();
Header.ID = 278;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public CancelAuctionPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public CancelAuctionPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- CancelAuction ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class CheckParcelAuctionsPacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public ulong RegionHandle;
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 --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.CheckParcelAuctions; } }
public RegionDataBlock[] RegionData;
public CheckParcelAuctionsPacket()
{
Header = new LowHeader();
Header.ID = 279;
Header.Reliable = true;
RegionData = new RegionDataBlock[0];
}
public CheckParcelAuctionsPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public CheckParcelAuctionsPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
RegionData = new RegionDataBlock[count];
for (int j = 0; j < count; j++)
{ RegionData[j] = new RegionDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < RegionData.Length; j++) { length += RegionData[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)RegionData.Length;
for (int j = 0; j < RegionData.Length; j++) { RegionData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- CheckParcelAuctions ---\n";
for (int j = 0; j < RegionData.Length; j++)
{
output += RegionData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ParcelAuctionsPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public LLUUID ParcelID;
public LLUUID WinnerID;
public int Length
{
get
{
return 32;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(byte[] bytes, ref int i)
{
try
{
ParcelID = new LLUUID(bytes, i); i += 16;
WinnerID = 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;
if(WinnerID == null) { Console.WriteLine("Warning: WinnerID is null, in " + this.GetType()); }
Array.Copy(WinnerID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- ParcelData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "WinnerID: " + WinnerID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ParcelAuctions; } }
public ParcelDataBlock[] ParcelData;
public ParcelAuctionsPacket()
{
Header = new LowHeader();
Header.ID = 280;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public ParcelAuctionsPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public ParcelAuctionsPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- ParcelAuctions ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class UUIDNameRequestPacket : Packet
{
/// <exclude/>
public class UUIDNameBlockBlock
{
public LLUUID ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = 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 = 281;
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 ---\n";
for (int j = 0; j < UUIDNameBlock.Length; j++)
{
output += UUIDNameBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class UUIDNameReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += Helpers.FieldToString(LastName, "LastName") + "\n";
output += Helpers.FieldToString(FirstName, "FirstName") + "\n";
output = 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 = 282;
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 ---\n";
for (int j = 0; j < UUIDNameBlock.Length; j++)
{
output += UUIDNameBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class UUIDGroupNameRequestPacket : Packet
{
/// <exclude/>
public class UUIDNameBlockBlock
{
public LLUUID ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = 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 = 283;
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 ---\n";
for (int j = 0; j < UUIDNameBlock.Length; j++)
{
output += UUIDNameBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class UUIDGroupNameReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += Helpers.FieldToString(GroupName, "GroupName") + "\n";
output = 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 = 284;
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 ---\n";
for (int j = 0; j < UUIDNameBlock.Length; j++)
{
output += UUIDNameBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ChatPassPacket : Packet
{
/// <exclude/>
public class ChatDataBlock
{
public LLUUID ID;
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); }
}
}
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 Type;
public LLUUID OwnerID;
public byte SimAccess;
public float Radius;
public byte SourceType;
public LLVector3 Position;
public int Length
{
get
{
int length = 55;
if (Message != null) { length += 2 + Message.Length; }
if (Name != null) { length += 1 + Name.Length; }
return length;
}
}
public ChatDataBlock() { }
public ChatDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
ID = new LLUUID(bytes, i); i += 16;
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;
length = (ushort)bytes[i++];
_name = new byte[length];
Array.Copy(bytes, i, _name, 0, length); i += length;
Type = (byte)bytes[i++];
OwnerID = new LLUUID(bytes, i); i += 16;
SimAccess = (byte)bytes[i++];
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
Radius = BitConverter.ToSingle(bytes, i); i += 4;
SourceType = (byte)bytes[i++];
Position = new LLVector3(bytes, i); i += 12;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
byte[] ba;
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)(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;
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++] = Type;
if(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = SimAccess;
ba = BitConverter.GetBytes(Radius);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
bytes[i++] = SourceType;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ChatData --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Channel: " + Channel.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "Radius: " + Radius.ToString() + "\n";
output += "SourceType: " + SourceType.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ChatPass; } }
public ChatDataBlock ChatData;
public ChatPassPacket()
{
Header = new LowHeader();
Header.ID = 285;
Header.Reliable = true;
Header.Zerocoded = true;
ChatData = new ChatDataBlock();
}
public ChatPassPacket(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 ChatPassPacket(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 = "--- ChatPass ---\n";
output += ChatData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ChildAgentDyingPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 286;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ChildAgentUnknownPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 287;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class KillChildAgentsPacket : Packet
{
/// <exclude/>
public class IDBlockBlock
{
public LLUUID AgentID;
public int Length
{
get
{
return 16;
}
}
public IDBlockBlock() { }
public IDBlockBlock(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 = "-- IDBlock --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.KillChildAgents; } }
public IDBlockBlock IDBlock;
public KillChildAgentsPacket()
{
Header = new LowHeader();
Header.ID = 288;
Header.Reliable = true;
IDBlock = new IDBlockBlock();
}
public KillChildAgentsPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
IDBlock = new IDBlockBlock(bytes, ref i);
}
public KillChildAgentsPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
IDBlock = new IDBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += IDBlock.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
IDBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- KillChildAgents ---\n";
output += IDBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GetScriptRunningPacket : Packet
{
/// <exclude/>
public class ScriptBlock
{
public LLUUID ObjectID;
public LLUUID ItemID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = 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 = 289;
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 ---\n";
output += Script.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptRunningReplyPacket : Packet
{
/// <exclude/>
public class ScriptBlock
{
public LLUUID ObjectID;
public bool Running;
public LLUUID ItemID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Running: " + Running.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = 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 = 290;
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 ---\n";
output += Script.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetScriptRunningPacket : Packet
{
/// <exclude/>
public class ScriptBlock
{
public LLUUID ObjectID;
public bool Running;
public LLUUID ItemID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Running: " + Running.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 291;
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 ---\n";
output += Script.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptResetPacket : Packet
{
/// <exclude/>
public class ScriptBlock
{
public LLUUID ObjectID;
public LLUUID ItemID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 292;
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 ---\n";
output += Script.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptSensorRequestPacket : Packet
{
/// <exclude/>
public class RequesterBlock
{
public float Arc;
public LLUUID RequestID;
public LLUUID SearchID;
private byte[] _searchname;
public byte[] SearchName
{
get { return _searchname; }
set
{
if (value == null) { _searchname = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _searchname = new byte[value.Length]; Array.Copy(value, _searchname, value.Length); }
}
}
public int Type;
public ulong RegionHandle;
public LLQuaternion SearchDir;
public byte SearchRegions;
public LLVector3 SearchPos;
public float Range;
public LLUUID SourceID;
public int Length
{
get
{
int length = 93;
if (SearchName != null) { length += 1 + SearchName.Length; }
return length;
}
}
public RequesterBlock() { }
public RequesterBlock(byte[] bytes, ref int i)
{
int length;
try
{
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
Arc = BitConverter.ToSingle(bytes, i); i += 4;
RequestID = new LLUUID(bytes, i); i += 16;
SearchID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_searchname = new byte[length];
Array.Copy(bytes, i, _searchname, 0, length); i += length;
Type = (int)(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));
SearchDir = new LLQuaternion(bytes, i, true); i += 12;
SearchRegions = (byte)bytes[i++];
SearchPos = new LLVector3(bytes, i); i += 12;
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
Range = BitConverter.ToSingle(bytes, i); i += 4;
SourceID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
byte[] ba;
ba = BitConverter.GetBytes(Arc);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
if(RequestID == null) { Console.WriteLine("Warning: RequestID is null, in " + this.GetType()); }
Array.Copy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16;
if(SearchID == null) { Console.WriteLine("Warning: SearchID is null, in " + this.GetType()); }
Array.Copy(SearchID.GetBytes(), 0, bytes, i, 16); i += 16;
if(SearchName == null) { Console.WriteLine("Warning: SearchName is null, in " + this.GetType()); }
bytes[i++] = (byte)SearchName.Length;
Array.Copy(SearchName, 0, bytes, i, SearchName.Length); i += SearchName.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)(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);
if(SearchDir == null) { Console.WriteLine("Warning: SearchDir is null, in " + this.GetType()); }
Array.Copy(SearchDir.GetBytes(), 0, bytes, i, 12); i += 12;
bytes[i++] = SearchRegions;
if(SearchPos == null) { Console.WriteLine("Warning: SearchPos is null, in " + this.GetType()); }
Array.Copy(SearchPos.GetBytes(), 0, bytes, i, 12); i += 12;
ba = BitConverter.GetBytes(Range);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
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 = "-- Requester --\n";
output += "Arc: " + Arc.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "SearchID: " + SearchID.ToString() + "\n";
output += Helpers.FieldToString(SearchName, "SearchName") + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "SearchDir: " + SearchDir.ToString() + "\n";
output += "SearchRegions: " + SearchRegions.ToString() + "\n";
output += "SearchPos: " + SearchPos.ToString() + "\n";
output += "Range: " + Range.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ScriptSensorRequest; } }
public RequesterBlock Requester;
public ScriptSensorRequestPacket()
{
Header = new LowHeader();
Header.ID = 293;
Header.Reliable = true;
Header.Zerocoded = true;
Requester = new RequesterBlock();
}
public ScriptSensorRequestPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
Requester = new RequesterBlock(bytes, ref i);
}
public ScriptSensorRequestPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
Requester = new RequesterBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += Requester.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
Requester.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- ScriptSensorRequest ---\n";
output += Requester.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptSensorReplyPacket : Packet
{
/// <exclude/>
public class SensedDataBlock
{
public LLUUID ObjectID;
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 Type;
public LLUUID GroupID;
public LLUUID OwnerID;
public LLVector3 Velocity;
public float Range;
public LLQuaternion Rotation;
public LLVector3 Position;
public int Length
{
get
{
int length = 92;
if (Name != null) { length += 1 + Name.Length; }
return length;
}
}
public SensedDataBlock() { }
public SensedDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
ObjectID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_name = new byte[length];
Array.Copy(bytes, i, _name, 0, length); i += length;
Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GroupID = new LLUUID(bytes, i); i += 16;
OwnerID = new LLUUID(bytes, i); i += 16;
Velocity = new LLVector3(bytes, i); i += 12;
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
Range = BitConverter.ToSingle(bytes, i); i += 4;
Rotation = new LLQuaternion(bytes, i, true); i += 12;
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;
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)(Type % 256);
bytes[i++] = (byte)((Type >> 8) % 256);
bytes[i++] = (byte)((Type >> 16) % 256);
bytes[i++] = (byte)((Type >> 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(OwnerID == null) { Console.WriteLine("Warning: OwnerID is null, in " + this.GetType()); }
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
if(Velocity == null) { Console.WriteLine("Warning: Velocity is null, in " + this.GetType()); }
Array.Copy(Velocity.GetBytes(), 0, bytes, i, 12); i += 12;
ba = BitConverter.GetBytes(Range);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
if(Rotation == null) { Console.WriteLine("Warning: Rotation is null, in " + this.GetType()); }
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- SensedData --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "Velocity: " + Velocity.ToString() + "\n";
output += "Range: " + Range.ToString() + "\n";
output += "Rotation: " + Rotation.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RequesterBlock
{
public LLUUID SourceID;
public int Length
{
get
{
return 16;
}
}
public RequesterBlock() { }
public RequesterBlock(byte[] bytes, ref int i)
{
try
{
SourceID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
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 = "-- Requester --\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ScriptSensorReply; } }
public SensedDataBlock[] SensedData;
public RequesterBlock Requester;
public ScriptSensorReplyPacket()
{
Header = new LowHeader();
Header.ID = 294;
Header.Reliable = true;
Header.Zerocoded = true;
SensedData = new SensedDataBlock[0];
Requester = new RequesterBlock();
}
public ScriptSensorReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
SensedData = new SensedDataBlock[count];
for (int j = 0; j < count; j++)
{ SensedData[j] = new SensedDataBlock(bytes, ref i); }
Requester = new RequesterBlock(bytes, ref i);
}
public ScriptSensorReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
SensedData = new SensedDataBlock[count];
for (int j = 0; j < count; j++)
{ SensedData[j] = new SensedDataBlock(bytes, ref i); }
Requester = new RequesterBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += Requester.Length;;
length++;
for (int j = 0; j < SensedData.Length; j++) { length += SensedData[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)SensedData.Length;
for (int j = 0; j < SensedData.Length; j++) { SensedData[j].ToBytes(bytes, ref i); }
Requester.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- ScriptSensorReply ---\n";
for (int j = 0; j < SensedData.Length; j++)
{
output += SensedData[j].ToString() + "\n";
}
output += Requester.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CompleteAgentMovementPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint CircuitCode;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output = 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 = 295;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentMovementCompletePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public uint Timestamp;
public ulong RegionHandle;
public LLVector3 LookAt;
public LLVector3 Position;
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);
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Data --\n";
output += "Timestamp: " + Timestamp.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 296;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogLoginPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID ViewerDigest;
public uint SpaceIP;
public bool LastExecFroze;
public int Length
{
get
{
return 21;
}
}
public DataBlock() { }
public DataBlock(byte[] bytes, ref int i)
{
try
{
ViewerDigest = new LLUUID(bytes, i); i += 16;
SpaceIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
LastExecFroze = (bytes[i++] != 0) ? (bool)true : (bool)false;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(ViewerDigest == null) { Console.WriteLine("Warning: ViewerDigest is null, in " + this.GetType()); }
Array.Copy(ViewerDigest.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = (byte)(SpaceIP % 256);
bytes[i++] = (byte)((SpaceIP >> 8) % 256);
bytes[i++] = (byte)((SpaceIP >> 16) % 256);
bytes[i++] = (byte)((SpaceIP >> 24) % 256);
bytes[i++] = (byte)((LastExecFroze) ? 1 : 0);
}
public override string ToString()
{
string output = "-- Data --\n";
output += "ViewerDigest: " + ViewerDigest.ToString() + "\n";
output += "SpaceIP: " + SpaceIP.ToString() + "\n";
output += "LastExecFroze: " + LastExecFroze.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.LogLogin; } }
public DataBlock Data;
public AgentDataBlock AgentData;
public LogLoginPacket()
{
Header = new LowHeader();
Header.ID = 297;
Header.Reliable = true;
Data = new DataBlock();
AgentData = new AgentDataBlock();
}
public LogLoginPacket(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 LogLoginPacket(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 = "--- LogLogin ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ConnectAgentToUserserverPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 298;
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 ---\n";
output += AgentData.ToString() + "\n";
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 = 299;
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 ---\n";
return output;
}
}
/// <exclude/>
public class DataServerLogoutPacket : Packet
{
/// <exclude/>
public class UserDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint ViewerIP;
public bool Disconnect;
public int Length
{
get
{
return 37;
}
}
public UserDataBlock() { }
public UserDataBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
SessionID = new LLUUID(bytes, i); i += 16;
ViewerIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Disconnect = (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)(ViewerIP % 256);
bytes[i++] = (byte)((ViewerIP >> 8) % 256);
bytes[i++] = (byte)((ViewerIP >> 16) % 256);
bytes[i++] = (byte)((ViewerIP >> 24) % 256);
bytes[i++] = (byte)((Disconnect) ? 1 : 0);
}
public override string ToString()
{
string output = "-- UserData --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "ViewerIP: " + ViewerIP.ToString() + "\n";
output += "Disconnect: " + Disconnect.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.DataServerLogout; } }
public UserDataBlock UserData;
public DataServerLogoutPacket()
{
Header = new LowHeader();
Header.ID = 300;
Header.Reliable = true;
UserData = new UserDataBlock();
}
public DataServerLogoutPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
UserData = new UserDataBlock(bytes, ref i);
}
public DataServerLogoutPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
UserData = new UserDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += UserData.Length;;
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);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- DataServerLogout ---\n";
output += UserData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogoutRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 301;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class FinalizeLogoutPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 302;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogoutReplyPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID NewAssetID;
public LLUUID ItemID;
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 --\n";
output += "NewAssetID: " + NewAssetID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 303;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogoutDemandPacket : Packet
{
/// <exclude/>
public class LogoutBlockBlock
{
public LLUUID SessionID;
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 --\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 304;
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 ---\n";
output += LogoutBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ImprovedInstantMessagePacket : Packet
{
/// <exclude/>
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;
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;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- MessageBlock --\n";
output += "ID: " + ID.ToString() + "\n";
output += "ToAgentID: " + ToAgentID.ToString() + "\n";
output += "Offline: " + Offline.ToString() + "\n";
output += "Timestamp: " + Timestamp.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "Dialog: " + Dialog.ToString() + "\n";
output += "FromGroup: " + FromGroup.ToString() + "\n";
output += Helpers.FieldToString(BinaryBucket, "BinaryBucket") + "\n";
output += "ParentEstateID: " + ParentEstateID.ToString() + "\n";
output += Helpers.FieldToString(FromAgentName, "FromAgentName") + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 305;
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 ---\n";
output += MessageBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RetrieveInstantMessagesPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 306;
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 ---\n";
output += AgentData.ToString() + "\n";
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 = 307;
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 ---\n";
return output;
}
}
/// <exclude/>
public class FindAgentPacket : Packet
{
/// <exclude/>
public class LocationBlockBlock
{
public double GlobalX;
public double GlobalY;
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 --\n";
output += "GlobalX: " + GlobalX.ToString() + "\n";
output += "GlobalY: " + GlobalY.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentBlockBlock
{
public uint SpaceIP;
public LLUUID Prey;
public LLUUID Hunter;
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 --\n";
output += "SpaceIP: " + SpaceIP.ToString() + "\n";
output += "Prey: " + Prey.ToString() + "\n";
output += "Hunter: " + Hunter.ToString() + "\n";
output = 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 = 308;
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 ---\n";
for (int j = 0; j < LocationBlock.Length; j++)
{
output += LocationBlock[j].ToString() + "\n";
}
output += AgentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestGodlikePowersPacket : Packet
{
/// <exclude/>
public class RequestBlockBlock
{
public bool Godlike;
public LLUUID Token;
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 --\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "Token: " + Token.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 309;
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 ---\n";
output += RequestBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GrantGodlikePowersPacket : Packet
{
/// <exclude/>
public class GrantDataBlock
{
public byte GodLevel;
public LLUUID Token;
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 --\n";
output += "GodLevel: " + GodLevel.ToString() + "\n";
output += "Token: " + Token.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 310;
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 ---\n";
output += GrantData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GodlikeMessagePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "Invoice: " + Invoice.ToString() + "\n";
output += Helpers.FieldToString(Method, "Method") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Parameter, "Parameter") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 311;
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 ---\n";
output += MethodData.ToString() + "\n";
for (int j = 0; j < ParamList.Length; j++)
{
output += ParamList[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EstateOwnerMessagePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "Invoice: " + Invoice.ToString() + "\n";
output += Helpers.FieldToString(Method, "Method") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Parameter, "Parameter") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 312;
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 ---\n";
output += MethodData.ToString() + "\n";
for (int j = 0; j < ParamList.Length; j++)
{
output += ParamList[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GenericMessagePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "Invoice: " + Invoice.ToString() + "\n";
output += Helpers.FieldToString(Method, "Method") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Parameter, "Parameter") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 313;
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 ---\n";
output += MethodData.ToString() + "\n";
for (int j = 0; j < ParamList.Length; j++)
{
output += ParamList[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MuteListRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class MuteDataBlock
{
public uint MuteCRC;
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 --\n";
output += "MuteCRC: " + MuteCRC.ToString() + "\n";
output = 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 = 314;
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 ---\n";
output += AgentData.ToString() + "\n";
output += MuteData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateMuteListEntryPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "MuteID: " + MuteID.ToString() + "\n";
output += "MuteFlags: " + MuteFlags.ToString() + "\n";
output += Helpers.FieldToString(MuteName, "MuteName") + "\n";
output += "MuteType: " + MuteType.ToString() + "\n";
output = 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 = 315;
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 ---\n";
output += AgentData.ToString() + "\n";
output += MuteData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveMuteListEntryPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "MuteID: " + MuteID.ToString() + "\n";
output += Helpers.FieldToString(MuteName, "MuteName") + "\n";
output = 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 = 316;
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 ---\n";
output += AgentData.ToString() + "\n";
output += MuteData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CopyInventoryFromNotecardPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID ItemID;
public LLUUID FolderID;
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 --\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class NotecardDataBlock
{
public LLUUID ObjectID;
public LLUUID NotecardItemID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "NotecardItemID: " + NotecardItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 317;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += NotecardData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateInventoryItemPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "CallbackID: " + CallbackID.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 318;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateCreateInventoryItemPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "CallbackID: " + CallbackID.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public bool SimApproved;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SimApproved: " + SimApproved.ToString() + "\n";
output = 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 = 319;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoveInventoryItemPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(NewName, "NewName") + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Stamp;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Stamp: " + Stamp.ToString() + "\n";
output = 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 = 320;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CopyInventoryItemPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(NewName, "NewName") + "\n";
output += "NewFolderID: " + NewFolderID.ToString() + "\n";
output += "CallbackID: " + CallbackID.ToString() + "\n";
output += "OldItemID: " + OldItemID.ToString() + "\n";
output += "OldAgentID: " + OldAgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 321;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveInventoryItemPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID ItemID;
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 --\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 322;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ChangeInventoryItemFlagsPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID ItemID;
public uint Flags;
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 --\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 323;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SaveAssetIntoInventoryPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID NewAssetID;
public LLUUID ItemID;
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 --\n";
output += "NewAssetID: " + NewAssetID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 324;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CreateInventoryFolderPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 325;
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 ---\n";
output += AgentData.ToString() + "\n";
output += FolderData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateInventoryFolderPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 326;
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 ---\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < FolderData.Length; j++)
{
output += FolderData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class MoveInventoryFolderPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID ParentID;
public LLUUID FolderID;
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 --\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Stamp;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Stamp: " + Stamp.ToString() + "\n";
output = 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 = 327;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveInventoryFolderPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class FolderDataBlock
{
public LLUUID FolderID;
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 --\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 328;
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 ---\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < FolderData.Length; j++)
{
output += FolderData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class FetchInventoryDescendentsPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID OwnerID;
public LLUUID FolderID;
public int SortOrder;
public bool FetchFolders;
public bool FetchItems;
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 --\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "SortOrder: " + SortOrder.ToString() + "\n";
output += "FetchFolders: " + FetchFolders.ToString() + "\n";
output += "FetchItems: " + FetchItems.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 329;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class InventoryDescendentsPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public int Descendents;
public int Version;
public LLUUID OwnerID;
public LLUUID FolderID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "Descendents: " + Descendents.ToString() + "\n";
output += "Version: " + Version.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 330;
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 ---\n";
for (int j = 0; j < ItemData.Length; j++)
{
output += ItemData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
for (int j = 0; j < FolderData.Length; j++)
{
output += FolderData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class FetchInventoryPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID OwnerID;
public LLUUID ItemID;
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 --\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 331;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class FetchInventoryReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 332;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class BulkUpdateInventoryPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "CallbackID: " + CallbackID.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID TransactionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 333;
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 ---\n";
for (int j = 0; j < ItemData.Length; j++)
{
output += ItemData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
for (int j = 0; j < FolderData.Length; j++)
{
output += FolderData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class RequestInventoryAssetPacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public LLUUID AgentID;
public LLUUID QueryID;
public LLUUID OwnerID;
public LLUUID ItemID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = 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 = 334;
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 ---\n";
output += QueryData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class InventoryAssetResponsePacket : Packet
{
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
public LLUUID AssetID;
public bool IsReadable;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "IsReadable: " + IsReadable.ToString() + "\n";
output = 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 = 335;
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 ---\n";
output += QueryData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveInventoryObjectsPacket : Packet
{
/// <exclude/>
public class ItemDataBlock
{
public LLUUID ItemID;
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 --\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class FolderDataBlock
{
public LLUUID FolderID;
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 --\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 336;
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 ---\n";
for (int j = 0; j < ItemData.Length; j++)
{
output += ItemData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
for (int j = 0; j < FolderData.Length; j++)
{
output += FolderData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class PurgeInventoryDescendentsPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID FolderID;
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 --\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 337;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateTaskInventoryPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class UpdateDataBlock
{
public byte Key;
public uint LocalID;
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 --\n";
output += "Key: " + Key.ToString() + "\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 338;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += UpdateData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveTaskInventoryPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public uint LocalID;
public LLUUID ItemID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 339;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoveTaskInventoryPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public uint LocalID;
public LLUUID ItemID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID FolderID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 340;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestTaskInventoryPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public uint LocalID;
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 --\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 341;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ReplyTaskInventoryPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += Helpers.FieldToString(Filename, "Filename") + "\n";
output += "Serial: " + Serial.ToString() + "\n";
output = 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 = 342;
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 ---\n";
output += InventoryData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DeRezObjectPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
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 --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID GroupID;
public byte Destination;
public byte PacketNumber;
public byte PacketCount;
public LLUUID TransactionID;
public LLUUID DestinationID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "Destination: " + Destination.ToString() + "\n";
output += "PacketNumber: " + PacketNumber.ToString() + "\n";
output += "PacketCount: " + PacketCount.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "DestinationID: " + DestinationID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 343;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
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 = 344;
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 ---\n";
return output;
}
}
/// <exclude/>
public class RezObjectPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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);
if(RayStart == null) { Console.WriteLine("Warning: RayStart is null, in " + this.GetType()); }
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);
if(RayEnd == null) { Console.WriteLine("Warning: RayEnd is null, in " + this.GetType()); }
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 --\n";
output += "RezSelected: " + RezSelected.ToString() + "\n";
output += "RemoveItem: " + RemoveItem.ToString() + "\n";
output += "RayStart: " + RayStart.ToString() + "\n";
output += "ItemFlags: " + ItemFlags.ToString() + "\n";
output += "FromTaskID: " + FromTaskID.ToString() + "\n";
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "\n";
output += "RayEnd: " + RayEnd.ToString() + "\n";
output += "BypassRaycast: " + BypassRaycast.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "RayTargetID: " + RayTargetID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 345;
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 ---\n";
output += InventoryData.ToString() + "\n";
output += RezData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RezObjectFromNotecardPacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public LLUUID ItemID;
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 --\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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);
if(RayStart == null) { Console.WriteLine("Warning: RayStart is null, in " + this.GetType()); }
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);
if(RayEnd == null) { Console.WriteLine("Warning: RayEnd is null, in " + this.GetType()); }
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 --\n";
output += "RezSelected: " + RezSelected.ToString() + "\n";
output += "RemoveItem: " + RemoveItem.ToString() + "\n";
output += "RayStart: " + RayStart.ToString() + "\n";
output += "ItemFlags: " + ItemFlags.ToString() + "\n";
output += "FromTaskID: " + FromTaskID.ToString() + "\n";
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "\n";
output += "RayEnd: " + RayEnd.ToString() + "\n";
output += "BypassRaycast: " + BypassRaycast.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "RayTargetID: " + RayTargetID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class NotecardDataBlock
{
public LLUUID ObjectID;
public LLUUID NotecardItemID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "NotecardItemID: " + NotecardItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 346;
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 ---\n";
for (int j = 0; j < InventoryData.Length; j++)
{
output += InventoryData[j].ToString() + "\n";
}
output += RezData.ToString() + "\n";
output += NotecardData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DeclineInventoryPacket : Packet
{
/// <exclude/>
public class InfoBlockBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = 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 = 347;
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 ---\n";
output += InfoBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TransferInventoryPacket : Packet
{
/// <exclude/>
public class InfoBlockBlock
{
public LLUUID DestID;
public LLUUID SourceID;
public LLUUID TransactionID;
public int Length
{
get
{
return 48;
}
}
public InfoBlockBlock() { }
public InfoBlockBlock(byte[] bytes, ref int i)
{
try
{
DestID = new LLUUID(bytes, i); i += 16;
SourceID = 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(SourceID == null) { Console.WriteLine("Warning: SourceID is null, in " + this.GetType()); }
Array.Copy(SourceID.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 = "-- InfoBlock --\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class InventoryBlockBlock
{
public sbyte Type;
public LLUUID InventoryID;
public int Length
{
get
{
return 17;
}
}
public InventoryBlockBlock() { }
public InventoryBlockBlock(byte[] bytes, ref int i)
{
try
{
Type = (sbyte)bytes[i++];
InventoryID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)Type;
if(InventoryID == null) { Console.WriteLine("Warning: InventoryID is null, in " + this.GetType()); }
Array.Copy(InventoryID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- InventoryBlock --\n";
output += "Type: " + Type.ToString() + "\n";
output += "InventoryID: " + InventoryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.TransferInventory; } }
public InfoBlockBlock InfoBlock;
public InventoryBlockBlock[] InventoryBlock;
public TransferInventoryPacket()
{
Header = new LowHeader();
Header.ID = 348;
Header.Reliable = true;
Header.Zerocoded = true;
InfoBlock = new InfoBlockBlock();
InventoryBlock = new InventoryBlockBlock[0];
}
public TransferInventoryPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
InfoBlock = new InfoBlockBlock(bytes, ref i);
int count = (int)bytes[i++];
InventoryBlock = new InventoryBlockBlock[count];
for (int j = 0; j < count; j++)
{ InventoryBlock[j] = new InventoryBlockBlock(bytes, ref i); }
}
public TransferInventoryPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
InfoBlock = new InfoBlockBlock(bytes, ref i);
int count = (int)bytes[i++];
InventoryBlock = new InventoryBlockBlock[count];
for (int j = 0; j < count; j++)
{ InventoryBlock[j] = new InventoryBlockBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
length += InfoBlock.Length;;
length++;
for (int j = 0; j < InventoryBlock.Length; j++) { length += InventoryBlock[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);
InfoBlock.ToBytes(bytes, ref i);
bytes[i++] = (byte)InventoryBlock.Length;
for (int j = 0; j < InventoryBlock.Length; j++) { InventoryBlock[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- TransferInventory ---\n";
output += InfoBlock.ToString() + "\n";
for (int j = 0; j < InventoryBlock.Length; j++)
{
output += InventoryBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class TransferInventoryAckPacket : Packet
{
/// <exclude/>
public class InfoBlockBlock
{
public LLUUID InventoryID;
public LLUUID TransactionID;
public int Length
{
get
{
return 32;
}
}
public InfoBlockBlock() { }
public InfoBlockBlock(byte[] bytes, ref int i)
{
try
{
InventoryID = 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(InventoryID == null) { Console.WriteLine("Warning: InventoryID is null, in " + this.GetType()); }
Array.Copy(InventoryID.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 = "-- InfoBlock --\n";
output += "InventoryID: " + InventoryID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.TransferInventoryAck; } }
public InfoBlockBlock InfoBlock;
public TransferInventoryAckPacket()
{
Header = new LowHeader();
Header.ID = 349;
Header.Reliable = true;
Header.Zerocoded = true;
InfoBlock = new InfoBlockBlock();
}
public TransferInventoryAckPacket(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 TransferInventoryAckPacket(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 = "--- TransferInventoryAck ---\n";
output += InfoBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestFriendshipPacket : Packet
{
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID DestID;
public LLUUID FolderID;
public LLUUID TransactionID;
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 --\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 350;
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 ---\n";
output += AgentBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AcceptFriendshipPacket : Packet
{
/// <exclude/>
public class TransactionBlockBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class FolderDataBlock
{
public LLUUID FolderID;
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 --\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 351;
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 ---\n";
output += TransactionBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < FolderData.Length; j++)
{
output += FolderData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class DeclineFriendshipPacket : Packet
{
/// <exclude/>
public class TransactionBlockBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 352;
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 ---\n";
output += TransactionBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class FormFriendshipPacket : Packet
{
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID DestID;
public LLUUID SourceID;
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 --\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output = 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 = 353;
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 ---\n";
output += AgentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TerminateFriendshipPacket : Packet
{
/// <exclude/>
public class ExBlockBlock
{
public LLUUID OtherID;
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 --\n";
output += "OtherID: " + OtherID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 354;
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 ---\n";
output += ExBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class OfferCallingCardPacket : Packet
{
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID DestID;
public LLUUID TransactionID;
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 --\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 355;
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 ---\n";
output += AgentBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AcceptCallingCardPacket : Packet
{
/// <exclude/>
public class TransactionBlockBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class FolderDataBlock
{
public LLUUID FolderID;
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 --\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = 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 = 356;
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 ---\n";
output += TransactionBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < FolderData.Length; j++)
{
output += FolderData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class DeclineCallingCardPacket : Packet
{
/// <exclude/>
public class TransactionBlockBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 357;
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 ---\n";
output += TransactionBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RezScriptPacket : Packet
{
/// <exclude/>
public class UpdateBlockBlock
{
public bool Enabled;
public uint ObjectLocalID;
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 --\n";
output += "Enabled: " + Enabled.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 358;
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 ---\n";
output += UpdateBlock.ToString() + "\n";
output += InventoryBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CreateInventoryItemPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "CallbackID: " + CallbackID.ToString() + "\n";
output += "WearableType: " + WearableType.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 359;
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 ---\n";
output += InventoryBlock.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CreateLandmarkForEventPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class EventDataBlock
{
public uint EventID;
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 --\n";
output += "EventID: " + EventID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 360;
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 ---\n";
output += InventoryBlock.ToString() + "\n";
output += EventData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EventLocationRequestPacket : Packet
{
/// <exclude/>
public class EventDataBlock
{
public uint EventID;
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 --\n";
output += "EventID: " + EventID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.EventLocationRequest; } }
public EventDataBlock EventData;
public QueryDataBlock QueryData;
public EventLocationRequestPacket()
{
Header = new LowHeader();
Header.ID = 361;
Header.Reliable = true;
Header.Zerocoded = true;
EventData = new EventDataBlock();
QueryData = new QueryDataBlock();
}
public EventLocationRequestPacket(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);
}
public EventLocationRequestPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
EventData = new EventDataBlock(bytes, ref i);
QueryData = new QueryDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += EventData.Length; 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);
EventData.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 = "--- EventLocationRequest ---\n";
output += EventData.ToString() + "\n";
output += QueryData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EventLocationReplyPacket : Packet
{
/// <exclude/>
public class EventDataBlock
{
public LLUUID RegionID;
public bool Success;
public LLVector3 RegionPos;
public int Length
{
get
{
return 29;
}
}
public EventDataBlock() { }
public EventDataBlock(byte[] bytes, ref int i)
{
try
{
RegionID = new LLUUID(bytes, i); i += 16;
Success = (bytes[i++] != 0) ? (bool)true : (bool)false;
RegionPos = 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;
bytes[i++] = (byte)((Success) ? 1 : 0);
if(RegionPos == null) { Console.WriteLine("Warning: RegionPos is null, in " + this.GetType()); }
Array.Copy(RegionPos.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- EventData --\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "Success: " + Success.ToString() + "\n";
output += "RegionPos: " + RegionPos.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class QueryDataBlock
{
public LLUUID QueryID;
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 --\n";
output += "QueryID: " + QueryID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.EventLocationReply; } }
public EventDataBlock EventData;
public QueryDataBlock QueryData;
public EventLocationReplyPacket()
{
Header = new LowHeader();
Header.ID = 362;
Header.Reliable = true;
Header.Zerocoded = true;
EventData = new EventDataBlock();
QueryData = new QueryDataBlock();
}
public EventLocationReplyPacket(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);
}
public EventLocationReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
EventData = new EventDataBlock(bytes, ref i);
QueryData = new QueryDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += EventData.Length; 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);
EventData.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 = "--- EventLocationReply ---\n";
output += EventData.ToString() + "\n";
output += QueryData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RegionHandleRequestPacket : Packet
{
/// <exclude/>
public class RequestBlockBlock
{
public LLUUID RegionID;
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 --\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output = 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 = 363;
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 ---\n";
output += RequestBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RegionIDAndHandleReplyPacket : Packet
{
/// <exclude/>
public class ReplyBlockBlock
{
public LLUUID RegionID;
public ulong RegionHandle;
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 --\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = 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 = 364;
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 ---\n";
output += ReplyBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyTransferRequestPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "AggregatePermInventory: " + AggregatePermInventory.ToString() + "\n";
output += "AggregatePermNextOwner: " + AggregatePermNextOwner.ToString() + "\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output += "TransactionType: " + TransactionType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 365;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyTransferBackendPacket : Packet
{
/// <exclude/>
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 LLUUID TransactionID;
public uint TransactionTime;
public int TransactionType;
public int Length
{
get
{
int length = 63;
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;
TransactionID = new LLUUID(bytes, i); i += 16;
TransactionTime = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
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;
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)(TransactionTime % 256);
bytes[i++] = (byte)((TransactionTime >> 8) % 256);
bytes[i++] = (byte)((TransactionTime >> 16) % 256);
bytes[i++] = (byte)((TransactionTime >> 24) % 256);
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 --\n";
output += "AggregatePermInventory: " + AggregatePermInventory.ToString() + "\n";
output += "AggregatePermNextOwner: " + AggregatePermNextOwner.ToString() + "\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "SourceID: " + SourceID.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "TransactionTime: " + TransactionTime.ToString() + "\n";
output += "TransactionType: " + TransactionType.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.MoneyTransferBackend; } }
public MoneyDataBlock MoneyData;
public MoneyTransferBackendPacket()
{
Header = new LowHeader();
Header.ID = 366;
Header.Reliable = true;
Header.Zerocoded = true;
MoneyData = new MoneyDataBlock();
}
public MoneyTransferBackendPacket(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 MoneyTransferBackendPacket(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 = "--- MoneyTransferBackend ---\n";
output += MoneyData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class BulkMoneyTransferPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
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 TransactionID;
public int TransactionType;
public int Length
{
get
{
int length = 41;
if (Description != null) { length += 1 + Description.Length; }
return length;
}
}
public MoneyDataBlock() { }
public MoneyDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
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++];
TransactionID = 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)
{
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(TransactionID == null) { Console.WriteLine("Warning: TransactionID is null, in " + this.GetType()); }
Array.Copy(TransactionID.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 --\n";
output += "DestID: " + DestID.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "TransactionType: " + TransactionType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public uint RegionX;
public uint RegionY;
public int Length
{
get
{
return 24;
}
}
public AgentDataBlock() { }
public AgentDataBlock(byte[] bytes, ref int i)
{
try
{
AgentID = new LLUUID(bytes, i); i += 16;
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));
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref 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)(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);
}
public override string ToString()
{
string output = "-- AgentData --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RegionX: " + RegionX.ToString() + "\n";
output += "RegionY: " + RegionY.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.BulkMoneyTransfer; } }
public MoneyDataBlock[] MoneyData;
public AgentDataBlock AgentData;
public BulkMoneyTransferPacket()
{
Header = new LowHeader();
Header.ID = 367;
Header.Reliable = true;
Header.Zerocoded = true;
MoneyData = new MoneyDataBlock[0];
AgentData = new AgentDataBlock();
}
public BulkMoneyTransferPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
MoneyData = new MoneyDataBlock[count];
for (int j = 0; j < count; j++)
{ MoneyData[j] = new MoneyDataBlock(bytes, ref i); }
AgentData = new AgentDataBlock(bytes, ref i);
}
public BulkMoneyTransferPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
MoneyData = new MoneyDataBlock[count];
for (int j = 0; j < count; j++)
{ MoneyData[j] = new MoneyDataBlock(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 < MoneyData.Length; j++) { length += MoneyData[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)MoneyData.Length;
for (int j = 0; j < MoneyData.Length; j++) { MoneyData[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 = "--- BulkMoneyTransfer ---\n";
for (int j = 0; j < MoneyData.Length; j++)
{
output += MoneyData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AdjustBalancePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public int Delta;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "Delta: " + Delta.ToString() + "\n";
output = 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 = 368;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyBalanceRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 369;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyBalanceReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "MoneyBalance: " + MoneyBalance.ToString() + "\n";
output += "SquareMetersCredit: " + SquareMetersCredit.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "SquareMetersCommitted: " + SquareMetersCommitted.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "TransactionSuccess: " + TransactionSuccess.ToString() + "\n";
output = 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 = 370;
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 ---\n";
output += MoneyData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RoutedMoneyBalanceReplyPacket : Packet
{
/// <exclude/>
public class TargetBlockBlock
{
public uint TargetIP;
public ushort TargetPort;
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 --\n";
output += "TargetIP: " + TargetIP.ToString() + "\n";
output += "TargetPort: " + TargetPort.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "MoneyBalance: " + MoneyBalance.ToString() + "\n";
output += "SquareMetersCredit: " + SquareMetersCredit.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "SquareMetersCommitted: " + SquareMetersCommitted.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "TransactionSuccess: " + TransactionSuccess.ToString() + "\n";
output = 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 = 371;
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 ---\n";
output += TargetBlock.ToString() + "\n";
output += MoneyData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyHistoryRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID AgentID;
public int StartPeriod;
public int EndPeriod;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "StartPeriod: " + StartPeriod.ToString() + "\n";
output += "EndPeriod: " + EndPeriod.ToString() + "\n";
output = 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 = 372;
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 ---\n";
output += MoneyData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyHistoryReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "Balance: " + Balance.ToString() + "\n";
output += "TaxEstimate: " + TaxEstimate.ToString() + "\n";
output += Helpers.FieldToString(StartDate, "StartDate") + "\n";
output += "StartPeriod: " + StartPeriod.ToString() + "\n";
output += "StipendEstimate: " + StipendEstimate.ToString() + "\n";
output += "EndPeriod: " + EndPeriod.ToString() + "\n";
output += "BonusEstimate: " + BonusEstimate.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "Amount: " + Amount.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 373;
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 ---\n";
output += MoneyData.ToString() + "\n";
for (int j = 0; j < HistoryData.Length; j++)
{
output += HistoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneySummaryRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID RequestID;
public int IntervalDays;
public int CurrentInterval;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 374;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneySummaryReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ParcelDirFeeCurrent: " + ParcelDirFeeCurrent.ToString() + "\n";
output += Helpers.FieldToString(TaxDate, "TaxDate") + "\n";
output += "Balance: " + Balance.ToString() + "\n";
output += "ParcelDirFeeEstimate: " + ParcelDirFeeEstimate.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "ObjectTaxCurrent: " + ObjectTaxCurrent.ToString() + "\n";
output += "LightTaxCurrent: " + LightTaxCurrent.ToString() + "\n";
output += "LandTaxCurrent: " + LandTaxCurrent.ToString() + "\n";
output += "GroupTaxCurrent: " + GroupTaxCurrent.ToString() + "\n";
output += "TotalDebits: " + TotalDebits.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "ObjectTaxEstimate: " + ObjectTaxEstimate.ToString() + "\n";
output += "LightTaxEstimate: " + LightTaxEstimate.ToString() + "\n";
output += "LandTaxEstimate: " + LandTaxEstimate.ToString() + "\n";
output += "GroupTaxEstimate: " + GroupTaxEstimate.ToString() + "\n";
output += Helpers.FieldToString(LastTaxDate, "LastTaxDate") + "\n";
output += Helpers.FieldToString(StartDate, "StartDate") + "\n";
output += "TotalCredits: " + TotalCredits.ToString() + "\n";
output += "StipendEstimate: " + StipendEstimate.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output += "BonusEstimate: " + BonusEstimate.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 375;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyDetailsRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID RequestID;
public int IntervalDays;
public int CurrentInterval;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 376;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyDetailsReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += Helpers.FieldToString(StartDate, "StartDate") + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "Amount: " + Amount.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 377;
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 ---\n";
output += MoneyData.ToString() + "\n";
for (int j = 0; j < HistoryData.Length; j++)
{
output += HistoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyTransactionsRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID RequestID;
public int IntervalDays;
public int CurrentInterval;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 378;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MoneyTransactionsReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += Helpers.FieldToString(StartDate, "StartDate") + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Time, "Time") + "\n";
output += Helpers.FieldToString(Item, "Item") + "\n";
output += Helpers.FieldToString(User, "User") + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 379;
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 ---\n";
output += MoneyData.ToString() + "\n";
for (int j = 0; j < HistoryData.Length; j++)
{
output += HistoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GestureRequestPacket : Packet
{
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID AgentID;
public bool Reset;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "Reset: " + Reset.ToString() + "\n";
output = 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 = 380;
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 ---\n";
output += AgentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ActivateGesturesPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID AssetID;
public uint GestureFlags;
public LLUUID ItemID;
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 --\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "GestureFlags: " + GestureFlags.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint Flags;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 = 381;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DeactivateGesturesPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public uint GestureFlags;
public LLUUID ItemID;
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 --\n";
output += "GestureFlags: " + GestureFlags.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public uint Flags;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 = 382;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class InventoryUpdatePacket : Packet
{
/// <exclude/>
public class InventoryDataBlock
{
public byte IsComplete;
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 int Length
{
get
{
int length = 1;
if (Filename != null) { length += 1 + Filename.Length; }
return length;
}
}
public InventoryDataBlock() { }
public InventoryDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
IsComplete = (byte)bytes[i++];
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)
{
bytes[i++] = IsComplete;
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 = "-- InventoryData --\n";
output += "IsComplete: " + IsComplete.ToString() + "\n";
output += Helpers.FieldToString(Filename, "Filename") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.InventoryUpdate; } }
public InventoryDataBlock InventoryData;
public AgentDataBlock AgentData;
public InventoryUpdatePacket()
{
Header = new LowHeader();
Header.ID = 383;
Header.Reliable = true;
InventoryData = new InventoryDataBlock();
AgentData = new AgentDataBlock();
}
public InventoryUpdatePacket(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 InventoryUpdatePacket(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 = "--- InventoryUpdate ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MuteListUpdatePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(Filename, "Filename") + "\n";
output = 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 = 384;
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 ---\n";
output += MuteData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UseCachedMuteListPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 385;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserLoginLocationReplyPacket : Packet
{
/// <exclude/>
public class URLBlockBlock
{
public uint LocationID;
public LLVector3 LocationLookAt;
public int Length
{
get
{
return 16;
}
}
public URLBlockBlock() { }
public URLBlockBlock(byte[] bytes, ref int i)
{
try
{
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)
{
bytes[i++] = (byte)(LocationID % 256);
bytes[i++] = (byte)((LocationID >> 8) % 256);
bytes[i++] = (byte)((LocationID >> 16) % 256);
bytes[i++] = (byte)((LocationID >> 24) % 256);
if(LocationLookAt == null) { Console.WriteLine("Warning: LocationLookAt is null, in " + this.GetType()); }
Array.Copy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- URLBlock --\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "LocationLookAt: " + LocationLookAt.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SimulatorBlockBlock
{
public uint IP;
public ushort Port;
public int Length
{
get
{
return 6;
}
}
public SimulatorBlockBlock() { }
public SimulatorBlockBlock(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 = "-- SimulatorBlock --\n";
output += "IP: " + IP.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionInfoBlock
{
public uint SecPerDay;
public float MetersPerGrid;
public ulong UsecSinceStart;
public bool LocationValid;
public uint SecPerYear;
public uint GridsPerEdge;
public ulong Handle;
public LLVector3 SunAngVelocity;
public LLVector3 SunDirection;
public int Length
{
get
{
return 57;
}
}
public RegionInfoBlock() { }
public RegionInfoBlock(byte[] bytes, ref int i)
{
try
{
SecPerDay = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
MetersPerGrid = BitConverter.ToSingle(bytes, i); i += 4;
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));
LocationValid = (bytes[i++] != 0) ? (bool)true : (bool)false;
SecPerYear = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridsPerEdge = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
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));
SunAngVelocity = new LLVector3(bytes, i); i += 12;
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);
ba = BitConverter.GetBytes(MetersPerGrid);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
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)((LocationValid) ? 1 : 0);
bytes[i++] = (byte)(SecPerYear % 256);
bytes[i++] = (byte)((SecPerYear >> 8) % 256);
bytes[i++] = (byte)((SecPerYear >> 16) % 256);
bytes[i++] = (byte)((SecPerYear >> 24) % 256);
bytes[i++] = (byte)(GridsPerEdge % 256);
bytes[i++] = (byte)((GridsPerEdge >> 8) % 256);
bytes[i++] = (byte)((GridsPerEdge >> 16) % 256);
bytes[i++] = (byte)((GridsPerEdge >> 24) % 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);
if(SunAngVelocity == null) { Console.WriteLine("Warning: SunAngVelocity is null, in " + this.GetType()); }
Array.Copy(SunAngVelocity.GetBytes(), 0, bytes, i, 12); i += 12;
if(SunDirection == null) { Console.WriteLine("Warning: SunDirection is null, in " + this.GetType()); }
Array.Copy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- RegionInfo --\n";
output += "SecPerDay: " + SecPerDay.ToString() + "\n";
output += "MetersPerGrid: " + MetersPerGrid.ToString() + "\n";
output += "UsecSinceStart: " + UsecSinceStart.ToString() + "\n";
output += "LocationValid: " + LocationValid.ToString() + "\n";
output += "SecPerYear: " + SecPerYear.ToString() + "\n";
output += "GridsPerEdge: " + GridsPerEdge.ToString() + "\n";
output += "Handle: " + Handle.ToString() + "\n";
output += "SunAngVelocity: " + SunAngVelocity.ToString() + "\n";
output += "SunDirection: " + SunDirection.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
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 SessionID;
public int Length
{
get
{
int length = 16;
if (Message != null) { length += 1 + Message.Length; }
return length;
}
}
public AgentDataBlock() { }
public AgentDataBlock(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;
SessionID = 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;
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 --\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UserLoginLocationReply; } }
public URLBlockBlock URLBlock;
public SimulatorBlockBlock SimulatorBlock;
public RegionInfoBlock RegionInfo;
public AgentDataBlock AgentData;
public UserLoginLocationReplyPacket()
{
Header = new LowHeader();
Header.ID = 386;
Header.Reliable = true;
Header.Zerocoded = true;
URLBlock = new URLBlockBlock();
SimulatorBlock = new SimulatorBlockBlock();
RegionInfo = new RegionInfoBlock();
AgentData = new AgentDataBlock();
}
public UserLoginLocationReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
URLBlock = new URLBlockBlock(bytes, ref i);
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
RegionInfo = new RegionInfoBlock(bytes, ref i);
AgentData = new AgentDataBlock(bytes, ref i);
}
public UserLoginLocationReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
URLBlock = new URLBlockBlock(bytes, ref i);
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
RegionInfo = new RegionInfoBlock(bytes, ref i);
AgentData = new AgentDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += URLBlock.Length; length += SimulatorBlock.Length; 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);
URLBlock.ToBytes(bytes, ref i);
SimulatorBlock.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 = "--- UserLoginLocationReply ---\n";
output += URLBlock.ToString() + "\n";
output += SimulatorBlock.ToString() + "\n";
output += RegionInfo.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserSimLocationReplyPacket : Packet
{
/// <exclude/>
public class SimulatorBlockBlock
{
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 byte AccessOK;
public ulong SimHandle;
public int Length
{
get
{
int length = 9;
if (SimName != null) { length += 1 + SimName.Length; }
return length;
}
}
public SimulatorBlockBlock() { }
public SimulatorBlockBlock(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;
AccessOK = (byte)bytes[i++];
SimHandle = (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(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++] = AccessOK;
bytes[i++] = (byte)(SimHandle % 256);
bytes[i++] = (byte)((SimHandle >> 8) % 256);
bytes[i++] = (byte)((SimHandle >> 16) % 256);
bytes[i++] = (byte)((SimHandle >> 24) % 256);
bytes[i++] = (byte)((SimHandle >> 32) % 256);
bytes[i++] = (byte)((SimHandle >> 40) % 256);
bytes[i++] = (byte)((SimHandle >> 48) % 256);
bytes[i++] = (byte)((SimHandle >> 56) % 256);
}
public override string ToString()
{
string output = "-- SimulatorBlock --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "AccessOK: " + AccessOK.ToString() + "\n";
output += "SimHandle: " + SimHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UserSimLocationReply; } }
public SimulatorBlockBlock SimulatorBlock;
public UserSimLocationReplyPacket()
{
Header = new LowHeader();
Header.ID = 387;
Header.Reliable = true;
SimulatorBlock = new SimulatorBlockBlock();
}
public UserSimLocationReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
}
public UserSimLocationReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += SimulatorBlock.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
SimulatorBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- UserSimLocationReply ---\n";
output += SimulatorBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserListReplyPacket : Packet
{
/// <exclude/>
public class UserBlockBlock
{
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 byte Status;
public int Length
{
get
{
int length = 1;
if (LastName != null) { length += 1 + LastName.Length; }
if (FirstName != null) { length += 1 + FirstName.Length; }
return length;
}
}
public UserBlockBlock() { }
public UserBlockBlock(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;
Status = (byte)bytes[i++];
}
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;
bytes[i++] = Status;
}
public override string ToString()
{
string output = "-- UserBlock --\n";
output += Helpers.FieldToString(LastName, "LastName") + "\n";
output += Helpers.FieldToString(FirstName, "FirstName") + "\n";
output += "Status: " + Status.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UserListReply; } }
public UserBlockBlock[] UserBlock;
public UserListReplyPacket()
{
Header = new LowHeader();
Header.ID = 388;
Header.Reliable = true;
UserBlock = new UserBlockBlock[0];
}
public UserListReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
UserBlock = new UserBlockBlock[count];
for (int j = 0; j < count; j++)
{ UserBlock[j] = new UserBlockBlock(bytes, ref i); }
}
public UserListReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
UserBlock = new UserBlockBlock[count];
for (int j = 0; j < count; j++)
{ UserBlock[j] = new UserBlockBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
length++;
for (int j = 0; j < UserBlock.Length; j++) { length += UserBlock[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)UserBlock.Length;
for (int j = 0; j < UserBlock.Length; j++) { UserBlock[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- UserListReply ---\n";
for (int j = 0; j < UserBlock.Length; j++)
{
output += UserBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class OnlineNotificationPacket : Packet
{
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 389;
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 ---\n";
for (int j = 0; j < AgentBlock.Length; j++)
{
output += AgentBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class OfflineNotificationPacket : Packet
{
/// <exclude/>
public class AgentBlockBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 390;
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 ---\n";
for (int j = 0; j < AgentBlock.Length; j++)
{
output += AgentBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SetStartLocationRequestPacket : Packet
{
/// <exclude/>
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;
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)
{
if(LocationPos == null) { Console.WriteLine("Warning: LocationPos is null, in " + this.GetType()); }
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);
if(LocationLookAt == null) { Console.WriteLine("Warning: LocationLookAt is null, in " + this.GetType()); }
Array.Copy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- StartLocationData --\n";
output += "LocationPos: " + LocationPos.ToString() + "\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "LocationLookAt: " + LocationLookAt.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 391;
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 ---\n";
output += StartLocationData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetStartLocationPacket : Packet
{
/// <exclude/>
public class StartLocationDataBlock
{
public LLVector3 LocationPos;
public LLUUID AgentID;
public LLUUID RegionID;
public ulong RegionHandle;
public uint LocationID;
public LLVector3 LocationLookAt;
public int Length
{
get
{
return 68;
}
}
public StartLocationDataBlock() { }
public StartLocationDataBlock(byte[] bytes, ref int i)
{
try
{
LocationPos = new LLVector3(bytes, i); i += 12;
AgentID = new LLUUID(bytes, i); i += 16;
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));
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)
{
if(LocationPos == null) { Console.WriteLine("Warning: LocationPos is null, in " + this.GetType()); }
Array.Copy(LocationPos.GetBytes(), 0, bytes, i, 12); i += 12;
if(AgentID == null) { Console.WriteLine("Warning: AgentID is null, in " + this.GetType()); }
Array.Copy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16;
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);
bytes[i++] = (byte)(LocationID % 256);
bytes[i++] = (byte)((LocationID >> 8) % 256);
bytes[i++] = (byte)((LocationID >> 16) % 256);
bytes[i++] = (byte)((LocationID >> 24) % 256);
if(LocationLookAt == null) { Console.WriteLine("Warning: LocationLookAt is null, in " + this.GetType()); }
Array.Copy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- StartLocationData --\n";
output += "LocationPos: " + LocationPos.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "LocationLookAt: " + LocationLookAt.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SetStartLocation; } }
public StartLocationDataBlock StartLocationData;
public SetStartLocationPacket()
{
Header = new LowHeader();
Header.ID = 392;
Header.Reliable = true;
Header.Zerocoded = true;
StartLocationData = new StartLocationDataBlock();
}
public SetStartLocationPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
StartLocationData = new StartLocationDataBlock(bytes, ref i);
}
public SetStartLocationPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
StartLocationData = new StartLocationDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += StartLocationData.Length;;
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);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SetStartLocation ---\n";
output += StartLocationData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserLoginLocationRequestPacket : Packet
{
/// <exclude/>
public class URLBlockBlock
{
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 Pos;
public int Length
{
get
{
int length = 12;
if (SimName != null) { length += 1 + SimName.Length; }
return length;
}
}
public URLBlockBlock() { }
public URLBlockBlock(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;
Pos = new LLVector3(bytes, i); i += 12;
}
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(Pos == null) { Console.WriteLine("Warning: Pos is null, in " + this.GetType()); }
Array.Copy(Pos.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- URLBlock --\n";
output += Helpers.FieldToString(SimName, "SimName") + "\n";
output += "Pos: " + Pos.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class PositionBlockBlock
{
public ulong ViewerRegion;
public LLVector3 ViewerPosition;
public int Length
{
get
{
return 20;
}
}
public PositionBlockBlock() { }
public PositionBlockBlock(byte[] bytes, ref int i)
{
try
{
ViewerRegion = (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));
ViewerPosition = new LLVector3(bytes, i); i += 12;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)(ViewerRegion % 256);
bytes[i++] = (byte)((ViewerRegion >> 8) % 256);
bytes[i++] = (byte)((ViewerRegion >> 16) % 256);
bytes[i++] = (byte)((ViewerRegion >> 24) % 256);
bytes[i++] = (byte)((ViewerRegion >> 32) % 256);
bytes[i++] = (byte)((ViewerRegion >> 40) % 256);
bytes[i++] = (byte)((ViewerRegion >> 48) % 256);
bytes[i++] = (byte)((ViewerRegion >> 56) % 256);
if(ViewerPosition == null) { Console.WriteLine("Warning: ViewerPosition is null, in " + this.GetType()); }
Array.Copy(ViewerPosition.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- PositionBlock --\n";
output += "ViewerRegion: " + ViewerRegion.ToString() + "\n";
output += "ViewerPosition: " + ViewerPosition.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class UserBlockBlock
{
public bool FirstLogin;
public byte TravelAccess;
public uint LimitedToEstate;
public LLUUID SessionID;
public int Length
{
get
{
return 22;
}
}
public UserBlockBlock() { }
public UserBlockBlock(byte[] bytes, ref int i)
{
try
{
FirstLogin = (bytes[i++] != 0) ? (bool)true : (bool)false;
TravelAccess = (byte)bytes[i++];
LimitedToEstate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
SessionID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((FirstLogin) ? 1 : 0);
bytes[i++] = TravelAccess;
bytes[i++] = (byte)(LimitedToEstate % 256);
bytes[i++] = (byte)((LimitedToEstate >> 8) % 256);
bytes[i++] = (byte)((LimitedToEstate >> 16) % 256);
bytes[i++] = (byte)((LimitedToEstate >> 24) % 256);
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 = "-- UserBlock --\n";
output += "FirstLogin: " + FirstLogin.ToString() + "\n";
output += "TravelAccess: " + TravelAccess.ToString() + "\n";
output += "LimitedToEstate: " + LimitedToEstate.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UserLoginLocationRequest; } }
public URLBlockBlock URLBlock;
public PositionBlockBlock PositionBlock;
public UserBlockBlock UserBlock;
public UserLoginLocationRequestPacket()
{
Header = new LowHeader();
Header.ID = 393;
Header.Reliable = true;
Header.Zerocoded = true;
URLBlock = new URLBlockBlock();
PositionBlock = new PositionBlockBlock();
UserBlock = new UserBlockBlock();
}
public UserLoginLocationRequestPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
URLBlock = new URLBlockBlock(bytes, ref i);
PositionBlock = new PositionBlockBlock(bytes, ref i);
UserBlock = new UserBlockBlock(bytes, ref i);
}
public UserLoginLocationRequestPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
URLBlock = new URLBlockBlock(bytes, ref i);
PositionBlock = new PositionBlockBlock(bytes, ref i);
UserBlock = new UserBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += URLBlock.Length; length += PositionBlock.Length; length += UserBlock.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
URLBlock.ToBytes(bytes, ref i);
PositionBlock.ToBytes(bytes, ref i);
UserBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- UserLoginLocationRequest ---\n";
output += URLBlock.ToString() + "\n";
output += PositionBlock.ToString() + "\n";
output += UserBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SpaceLoginLocationReplyPacket : Packet
{
/// <exclude/>
public class SimulatorBlockBlock
{
public uint IP;
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 ushort Port;
public byte SimAccess;
public uint CircuitCode;
public int Length
{
get
{
int length = 11;
if (Name != null) { length += 1 + Name.Length; }
return length;
}
}
public SimulatorBlockBlock() { }
public SimulatorBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
IP = (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;
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
SimAccess = (byte)bytes[i++];
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)
{
bytes[i++] = (byte)(IP % 256);
bytes[i++] = (byte)((IP >> 8) % 256);
bytes[i++] = (byte)((IP >> 16) % 256);
bytes[i++] = (byte)((IP >> 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)((Port >> 8) % 256);
bytes[i++] = (byte)(Port % 256);
bytes[i++] = SimAccess;
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 = "-- SimulatorBlock --\n";
output += "IP: " + IP.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class UserBlockBlock
{
public LLVector3 LocationPos;
public LLUUID SessionID;
public uint LocationID;
public LLVector3 LocationLookAt;
public int Length
{
get
{
return 44;
}
}
public UserBlockBlock() { }
public UserBlockBlock(byte[] bytes, ref int i)
{
try
{
LocationPos = new LLVector3(bytes, i); i += 12;
SessionID = new LLUUID(bytes, i); i += 16;
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)
{
if(LocationPos == null) { Console.WriteLine("Warning: LocationPos is null, in " + this.GetType()); }
Array.Copy(LocationPos.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;
bytes[i++] = (byte)(LocationID % 256);
bytes[i++] = (byte)((LocationID >> 8) % 256);
bytes[i++] = (byte)((LocationID >> 16) % 256);
bytes[i++] = (byte)((LocationID >> 24) % 256);
if(LocationLookAt == null) { Console.WriteLine("Warning: LocationLookAt is null, in " + this.GetType()); }
Array.Copy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- UserBlock --\n";
output += "LocationPos: " + LocationPos.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "LocationID: " + LocationID.ToString() + "\n";
output += "LocationLookAt: " + LocationLookAt.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionInfoBlock
{
public uint SecPerDay;
public float MetersPerGrid;
public ulong UsecSinceStart;
public uint SecPerYear;
public uint GridsPerEdge;
public ulong Handle;
public LLVector3 SunAngVelocity;
public LLVector3 SunDirection;
public int Length
{
get
{
return 56;
}
}
public RegionInfoBlock() { }
public RegionInfoBlock(byte[] bytes, ref int i)
{
try
{
SecPerDay = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);
MetersPerGrid = BitConverter.ToSingle(bytes, i); i += 4;
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));
GridsPerEdge = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
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));
SunAngVelocity = new LLVector3(bytes, i); i += 12;
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);
ba = BitConverter.GetBytes(MetersPerGrid);
if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }
Array.Copy(ba, 0, bytes, i, 4); i += 4;
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);
bytes[i++] = (byte)(GridsPerEdge % 256);
bytes[i++] = (byte)((GridsPerEdge >> 8) % 256);
bytes[i++] = (byte)((GridsPerEdge >> 16) % 256);
bytes[i++] = (byte)((GridsPerEdge >> 24) % 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);
if(SunAngVelocity == null) { Console.WriteLine("Warning: SunAngVelocity is null, in " + this.GetType()); }
Array.Copy(SunAngVelocity.GetBytes(), 0, bytes, i, 12); i += 12;
if(SunDirection == null) { Console.WriteLine("Warning: SunDirection is null, in " + this.GetType()); }
Array.Copy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- RegionInfo --\n";
output += "SecPerDay: " + SecPerDay.ToString() + "\n";
output += "MetersPerGrid: " + MetersPerGrid.ToString() + "\n";
output += "UsecSinceStart: " + UsecSinceStart.ToString() + "\n";
output += "SecPerYear: " + SecPerYear.ToString() + "\n";
output += "GridsPerEdge: " + GridsPerEdge.ToString() + "\n";
output += "Handle: " + Handle.ToString() + "\n";
output += "SunAngVelocity: " + SunAngVelocity.ToString() + "\n";
output += "SunDirection: " + SunDirection.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SpaceLoginLocationReply; } }
public SimulatorBlockBlock SimulatorBlock;
public UserBlockBlock UserBlock;
public RegionInfoBlock RegionInfo;
public SpaceLoginLocationReplyPacket()
{
Header = new LowHeader();
Header.ID = 394;
Header.Reliable = true;
Header.Zerocoded = true;
SimulatorBlock = new SimulatorBlockBlock();
UserBlock = new UserBlockBlock();
RegionInfo = new RegionInfoBlock();
}
public SpaceLoginLocationReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
UserBlock = new UserBlockBlock(bytes, ref i);
RegionInfo = new RegionInfoBlock(bytes, ref i);
}
public SpaceLoginLocationReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
UserBlock = new UserBlockBlock(bytes, ref i);
RegionInfo = new RegionInfoBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += SimulatorBlock.Length; length += UserBlock.Length; 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);
SimulatorBlock.ToBytes(bytes, ref i);
UserBlock.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 = "--- SpaceLoginLocationReply ---\n";
output += SimulatorBlock.ToString() + "\n";
output += UserBlock.ToString() + "\n";
output += RegionInfo.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class NetTestPacket : Packet
{
/// <exclude/>
public class NetBlockBlock
{
public ushort Port;
public int Length
{
get
{
return 2;
}
}
public NetBlockBlock() { }
public NetBlockBlock(byte[] bytes, ref int i)
{
try
{
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((Port >> 8) % 256);
bytes[i++] = (byte)(Port % 256);
}
public override string ToString()
{
string output = "-- NetBlock --\n";
output += "Port: " + Port.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.NetTest; } }
public NetBlockBlock NetBlock;
public NetTestPacket()
{
Header = new LowHeader();
Header.ID = 395;
Header.Reliable = true;
NetBlock = new NetBlockBlock();
}
public NetTestPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
NetBlock = new NetBlockBlock(bytes, ref i);
}
public NetTestPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
NetBlock = new NetBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += NetBlock.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
NetBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- NetTest ---\n";
output += NetBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetCPURatioPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public byte Ratio;
public int Length
{
get
{
return 1;
}
}
public DataBlock() { }
public DataBlock(byte[] bytes, ref int i)
{
try
{
Ratio = (byte)bytes[i++];
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = Ratio;
}
public override string ToString()
{
string output = "-- Data --\n";
output += "Ratio: " + Ratio.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SetCPURatio; } }
public DataBlock Data;
public SetCPURatioPacket()
{
Header = new LowHeader();
Header.ID = 396;
Header.Reliable = true;
Data = new DataBlock();
}
public SetCPURatioPacket(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 SetCPURatioPacket(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 = "--- SetCPURatio ---\n";
output += Data.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimCrashedPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public uint RegionX;
public uint RegionY;
public int Length
{
get
{
return 8;
}
}
public DataBlock() { }
public DataBlock(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));
}
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);
}
public override string ToString()
{
string output = "-- Data --\n";
output += "RegionX: " + RegionX.ToString() + "\n";
output += "RegionY: " + RegionY.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class UsersBlock
{
public LLUUID AgentID;
public int Length
{
get
{
return 16;
}
}
public UsersBlock() { }
public UsersBlock(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 = "-- Users --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimCrashed; } }
public DataBlock Data;
public UsersBlock[] Users;
public SimCrashedPacket()
{
Header = new LowHeader();
Header.ID = 397;
Header.Reliable = true;
Data = new DataBlock();
Users = new UsersBlock[0];
}
public SimCrashedPacket(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++];
Users = new UsersBlock[count];
for (int j = 0; j < count; j++)
{ Users[j] = new UsersBlock(bytes, ref i); }
}
public SimCrashedPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
Data = new DataBlock(bytes, ref i);
int count = (int)bytes[i++];
Users = new UsersBlock[count];
for (int j = 0; j < count; j++)
{ Users[j] = new UsersBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
length += Data.Length;;
length++;
for (int j = 0; j < Users.Length; j++) { length += Users[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)Users.Length;
for (int j = 0; j < Users.Length; j++) { Users[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimCrashed ---\n";
output += Data.ToString() + "\n";
for (int j = 0; j < Users.Length; j++)
{
output += Users[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SimulatorPauseStatePacket : Packet
{
/// <exclude/>
public class PauseBlockBlock
{
public uint TasksPaused;
public uint SimPaused;
public uint LayersPaused;
public int Length
{
get
{
return 12;
}
}
public PauseBlockBlock() { }
public PauseBlockBlock(byte[] bytes, ref int i)
{
try
{
TasksPaused = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
SimPaused = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
LayersPaused = (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)(TasksPaused % 256);
bytes[i++] = (byte)((TasksPaused >> 8) % 256);
bytes[i++] = (byte)((TasksPaused >> 16) % 256);
bytes[i++] = (byte)((TasksPaused >> 24) % 256);
bytes[i++] = (byte)(SimPaused % 256);
bytes[i++] = (byte)((SimPaused >> 8) % 256);
bytes[i++] = (byte)((SimPaused >> 16) % 256);
bytes[i++] = (byte)((SimPaused >> 24) % 256);
bytes[i++] = (byte)(LayersPaused % 256);
bytes[i++] = (byte)((LayersPaused >> 8) % 256);
bytes[i++] = (byte)((LayersPaused >> 16) % 256);
bytes[i++] = (byte)((LayersPaused >> 24) % 256);
}
public override string ToString()
{
string output = "-- PauseBlock --\n";
output += "TasksPaused: " + TasksPaused.ToString() + "\n";
output += "SimPaused: " + SimPaused.ToString() + "\n";
output += "LayersPaused: " + LayersPaused.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorPauseState; } }
public PauseBlockBlock PauseBlock;
public SimulatorPauseStatePacket()
{
Header = new LowHeader();
Header.ID = 398;
Header.Reliable = true;
PauseBlock = new PauseBlockBlock();
}
public SimulatorPauseStatePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
PauseBlock = new PauseBlockBlock(bytes, ref i);
}
public SimulatorPauseStatePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
PauseBlock = new PauseBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += PauseBlock.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
PauseBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimulatorPauseState ---\n";
output += PauseBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimulatorThrottleSettingsPacket : Packet
{
/// <exclude/>
public class SenderBlock
{
public LLUUID ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ThrottleBlock
{
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 int Length
{
get
{
int length = 0;
if (Throttles != null) { length += 1 + Throttles.Length; }
return length;
}
}
public ThrottleBlock() { }
public ThrottleBlock(byte[] bytes, ref int i)
{
int length;
try
{
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)
{
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 --\n";
output += Helpers.FieldToString(Throttles, "Throttles") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimulatorThrottleSettings; } }
public SenderBlock Sender;
public ThrottleBlock Throttle;
public SimulatorThrottleSettingsPacket()
{
Header = new LowHeader();
Header.ID = 399;
Header.Reliable = true;
Sender = new SenderBlock();
Throttle = new ThrottleBlock();
}
public SimulatorThrottleSettingsPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
Sender = new SenderBlock(bytes, ref i);
Throttle = new ThrottleBlock(bytes, ref i);
}
public SimulatorThrottleSettingsPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
Sender = new SenderBlock(bytes, ref i);
Throttle = new ThrottleBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += Sender.Length; length += Throttle.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
Sender.ToBytes(bytes, ref i);
Throttle.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimulatorThrottleSettings ---\n";
output += Sender.ToString() + "\n";
output += Throttle.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class NameValuePairPacket : Packet
{
/// <exclude/>
public class NameValueDataBlock
{
private byte[] _nvpair;
public byte[] NVPair
{
get { return _nvpair; }
set
{
if (value == null) { _nvpair = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _nvpair = new byte[value.Length]; Array.Copy(value, _nvpair, value.Length); }
}
}
public int Length
{
get
{
int length = 0;
if (NVPair != null) { length += 2 + NVPair.Length; }
return length;
}
}
public NameValueDataBlock() { }
public NameValueDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_nvpair = new byte[length];
Array.Copy(bytes, i, _nvpair, 0, length); i += length;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(NVPair == null) { Console.WriteLine("Warning: NVPair is null, in " + this.GetType()); }
bytes[i++] = (byte)(NVPair.Length % 256);
bytes[i++] = (byte)((NVPair.Length >> 8) % 256);
Array.Copy(NVPair, 0, bytes, i, NVPair.Length); i += NVPair.Length;
}
public override string ToString()
{
string output = "-- NameValueData --\n";
output += Helpers.FieldToString(NVPair, "NVPair") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TaskDataBlock
{
public LLUUID ID;
public int Length
{
get
{
return 16;
}
}
public TaskDataBlock() { }
public TaskDataBlock(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 = "-- TaskData --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.NameValuePair; } }
public NameValueDataBlock[] NameValueData;
public TaskDataBlock TaskData;
public NameValuePairPacket()
{
Header = new LowHeader();
Header.ID = 400;
Header.Reliable = true;
NameValueData = new NameValueDataBlock[0];
TaskData = new TaskDataBlock();
}
public NameValuePairPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
NameValueData = new NameValueDataBlock[count];
for (int j = 0; j < count; j++)
{ NameValueData[j] = new NameValueDataBlock(bytes, ref i); }
TaskData = new TaskDataBlock(bytes, ref i);
}
public NameValuePairPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
NameValueData = new NameValueDataBlock[count];
for (int j = 0; j < count; j++)
{ NameValueData[j] = new NameValueDataBlock(bytes, ref i); }
TaskData = new TaskDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TaskData.Length;;
length++;
for (int j = 0; j < NameValueData.Length; j++) { length += NameValueData[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)NameValueData.Length;
for (int j = 0; j < NameValueData.Length; j++) { NameValueData[j].ToBytes(bytes, ref i); }
TaskData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- NameValuePair ---\n";
for (int j = 0; j < NameValueData.Length; j++)
{
output += NameValueData[j].ToString() + "\n";
}
output += TaskData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveNameValuePairPacket : Packet
{
/// <exclude/>
public class NameValueDataBlock
{
private byte[] _nvpair;
public byte[] NVPair
{
get { return _nvpair; }
set
{
if (value == null) { _nvpair = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _nvpair = new byte[value.Length]; Array.Copy(value, _nvpair, value.Length); }
}
}
public int Length
{
get
{
int length = 0;
if (NVPair != null) { length += 2 + NVPair.Length; }
return length;
}
}
public NameValueDataBlock() { }
public NameValueDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_nvpair = new byte[length];
Array.Copy(bytes, i, _nvpair, 0, length); i += length;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(NVPair == null) { Console.WriteLine("Warning: NVPair is null, in " + this.GetType()); }
bytes[i++] = (byte)(NVPair.Length % 256);
bytes[i++] = (byte)((NVPair.Length >> 8) % 256);
Array.Copy(NVPair, 0, bytes, i, NVPair.Length); i += NVPair.Length;
}
public override string ToString()
{
string output = "-- NameValueData --\n";
output += Helpers.FieldToString(NVPair, "NVPair") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TaskDataBlock
{
public LLUUID ID;
public int Length
{
get
{
return 16;
}
}
public TaskDataBlock() { }
public TaskDataBlock(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 = "-- TaskData --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RemoveNameValuePair; } }
public NameValueDataBlock[] NameValueData;
public TaskDataBlock TaskData;
public RemoveNameValuePairPacket()
{
Header = new LowHeader();
Header.ID = 401;
Header.Reliable = true;
NameValueData = new NameValueDataBlock[0];
TaskData = new TaskDataBlock();
}
public RemoveNameValuePairPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
NameValueData = new NameValueDataBlock[count];
for (int j = 0; j < count; j++)
{ NameValueData[j] = new NameValueDataBlock(bytes, ref i); }
TaskData = new TaskDataBlock(bytes, ref i);
}
public RemoveNameValuePairPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
NameValueData = new NameValueDataBlock[count];
for (int j = 0; j < count; j++)
{ NameValueData[j] = new NameValueDataBlock(bytes, ref i); }
TaskData = new TaskDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TaskData.Length;;
length++;
for (int j = 0; j < NameValueData.Length; j++) { length += NameValueData[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)NameValueData.Length;
for (int j = 0; j < NameValueData.Length; j++) { NameValueData[j].ToBytes(bytes, ref i); }
TaskData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RemoveNameValuePair ---\n";
for (int j = 0; j < NameValueData.Length; j++)
{
output += NameValueData[j].ToString() + "\n";
}
output += TaskData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GetNameValuePairPacket : Packet
{
/// <exclude/>
public class NameValueNameBlock
{
private byte[] _name;
public byte[] Name
{
get { return _name; }
set
{
if (value == null) { _name = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _name = new byte[value.Length]; Array.Copy(value, _name, value.Length); }
}
}
public int Length
{
get
{
int length = 0;
if (Name != null) { length += 2 + Name.Length; }
return length;
}
}
public NameValueNameBlock() { }
public NameValueNameBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_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 % 256);
bytes[i++] = (byte)((Name.Length >> 8) % 256);
Array.Copy(Name, 0, bytes, i, Name.Length); i += Name.Length;
}
public override string ToString()
{
string output = "-- NameValueName --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TaskDataBlock
{
public LLUUID ID;
public int Length
{
get
{
return 16;
}
}
public TaskDataBlock() { }
public TaskDataBlock(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 = "-- TaskData --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.GetNameValuePair; } }
public NameValueNameBlock[] NameValueName;
public TaskDataBlock TaskData;
public GetNameValuePairPacket()
{
Header = new LowHeader();
Header.ID = 402;
Header.Reliable = true;
NameValueName = new NameValueNameBlock[0];
TaskData = new TaskDataBlock();
}
public GetNameValuePairPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
NameValueName = new NameValueNameBlock[count];
for (int j = 0; j < count; j++)
{ NameValueName[j] = new NameValueNameBlock(bytes, ref i); }
TaskData = new TaskDataBlock(bytes, ref i);
}
public GetNameValuePairPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
NameValueName = new NameValueNameBlock[count];
for (int j = 0; j < count; j++)
{ NameValueName[j] = new NameValueNameBlock(bytes, ref i); }
TaskData = new TaskDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TaskData.Length;;
length++;
for (int j = 0; j < NameValueName.Length; j++) { length += NameValueName[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)NameValueName.Length;
for (int j = 0; j < NameValueName.Length; j++) { NameValueName[j].ToBytes(bytes, ref i); }
TaskData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- GetNameValuePair ---\n";
for (int j = 0; j < NameValueName.Length; j++)
{
output += NameValueName[j].ToString() + "\n";
}
output += TaskData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateAttachmentPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "CreationDate: " + CreationDate.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InvType: " + InvType.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class OperationDataBlock
{
public bool AddItem;
public bool UseExistingAsset;
public int Length
{
get
{
return 2;
}
}
public OperationDataBlock() { }
public OperationDataBlock(byte[] bytes, ref int i)
{
try
{
AddItem = (bytes[i++] != 0) ? (bool)true : (bool)false;
UseExistingAsset = (bytes[i++] != 0) ? (bool)true : (bool)false;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((AddItem) ? 1 : 0);
bytes[i++] = (byte)((UseExistingAsset) ? 1 : 0);
}
public override string ToString()
{
string output = "-- OperationData --\n";
output += "AddItem: " + AddItem.ToString() + "\n";
output += "UseExistingAsset: " + UseExistingAsset.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AttachmentBlockBlock
{
public byte AttachmentPoint;
public int Length
{
get
{
return 1;
}
}
public AttachmentBlockBlock() { }
public AttachmentBlockBlock(byte[] bytes, ref int i)
{
try
{
AttachmentPoint = (byte)bytes[i++];
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = AttachmentPoint;
}
public override string ToString()
{
string output = "-- AttachmentBlock --\n";
output += "AttachmentPoint: " + AttachmentPoint.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.UpdateAttachment; } }
public InventoryDataBlock InventoryData;
public AgentDataBlock AgentData;
public OperationDataBlock OperationData;
public AttachmentBlockBlock AttachmentBlock;
public UpdateAttachmentPacket()
{
Header = new LowHeader();
Header.ID = 403;
Header.Reliable = true;
Header.Zerocoded = true;
InventoryData = new InventoryDataBlock();
AgentData = new AgentDataBlock();
OperationData = new OperationDataBlock();
AttachmentBlock = new AttachmentBlockBlock();
}
public UpdateAttachmentPacket(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);
OperationData = new OperationDataBlock(bytes, ref i);
AttachmentBlock = new AttachmentBlockBlock(bytes, ref i);
}
public UpdateAttachmentPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
InventoryData = new InventoryDataBlock(bytes, ref i);
AgentData = new AgentDataBlock(bytes, ref i);
OperationData = new OperationDataBlock(bytes, ref i);
AttachmentBlock = new AttachmentBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += InventoryData.Length; length += AgentData.Length; length += OperationData.Length; length += AttachmentBlock.Length;;
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);
OperationData.ToBytes(bytes, ref i);
AttachmentBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- UpdateAttachment ---\n";
output += InventoryData.ToString() + "\n";
output += AgentData.ToString() + "\n";
output += OperationData.ToString() + "\n";
output += AttachmentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RemoveAttachmentPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AttachmentBlockBlock
{
public byte AttachmentPoint;
public LLUUID ItemID;
public int Length
{
get
{
return 17;
}
}
public AttachmentBlockBlock() { }
public AttachmentBlockBlock(byte[] bytes, ref int i)
{
try
{
AttachmentPoint = (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++] = AttachmentPoint;
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 = "-- AttachmentBlock --\n";
output += "AttachmentPoint: " + AttachmentPoint.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RemoveAttachment; } }
public AgentDataBlock AgentData;
public AttachmentBlockBlock AttachmentBlock;
public RemoveAttachmentPacket()
{
Header = new LowHeader();
Header.ID = 404;
Header.Reliable = true;
AgentData = new AgentDataBlock();
AttachmentBlock = new AttachmentBlockBlock();
}
public RemoveAttachmentPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
AgentData = new AgentDataBlock(bytes, ref i);
AttachmentBlock = new AttachmentBlockBlock(bytes, ref i);
}
public RemoveAttachmentPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
AgentData = new AgentDataBlock(bytes, ref i);
AttachmentBlock = new AttachmentBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += AgentData.Length; length += AttachmentBlock.Length;;
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);
AttachmentBlock.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- RemoveAttachment ---\n";
output += AgentData.ToString() + "\n";
output += AttachmentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AssetUploadRequestPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "Type: " + Type.ToString() + "\n";
output += "Tempfile: " + Tempfile.ToString() + "\n";
output += Helpers.FieldToString(AssetData, "AssetData") + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output += "StoreLocal: " + StoreLocal.ToString() + "\n";
output = 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 = 405;
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 ---\n";
output += AssetBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AssetUploadCompletePacket : Packet
{
/// <exclude/>
public class AssetBlockBlock
{
public LLUUID UUID;
public bool Success;
public sbyte Type;
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 --\n";
output += "UUID: " + UUID.ToString() + "\n";
output += "Success: " + Success.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output = 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 = 406;
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 ---\n";
output += AssetBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ReputationAgentAssignPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID RateeID;
public LLUUID RatorID;
public float Appearance;
public float Behavior;
public float Building;
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 --\n";
output += "RateeID: " + RateeID.ToString() + "\n";
output += "RatorID: " + RatorID.ToString() + "\n";
output += "Appearance: " + Appearance.ToString() + "\n";
output += "Behavior: " + Behavior.ToString() + "\n";
output += "Building: " + Building.ToString() + "\n";
output = 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 = 407;
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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ReputationIndividualRequestPacket : Packet
{
/// <exclude/>
public class ReputationDataBlock
{
public LLUUID ToID;
public LLUUID FromID;
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 --\n";
output += "ToID: " + ToID.ToString() + "\n";
output += "FromID: " + FromID.ToString() + "\n";
output = 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 = 408;
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 ---\n";
output += ReputationData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ReputationIndividualReplyPacket : Packet
{
/// <exclude/>
public class ReputationDataBlock
{
public float Appearance;
public LLUUID ToID;
public float Behavior;
public LLUUID FromID;
public float Building;
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 --\n";
output += "Appearance: " + Appearance.ToString() + "\n";
output += "ToID: " + ToID.ToString() + "\n";
output += "Behavior: " + Behavior.ToString() + "\n";
output += "FromID: " + FromID.ToString() + "\n";
output += "Building: " + Building.ToString() + "\n";
output = 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 = 409;
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 ---\n";
output += ReputationData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EmailMessageRequestPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID ObjectID;
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[] _fromaddress;
public byte[] FromAddress
{
get { return _fromaddress; }
set
{
if (value == null) { _fromaddress = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _fromaddress = new byte[value.Length]; Array.Copy(value, _fromaddress, value.Length); }
}
}
public int Length
{
get
{
int length = 16;
if (Subject != null) { length += 1 + Subject.Length; }
if (FromAddress != null) { length += 1 + FromAddress.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
ObjectID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_subject = new byte[length];
Array.Copy(bytes, i, _subject, 0, length); i += length;
length = (ushort)bytes[i++];
_fromaddress = new byte[length];
Array.Copy(bytes, i, _fromaddress, 0, length); i += length;
}
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(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(FromAddress == null) { Console.WriteLine("Warning: FromAddress is null, in " + this.GetType()); }
bytes[i++] = (byte)FromAddress.Length;
Array.Copy(FromAddress, 0, bytes, i, FromAddress.Length); i += FromAddress.Length;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(Subject, "Subject") + "\n";
output += Helpers.FieldToString(FromAddress, "FromAddress") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.EmailMessageRequest; } }
public DataBlockBlock DataBlock;
public EmailMessageRequestPacket()
{
Header = new LowHeader();
Header.ID = 410;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public EmailMessageRequestPacket(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 EmailMessageRequestPacket(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 = "--- EmailMessageRequest ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EmailMessageReplyPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID ObjectID;
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[] _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); }
}
}
public uint Time;
private byte[] _fromaddress;
public byte[] FromAddress
{
get { return _fromaddress; }
set
{
if (value == null) { _fromaddress = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _fromaddress = new byte[value.Length]; Array.Copy(value, _fromaddress, value.Length); }
}
}
public uint More;
private byte[] _mailfilter;
public byte[] MailFilter
{
get { return _mailfilter; }
set
{
if (value == null) { _mailfilter = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _mailfilter = new byte[value.Length]; Array.Copy(value, _mailfilter, value.Length); }
}
}
public int Length
{
get
{
int length = 24;
if (Data != null) { length += 2 + Data.Length; }
if (Subject != null) { length += 1 + Subject.Length; }
if (FromAddress != null) { length += 1 + FromAddress.Length; }
if (MailFilter != null) { length += 1 + MailFilter.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
ObjectID = 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;
length = (ushort)bytes[i++];
_subject = new byte[length];
Array.Copy(bytes, i, _subject, 0, length); i += length;
Time = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
length = (ushort)bytes[i++];
_fromaddress = new byte[length];
Array.Copy(bytes, i, _fromaddress, 0, length); i += length;
More = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
length = (ushort)bytes[i++];
_mailfilter = new byte[length];
Array.Copy(bytes, i, _mailfilter, 0, length); i += length;
}
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(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(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;
bytes[i++] = (byte)(Time % 256);
bytes[i++] = (byte)((Time >> 8) % 256);
bytes[i++] = (byte)((Time >> 16) % 256);
bytes[i++] = (byte)((Time >> 24) % 256);
if(FromAddress == null) { Console.WriteLine("Warning: FromAddress is null, in " + this.GetType()); }
bytes[i++] = (byte)FromAddress.Length;
Array.Copy(FromAddress, 0, bytes, i, FromAddress.Length); i += FromAddress.Length;
bytes[i++] = (byte)(More % 256);
bytes[i++] = (byte)((More >> 8) % 256);
bytes[i++] = (byte)((More >> 16) % 256);
bytes[i++] = (byte)((More >> 24) % 256);
if(MailFilter == null) { Console.WriteLine("Warning: MailFilter is null, in " + this.GetType()); }
bytes[i++] = (byte)MailFilter.Length;
Array.Copy(MailFilter, 0, bytes, i, MailFilter.Length); i += MailFilter.Length;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output += Helpers.FieldToString(Subject, "Subject") + "\n";
output += "Time: " + Time.ToString() + "\n";
output += Helpers.FieldToString(FromAddress, "FromAddress") + "\n";
output += "More: " + More.ToString() + "\n";
output += Helpers.FieldToString(MailFilter, "MailFilter") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.EmailMessageReply; } }
public DataBlockBlock DataBlock;
public EmailMessageReplyPacket()
{
Header = new LowHeader();
Header.ID = 411;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public EmailMessageReplyPacket(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 EmailMessageReplyPacket(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 = "--- EmailMessageReply ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptDataRequestPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public sbyte RequestType;
private byte[] _request;
public byte[] Request
{
get { return _request; }
set
{
if (value == null) { _request = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _request = new byte[value.Length]; Array.Copy(value, _request, value.Length); }
}
}
public ulong Hash;
public int Length
{
get
{
int length = 9;
if (Request != null) { length += 2 + Request.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
RequestType = (sbyte)bytes[i++];
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_request = new byte[length];
Array.Copy(bytes, i, _request, 0, length); i += length;
Hash = (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)RequestType;
if(Request == null) { Console.WriteLine("Warning: Request is null, in " + this.GetType()); }
bytes[i++] = (byte)(Request.Length % 256);
bytes[i++] = (byte)((Request.Length >> 8) % 256);
Array.Copy(Request, 0, bytes, i, Request.Length); i += Request.Length;
bytes[i++] = (byte)(Hash % 256);
bytes[i++] = (byte)((Hash >> 8) % 256);
bytes[i++] = (byte)((Hash >> 16) % 256);
bytes[i++] = (byte)((Hash >> 24) % 256);
bytes[i++] = (byte)((Hash >> 32) % 256);
bytes[i++] = (byte)((Hash >> 40) % 256);
bytes[i++] = (byte)((Hash >> 48) % 256);
bytes[i++] = (byte)((Hash >> 56) % 256);
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "RequestType: " + RequestType.ToString() + "\n";
output += Helpers.FieldToString(Request, "Request") + "\n";
output += "Hash: " + Hash.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ScriptDataRequest; } }
public DataBlockBlock[] DataBlock;
public ScriptDataRequestPacket()
{
Header = new LowHeader();
Header.ID = 412;
Header.Reliable = true;
DataBlock = new DataBlockBlock[0];
}
public ScriptDataRequestPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(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 ScriptDataRequestPacket(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 = 8;
;
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 = "--- ScriptDataRequest ---\n";
for (int j = 0; j < DataBlock.Length; j++)
{
output += DataBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ScriptDataReplyPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public ulong Hash;
private byte[] _reply;
public byte[] Reply
{
get { return _reply; }
set
{
if (value == null) { _reply = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _reply = new byte[value.Length]; Array.Copy(value, _reply, value.Length); }
}
}
public int Length
{
get
{
int length = 8;
if (Reply != null) { length += 2 + Reply.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
Hash = (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++] + (bytes[i++] << 8));
_reply = new byte[length];
Array.Copy(bytes, i, _reply, 0, length); i += length;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)(Hash % 256);
bytes[i++] = (byte)((Hash >> 8) % 256);
bytes[i++] = (byte)((Hash >> 16) % 256);
bytes[i++] = (byte)((Hash >> 24) % 256);
bytes[i++] = (byte)((Hash >> 32) % 256);
bytes[i++] = (byte)((Hash >> 40) % 256);
bytes[i++] = (byte)((Hash >> 48) % 256);
bytes[i++] = (byte)((Hash >> 56) % 256);
if(Reply == null) { Console.WriteLine("Warning: Reply is null, in " + this.GetType()); }
bytes[i++] = (byte)(Reply.Length % 256);
bytes[i++] = (byte)((Reply.Length >> 8) % 256);
Array.Copy(Reply, 0, bytes, i, Reply.Length); i += Reply.Length;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "Hash: " + Hash.ToString() + "\n";
output += Helpers.FieldToString(Reply, "Reply") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ScriptDataReply; } }
public DataBlockBlock[] DataBlock;
public ScriptDataReplyPacket()
{
Header = new LowHeader();
Header.ID = 413;
Header.Reliable = true;
DataBlock = new DataBlockBlock[0];
}
public ScriptDataReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(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 ScriptDataReplyPacket(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 = 8;
;
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 = "--- ScriptDataReply ---\n";
for (int j = 0; j < DataBlock.Length; j++)
{
output += DataBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class CreateGroupRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "AllowPublish: " + AllowPublish.ToString() + "\n";
output += Helpers.FieldToString(Charter, "Charter") + "\n";
output += "ShowInList: " + ShowInList.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "InsigniaID: " + InsigniaID.ToString() + "\n";
output += "MembershipFee: " + MembershipFee.ToString() + "\n";
output += "MaturePublish: " + MaturePublish.ToString() + "\n";
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "\n";
output = 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 = 414;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CreateGroupReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "Success: " + Success.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 415;
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 ---\n";
output += ReplyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateGroupInfoPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "AllowPublish: " + AllowPublish.ToString() + "\n";
output += Helpers.FieldToString(Charter, "Charter") + "\n";
output += "ShowInList: " + ShowInList.ToString() + "\n";
output += "InsigniaID: " + InsigniaID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "MembershipFee: " + MembershipFee.ToString() + "\n";
output += "MaturePublish: " + MaturePublish.ToString() + "\n";
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "\n";
output = 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 = 416;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupRoleChangesPacket : Packet
{
/// <exclude/>
public class RoleChangeBlock
{
public LLUUID MemberID;
public uint Change;
public LLUUID RoleID;
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 --\n";
output += "MemberID: " + MemberID.ToString() + "\n";
output += "Change: " + Change.ToString() + "\n";
output += "RoleID: " + RoleID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 417;
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 ---\n";
for (int j = 0; j < RoleChange.Length; j++)
{
output += RoleChange[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class JoinGroupRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 418;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class JoinGroupReplyPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public bool Success;
public LLUUID GroupID;
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 --\n";
output += "Success: " + Success.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 419;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EjectGroupMemberRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class EjectDataBlock
{
public LLUUID EjecteeID;
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 --\n";
output += "EjecteeID: " + EjecteeID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 420;
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 ---\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < EjectData.Length; j++)
{
output += EjectData[j].ToString() + "\n";
}
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EjectGroupMemberReplyPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class EjectDataBlock
{
public bool Success;
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 --\n";
output += "Success: " + Success.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 421;
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 ---\n";
output += AgentData.ToString() + "\n";
output += EjectData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LeaveGroupRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 422;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LeaveGroupReplyPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public bool Success;
public LLUUID GroupID;
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 --\n";
output += "Success: " + Success.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 423;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class InviteGroupRequestPacket : Packet
{
/// <exclude/>
public class InviteDataBlock
{
public LLUUID RoleID;
public LLUUID InviteeID;
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 --\n";
output += "RoleID: " + RoleID.ToString() + "\n";
output += "InviteeID: " + InviteeID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 424;
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 ---\n";
for (int j = 0; j < InviteData.Length; j++)
{
output += InviteData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class InviteGroupResponsePacket : Packet
{
/// <exclude/>
public class InviteDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
public int MembershipFee;
public LLUUID RoleID;
public LLUUID InviteeID;
public int Length
{
get
{
return 68;
}
}
public InviteDataBlock() { }
public InviteDataBlock(byte[] bytes, ref int i)
{
try
{
AgentID = 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));
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(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)(MembershipFee % 256);
bytes[i++] = (byte)((MembershipFee >> 8) % 256);
bytes[i++] = (byte)((MembershipFee >> 16) % 256);
bytes[i++] = (byte)((MembershipFee >> 24) % 256);
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "MembershipFee: " + MembershipFee.ToString() + "\n";
output += "RoleID: " + RoleID.ToString() + "\n";
output += "InviteeID: " + InviteeID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.InviteGroupResponse; } }
public InviteDataBlock InviteData;
public InviteGroupResponsePacket()
{
Header = new LowHeader();
Header.ID = 425;
Header.Reliable = true;
InviteData = new InviteDataBlock();
}
public InviteGroupResponsePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
InviteData = new InviteDataBlock(bytes, ref i);
}
public InviteGroupResponsePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
InviteData = new InviteDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += InviteData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
InviteData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- InviteGroupResponse ---\n";
output += InviteData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupProfileRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 426;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupProfileReplyPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "OwnerRole: " + OwnerRole.ToString() + "\n";
output += "AllowPublish: " + AllowPublish.ToString() + "\n";
output += Helpers.FieldToString(Charter, "Charter") + "\n";
output += "GroupMembershipCount: " + GroupMembershipCount.ToString() + "\n";
output += "ShowInList: " + ShowInList.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(MemberTitle, "MemberTitle") + "\n";
output += "InsigniaID: " + InsigniaID.ToString() + "\n";
output += "GroupRolesCount: " + GroupRolesCount.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "MembershipFee: " + MembershipFee.ToString() + "\n";
output += "MaturePublish: " + MaturePublish.ToString() + "\n";
output += "PowersMask: " + PowersMask.ToString() + "\n";
output += "Money: " + Money.ToString() + "\n";
output += "FounderID: " + FounderID.ToString() + "\n";
output += "OpenEnrollment: " + OpenEnrollment.ToString() + "\n";
output = 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 = 427;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupAccountSummaryRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID RequestID;
public int IntervalDays;
public int CurrentInterval;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 428;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupAccountSummaryReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "ParcelDirFeeCurrent: " + ParcelDirFeeCurrent.ToString() + "\n";
output += Helpers.FieldToString(TaxDate, "TaxDate") + "\n";
output += "Balance: " + Balance.ToString() + "\n";
output += "ParcelDirFeeEstimate: " + ParcelDirFeeEstimate.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "ObjectTaxCurrent: " + ObjectTaxCurrent.ToString() + "\n";
output += "LightTaxCurrent: " + LightTaxCurrent.ToString() + "\n";
output += "LandTaxCurrent: " + LandTaxCurrent.ToString() + "\n";
output += "GroupTaxCurrent: " + GroupTaxCurrent.ToString() + "\n";
output += "TotalDebits: " + TotalDebits.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "ObjectTaxEstimate: " + ObjectTaxEstimate.ToString() + "\n";
output += "LightTaxEstimate: " + LightTaxEstimate.ToString() + "\n";
output += "LandTaxEstimate: " + LandTaxEstimate.ToString() + "\n";
output += "GroupTaxEstimate: " + GroupTaxEstimate.ToString() + "\n";
output += Helpers.FieldToString(LastTaxDate, "LastTaxDate") + "\n";
output += "NonExemptMembers: " + NonExemptMembers.ToString() + "\n";
output += Helpers.FieldToString(StartDate, "StartDate") + "\n";
output += "TotalCredits: " + TotalCredits.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 429;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupAccountDetailsRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID RequestID;
public int IntervalDays;
public int CurrentInterval;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 430;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupAccountDetailsReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += Helpers.FieldToString(StartDate, "StartDate") + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "Amount: " + Amount.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 431;
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 ---\n";
output += MoneyData.ToString() + "\n";
for (int j = 0; j < HistoryData.Length; j++)
{
output += HistoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupAccountTransactionsRequestPacket : Packet
{
/// <exclude/>
public class MoneyDataBlock
{
public LLUUID RequestID;
public int IntervalDays;
public int CurrentInterval;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 432;
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 ---\n";
output += MoneyData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupAccountTransactionsReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "IntervalDays: " + IntervalDays.ToString() + "\n";
output += Helpers.FieldToString(StartDate, "StartDate") + "\n";
output += "CurrentInterval: " + CurrentInterval.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Time, "Time") + "\n";
output += Helpers.FieldToString(Item, "Item") + "\n";
output += Helpers.FieldToString(User, "User") + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "Amount: " + Amount.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 433;
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 ---\n";
output += MoneyData.ToString() + "\n";
for (int j = 0; j < HistoryData.Length; j++)
{
output += HistoryData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupActiveProposalsRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TransactionDataBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 434;
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 ---\n";
output += AgentData.ToString() + "\n";
output += TransactionData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupActiveProposalItemReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(StartDateTime, "StartDateTime") + "\n";
output += Helpers.FieldToString(ProposalText, "ProposalText") + "\n";
output += "Majority: " + Majority.ToString() + "\n";
output += Helpers.FieldToString(TerseDateID, "TerseDateID") + "\n";
output += Helpers.FieldToString(EndDateTime, "EndDateTime") + "\n";
output += "VoteID: " + VoteID.ToString() + "\n";
output += "AlreadyVoted: " + AlreadyVoted.ToString() + "\n";
output += Helpers.FieldToString(VoteCast, "VoteCast") + "\n";
output += "Quorum: " + Quorum.ToString() + "\n";
output += "VoteInitiator: " + VoteInitiator.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TransactionDataBlock
{
public uint TotalNumItems;
public LLUUID TransactionID;
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 --\n";
output += "TotalNumItems: " + TotalNumItems.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = 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 = 435;
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 ---\n";
for (int j = 0; j < ProposalData.Length; j++)
{
output += ProposalData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += TransactionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupVoteHistoryRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TransactionDataBlock
{
public LLUUID TransactionID;
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 --\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID GroupID;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 436;
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 ---\n";
output += AgentData.ToString() + "\n";
output += TransactionData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupVoteHistoryItemReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(StartDateTime, "StartDateTime") + "\n";
output += Helpers.FieldToString(VoteResult, "VoteResult") + "\n";
output += Helpers.FieldToString(ProposalText, "ProposalText") + "\n";
output += "Majority: " + Majority.ToString() + "\n";
output += Helpers.FieldToString(TerseDateID, "TerseDateID") + "\n";
output += Helpers.FieldToString(EndDateTime, "EndDateTime") + "\n";
output += "VoteID: " + VoteID.ToString() + "\n";
output += "Quorum: " + Quorum.ToString() + "\n";
output += Helpers.FieldToString(VoteType, "VoteType") + "\n";
output += "VoteInitiator: " + VoteInitiator.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "CandidateID: " + CandidateID.ToString() + "\n";
output += Helpers.FieldToString(VoteCast, "VoteCast") + "\n";
output += "NumVotes: " + NumVotes.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TransactionDataBlock
{
public uint TotalNumItems;
public LLUUID TransactionID;
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 --\n";
output += "TotalNumItems: " + TotalNumItems.ToString() + "\n";
output += "TransactionID: " + TransactionID.ToString() + "\n";
output = 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 = 437;
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 ---\n";
output += HistoryItemData.ToString() + "\n";
for (int j = 0; j < VoteItem.Length; j++)
{
output += VoteItem[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += TransactionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class StartGroupProposalPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "Duration: " + Duration.ToString() + "\n";
output += Helpers.FieldToString(ProposalText, "ProposalText") + "\n";
output += "Majority: " + Majority.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "Quorum: " + Quorum.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 438;
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 ---\n";
output += ProposalData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupProposalBallotPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "ProposalID: " + ProposalID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += Helpers.FieldToString(VoteCast, "VoteCast") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 439;
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 ---\n";
output += ProposalData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TallyVotesPacket : Packet
{
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.TallyVotes; } }
public TallyVotesPacket()
{
Header = new LowHeader();
Header.ID = 440;
Header.Reliable = true;
}
public TallyVotesPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
}
public TallyVotesPacket(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 = "--- TallyVotes ---\n";
return output;
}
}
/// <exclude/>
public class GroupMembersRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID RequestID;
public LLUUID GroupID;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 441;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupMembersReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(OnlineStatus, "OnlineStatus") + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "Contribution: " + Contribution.ToString() + "\n";
output += "IsOwner: " + IsOwner.ToString() + "\n";
output += Helpers.FieldToString(Title, "Title") + "\n";
output += "AgentPowers: " + AgentPowers.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID RequestID;
public int MemberCount;
public LLUUID GroupID;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "MemberCount: " + MemberCount.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 442;
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 ---\n";
for (int j = 0; j < MemberData.Length; j++)
{
output += MemberData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ActivateGroupPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 443;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetGroupContributionPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public int Contribution;
public LLUUID GroupID;
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 --\n";
output += "Contribution: " + Contribution.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 444;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SetGroupAcceptNoticesPacket : Packet
{
/// <exclude/>
public class DataBlock
{
public LLUUID GroupID;
public bool AcceptNotices;
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 --\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "AcceptNotices: " + AcceptNotices.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 445;
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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupRoleDataRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID RequestID;
public LLUUID GroupID;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 446;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupRoleDataReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "Members: " + Members.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "RoleID: " + RoleID.ToString() + "\n";
output += "Powers: " + Powers.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += Helpers.FieldToString(Title, "Title") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public int RoleCount;
public LLUUID RequestID;
public LLUUID GroupID;
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 --\n";
output += "RoleCount: " + RoleCount.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 447;
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 ---\n";
for (int j = 0; j < RoleData.Length; j++)
{
output += RoleData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupRoleMembersRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public LLUUID RequestID;
public LLUUID GroupID;
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 448;
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 ---\n";
output += AgentData.ToString() + "\n";
output += GroupData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupRoleMembersReplyPacket : Packet
{
/// <exclude/>
public class MemberDataBlock
{
public LLUUID MemberID;
public LLUUID RoleID;
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 --\n";
output += "MemberID: " + MemberID.ToString() + "\n";
output += "RoleID: " + RoleID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public uint TotalPairs;
public LLUUID RequestID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "TotalPairs: " + TotalPairs.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 449;
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 ---\n";
for (int j = 0; j < MemberData.Length; j++)
{
output += MemberData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupTitlesRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID RequestID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 450;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupTitlesReplyPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID RequestID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "Selected: " + Selected.ToString() + "\n";
output += "RoleID: " + RoleID.ToString() + "\n";
output += Helpers.FieldToString(Title, "Title") + "\n";
output = 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 = 451;
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 ---\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < GroupData.Length; j++)
{
output += GroupData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class GroupTitleUpdatePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
public LLUUID TitleRoleID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "TitleRoleID: " + TitleRoleID.ToString() + "\n";
output = 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 = 452;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupRoleUpdatePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "RoleID: " + RoleID.ToString() + "\n";
output += "UpdateType: " + UpdateType.ToString() + "\n";
output += "Powers: " + Powers.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += Helpers.FieldToString(Title, "Title") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 453;
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 ---\n";
for (int j = 0; j < RoleData.Length; j++)
{
output += RoleData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LiveHelpGroupRequestPacket : Packet
{
/// <exclude/>
public class RequestDataBlock
{
public LLUUID AgentID;
public LLUUID RequestID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output = 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 = 454;
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 ---\n";
output += RequestData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LiveHelpGroupReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "RequestID: " + RequestID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += Helpers.FieldToString(Selection, "Selection") + "\n";
output = 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 = 455;
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 ---\n";
output += ReplyData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentWearablesRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 456;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentWearablesUpdatePacket : Packet
{
/// <exclude/>
public class WearableDataBlock
{
public byte WearableType;
public LLUUID AssetID;
public LLUUID ItemID;
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 --\n";
output += "WearableType: " + WearableType.ToString() + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public uint SerialNum;
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "SerialNum: " + SerialNum.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 457;
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 ---\n";
for (int j = 0; j < WearableData.Length; j++)
{
output += WearableData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentIsNowWearingPacket : Packet
{
/// <exclude/>
public class WearableDataBlock
{
public byte WearableType;
public LLUUID ItemID;
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 --\n";
output += "WearableType: " + WearableType.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 458;
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 ---\n";
for (int j = 0; j < WearableData.Length; j++)
{
output += WearableData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentCachedTexturePacket : Packet
{
/// <exclude/>
public class WearableDataBlock
{
public LLUUID ID;
public byte TextureIndex;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "TextureIndex: " + TextureIndex.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public int SerialNum;
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "SerialNum: " + SerialNum.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 459;
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 ---\n";
for (int j = 0; j < WearableData.Length; j++)
{
output += WearableData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentCachedTextureResponsePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "TextureID: " + TextureID.ToString() + "\n";
output += "TextureIndex: " + TextureIndex.ToString() + "\n";
output += Helpers.FieldToString(HostName, "HostName") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public int SerialNum;
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "SerialNum: " + SerialNum.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 460;
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 ---\n";
for (int j = 0; j < WearableData.Length; j++)
{
output += WearableData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentDataUpdateRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 461;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentDataUpdatePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(GroupTitle, "GroupTitle") + "\n";
output += "GroupPowers: " + GroupPowers.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(LastName, "LastName") + "\n";
output += Helpers.FieldToString(FirstName, "FirstName") + "\n";
output += Helpers.FieldToString(GroupName, "GroupName") + "\n";
output += "ActiveGroupID: " + ActiveGroupID.ToString() + "\n";
output = 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 = 462;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GroupDataUpdatePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(GroupTitle, "GroupTitle") + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "AgentPowers: " + AgentPowers.ToString() + "\n";
output = 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 = 463;
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 ---\n";
for (int j = 0; j < AgentGroupData.Length; j++)
{
output += AgentGroupData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AgentGroupDataUpdatePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "GroupPowers: " + GroupPowers.ToString() + "\n";
output += "Contribution: " + Contribution.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "GroupInsigniaID: " + GroupInsigniaID.ToString() + "\n";
output += "AcceptNotices: " + AcceptNotices.ToString() + "\n";
output += Helpers.FieldToString(GroupName, "GroupName") + "\n";
output = 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 = 464;
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 ---\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < GroupData.Length; j++)
{
output += GroupData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AgentDropGroupPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 = 465;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LogTextMessagePacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID ToAgentId;
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 double GlobalX;
public double GlobalY;
public uint Time;
public LLUUID FromAgentId;
public int Length
{
get
{
int length = 52;
if (Message != null) { length += 2 + Message.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
ToAgentId = 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;
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;
Time = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
FromAgentId = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
byte[] ba;
if(ToAgentId == null) { Console.WriteLine("Warning: ToAgentId is null, in " + this.GetType()); }
Array.Copy(ToAgentId.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;
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;
bytes[i++] = (byte)(Time % 256);
bytes[i++] = (byte)((Time >> 8) % 256);
bytes[i++] = (byte)((Time >> 16) % 256);
bytes[i++] = (byte)((Time >> 24) % 256);
if(FromAgentId == null) { Console.WriteLine("Warning: FromAgentId is null, in " + this.GetType()); }
Array.Copy(FromAgentId.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "ToAgentId: " + ToAgentId.ToString() + "\n";
output += Helpers.FieldToString(Message, "Message") + "\n";
output += "GlobalX: " + GlobalX.ToString() + "\n";
output += "GlobalY: " + GlobalY.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "FromAgentId: " + FromAgentId.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.LogTextMessage; } }
public DataBlockBlock[] DataBlock;
public LogTextMessagePacket()
{
Header = new LowHeader();
Header.ID = 466;
Header.Reliable = true;
Header.Zerocoded = true;
DataBlock = new DataBlockBlock[0];
}
public LogTextMessagePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(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 LogTextMessagePacket(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 = 8;
;
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 = "--- LogTextMessage ---\n";
for (int j = 0; j < DataBlock.Length; j++)
{
output += DataBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class CreateTrustedCircuitPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public byte[] Digest;
public LLUUID EndPointID;
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 --\n";
output += Helpers.FieldToString(Digest, "Digest") + "\n";
output += "EndPointID: " + EndPointID.ToString() + "\n";
output = 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 = 467;
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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DenyTrustedCircuitPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID EndPointID;
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 --\n";
output += "EndPointID: " + EndPointID.ToString() + "\n";
output = 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 = 468;
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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RezSingleAttachmentFromInvPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "ItemFlags: " + ItemFlags.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "AttachmentPt: " + AttachmentPt.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 469;
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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RezMultipleAttachmentsFromInvPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "ItemFlags: " + ItemFlags.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "AttachmentPt: " + AttachmentPt.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class HeaderDataBlock
{
public LLUUID CompoundMsgID;
public bool FirstDetachAll;
public byte TotalObjects;
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 --\n";
output += "CompoundMsgID: " + CompoundMsgID.ToString() + "\n";
output += "FirstDetachAll: " + FirstDetachAll.ToString() + "\n";
output += "TotalObjects: " + TotalObjects.ToString() + "\n";
output = 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 = 470;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += HeaderData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class DetachAttachmentIntoInvPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID AgentID;
public LLUUID ItemID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output = 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 = 471;
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 ---\n";
output += ObjectData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CreateNewOutfitAttachmentsPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID OldFolderID;
public LLUUID OldItemID;
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 --\n";
output += "OldFolderID: " + OldFolderID.ToString() + "\n";
output += "OldItemID: " + OldItemID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class HeaderDataBlock
{
public LLUUID NewFolderID;
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 --\n";
output += "NewFolderID: " + NewFolderID.ToString() + "\n";
output = 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 = 472;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
output += HeaderData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserInfoRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 473;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UserInfoReplyPacket : Packet
{
/// <exclude/>
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); }
}
}
public bool IMViaEMail;
public int Length
{
get
{
int length = 1;
if (EMail != null) { length += 2 + EMail.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;
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;
bytes[i++] = (byte)((IMViaEMail) ? 1 : 0);
}
public override string ToString()
{
string output = "-- UserData --\n";
output += Helpers.FieldToString(EMail, "EMail") + "\n";
output += "IMViaEMail: " + IMViaEMail.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 474;
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 ---\n";
output += UserData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class UpdateUserInfoPacket : Packet
{
/// <exclude/>
public class UserDataBlock
{
public bool IMViaEMail;
public int Length
{
get
{
return 1;
}
}
public UserDataBlock() { }
public UserDataBlock(byte[] bytes, ref int i)
{
try
{
IMViaEMail = (bytes[i++] != 0) ? (bool)true : (bool)false;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((IMViaEMail) ? 1 : 0);
}
public override string ToString()
{
string output = "-- UserData --\n";
output += "IMViaEMail: " + IMViaEMail.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 475;
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 ---\n";
output += UserData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GodExpungeUserPacket : Packet
{
/// <exclude/>
public class ExpungeDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 476;
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 ---\n";
for (int j = 0; j < ExpungeData.Length; j++)
{
output += ExpungeData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class StartExpungeProcessPacket : Packet
{
/// <exclude/>
public class ExpungeDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.StartExpungeProcess; } }
public ExpungeDataBlock[] ExpungeData;
public StartExpungeProcessPacket()
{
Header = new LowHeader();
Header.ID = 477;
Header.Reliable = true;
Header.Zerocoded = true;
ExpungeData = new ExpungeDataBlock[0];
}
public StartExpungeProcessPacket(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); }
}
public StartExpungeProcessPacket(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); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- StartExpungeProcess ---\n";
for (int j = 0; j < ExpungeData.Length; j++)
{
output += ExpungeData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class StartExpungeProcessAckPacket : Packet
{
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.StartExpungeProcessAck; } }
public StartExpungeProcessAckPacket()
{
Header = new LowHeader();
Header.ID = 478;
Header.Reliable = true;
}
public StartExpungeProcessAckPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
}
public StartExpungeProcessAckPacket(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 = "--- StartExpungeProcessAck ---\n";
return output;
}
}
/// <exclude/>
public class StartParcelRenamePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
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 ParcelID;
public int Length
{
get
{
int length = 16;
if (NewName != null) { length += 1 + NewName.Length; }
return length;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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;
ParcelID = 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(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 = "-- ParcelData --\n";
output += Helpers.FieldToString(NewName, "NewName") + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.StartParcelRename; } }
public ParcelDataBlock[] ParcelData;
public StartParcelRenamePacket()
{
Header = new LowHeader();
Header.ID = 479;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public StartParcelRenamePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public StartParcelRenamePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- StartParcelRename ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class StartParcelRenameAckPacket : Packet
{
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.StartParcelRenameAck; } }
public StartParcelRenameAckPacket()
{
Header = new LowHeader();
Header.ID = 480;
Header.Reliable = true;
}
public StartParcelRenameAckPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
}
public StartParcelRenameAckPacket(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 = "--- StartParcelRenameAck ---\n";
return output;
}
}
/// <exclude/>
public class BulkParcelRenamePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
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 ParcelID;
public ulong RegionHandle;
public int Length
{
get
{
int length = 24;
if (NewName != null) { length += 1 + NewName.Length; }
return length;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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;
ParcelID = 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(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(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
Array.Copy(ParcelID.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 = "-- ParcelData --\n";
output += Helpers.FieldToString(NewName, "NewName") + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.BulkParcelRename; } }
public ParcelDataBlock[] ParcelData;
public BulkParcelRenamePacket()
{
Header = new LowHeader();
Header.ID = 481;
Header.Reliable = true;
Header.Zerocoded = true;
ParcelData = new ParcelDataBlock[0];
}
public BulkParcelRenamePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public BulkParcelRenamePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- BulkParcelRename ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ParcelRenamePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
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 ParcelID;
public int Length
{
get
{
int length = 16;
if (NewName != null) { length += 1 + NewName.Length; }
return length;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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;
ParcelID = 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(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 = "-- ParcelData --\n";
output += Helpers.FieldToString(NewName, "NewName") + "\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ParcelRename; } }
public ParcelDataBlock[] ParcelData;
public ParcelRenamePacket()
{
Header = new LowHeader();
Header.ID = 482;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public ParcelRenamePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public ParcelRenamePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- ParcelRename ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class StartParcelRemovePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public LLUUID ParcelID;
public int Length
{
get
{
return 16;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(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 = "-- ParcelData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.StartParcelRemove; } }
public ParcelDataBlock[] ParcelData;
public StartParcelRemovePacket()
{
Header = new LowHeader();
Header.ID = 483;
Header.Reliable = true;
ParcelData = new ParcelDataBlock[0];
}
public StartParcelRemovePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public StartParcelRemovePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- StartParcelRemove ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
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 = 484;
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 ---\n";
return output;
}
}
/// <exclude/>
public class BulkParcelRemovePacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public LLUUID ParcelID;
public ulong RegionHandle;
public int Length
{
get
{
return 24;
}
}
public ParcelDataBlock() { }
public ParcelDataBlock(byte[] bytes, ref int i)
{
try
{
ParcelID = 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(ParcelID == null) { Console.WriteLine("Warning: ParcelID is null, in " + this.GetType()); }
Array.Copy(ParcelID.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 = "-- ParcelData --\n";
output += "ParcelID: " + ParcelID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.BulkParcelRemove; } }
public ParcelDataBlock[] ParcelData;
public BulkParcelRemovePacket()
{
Header = new LowHeader();
Header.ID = 485;
Header.Reliable = true;
Header.Zerocoded = true;
ParcelData = new ParcelDataBlock[0];
}
public BulkParcelRemovePacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public BulkParcelRemovePacket(Header head, byte[] bytes, ref int i)
{
Header = head;
int count = (int)bytes[i++];
ParcelData = new ParcelDataBlock[count];
for (int j = 0; j < count; j++)
{ ParcelData[j] = new ParcelDataBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 8;
;
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);
bytes[i++] = (byte)ParcelData.Length;
for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); }
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- BulkParcelRemove ---\n";
for (int j = 0; j < ParcelData.Length; j++)
{
output += ParcelData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class InitiateUploadPacket : Packet
{
/// <exclude/>
public class FileDataBlock
{
private byte[] _sourcefilename;
public byte[] SourceFilename
{
get { return _sourcefilename; }
set
{
if (value == null) { _sourcefilename = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _sourcefilename = new byte[value.Length]; Array.Copy(value, _sourcefilename, value.Length); }
}
}
private byte[] _basefilename;
public byte[] BaseFilename
{
get { return _basefilename; }
set
{
if (value == null) { _basefilename = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _basefilename = new byte[value.Length]; Array.Copy(value, _basefilename, value.Length); }
}
}
public int Length
{
get
{
int length = 0;
if (SourceFilename != null) { length += 1 + SourceFilename.Length; }
if (BaseFilename != null) { length += 1 + BaseFilename.Length; }
return length;
}
}
public FileDataBlock() { }
public FileDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)bytes[i++];
_sourcefilename = new byte[length];
Array.Copy(bytes, i, _sourcefilename, 0, length); i += length;
length = (ushort)bytes[i++];
_basefilename = new byte[length];
Array.Copy(bytes, i, _basefilename, 0, length); i += length;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(SourceFilename == null) { Console.WriteLine("Warning: SourceFilename is null, in " + this.GetType()); }
bytes[i++] = (byte)SourceFilename.Length;
Array.Copy(SourceFilename, 0, bytes, i, SourceFilename.Length); i += SourceFilename.Length;
if(BaseFilename == null) { Console.WriteLine("Warning: BaseFilename is null, in " + this.GetType()); }
bytes[i++] = (byte)BaseFilename.Length;
Array.Copy(BaseFilename, 0, bytes, i, BaseFilename.Length); i += BaseFilename.Length;
}
public override string ToString()
{
string output = "-- FileData --\n";
output += Helpers.FieldToString(SourceFilename, "SourceFilename") + "\n";
output += Helpers.FieldToString(BaseFilename, "BaseFilename") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.InitiateUpload; } }
public FileDataBlock FileData;
public AgentDataBlock AgentData;
public InitiateUploadPacket()
{
Header = new LowHeader();
Header.ID = 486;
Header.Reliable = true;
FileData = new FileDataBlock();
AgentData = new AgentDataBlock();
}
public InitiateUploadPacket(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 InitiateUploadPacket(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 = "--- InitiateUpload ---\n";
output += FileData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class InitiateDownloadPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(SimFilename, "SimFilename") + "\n";
output += Helpers.FieldToString(ViewerFilename, "ViewerFilename") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output = 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 = 487;
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 ---\n";
output += FileData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SystemMessagePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "Invoice: " + Invoice.ToString() + "\n";
output += Helpers.FieldToString(Digest, "Digest") + "\n";
output += Helpers.FieldToString(Method, "Method") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Parameter, "Parameter") + "\n";
output = 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 = 488;
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 ---\n";
output += MethodData.ToString() + "\n";
for (int j = 0; j < ParamList.Length; j++)
{
output += ParamList[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class MapLayerRequestPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Godlike;
public uint Flags;
public uint EstateID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = 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 = 489;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MapLayerReplyPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public uint Flags;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class LayerDataBlock
{
public uint Top;
public LLUUID ImageID;
public uint Left;
public uint Bottom;
public uint Right;
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 --\n";
output += "Top: " + Top.ToString() + "\n";
output += "ImageID: " + ImageID.ToString() + "\n";
output += "Left: " + Left.ToString() + "\n";
output += "Bottom: " + Bottom.ToString() + "\n";
output += "Right: " + Right.ToString() + "\n";
output = 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 = 490;
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 ---\n";
output += AgentData.ToString() + "\n";
for (int j = 0; j < LayerData.Length; j++)
{
output += LayerData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class MapBlockRequestPacket : Packet
{
/// <exclude/>
public class PositionDataBlock
{
public ushort MaxX;
public ushort MaxY;
public ushort MinX;
public ushort MinY;
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 --\n";
output += "MaxX: " + MaxX.ToString() + "\n";
output += "MaxY: " + MaxY.ToString() + "\n";
output += "MinX: " + MinX.ToString() + "\n";
output += "MinY: " + MinY.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Godlike;
public uint Flags;
public uint EstateID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = 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 = 491;
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 ---\n";
output += PositionData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MapNameRequestPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Godlike;
public uint Flags;
public uint EstateID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = 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 = 492;
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 ---\n";
output += NameData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MapBlockReplyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "X: " + X.ToString() + "\n";
output += "Y: " + Y.ToString() + "\n";
output += "RegionFlags: " + RegionFlags.ToString() + "\n";
output += "WaterHeight: " + WaterHeight.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Access: " + Access.ToString() + "\n";
output += "MapImageID: " + MapImageID.ToString() + "\n";
output += "Agents: " + Agents.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public uint Flags;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 = 493;
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 ---\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MapItemRequestPacket : Packet
{
/// <exclude/>
public class RequestDataBlock
{
public ulong RegionHandle;
public uint ItemType;
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 --\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "ItemType: " + ItemType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public bool Godlike;
public uint Flags;
public uint EstateID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Godlike: " + Godlike.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "EstateID: " + EstateID.ToString() + "\n";
output = 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 = 494;
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 ---\n";
output += RequestData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MapItemReplyPacket : Packet
{
/// <exclude/>
public class RequestDataBlock
{
public uint ItemType;
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 --\n";
output += "ItemType: " + ItemType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += "X: " + X.ToString() + "\n";
output += "Y: " + Y.ToString() + "\n";
output += "ID: " + ID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Extra2: " + Extra2.ToString() + "\n";
output += "Extra: " + Extra.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public uint Flags;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 = 495;
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 ---\n";
output += RequestData.ToString() + "\n";
for (int j = 0; j < Data.Length; j++)
{
output += Data[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SendPostcardPacket : Packet
{
/// <exclude/>
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;
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);
if(PosGlobal == null) { Console.WriteLine("Warning: PosGlobal is null, in " + this.GetType()); }
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 --\n";
output += Helpers.FieldToString(To, "To") + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += Helpers.FieldToString(Msg, "Msg") + "\n";
output += "AllowPublish: " + AllowPublish.ToString() + "\n";
output += "PosGlobal: " + PosGlobal.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += Helpers.FieldToString(Subject, "Subject") + "\n";
output += Helpers.FieldToString(From, "From") + "\n";
output += "AssetID: " + AssetID.ToString() + "\n";
output += "MaturePublish: " + MaturePublish.ToString() + "\n";
output = 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 = 496;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RpcChannelRequestPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID TaskID;
public LLUUID ItemID;
public uint GridX;
public uint GridY;
public int Length
{
get
{
return 40;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
try
{
TaskID = new LLUUID(bytes, i); i += 16;
ItemID = new LLUUID(bytes, i); i += 16;
GridX = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridY = (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(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)(GridX % 256);
bytes[i++] = (byte)((GridX >> 8) % 256);
bytes[i++] = (byte)((GridX >> 16) % 256);
bytes[i++] = (byte)((GridX >> 24) % 256);
bytes[i++] = (byte)(GridY % 256);
bytes[i++] = (byte)((GridY >> 8) % 256);
bytes[i++] = (byte)((GridY >> 16) % 256);
bytes[i++] = (byte)((GridY >> 24) % 256);
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "GridX: " + GridX.ToString() + "\n";
output += "GridY: " + GridY.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RpcChannelRequest; } }
public DataBlockBlock DataBlock;
public RpcChannelRequestPacket()
{
Header = new LowHeader();
Header.ID = 497;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public RpcChannelRequestPacket(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 RpcChannelRequestPacket(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 = "--- RpcChannelRequest ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RpcChannelReplyPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID TaskID;
public LLUUID ItemID;
public LLUUID ChannelID;
public int Length
{
get
{
return 48;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
try
{
TaskID = new LLUUID(bytes, i); i += 16;
ItemID = new LLUUID(bytes, i); i += 16;
ChannelID = 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;
if(ItemID == null) { Console.WriteLine("Warning: ItemID is null, in " + this.GetType()); }
Array.Copy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16;
if(ChannelID == null) { Console.WriteLine("Warning: ChannelID is null, in " + this.GetType()); }
Array.Copy(ChannelID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "ChannelID: " + ChannelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RpcChannelReply; } }
public DataBlockBlock DataBlock;
public RpcChannelReplyPacket()
{
Header = new LowHeader();
Header.ID = 498;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public RpcChannelReplyPacket(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 RpcChannelReplyPacket(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 = "--- RpcChannelReply ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RpcScriptRequestInboundPacket : Packet
{
/// <exclude/>
public class TargetBlockBlock
{
public uint GridX;
public uint GridY;
public int Length
{
get
{
return 8;
}
}
public TargetBlockBlock() { }
public TargetBlockBlock(byte[] bytes, ref int i)
{
try
{
GridX = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
GridY = (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)(GridX % 256);
bytes[i++] = (byte)((GridX >> 8) % 256);
bytes[i++] = (byte)((GridX >> 16) % 256);
bytes[i++] = (byte)((GridX >> 24) % 256);
bytes[i++] = (byte)(GridY % 256);
bytes[i++] = (byte)((GridY >> 8) % 256);
bytes[i++] = (byte)((GridY >> 16) % 256);
bytes[i++] = (byte)((GridY >> 24) % 256);
}
public override string ToString()
{
string output = "-- TargetBlock --\n";
output += "GridX: " + GridX.ToString() + "\n";
output += "GridY: " + GridY.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class DataBlockBlock
{
private byte[] _stringvalue;
public byte[] StringValue
{
get { return _stringvalue; }
set
{
if (value == null) { _stringvalue = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _stringvalue = new byte[value.Length]; Array.Copy(value, _stringvalue, value.Length); }
}
}
public LLUUID TaskID;
public LLUUID ItemID;
public uint IntValue;
public LLUUID ChannelID;
public int Length
{
get
{
int length = 52;
if (StringValue != null) { length += 2 + StringValue.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_stringvalue = new byte[length];
Array.Copy(bytes, i, _stringvalue, 0, length); i += length;
TaskID = new LLUUID(bytes, i); i += 16;
ItemID = new LLUUID(bytes, i); i += 16;
IntValue = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ChannelID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(StringValue == null) { Console.WriteLine("Warning: StringValue is null, in " + this.GetType()); }
bytes[i++] = (byte)(StringValue.Length % 256);
bytes[i++] = (byte)((StringValue.Length >> 8) % 256);
Array.Copy(StringValue, 0, bytes, i, StringValue.Length); i += StringValue.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)(IntValue % 256);
bytes[i++] = (byte)((IntValue >> 8) % 256);
bytes[i++] = (byte)((IntValue >> 16) % 256);
bytes[i++] = (byte)((IntValue >> 24) % 256);
if(ChannelID == null) { Console.WriteLine("Warning: ChannelID is null, in " + this.GetType()); }
Array.Copy(ChannelID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += Helpers.FieldToString(StringValue, "StringValue") + "\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "IntValue: " + IntValue.ToString() + "\n";
output += "ChannelID: " + ChannelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RpcScriptRequestInbound; } }
public TargetBlockBlock TargetBlock;
public DataBlockBlock DataBlock;
public RpcScriptRequestInboundPacket()
{
Header = new LowHeader();
Header.ID = 499;
Header.Reliable = true;
TargetBlock = new TargetBlockBlock();
DataBlock = new DataBlockBlock();
}
public RpcScriptRequestInboundPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
TargetBlock = new TargetBlockBlock(bytes, ref i);
DataBlock = new DataBlockBlock(bytes, ref i);
}
public RpcScriptRequestInboundPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
TargetBlock = new TargetBlockBlock(bytes, ref i);
DataBlock = new DataBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TargetBlock.Length; 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);
TargetBlock.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 = "--- RpcScriptRequestInbound ---\n";
output += TargetBlock.ToString() + "\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RpcScriptRequestInboundForwardPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public uint RPCServerIP;
private byte[] _stringvalue;
public byte[] StringValue
{
get { return _stringvalue; }
set
{
if (value == null) { _stringvalue = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _stringvalue = new byte[value.Length]; Array.Copy(value, _stringvalue, value.Length); }
}
}
public LLUUID TaskID;
public LLUUID ItemID;
public uint IntValue;
public LLUUID ChannelID;
public ushort RPCServerPort;
public int Length
{
get
{
int length = 58;
if (StringValue != null) { length += 2 + StringValue.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
RPCServerIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_stringvalue = new byte[length];
Array.Copy(bytes, i, _stringvalue, 0, length); i += length;
TaskID = new LLUUID(bytes, i); i += 16;
ItemID = new LLUUID(bytes, i); i += 16;
IntValue = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ChannelID = new LLUUID(bytes, i); i += 16;
RPCServerPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)(RPCServerIP % 256);
bytes[i++] = (byte)((RPCServerIP >> 8) % 256);
bytes[i++] = (byte)((RPCServerIP >> 16) % 256);
bytes[i++] = (byte)((RPCServerIP >> 24) % 256);
if(StringValue == null) { Console.WriteLine("Warning: StringValue is null, in " + this.GetType()); }
bytes[i++] = (byte)(StringValue.Length % 256);
bytes[i++] = (byte)((StringValue.Length >> 8) % 256);
Array.Copy(StringValue, 0, bytes, i, StringValue.Length); i += StringValue.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)(IntValue % 256);
bytes[i++] = (byte)((IntValue >> 8) % 256);
bytes[i++] = (byte)((IntValue >> 16) % 256);
bytes[i++] = (byte)((IntValue >> 24) % 256);
if(ChannelID == null) { Console.WriteLine("Warning: ChannelID is null, in " + this.GetType()); }
Array.Copy(ChannelID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = (byte)((RPCServerPort >> 8) % 256);
bytes[i++] = (byte)(RPCServerPort % 256);
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "RPCServerIP: " + RPCServerIP.ToString() + "\n";
output += Helpers.FieldToString(StringValue, "StringValue") + "\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "IntValue: " + IntValue.ToString() + "\n";
output += "ChannelID: " + ChannelID.ToString() + "\n";
output += "RPCServerPort: " + RPCServerPort.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RpcScriptRequestInboundForward; } }
public DataBlockBlock DataBlock;
public RpcScriptRequestInboundForwardPacket()
{
Header = new LowHeader();
Header.ID = 500;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public RpcScriptRequestInboundForwardPacket(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 RpcScriptRequestInboundForwardPacket(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 = "--- RpcScriptRequestInboundForward ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RpcScriptReplyInboundPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
private byte[] _stringvalue;
public byte[] StringValue
{
get { return _stringvalue; }
set
{
if (value == null) { _stringvalue = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _stringvalue = new byte[value.Length]; Array.Copy(value, _stringvalue, value.Length); }
}
}
public LLUUID TaskID;
public LLUUID ItemID;
public uint IntValue;
public LLUUID ChannelID;
public int Length
{
get
{
int length = 52;
if (StringValue != null) { length += 2 + StringValue.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_stringvalue = new byte[length];
Array.Copy(bytes, i, _stringvalue, 0, length); i += length;
TaskID = new LLUUID(bytes, i); i += 16;
ItemID = new LLUUID(bytes, i); i += 16;
IntValue = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ChannelID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(StringValue == null) { Console.WriteLine("Warning: StringValue is null, in " + this.GetType()); }
bytes[i++] = (byte)(StringValue.Length % 256);
bytes[i++] = (byte)((StringValue.Length >> 8) % 256);
Array.Copy(StringValue, 0, bytes, i, StringValue.Length); i += StringValue.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)(IntValue % 256);
bytes[i++] = (byte)((IntValue >> 8) % 256);
bytes[i++] = (byte)((IntValue >> 16) % 256);
bytes[i++] = (byte)((IntValue >> 24) % 256);
if(ChannelID == null) { Console.WriteLine("Warning: ChannelID is null, in " + this.GetType()); }
Array.Copy(ChannelID.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += Helpers.FieldToString(StringValue, "StringValue") + "\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "IntValue: " + IntValue.ToString() + "\n";
output += "ChannelID: " + ChannelID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.RpcScriptReplyInbound; } }
public DataBlockBlock DataBlock;
public RpcScriptReplyInboundPacket()
{
Header = new LowHeader();
Header.ID = 501;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public RpcScriptReplyInboundPacket(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 RpcScriptReplyInboundPacket(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 = "--- RpcScriptReplyInbound ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MailTaskSimRequestPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID TaskID;
public int Length
{
get
{
return 16;
}
}
public DataBlockBlock() { }
public DataBlockBlock(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 = "-- DataBlock --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.MailTaskSimRequest; } }
public DataBlockBlock DataBlock;
public MailTaskSimRequestPacket()
{
Header = new LowHeader();
Header.ID = 502;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public MailTaskSimRequestPacket(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 MailTaskSimRequestPacket(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 = "--- MailTaskSimRequest ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MailTaskSimReplyPacket : Packet
{
/// <exclude/>
public class TargetBlockBlock
{
private byte[] _targetip;
public byte[] TargetIP
{
get { return _targetip; }
set
{
if (value == null) { _targetip = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _targetip = new byte[value.Length]; Array.Copy(value, _targetip, value.Length); }
}
}
public ushort TargetPort;
public int Length
{
get
{
int length = 2;
if (TargetIP != null) { length += 1 + TargetIP.Length; }
return length;
}
}
public TargetBlockBlock() { }
public TargetBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)bytes[i++];
_targetip = new byte[length];
Array.Copy(bytes, i, _targetip, 0, length); i += length;
TargetPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
if(TargetIP == null) { Console.WriteLine("Warning: TargetIP is null, in " + this.GetType()); }
bytes[i++] = (byte)TargetIP.Length;
Array.Copy(TargetIP, 0, bytes, i, TargetIP.Length); i += TargetIP.Length;
bytes[i++] = (byte)((TargetPort >> 8) % 256);
bytes[i++] = (byte)(TargetPort % 256);
}
public override string ToString()
{
string output = "-- TargetBlock --\n";
output += Helpers.FieldToString(TargetIP, "TargetIP") + "\n";
output += "TargetPort: " + TargetPort.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class DataBlockBlock
{
public LLUUID TaskID;
public int Length
{
get
{
return 16;
}
}
public DataBlockBlock() { }
public DataBlockBlock(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 = "-- DataBlock --\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.MailTaskSimReply; } }
public TargetBlockBlock TargetBlock;
public DataBlockBlock DataBlock;
public MailTaskSimReplyPacket()
{
Header = new LowHeader();
Header.ID = 503;
Header.Reliable = true;
TargetBlock = new TargetBlockBlock();
DataBlock = new DataBlockBlock();
}
public MailTaskSimReplyPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new LowHeader(bytes, ref i, ref packetEnd);
TargetBlock = new TargetBlockBlock(bytes, ref i);
DataBlock = new DataBlockBlock(bytes, ref i);
}
public MailTaskSimReplyPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
TargetBlock = new TargetBlockBlock(bytes, ref i);
DataBlock = new DataBlockBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 8;
length += TargetBlock.Length; 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);
TargetBlock.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 = "--- MailTaskSimReply ---\n";
output += TargetBlock.ToString() + "\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ScriptMailRegistrationPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
private byte[] _targetip;
public byte[] TargetIP
{
get { return _targetip; }
set
{
if (value == null) { _targetip = null; return; }
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
else { _targetip = new byte[value.Length]; Array.Copy(value, _targetip, value.Length); }
}
}
public LLUUID TaskID;
public ushort TargetPort;
public uint Flags;
public int Length
{
get
{
int length = 22;
if (TargetIP != null) { length += 1 + TargetIP.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
length = (ushort)bytes[i++];
_targetip = new byte[length];
Array.Copy(bytes, i, _targetip, 0, length); i += length;
TaskID = new LLUUID(bytes, i); i += 16;
TargetPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
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(TargetIP == null) { Console.WriteLine("Warning: TargetIP is null, in " + this.GetType()); }
bytes[i++] = (byte)TargetIP.Length;
Array.Copy(TargetIP, 0, bytes, i, TargetIP.Length); i += TargetIP.Length;
if(TaskID == null) { Console.WriteLine("Warning: TaskID is null, in " + this.GetType()); }
Array.Copy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = (byte)((TargetPort >> 8) % 256);
bytes[i++] = (byte)(TargetPort % 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 = "-- DataBlock --\n";
output += Helpers.FieldToString(TargetIP, "TargetIP") + "\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "TargetPort: " + TargetPort.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ScriptMailRegistration; } }
public DataBlockBlock DataBlock;
public ScriptMailRegistrationPacket()
{
Header = new LowHeader();
Header.ID = 504;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public ScriptMailRegistrationPacket(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 ScriptMailRegistrationPacket(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 = "--- ScriptMailRegistration ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelMediaCommandMessagePacket : Packet
{
/// <exclude/>
public class CommandBlockBlock
{
public uint Command;
public float Time;
public uint Flags;
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 --\n";
output += "Command: " + Command.ToString() + "\n";
output += "Time: " + Time.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 = 505;
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 ---\n";
output += CommandBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelMediaUpdatePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "MediaID: " + MediaID.ToString() + "\n";
output += Helpers.FieldToString(MediaURL, "MediaURL") + "\n";
output += "MediaAutoScale: " + MediaAutoScale.ToString() + "\n";
output = 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 = 506;
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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LandStatRequestPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "RequestFlags: " + RequestFlags.ToString() + "\n";
output += "ReportType: " + ReportType.ToString() + "\n";
output += Helpers.FieldToString(Filter, "Filter") + "\n";
output += "ParcelLocalID: " + ParcelLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 507;
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 ---\n";
output += RequestData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LandStatReplyPacket : Packet
{
/// <exclude/>
public class RequestDataBlock
{
public uint RequestFlags;
public uint ReportType;
public uint TotalObjectCount;
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 --\n";
output += "RequestFlags: " + RequestFlags.ToString() + "\n";
output += "ReportType: " + ReportType.ToString() + "\n";
output += "TotalObjectCount: " + TotalObjectCount.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += "LocationX: " + LocationX.ToString() + "\n";
output += "LocationY: " + LocationY.ToString() + "\n";
output += "LocationZ: " + LocationZ.ToString() + "\n";
output += Helpers.FieldToString(TaskName, "TaskName") + "\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output += "Score: " + Score.ToString() + "\n";
output += "TaskLocalID: " + TaskLocalID.ToString() + "\n";
output += Helpers.FieldToString(OwnerName, "OwnerName") + "\n";
output = 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 = 508;
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 ---\n";
output += RequestData.ToString() + "\n";
for (int j = 0; j < ReportData.Length; j++)
{
output += ReportData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SecuredTemplateChecksumRequestPacket : Packet
{
/// <exclude/>
public class TokenBlockBlock
{
public LLUUID Token;
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 --\n";
output += "Token: " + Token.ToString() + "\n";
output = 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 ---\n";
output += TokenBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PacketAckPacket : Packet
{
/// <exclude/>
public class PacketsBlock
{
public uint ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < Packets.Length; j++)
{
output += Packets[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class OpenCircuitPacket : Packet
{
/// <exclude/>
public class CircuitInfoBlock
{
public uint IP;
public ushort Port;
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 --\n";
output += "IP: " + IP.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output = 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 ---\n";
output += CircuitInfo.ToString() + "\n";
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 ---\n";
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 ---\n";
return output;
}
}
/// <exclude/>
public class TemplateChecksumReplyPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public byte ServerVersion;
public byte PatchVersion;
public uint Checksum;
public uint Flags;
public byte MajorVersion;
public byte MinorVersion;
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 --\n";
output += "ServerVersion: " + ServerVersion.ToString() + "\n";
output += "PatchVersion: " + PatchVersion.ToString() + "\n";
output += "Checksum: " + Checksum.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "MajorVersion: " + MajorVersion.ToString() + "\n";
output += "MinorVersion: " + MinorVersion.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class TokenBlockBlock
{
public LLUUID Token;
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 --\n";
output += "Token: " + Token.ToString() + "\n";
output = 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 ---\n";
output += DataBlock.ToString() + "\n";
output += TokenBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ClosestSimulatorPacket : Packet
{
/// <exclude/>
public class SimulatorBlockBlock
{
public uint IP;
public ushort Port;
public ulong Handle;
public int Length
{
get
{
return 14;
}
}
public SimulatorBlockBlock() { }
public SimulatorBlockBlock(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 = "-- SimulatorBlock --\n";
output += "IP: " + IP.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "Handle: " + Handle.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class ViewerBlock
{
public LLUUID ID;
public int Length
{
get
{
return 16;
}
}
public ViewerBlock() { }
public ViewerBlock(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 = "-- Viewer --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.ClosestSimulator; } }
public SimulatorBlockBlock SimulatorBlock;
public ViewerBlock Viewer;
public ClosestSimulatorPacket()
{
Header = new MediumHeader();
Header.ID = 1;
Header.Reliable = true;
SimulatorBlock = new SimulatorBlockBlock();
Viewer = new ViewerBlock();
}
public ClosestSimulatorPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new MediumHeader(bytes, ref i, ref packetEnd);
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
Viewer = new ViewerBlock(bytes, ref i);
}
public ClosestSimulatorPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
SimulatorBlock = new SimulatorBlockBlock(bytes, ref i);
Viewer = new ViewerBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 6;
length += SimulatorBlock.Length; length += Viewer.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
SimulatorBlock.ToBytes(bytes, ref i);
Viewer.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- ClosestSimulator ---\n";
output += SimulatorBlock.ToString() + "\n";
output += Viewer.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectAddPacket : Packet
{
/// <exclude/>
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;
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;
public LLQuaternion Rotation;
public LLUUID RayTargetID;
public int Length
{
get
{
int length = 91;
if (TextureEntry != null) { length += 2 + TextureEntry.Length; }
return length;
}
}
public ObjectDataBlock() { }
public ObjectDataBlock(byte[] bytes, ref int i)
{
int length;
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++];
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++];
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;
if(RayStart == null) { Console.WriteLine("Warning: RayStart is null, in " + this.GetType()); }
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;
if(RayEnd == null) { Console.WriteLine("Warning: RayEnd is null, in " + this.GetType()); }
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;
if(Scale == null) { Console.WriteLine("Warning: Scale is null, in " + this.GetType()); }
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
bytes[i++] = State;
bytes[i++] = (byte)PathTwist;
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;
if(Rotation == null) { Console.WriteLine("Warning: Rotation is null, in " + this.GetType()); }
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 --\n";
output += "AddFlags: " + AddFlags.ToString() + "\n";
output += "PathTwistBegin: " + PathTwistBegin.ToString() + "\n";
output += "PathEnd: " + PathEnd.ToString() + "\n";
output += "ProfileBegin: " + ProfileBegin.ToString() + "\n";
output += "PathRadiusOffset: " + PathRadiusOffset.ToString() + "\n";
output += "PathSkew: " + PathSkew.ToString() + "\n";
output += "RayStart: " + RayStart.ToString() + "\n";
output += "ProfileCurve: " + ProfileCurve.ToString() + "\n";
output += "PathScaleX: " + PathScaleX.ToString() + "\n";
output += "PathScaleY: " + PathScaleY.ToString() + "\n";
output += "Material: " + Material.ToString() + "\n";
output += "PathShearX: " + PathShearX.ToString() + "\n";
output += "PathShearY: " + PathShearY.ToString() + "\n";
output += "PathTaperX: " + PathTaperX.ToString() + "\n";
output += "PathTaperY: " + PathTaperY.ToString() + "\n";
output += "RayEndIsIntersection: " + RayEndIsIntersection.ToString() + "\n";
output += "RayEnd: " + RayEnd.ToString() + "\n";
output += "ProfileEnd: " + ProfileEnd.ToString() + "\n";
output += "PathBegin: " + PathBegin.ToString() + "\n";
output += "BypassRaycast: " + BypassRaycast.ToString() + "\n";
output += "PCode: " + PCode.ToString() + "\n";
output += "PathCurve: " + PathCurve.ToString() + "\n";
output += "Scale: " + Scale.ToString() + "\n";
output += "State: " + State.ToString() + "\n";
output += "PathTwist: " + PathTwist.ToString() + "\n";
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "\n";
output += "ProfileHollow: " + ProfileHollow.ToString() + "\n";
output += "PathRevolutions: " + PathRevolutions.ToString() + "\n";
output += "Rotation: " + Rotation.ToString() + "\n";
output += "RayTargetID: " + RayTargetID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
public LLUUID GroupID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output = 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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class MultipleObjectUpdatePacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestMultipleObjectsPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ID;
public byte CacheMissType;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "CacheMissType: " + CacheMissType.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectPositionPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ObjectLocalID;
public LLVector3 Position;
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);
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- ObjectData --\n";
output += "ObjectLocalID: " + ObjectLocalID.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestObjectPropertiesFamilyPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ObjectID;
public uint RequestFlags;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "RequestFlags: " + RequestFlags.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
output += ObjectData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CoarseLocationUpdatePacket : Packet
{
/// <exclude/>
public class LocationBlock
{
public byte X;
public byte Y;
public byte Z;
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 --\n";
output += "X: " + X.ToString() + "\n";
output += "Y: " + Y.ToString() + "\n";
output += "Z: " + Z.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class IndexBlock
{
public short You;
public short Prey;
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 --\n";
output += "You: " + You.ToString() + "\n";
output += "Prey: " + Prey.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < Location.Length; j++)
{
output += Location[j].ToString() + "\n";
}
output += Index.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CrossedRegionPacket : Packet
{
/// <exclude/>
public class InfoBlock
{
public LLVector3 LookAt;
public LLVector3 Position;
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)
{
if(LookAt == null) { Console.WriteLine("Warning: LookAt is null, in " + this.GetType()); }
Array.Copy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12;
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- Info --\n";
output += "LookAt: " + LookAt.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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 --\n";
output += Helpers.FieldToString(SeedCapability, "SeedCapability") + "\n";
output += "SimPort: " + SimPort.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "SimIP: " + SimIP.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
output += Info.ToString() + "\n";
output += RegionData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ConfirmEnableSimulatorPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectPropertiesPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public int OwnershipCost;
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;
public int Length
{
get
{
int length = 166;
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));
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++] = 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 --\n";
output += "OwnershipCost: " + OwnershipCost.ToString() + "\n";
output += "AggregatePermTexturesOwner: " + AggregatePermTexturesOwner.ToString() + "\n";
output += Helpers.FieldToString(SitName, "SitName") + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "FromTaskID: " + FromTaskID.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += Helpers.FieldToString(TextureID, "TextureID") + "\n";
output += Helpers.FieldToString(TouchName, "TouchName") + "\n";
output += "ItemID: " + ItemID.ToString() + "\n";
output += "AggregatePermTextures: " + AggregatePermTextures.ToString() + "\n";
output += "FolderID: " + FolderID.ToString() + "\n";
output += "InventorySerial: " + InventorySerial.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "LastOwnerID: " + LastOwnerID.ToString() + "\n";
output += "AggregatePerms: " + AggregatePerms.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ObjectPropertiesFamilyPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "OwnershipCost: " + OwnershipCost.ToString() + "\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "SaleType: " + SaleType.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "RequestFlags: " + RequestFlags.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += Helpers.FieldToString(Description, "Description") + "\n";
output += "LastOwnerID: " + LastOwnerID.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = 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 ---\n";
output += ObjectData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelPropertiesRequestPacket : Packet
{
/// <exclude/>
public class ParcelDataBlock
{
public float East;
public float West;
public int SequenceID;
public bool SnapSelection;
public float North;
public float South;
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 --\n";
output += "East: " + East.ToString() + "\n";
output += "West: " + West.ToString() + "\n";
output += "SequenceID: " + SequenceID.ToString() + "\n";
output += "SnapSelection: " + SnapSelection.ToString() + "\n";
output += "North: " + North.ToString() + "\n";
output += "South: " + South.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
output += ParcelData.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SimStatusPacket : Packet
{
/// <exclude/>
public class SimStatusBlock
{
public bool CanAcceptAgents;
public bool CanAcceptTasks;
public int Length
{
get
{
return 2;
}
}
public SimStatusBlock() { }
public SimStatusBlock(byte[] bytes, ref int i)
{
try
{
CanAcceptAgents = (bytes[i++] != 0) ? (bool)true : (bool)false;
CanAcceptTasks = (bytes[i++] != 0) ? (bool)true : (bool)false;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((CanAcceptAgents) ? 1 : 0);
bytes[i++] = (byte)((CanAcceptTasks) ? 1 : 0);
}
public override string ToString()
{
string output = "-- SimStatus --\n";
output += "CanAcceptAgents: " + CanAcceptAgents.ToString() + "\n";
output += "CanAcceptTasks: " + CanAcceptTasks.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.SimStatus; } }
public SimStatusBlock SimStatus;
public SimStatusPacket()
{
Header = new MediumHeader();
Header.ID = 13;
Header.Reliable = true;
SimStatus = new SimStatusBlock();
}
public SimStatusPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new MediumHeader(bytes, ref i, ref packetEnd);
SimStatus = new SimStatusBlock(bytes, ref i);
}
public SimStatusPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
SimStatus = new SimStatusBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 6;
length += SimStatus.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
SimStatus.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- SimStatus ---\n";
output += SimStatus.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class GestureUpdatePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "ToViewer: " + ToViewer.ToString() + "\n";
output += Helpers.FieldToString(Filename, "Filename") + "\n";
output = 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 ---\n";
output += AgentBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AttachedSoundPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID ObjectID;
public float Gain;
public LLUUID SoundID;
public LLUUID OwnerID;
public byte Flags;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Gain: " + Gain.ToString() + "\n";
output += "SoundID: " + SoundID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output = 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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AttachedSoundGainChangePacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID ObjectID;
public float Gain;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Gain: " + Gain.ToString() + "\n";
output = 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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AttachedSoundCutoffRadiusPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID ObjectID;
public float Radius;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Radius: " + Radius.ToString() + "\n";
output = 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 ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PreloadSoundPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID ObjectID;
public LLUUID SoundID;
public LLUUID OwnerID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "SoundID: " + SoundID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output = 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 ---\n";
for (int j = 0; j < DataBlock.Length; j++)
{
output += DataBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class InternalScriptMailPacket : Packet
{
/// <exclude/>
public class DataBlockBlock
{
public LLUUID To;
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[] _body;
public byte[] Body
{
get { return _body; }
set
{
if (value == null) { _body = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _body = new byte[value.Length]; Array.Copy(value, _body, 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 int Length
{
get
{
int length = 16;
if (Subject != null) { length += 1 + Subject.Length; }
if (Body != null) { length += 2 + Body.Length; }
if (From != null) { length += 1 + From.Length; }
return length;
}
}
public DataBlockBlock() { }
public DataBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
To = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_subject = new byte[length];
Array.Copy(bytes, i, _subject, 0, length); i += length;
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_body = new byte[length];
Array.Copy(bytes, i, _body, 0, length); i += length;
length = (ushort)bytes[i++];
_from = new byte[length];
Array.Copy(bytes, i, _from, 0, length); i += length;
}
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()); }
Array.Copy(To.GetBytes(), 0, bytes, i, 16); i += 16;
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(Body == null) { Console.WriteLine("Warning: Body is null, in " + this.GetType()); }
bytes[i++] = (byte)(Body.Length % 256);
bytes[i++] = (byte)((Body.Length >> 8) % 256);
Array.Copy(Body, 0, bytes, i, Body.Length); i += Body.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;
}
public override string ToString()
{
string output = "-- DataBlock --\n";
output += "To: " + To.ToString() + "\n";
output += Helpers.FieldToString(Subject, "Subject") + "\n";
output += Helpers.FieldToString(Body, "Body") + "\n";
output += Helpers.FieldToString(From, "From") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.InternalScriptMail; } }
public DataBlockBlock DataBlock;
public InternalScriptMailPacket()
{
Header = new MediumHeader();
Header.ID = 19;
Header.Reliable = true;
DataBlock = new DataBlockBlock();
}
public InternalScriptMailPacket(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 InternalScriptMailPacket(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 = "--- InternalScriptMail ---\n";
output += DataBlock.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ViewerEffectPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "Duration: " + Duration.ToString() + "\n";
output += "ID: " + ID.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += Helpers.FieldToString(Color, "Color") + "\n";
output += Helpers.FieldToString(TypeData, "TypeData") + "\n";
output = 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 ---\n";
for (int j = 0; j < Effect.Length; j++)
{
output += Effect[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class SetSunPhasePacket : Packet
{
/// <exclude/>
public class DataBlock
{
public float Phase;
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 --\n";
output += "Phase: " + Phase.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 ---\n";
output += Data.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class StartPingCheckPacket : Packet
{
/// <exclude/>
public class PingIDBlock
{
public byte PingID;
public uint OldestUnacked;
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 --\n";
output += "PingID: " + PingID.ToString() + "\n";
output += "OldestUnacked: " + OldestUnacked.ToString() + "\n";
output = 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 ---\n";
output += PingID.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CompletePingCheckPacket : Packet
{
/// <exclude/>
public class PingIDBlock
{
public byte PingID;
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 --\n";
output += "PingID: " + PingID.ToString() + "\n";
output = 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 ---\n";
output += PingID.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class NeighborListPacket : Packet
{
/// <exclude/>
public class NeighborBlockBlock
{
public uint IP;
public ushort PublicPort;
public LLUUID RegionID;
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 ushort Port;
public byte SimAccess;
public uint PublicIP;
public int Length
{
get
{
int length = 29;
if (Name != null) { length += 1 + Name.Length; }
return length;
}
}
public NeighborBlockBlock() { }
public NeighborBlockBlock(byte[] bytes, ref int i)
{
int length;
try
{
IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
PublicPort = (ushort)((bytes[i++] << 8) + bytes[i++]);
RegionID = new LLUUID(bytes, i); i += 16;
length = (ushort)bytes[i++];
_name = new byte[length];
Array.Copy(bytes, i, _name, 0, length); i += length;
Port = (ushort)((bytes[i++] << 8) + bytes[i++]);
SimAccess = (byte)bytes[i++];
PublicIP = (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)(IP % 256);
bytes[i++] = (byte)((IP >> 8) % 256);
bytes[i++] = (byte)((IP >> 16) % 256);
bytes[i++] = (byte)((IP >> 24) % 256);
bytes[i++] = (byte)((PublicPort >> 8) % 256);
bytes[i++] = (byte)(PublicPort % 256);
if(RegionID == null) { Console.WriteLine("Warning: RegionID is null, in " + this.GetType()); }
Array.Copy(RegionID.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)((Port >> 8) % 256);
bytes[i++] = (byte)(Port % 256);
bytes[i++] = SimAccess;
bytes[i++] = (byte)(PublicIP % 256);
bytes[i++] = (byte)((PublicIP >> 8) % 256);
bytes[i++] = (byte)((PublicIP >> 16) % 256);
bytes[i++] = (byte)((PublicIP >> 24) % 256);
}
public override string ToString()
{
string output = "-- NeighborBlock --\n";
output += "IP: " + IP.ToString() + "\n";
output += "PublicPort: " + PublicPort.ToString() + "\n";
output += "RegionID: " + RegionID.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "SimAccess: " + SimAccess.ToString() + "\n";
output += "PublicIP: " + PublicIP.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.NeighborList; } }
public NeighborBlockBlock[] NeighborBlock;
public NeighborListPacket()
{
Header = new HighHeader();
Header.ID = 3;
Header.Reliable = true;
NeighborBlock = new NeighborBlockBlock[4];
}
public NeighborListPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new HighHeader(bytes, ref i, ref packetEnd);
NeighborBlock = new NeighborBlockBlock[4];
for (int j = 0; j < 4; j++)
{ NeighborBlock[j] = new NeighborBlockBlock(bytes, ref i); }
}
public NeighborListPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
NeighborBlock = new NeighborBlockBlock[4];
for (int j = 0; j < 4; j++)
{ NeighborBlock[j] = new NeighborBlockBlock(bytes, ref i); }
}
public override byte[] ToBytes()
{
int length = 5;
;
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);
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 = "--- NeighborList ---\n";
for (int j = 0; j < 4; j++)
{
output += NeighborBlock[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class MovedIntoSimulatorPacket : Packet
{
/// <exclude/>
public class SenderBlock
{
public LLUUID ID;
public LLUUID SessionID;
public uint CircuitCode;
public int Length
{
get
{
return 36;
}
}
public SenderBlock() { }
public SenderBlock(byte[] bytes, ref int i)
{
try
{
ID = 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(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)(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 = "-- Sender --\n";
output += "ID: " + ID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "CircuitCode: " + CircuitCode.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.MovedIntoSimulator; } }
public SenderBlock Sender;
public MovedIntoSimulatorPacket()
{
Header = new HighHeader();
Header.ID = 4;
Header.Reliable = true;
Sender = new SenderBlock();
}
public MovedIntoSimulatorPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new HighHeader(bytes, ref i, ref packetEnd);
Sender = new SenderBlock(bytes, ref i);
}
public MovedIntoSimulatorPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
Sender = new SenderBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 5;
length += Sender.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.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 = "--- MovedIntoSimulator ---\n";
output += Sender.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentUpdatePacket : Packet
{
/// <exclude/>
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;
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);
if(CameraAtAxis == null) { Console.WriteLine("Warning: CameraAtAxis is null, in " + this.GetType()); }
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;
if(CameraCenter == null) { Console.WriteLine("Warning: CameraCenter is null, in " + this.GetType()); }
Array.Copy(CameraCenter.GetBytes(), 0, bytes, i, 12); i += 12;
if(CameraLeftAxis == null) { Console.WriteLine("Warning: CameraLeftAxis is null, in " + this.GetType()); }
Array.Copy(CameraLeftAxis.GetBytes(), 0, bytes, i, 12); i += 12;
if(HeadRotation == null) { Console.WriteLine("Warning: HeadRotation is null, in " + this.GetType()); }
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;
if(CameraUpAxis == null) { Console.WriteLine("Warning: CameraUpAxis is null, in " + this.GetType()); }
Array.Copy(CameraUpAxis.GetBytes(), 0, bytes, i, 12); i += 12;
if(BodyRotation == null) { Console.WriteLine("Warning: BodyRotation is null, in " + this.GetType()); }
Array.Copy(BodyRotation.GetBytes(), 0, bytes, i, 12); i += 12;
bytes[i++] = Flags;
bytes[i++] = State;
}
public override string ToString()
{
string output = "-- AgentData --\n";
output += "ControlFlags: " + ControlFlags.ToString() + "\n";
output += "CameraAtAxis: " + CameraAtAxis.ToString() + "\n";
output += "Far: " + Far.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "CameraCenter: " + CameraCenter.ToString() + "\n";
output += "CameraLeftAxis: " + CameraLeftAxis.ToString() + "\n";
output += "HeadRotation: " + HeadRotation.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "CameraUpAxis: " + CameraUpAxis.ToString() + "\n";
output += "BodyRotation: " + BodyRotation.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "State: " + State.ToString() + "\n";
output = 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 = 5;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentAnimationPacket : Packet
{
/// <exclude/>
public class AnimationListBlock
{
public LLUUID AnimID;
public bool StartAnim;
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 --\n";
output += "AnimID: " + AnimID.ToString() + "\n";
output += "StartAnim: " + StartAnim.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 6;
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 ---\n";
for (int j = 0; j < AnimationList.Length; j++)
{
output += AnimationList[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentRequestSitPacket : Packet
{
/// <exclude/>
public class TargetObjectBlock
{
public LLUUID TargetID;
public LLVector3 Offset;
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;
if(Offset == null) { Console.WriteLine("Warning: Offset is null, in " + this.GetType()); }
Array.Copy(Offset.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- TargetObject --\n";
output += "TargetID: " + TargetID.ToString() + "\n";
output += "Offset: " + Offset.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 7;
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 ---\n";
output += TargetObject.ToString() + "\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AgentSitPacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 8;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class RequestImagePacket : Packet
{
/// <exclude/>
public class RequestImageBlock
{
public float DownloadPriority;
public sbyte DiscardLevel;
public byte Type;
public uint Packet;
public LLUUID Image;
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 --\n";
output += "DownloadPriority: " + DownloadPriority.ToString() + "\n";
output += "DiscardLevel: " + DiscardLevel.ToString() + "\n";
output += "Type: " + Type.ToString() + "\n";
output += "Packet: " + Packet.ToString() + "\n";
output += "Image: " + Image.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AgentDataBlock
{
public LLUUID AgentID;
public LLUUID SessionID;
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 --\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output = 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 = 9;
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 ---\n";
for (int j = 0; j < RequestImage.Length; j++)
{
output += RequestImage[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ImageDataPacket : Packet
{
/// <exclude/>
public class ImageIDBlock
{
public LLUUID ID;
public ushort Packets;
public uint Size;
public byte Codec;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Packets: " + Packets.ToString() + "\n";
output += "Size: " + Size.ToString() + "\n";
output += "Codec: " + Codec.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output = 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 = 10;
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 ---\n";
output += ImageID.ToString() + "\n";
output += ImageData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ImagePacketPacket : Packet
{
/// <exclude/>
public class ImageIDBlock
{
public LLUUID ID;
public ushort Packet;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Packet: " + Packet.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output = 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 = 11;
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 ---\n";
output += ImageID.ToString() + "\n";
output += ImageData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class LayerDataPacket : Packet
{
/// <exclude/>
public class LayerIDBlock
{
public byte Type;
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 --\n";
output += "Type: " + Type.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output = 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 = 12;
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 ---\n";
output += LayerID.ToString() + "\n";
output += LayerData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectUpdatePacket : Packet
{
/// <exclude/>
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;
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);
if(JointPivot == null) { Console.WriteLine("Warning: JointPivot is null, in " + this.GetType()); }
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;
if(Scale == null) { Console.WriteLine("Warning: Scale is null, in " + this.GetType()); }
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
if(JointAxisOrAnchor == null) { Console.WriteLine("Warning: JointAxisOrAnchor is null, in " + this.GetType()); }
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "UpdateFlags: " + UpdateFlags.ToString() + "\n";
output += Helpers.FieldToString(ObjectData, "ObjectData") + "\n";
output += "PathTwistBegin: " + PathTwistBegin.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output += "JointPivot: " + JointPivot.ToString() + "\n";
output += "PathEnd: " + PathEnd.ToString() + "\n";
output += Helpers.FieldToString(MediaURL, "MediaURL") + "\n";
output += Helpers.FieldToString(TextColor, "TextColor") + "\n";
output += "ClickAction: " + ClickAction.ToString() + "\n";
output += "ProfileBegin: " + ProfileBegin.ToString() + "\n";
output += "PathRadiusOffset: " + PathRadiusOffset.ToString() + "\n";
output += "Gain: " + Gain.ToString() + "\n";
output += "PathSkew: " + PathSkew.ToString() + "\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output += Helpers.FieldToString(TextureAnim, "TextureAnim") + "\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += Helpers.FieldToString(Text, "Text") + "\n";
output += "ProfileCurve: " + ProfileCurve.ToString() + "\n";
output += "PathScaleX: " + PathScaleX.ToString() + "\n";
output += "PathScaleY: " + PathScaleY.ToString() + "\n";
output += "Material: " + Material.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += Helpers.FieldToString(ExtraParams, "ExtraParams") + "\n";
output += Helpers.FieldToString(NameValue, "NameValue") + "\n";
output += "PathShearX: " + PathShearX.ToString() + "\n";
output += "PathShearY: " + PathShearY.ToString() + "\n";
output += "PathTaperX: " + PathTaperX.ToString() + "\n";
output += "PathTaperY: " + PathTaperY.ToString() + "\n";
output += "Radius: " + Radius.ToString() + "\n";
output += "ProfileEnd: " + ProfileEnd.ToString() + "\n";
output += "JointType: " + JointType.ToString() + "\n";
output += "PathBegin: " + PathBegin.ToString() + "\n";
output += Helpers.FieldToString(PSBlock, "PSBlock") + "\n";
output += "PCode: " + PCode.ToString() + "\n";
output += "FullID: " + FullID.ToString() + "\n";
output += "PathCurve: " + PathCurve.ToString() + "\n";
output += "Scale: " + Scale.ToString() + "\n";
output += "JointAxisOrAnchor: " + JointAxisOrAnchor.ToString() + "\n";
output += "Flags: " + Flags.ToString() + "\n";
output += "State: " + State.ToString() + "\n";
output += "PathTwist: " + PathTwist.ToString() + "\n";
output += "Sound: " + Sound.ToString() + "\n";
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "\n";
output += "ProfileHollow: " + ProfileHollow.ToString() + "\n";
output += "PathRevolutions: " + PathRevolutions.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionDataBlock
{
public ushort TimeDilation;
public ulong RegionHandle;
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 --\n";
output += "TimeDilation: " + TimeDilation.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = 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 = 13;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectUpdateCompressedPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += "UpdateFlags: " + UpdateFlags.ToString() + "\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionDataBlock
{
public ushort TimeDilation;
public ulong RegionHandle;
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 --\n";
output += "TimeDilation: " + TimeDilation.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = 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 = 14;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ObjectUpdateCachedPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ID;
public uint UpdateFlags;
public uint CRC;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "UpdateFlags: " + UpdateFlags.ToString() + "\n";
output += "CRC: " + CRC.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionDataBlock
{
public ushort TimeDilation;
public ulong RegionHandle;
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 --\n";
output += "TimeDilation: " + TimeDilation.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = 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 = 15;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ImprovedTerseObjectUpdatePacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class RegionDataBlock
{
public ushort TimeDilation;
public ulong RegionHandle;
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 --\n";
output += "TimeDilation: " + TimeDilation.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = 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 = 16;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class KillObjectPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public uint ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = 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 = 17;
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 ---\n";
for (int j = 0; j < ObjectData.Length; j++)
{
output += ObjectData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AgentToNewRegionPacket : Packet
{
/// <exclude/>
public class RegionDataBlock
{
public uint IP;
public LLUUID SessionID;
public ushort Port;
public ulong Handle;
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 --\n";
output += "IP: " + IP.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "Port: " + Port.ToString() + "\n";
output += "Handle: " + Handle.ToString() + "\n";
output = 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 = 18;
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 ---\n";
output += RegionData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class TransferPacketPacket : Packet
{
/// <exclude/>
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;
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 --\n";
output += "TransferID: " + TransferID.ToString() + "\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output += "Packet: " + Packet.ToString() + "\n";
output += "ChannelType: " + ChannelType.ToString() + "\n";
output += "Status: " + Status.ToString() + "\n";
output = 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 = 19;
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 ---\n";
output += TransferData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SendXferPacketPacket : Packet
{
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class XferIDBlock
{
public ulong ID;
public uint Packet;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Packet: " + Packet.ToString() + "\n";
output = 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 = 20;
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 ---\n";
output += DataPacket.ToString() + "\n";
output += XferID.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ConfirmXferPacketPacket : Packet
{
/// <exclude/>
public class XferIDBlock
{
public ulong ID;
public uint Packet;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "Packet: " + Packet.ToString() + "\n";
output = 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 = 21;
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 ---\n";
output += XferID.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class AvatarAnimationPacket : Packet
{
/// <exclude/>
public class AnimationSourceListBlock
{
public LLUUID ObjectID;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SenderBlock
{
public LLUUID ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AnimationListBlock
{
public LLUUID AnimID;
public int AnimSequenceID;
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 --\n";
output += "AnimID: " + AnimID.ToString() + "\n";
output += "AnimSequenceID: " + AnimSequenceID.ToString() + "\n";
output = 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 = 22;
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 ---\n";
for (int j = 0; j < AnimationSourceList.Length; j++)
{
output += AnimationSourceList[j].ToString() + "\n";
}
output += Sender.ToString() + "\n";
for (int j = 0; j < AnimationList.Length; j++)
{
output += AnimationList[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AvatarSitResponsePacket : Packet
{
/// <exclude/>
public class SitTransformBlock
{
public bool AutoPilot;
public bool ForceMouselook;
public LLVector3 CameraEyeOffset;
public LLVector3 CameraAtOffset;
public LLVector3 SitPosition;
public LLQuaternion SitRotation;
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);
if(CameraEyeOffset == null) { Console.WriteLine("Warning: CameraEyeOffset is null, in " + this.GetType()); }
Array.Copy(CameraEyeOffset.GetBytes(), 0, bytes, i, 12); i += 12;
if(CameraAtOffset == null) { Console.WriteLine("Warning: CameraAtOffset is null, in " + this.GetType()); }
Array.Copy(CameraAtOffset.GetBytes(), 0, bytes, i, 12); i += 12;
if(SitPosition == null) { Console.WriteLine("Warning: SitPosition is null, in " + this.GetType()); }
Array.Copy(SitPosition.GetBytes(), 0, bytes, i, 12); i += 12;
if(SitRotation == null) { Console.WriteLine("Warning: SitRotation is null, in " + this.GetType()); }
Array.Copy(SitRotation.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- SitTransform --\n";
output += "AutoPilot: " + AutoPilot.ToString() + "\n";
output += "ForceMouselook: " + ForceMouselook.ToString() + "\n";
output += "CameraEyeOffset: " + CameraEyeOffset.ToString() + "\n";
output += "CameraAtOffset: " + CameraAtOffset.ToString() + "\n";
output += "SitPosition: " + SitPosition.ToString() + "\n";
output += "SitRotation: " + SitRotation.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class SitObjectBlock
{
public LLUUID ID;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output = 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 = 23;
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 ---\n";
output += SitTransform.ToString() + "\n";
output += SitObject.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class CameraConstraintPacket : Packet
{
/// <exclude/>
public class CameraCollidePlaneBlock
{
public LLVector4 Plane;
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)
{
if(Plane == null) { Console.WriteLine("Warning: Plane is null, in " + this.GetType()); }
Array.Copy(Plane.GetBytes(), 0, bytes, i, 16); i += 16;
}
public override string ToString()
{
string output = "-- CameraCollidePlane --\n";
output += "Plane: " + Plane.ToString() + "\n";
output = 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 = 24;
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 ---\n";
output += CameraCollidePlane.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ParcelPropertiesPacket : Packet
{
/// <exclude/>
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;
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;
if(UserLookAt == null) { Console.WriteLine("Warning: UserLookAt is null, in " + this.GetType()); }
Array.Copy(UserLookAt.GetBytes(), 0, bytes, i, 12); i += 12;
if(AABBMax == null) { Console.WriteLine("Warning: AABBMax is null, in " + this.GetType()); }
Array.Copy(AABBMax.GetBytes(), 0, bytes, i, 12); i += 12;
if(AABBMin == null) { Console.WriteLine("Warning: AABBMin is null, in " + this.GetType()); }
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);
if(UserLocation == null) { Console.WriteLine("Warning: UserLocation is null, in " + this.GetType()); }
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 --\n";
output += "ReservedNewbie: " + ReservedNewbie.ToString() + "\n";
output += "GroupPrims: " + GroupPrims.ToString() + "\n";
output += "SelectedPrims: " + SelectedPrims.ToString() + "\n";
output += "MediaID: " + MediaID.ToString() + "\n";
output += "UserLookAt: " + UserLookAt.ToString() + "\n";
output += "AABBMax: " + AABBMax.ToString() + "\n";
output += "AABBMin: " + AABBMin.ToString() + "\n";
output += "RequestResult: " + RequestResult.ToString() + "\n";
output += "OwnerPrims: " + OwnerPrims.ToString() + "\n";
output += "RegionPushOverride: " + RegionPushOverride.ToString() + "\n";
output += "RegionDenyAnonymous: " + RegionDenyAnonymous.ToString() + "\n";
output += Helpers.FieldToString(MediaURL, "MediaURL") + "\n";
output += "LocalID: " + LocalID.ToString() + "\n";
output += "SimWideMaxPrims: " + SimWideMaxPrims.ToString() + "\n";
output += "TotalPrims: " + TotalPrims.ToString() + "\n";
output += "OtherCount: " + OtherCount.ToString() + "\n";
output += "IsGroupOwned: " + IsGroupOwned.ToString() + "\n";
output += "UserLocation: " + UserLocation.ToString() + "\n";
output += "MaxPrims: " + MaxPrims.ToString() + "\n";
output += Helpers.FieldToString(Name, "Name") + "\n";
output += "OtherCleanTime: " + OtherCleanTime.ToString() + "\n";
output += Helpers.FieldToString(Desc, "Desc") + "\n";
output += "Area: " + Area.ToString() + "\n";
output += "OtherPrims: " + OtherPrims.ToString() + "\n";
output += "RegionDenyIdentified: " + RegionDenyIdentified.ToString() + "\n";
output += "Category: " + Category.ToString() + "\n";
output += "PublicCount: " + PublicCount.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "SalePrice: " + SalePrice.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "SequenceID: " + SequenceID.ToString() + "\n";
output += "RegionDenyTransacted: " + RegionDenyTransacted.ToString() + "\n";
output += "SelfCount: " + SelfCount.ToString() + "\n";
output += Helpers.FieldToString(Bitmap, "Bitmap") + "\n";
output += "Status: " + Status.ToString() + "\n";
output += "SnapshotID: " + SnapshotID.ToString() + "\n";
output += "SnapSelection: " + SnapSelection.ToString() + "\n";
output += "LandingType: " + LandingType.ToString() + "\n";
output += "SimWideTotalPrims: " + SimWideTotalPrims.ToString() + "\n";
output += "AuctionID: " + AuctionID.ToString() + "\n";
output += "AuthBuyerID: " + AuthBuyerID.ToString() + "\n";
output += "PassHours: " + PassHours.ToString() + "\n";
output += "ParcelFlags: " + ParcelFlags.ToString() + "\n";
output += "PassPrice: " + PassPrice.ToString() + "\n";
output += "ClaimDate: " + ClaimDate.ToString() + "\n";
output += "MediaAutoScale: " + MediaAutoScale.ToString() + "\n";
output += Helpers.FieldToString(MusicURL, "MusicURL") + "\n";
output += "ParcelPrimBonus: " + ParcelPrimBonus.ToString() + "\n";
output += "ClaimPrice: " + ClaimPrice.ToString() + "\n";
output += "RentPrice: " + RentPrice.ToString() + "\n";
output = 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 = 25;
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 ---\n";
output += ParcelData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class EdgeDataPacketPacket : Packet
{
/// <exclude/>
public class EdgeDataBlock
{
public byte LayerType;
public byte Direction;
private byte[] _layerdata;
public byte[] LayerData
{
get { return _layerdata; }
set
{
if (value == null) { _layerdata = null; return; }
if (value.Length > 1024) { throw new OverflowException("Value exceeds 1024 characters"); }
else { _layerdata = new byte[value.Length]; Array.Copy(value, _layerdata, value.Length); }
}
}
public int Length
{
get
{
int length = 2;
if (LayerData != null) { length += 2 + LayerData.Length; }
return length;
}
}
public EdgeDataBlock() { }
public EdgeDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
LayerType = (byte)bytes[i++];
Direction = (byte)bytes[i++];
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_layerdata = new byte[length];
Array.Copy(bytes, i, _layerdata, 0, length); i += length;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = LayerType;
bytes[i++] = Direction;
if(LayerData == null) { Console.WriteLine("Warning: LayerData is null, in " + this.GetType()); }
bytes[i++] = (byte)(LayerData.Length % 256);
bytes[i++] = (byte)((LayerData.Length >> 8) % 256);
Array.Copy(LayerData, 0, bytes, i, LayerData.Length); i += LayerData.Length;
}
public override string ToString()
{
string output = "-- EdgeData --\n";
output += "LayerType: " + LayerType.ToString() + "\n";
output += "Direction: " + Direction.ToString() + "\n";
output += Helpers.FieldToString(LayerData, "LayerData") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.EdgeDataPacket; } }
public EdgeDataBlock EdgeData;
public EdgeDataPacketPacket()
{
Header = new HighHeader();
Header.ID = 26;
Header.Reliable = true;
Header.Zerocoded = true;
EdgeData = new EdgeDataBlock();
}
public EdgeDataPacketPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new HighHeader(bytes, ref i, ref packetEnd);
EdgeData = new EdgeDataBlock(bytes, ref i);
}
public EdgeDataPacketPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
EdgeData = new EdgeDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 5;
length += EdgeData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
EdgeData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- EdgeDataPacket ---\n";
output += EdgeData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ChildAgentUpdatePacket : Packet
{
/// <exclude/>
public class VisualParamBlock
{
public byte ParamValue;
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 --\n";
output += "ParamValue: " + ParamValue.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GranterBlockBlock
{
public LLUUID GranterID;
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 --\n";
output += "GranterID: " + GranterID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class AnimationDataBlock
{
public LLUUID ObjectID;
public LLUUID Animation;
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 --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Animation: " + Animation.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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;
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);
if(HeadRotation == null) { Console.WriteLine("Warning: HeadRotation is null, in " + this.GetType()); }
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;
if(LeftAxis == null) { Console.WriteLine("Warning: LeftAxis is null, in " + this.GetType()); }
Array.Copy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12;
if(Size == null) { Console.WriteLine("Warning: Size is null, in " + this.GetType()); }
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;
if(AgentVel == null) { Console.WriteLine("Warning: AgentVel is null, in " + this.GetType()); }
Array.Copy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12;
if(AgentPos == null) { Console.WriteLine("Warning: AgentPos is null, in " + this.GetType()); }
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;
if(UpAxis == null) { Console.WriteLine("Warning: UpAxis is null, in " + this.GetType()); }
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;
if(AtAxis == null) { Console.WriteLine("Warning: AtAxis is null, in " + this.GetType()); }
Array.Copy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12;
if(Center == null) { Console.WriteLine("Warning: Center is null, in " + this.GetType()); }
Array.Copy(Center.GetBytes(), 0, bytes, i, 12); i += 12;
if(BodyRotation == null) { Console.WriteLine("Warning: BodyRotation is null, in " + this.GetType()); }
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 --\n";
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "\n";
output += "ControlFlags: " + ControlFlags.ToString() + "\n";
output += "Far: " + Far.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "ChangedGrid: " + ChangedGrid.ToString() + "\n";
output += "HeadRotation: " + HeadRotation.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "LeftAxis: " + LeftAxis.ToString() + "\n";
output += "Size: " + Size.ToString() + "\n";
output += "GodLevel: " + GodLevel.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "AgentAccess: " + AgentAccess.ToString() + "\n";
output += "AgentVel: " + AgentVel.ToString() + "\n";
output += "AgentPos: " + AgentPos.ToString() + "\n";
output += "PreyAgent: " + PreyAgent.ToString() + "\n";
output += Helpers.FieldToString(Throttles, "Throttles") + "\n";
output += "UpAxis: " + UpAxis.ToString() + "\n";
output += Helpers.FieldToString(AgentTextures, "AgentTextures") + "\n";
output += "AtAxis: " + AtAxis.ToString() + "\n";
output += "Center: " + Center.ToString() + "\n";
output += "BodyRotation: " + BodyRotation.ToString() + "\n";
output += "Aspect: " + Aspect.ToString() + "\n";
output += "AlwaysRun: " + AlwaysRun.ToString() + "\n";
output += "EnergyLevel: " + EnergyLevel.ToString() + "\n";
output += "LocomotionState: " + LocomotionState.ToString() + "\n";
output += "ActiveGroupID: " + ActiveGroupID.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
public class GroupDataBlock
{
public ulong GroupPowers;
public LLUUID GroupID;
public bool AcceptNotices;
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 --\n";
output += "GroupPowers: " + GroupPowers.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "AcceptNotices: " + AcceptNotices.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(NVPairs, "NVPairs") + "\n";
output = 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 = 27;
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 ---\n";
for (int j = 0; j < VisualParam.Length; j++)
{
output += VisualParam[j].ToString() + "\n";
}
for (int j = 0; j < GranterBlock.Length; j++)
{
output += GranterBlock[j].ToString() + "\n";
}
for (int j = 0; j < AnimationData.Length; j++)
{
output += AnimationData[j].ToString() + "\n";
}
output += AgentData.ToString() + "\n";
for (int j = 0; j < GroupData.Length; j++)
{
output += GroupData[j].ToString() + "\n";
}
for (int j = 0; j < NVPairData.Length; j++)
{
output += NVPairData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class ChildAgentAlivePacket : Packet
{
/// <exclude/>
public class AgentDataBlock
{
public uint ViewerCircuitCode;
public LLUUID AgentID;
public LLUUID SessionID;
public ulong RegionHandle;
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 --\n";
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output = 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 = 28;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class ChildAgentPositionUpdatePacket : Packet
{
/// <exclude/>
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;
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;
if(LeftAxis == null) { Console.WriteLine("Warning: LeftAxis is null, in " + this.GetType()); }
Array.Copy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12;
if(Size == null) { Console.WriteLine("Warning: Size is null, in " + this.GetType()); }
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);
if(AgentVel == null) { Console.WriteLine("Warning: AgentVel is null, in " + this.GetType()); }
Array.Copy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12;
if(AgentPos == null) { Console.WriteLine("Warning: AgentPos is null, in " + this.GetType()); }
Array.Copy(AgentPos.GetBytes(), 0, bytes, i, 12); i += 12;
if(UpAxis == null) { Console.WriteLine("Warning: UpAxis is null, in " + this.GetType()); }
Array.Copy(UpAxis.GetBytes(), 0, bytes, i, 12); i += 12;
if(AtAxis == null) { Console.WriteLine("Warning: AtAxis is null, in " + this.GetType()); }
Array.Copy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12;
if(Center == null) { Console.WriteLine("Warning: Center is null, in " + this.GetType()); }
Array.Copy(Center.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- AgentData --\n";
output += "ViewerCircuitCode: " + ViewerCircuitCode.ToString() + "\n";
output += "AgentID: " + AgentID.ToString() + "\n";
output += "ChangedGrid: " + ChangedGrid.ToString() + "\n";
output += "SessionID: " + SessionID.ToString() + "\n";
output += "LeftAxis: " + LeftAxis.ToString() + "\n";
output += "Size: " + Size.ToString() + "\n";
output += "RegionHandle: " + RegionHandle.ToString() + "\n";
output += "AgentVel: " + AgentVel.ToString() + "\n";
output += "AgentPos: " + AgentPos.ToString() + "\n";
output += "UpAxis: " + UpAxis.ToString() + "\n";
output += "AtAxis: " + AtAxis.ToString() + "\n";
output += "Center: " + Center.ToString() + "\n";
output = 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 = 29;
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 ---\n";
output += AgentData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class PassObjectPacket : Packet
{
/// <exclude/>
public class ObjectDataBlock
{
public LLUUID ID;
public bool GroupOwned;
public sbyte PathTwistBegin;
public byte PathEnd;
public short AngVelX;
public short AngVelY;
public short AngVelZ;
public uint BaseMask;
public byte ProfileBegin;
public short SubType;
public sbyte PathRadiusOffset;
public short VelX;
public sbyte PathSkew;
public short VelY;
public short VelZ;
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 LLUUID ParentID;
public short PosX;
public short PosY;
public short PosZ;
public byte ProfileCurve;
public byte PathScaleX;
public byte PathScaleY;
public LLUUID GroupID;
public byte Material;
public LLUUID OwnerID;
public LLUUID CreatorID;
public byte PathShearX;
public byte PathShearY;
public sbyte PathTaperX;
public sbyte PathTaperY;
public byte ProfileEnd;
public byte UsePhysics;
public byte PathBegin;
public byte Active;
public byte PCode;
public byte PathCurve;
public uint EveryoneMask;
public LLVector3 Scale;
public byte State;
public sbyte PathTwist;
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;
public LLQuaternion Rotation;
public uint NextOwnerMask;
public uint GroupMask;
public uint OwnerMask;
public int Length
{
get
{
int length = 168;
if (Data != null) { length += 2 + Data.Length; }
if (TextureEntry != null) { length += 2 + TextureEntry.Length; }
return length;
}
}
public ObjectDataBlock() { }
public ObjectDataBlock(byte[] bytes, ref int i)
{
int length;
try
{
ID = new LLUUID(bytes, i); i += 16;
GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false;
PathTwistBegin = (sbyte)bytes[i++];
PathEnd = (byte)bytes[i++];
AngVelX = (short)(bytes[i++] + (bytes[i++] << 8));
AngVelY = (short)(bytes[i++] + (bytes[i++] << 8));
AngVelZ = (short)(bytes[i++] + (bytes[i++] << 8));
BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
ProfileBegin = (byte)bytes[i++];
SubType = (short)(bytes[i++] + (bytes[i++] << 8));
PathRadiusOffset = (sbyte)bytes[i++];
VelX = (short)(bytes[i++] + (bytes[i++] << 8));
PathSkew = (sbyte)bytes[i++];
VelY = (short)(bytes[i++] + (bytes[i++] << 8));
VelZ = (short)(bytes[i++] + (bytes[i++] << 8));
length = (ushort)(bytes[i++] + (bytes[i++] << 8));
_data = new byte[length];
Array.Copy(bytes, i, _data, 0, length); i += length;
ParentID = new LLUUID(bytes, i); i += 16;
PosX = (short)(bytes[i++] + (bytes[i++] << 8));
PosY = (short)(bytes[i++] + (bytes[i++] << 8));
PosZ = (short)(bytes[i++] + (bytes[i++] << 8));
ProfileCurve = (byte)bytes[i++];
PathScaleX = (byte)bytes[i++];
PathScaleY = (byte)bytes[i++];
GroupID = new LLUUID(bytes, i); i += 16;
Material = (byte)bytes[i++];
OwnerID = new LLUUID(bytes, i); i += 16;
CreatorID = new LLUUID(bytes, i); i += 16;
PathShearX = (byte)bytes[i++];
PathShearY = (byte)bytes[i++];
PathTaperX = (sbyte)bytes[i++];
PathTaperY = (sbyte)bytes[i++];
ProfileEnd = (byte)bytes[i++];
UsePhysics = (byte)bytes[i++];
PathBegin = (byte)bytes[i++];
Active = (byte)bytes[i++];
PCode = (byte)bytes[i++];
PathCurve = (byte)bytes[i++];
EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
Scale = new LLVector3(bytes, i); i += 12;
State = (byte)bytes[i++];
PathTwist = (sbyte)bytes[i++];
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++];
Rotation = new LLQuaternion(bytes, i, true); i += 12;
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)
{
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)((GroupOwned) ? 1 : 0);
bytes[i++] = (byte)PathTwistBegin;
bytes[i++] = PathEnd;
bytes[i++] = (byte)(AngVelX % 256);
bytes[i++] = (byte)((AngVelX >> 8) % 256);
bytes[i++] = (byte)(AngVelY % 256);
bytes[i++] = (byte)((AngVelY >> 8) % 256);
bytes[i++] = (byte)(AngVelZ % 256);
bytes[i++] = (byte)((AngVelZ >> 8) % 256);
bytes[i++] = (byte)(BaseMask % 256);
bytes[i++] = (byte)((BaseMask >> 8) % 256);
bytes[i++] = (byte)((BaseMask >> 16) % 256);
bytes[i++] = (byte)((BaseMask >> 24) % 256);
bytes[i++] = ProfileBegin;
bytes[i++] = (byte)(SubType % 256);
bytes[i++] = (byte)((SubType >> 8) % 256);
bytes[i++] = (byte)PathRadiusOffset;
bytes[i++] = (byte)(VelX % 256);
bytes[i++] = (byte)((VelX >> 8) % 256);
bytes[i++] = (byte)PathSkew;
bytes[i++] = (byte)(VelY % 256);
bytes[i++] = (byte)((VelY >> 8) % 256);
bytes[i++] = (byte)(VelZ % 256);
bytes[i++] = (byte)((VelZ >> 8) % 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;
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)(PosX % 256);
bytes[i++] = (byte)((PosX >> 8) % 256);
bytes[i++] = (byte)(PosY % 256);
bytes[i++] = (byte)((PosY >> 8) % 256);
bytes[i++] = (byte)(PosZ % 256);
bytes[i++] = (byte)((PosZ >> 8) % 256);
bytes[i++] = ProfileCurve;
bytes[i++] = PathScaleX;
bytes[i++] = PathScaleY;
if(GroupID == null) { Console.WriteLine("Warning: GroupID is null, in " + this.GetType()); }
Array.Copy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16;
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(CreatorID == null) { Console.WriteLine("Warning: CreatorID is null, in " + this.GetType()); }
Array.Copy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = PathShearX;
bytes[i++] = PathShearY;
bytes[i++] = (byte)PathTaperX;
bytes[i++] = (byte)PathTaperY;
bytes[i++] = ProfileEnd;
bytes[i++] = UsePhysics;
bytes[i++] = PathBegin;
bytes[i++] = Active;
bytes[i++] = PCode;
bytes[i++] = PathCurve;
bytes[i++] = (byte)(EveryoneMask % 256);
bytes[i++] = (byte)((EveryoneMask >> 8) % 256);
bytes[i++] = (byte)((EveryoneMask >> 16) % 256);
bytes[i++] = (byte)((EveryoneMask >> 24) % 256);
if(Scale == null) { Console.WriteLine("Warning: Scale is null, in " + this.GetType()); }
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
bytes[i++] = State;
bytes[i++] = (byte)PathTwist;
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;
if(Rotation == null) { Console.WriteLine("Warning: Rotation is null, in " + this.GetType()); }
Array.Copy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
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 --\n";
output += "ID: " + ID.ToString() + "\n";
output += "GroupOwned: " + GroupOwned.ToString() + "\n";
output += "PathTwistBegin: " + PathTwistBegin.ToString() + "\n";
output += "PathEnd: " + PathEnd.ToString() + "\n";
output += "AngVelX: " + AngVelX.ToString() + "\n";
output += "AngVelY: " + AngVelY.ToString() + "\n";
output += "AngVelZ: " + AngVelZ.ToString() + "\n";
output += "BaseMask: " + BaseMask.ToString() + "\n";
output += "ProfileBegin: " + ProfileBegin.ToString() + "\n";
output += "SubType: " + SubType.ToString() + "\n";
output += "PathRadiusOffset: " + PathRadiusOffset.ToString() + "\n";
output += "VelX: " + VelX.ToString() + "\n";
output += "PathSkew: " + PathSkew.ToString() + "\n";
output += "VelY: " + VelY.ToString() + "\n";
output += "VelZ: " + VelZ.ToString() + "\n";
output += Helpers.FieldToString(Data, "Data") + "\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += "PosX: " + PosX.ToString() + "\n";
output += "PosY: " + PosY.ToString() + "\n";
output += "PosZ: " + PosZ.ToString() + "\n";
output += "ProfileCurve: " + ProfileCurve.ToString() + "\n";
output += "PathScaleX: " + PathScaleX.ToString() + "\n";
output += "PathScaleY: " + PathScaleY.ToString() + "\n";
output += "GroupID: " + GroupID.ToString() + "\n";
output += "Material: " + Material.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "CreatorID: " + CreatorID.ToString() + "\n";
output += "PathShearX: " + PathShearX.ToString() + "\n";
output += "PathShearY: " + PathShearY.ToString() + "\n";
output += "PathTaperX: " + PathTaperX.ToString() + "\n";
output += "PathTaperY: " + PathTaperY.ToString() + "\n";
output += "ProfileEnd: " + ProfileEnd.ToString() + "\n";
output += "UsePhysics: " + UsePhysics.ToString() + "\n";
output += "PathBegin: " + PathBegin.ToString() + "\n";
output += "Active: " + Active.ToString() + "\n";
output += "PCode: " + PCode.ToString() + "\n";
output += "PathCurve: " + PathCurve.ToString() + "\n";
output += "EveryoneMask: " + EveryoneMask.ToString() + "\n";
output += "Scale: " + Scale.ToString() + "\n";
output += "State: " + State.ToString() + "\n";
output += "PathTwist: " + PathTwist.ToString() + "\n";
output += Helpers.FieldToString(TextureEntry, "TextureEntry") + "\n";
output += "ProfileHollow: " + ProfileHollow.ToString() + "\n";
output += "PathRevolutions: " + PathRevolutions.ToString() + "\n";
output += "Rotation: " + Rotation.ToString() + "\n";
output += "NextOwnerMask: " + NextOwnerMask.ToString() + "\n";
output += "GroupMask: " + GroupMask.ToString() + "\n";
output += "OwnerMask: " + OwnerMask.ToString() + "\n";
output = output.Trim();
return output;
}
}
/// <exclude/>
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); }
}
}
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 --\n";
output += Helpers.FieldToString(NVPairs, "NVPairs") + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.PassObject; } }
public ObjectDataBlock ObjectData;
public NVPairDataBlock[] NVPairData;
public PassObjectPacket()
{
Header = new HighHeader();
Header.ID = 30;
Header.Reliable = true;
Header.Zerocoded = true;
ObjectData = new ObjectDataBlock();
NVPairData = new NVPairDataBlock[0];
}
public PassObjectPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new HighHeader(bytes, ref i, ref packetEnd);
ObjectData = new ObjectDataBlock(bytes, ref i);
int count = (int)bytes[i++];
NVPairData = new NVPairDataBlock[count];
for (int j = 0; j < count; j++)
{ NVPairData[j] = new NVPairDataBlock(bytes, ref i); }
}
public PassObjectPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
ObjectData = new ObjectDataBlock(bytes, ref i);
int 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 += ObjectData.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);
ObjectData.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 = "--- PassObject ---\n";
output += ObjectData.ToString() + "\n";
for (int j = 0; j < NVPairData.Length; j++)
{
output += NVPairData[j].ToString() + "\n";
}
return output;
}
}
/// <exclude/>
public class AtomicPassObjectPacket : Packet
{
/// <exclude/>
public class TaskDataBlock
{
public bool AttachmentNeedsSave;
public LLUUID TaskID;
public int Length
{
get
{
return 17;
}
}
public TaskDataBlock() { }
public TaskDataBlock(byte[] bytes, ref int i)
{
try
{
AttachmentNeedsSave = (bytes[i++] != 0) ? (bool)true : (bool)false;
TaskID = new LLUUID(bytes, i); i += 16;
}
catch (Exception)
{
throw new MalformedDataException();
}
}
public void ToBytes(byte[] bytes, ref int i)
{
bytes[i++] = (byte)((AttachmentNeedsSave) ? 1 : 0);
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 = "-- TaskData --\n";
output += "AttachmentNeedsSave: " + AttachmentNeedsSave.ToString() + "\n";
output += "TaskID: " + TaskID.ToString() + "\n";
output = output.Trim();
return output;
}
}
private Header header;
public override Header Header { get { return header; } set { header = value; } }
public override PacketType Type { get { return PacketType.AtomicPassObject; } }
public TaskDataBlock TaskData;
public AtomicPassObjectPacket()
{
Header = new HighHeader();
Header.ID = 31;
Header.Reliable = true;
TaskData = new TaskDataBlock();
}
public AtomicPassObjectPacket(byte[] bytes, ref int i)
{
int packetEnd = bytes.Length - 1;
Header = new HighHeader(bytes, ref i, ref packetEnd);
TaskData = new TaskDataBlock(bytes, ref i);
}
public AtomicPassObjectPacket(Header head, byte[] bytes, ref int i)
{
Header = head;
TaskData = new TaskDataBlock(bytes, ref i);
}
public override byte[] ToBytes()
{
int length = 5;
length += TaskData.Length;;
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
byte[] bytes = new byte[length];
int i = 0;
header.ToBytes(bytes, ref i);
TaskData.ToBytes(bytes, ref i);
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
return bytes;
}
public override string ToString()
{
string output = "--- AtomicPassObject ---\n";
output += TaskData.ToString() + "\n";
return output;
}
}
/// <exclude/>
public class SoundTriggerPacket : Packet
{
/// <exclude/>
public class SoundDataBlock
{
public LLUUID ObjectID;
public float Gain;
public LLUUID ParentID;
public LLUUID SoundID;
public LLUUID OwnerID;
public ulong Handle;
public LLVector3 Position;
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);
if(Position == null) { Console.WriteLine("Warning: Position is null, in " + this.GetType()); }
Array.Copy(Position.GetBytes(), 0, bytes, i, 12); i += 12;
}
public override string ToString()
{
string output = "-- SoundData --\n";
output += "ObjectID: " + ObjectID.ToString() + "\n";
output += "Gain: " + Gain.ToString() + "\n";
output += "ParentID: " + ParentID.ToString() + "\n";
output += "SoundID: " + SoundID.ToString() + "\n";
output += "OwnerID: " + OwnerID.ToString() + "\n";
output += "Handle: " + Handle.ToString() + "\n";
output += "Position: " + Position.ToString() + "\n";
output = 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 = 32;
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 ---\n";
output += SoundData.ToString() + "\n";
return output;
}
}
}