From 0dc600e83bc4e85412849e7cfa84751014be9d9a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 11 Jul 2007 16:17:06 +0000 Subject: [PATCH] Merging aditi 1213-1274 in to the trunk, preparing for 1.18 release git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1286 52acb1d6-8a22-11de-b505-999d5b087335 --- SLProxy/SLProxy.cs | 103 +- libsecondlife/AvatarManager.cs | 10 +- libsecondlife/Helpers.cs | 10 +- libsecondlife/MainAvatar.cs | 57 +- libsecondlife/NetworkManager.cs | 29 +- libsecondlife/Simulator.cs | 30 + libsecondlife/_Packets_.cs | 57109 +++++++--------- .../examples/TestClient/TestClient.csproj | 2 +- .../libsecondlife.Utilities/Utilities.cs | 27 +- libsecondlife/mapgenerator/ProtocolManager.cs | 96 +- libsecondlife/mapgenerator/mapgenerator.cs | 26 +- libsecondlife/mapgenerator/template.cs | 151 +- 12 files changed, 25763 insertions(+), 31887 deletions(-) diff --git a/SLProxy/SLProxy.cs b/SLProxy/SLProxy.cs index e90c5e72..b2a6ab82 100644 --- a/SLProxy/SLProxy.cs +++ b/SLProxy/SLProxy.cs @@ -355,11 +355,6 @@ namespace SLProxy Socket client = loginServer.Accept(); IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint; -#if DEBUG_CAPS - Log("handling HTTP request from " + clientEndPoint, false); -#endif - - try { Thread connThread = new Thread((ThreadStart)delegate @@ -530,10 +525,6 @@ namespace SLProxy contentLength = Convert.ToInt32(headers["content-length"]); } -#if DEBUG_CAPS - Console.WriteLine("[" + reqNo + "] request length = " + contentLength); -#endif - // read the HTTP body into a buffer byte[] content = new byte[contentLength]; reader.Read(content, 0, contentLength); @@ -905,71 +896,24 @@ namespace SLProxy bytes[3] = (byte)((simIP >> 24) % 256); info["SimIP"] = bytes; info["SimPort"] = (int)simPort; - } + } else if(message == "EstablishAgentCommunication") { + string ipAndPort = (string)body["sim-ip-and-port"]; + string[] pieces = ipAndPort.Split(':'); + byte[] bytes = IPAddress.Parse(pieces[0]).GetAddressBytes(); + uint simIP = (uint)(bytes[0] + (bytes[1] << 8) + (bytes[2] << 16) + (bytes[3] << 24)); + ushort simPort = (ushort)Convert.ToInt32(pieces[1]); + + string capsURL = (string)body["seed-capability"]; + Console.WriteLine("DEBUG: Got EstablishAgentCommunication for " + ipAndPort +" with seed cap " +capsURL); + GenericCheck(ref simIP, ref simPort, ref capsURL, false); + body["seed-capability"] = capsURL; + body["sim-ip-and-port"] = new IPAddress((uint)simIP).ToString()+":"+simPort; + Console.WriteLine("DEBUG: Modified EstablishAgentCommunication to " + (string)body["sim-ip-and-port"] +" with seed cap " +capsURL); + } } return false; } - /* private byte[] CapsFixup(string uri, byte[] data) { - CapInfo cap; - lock(this) { - if(!KnownCaps.ContainsKey(uri)) { - Console.WriteLine("Unknown caps URI: "+uri); - return data; - } - cap = KnownCaps[uri]; - } - lock(cap) { - - } - object resp = LLSD.LLSDDeserialize(data); - if(cap.CapType == "SeedCapability") { - Hashtable m = (Hashtable)resp; - Hashtable nm = new Hashtable(); - foreach(string key in m.Keys) { - string val = (string)m[key]; - if(val != null && val != "") { - if(!KnownCaps.ContainsKey(val)) - KnownCaps[val] = new CapInfo(val, cap.Sim, key); - nm[key] = "http://127.0.0.1:8080/"+val; - } else { - nm[key] = val; - } - } - resp = nm; - } else if(cap.CapType == "NewAgentInventory") { - Hashtable m = (Hashtable)resp; - if(m.ContainsKey("uploader") && m["uploader"] != null && (string)m["uploader"] != "") - m["uploader"] = "http://127.0.0.1:8080/"+(string)m["uploader"]; - } else if(cap.CapType == "EventQueueGet") { - Console.WriteLine(LLSD.LLSDDump(resp,0)); - foreach(Hashtable evt in (ArrayList)((Hashtable)resp)["events"]) { - string message = (string)evt["message"]; - Hashtable body = (Hashtable)evt["body"]; - if(message == "TeleportFinish" || message == "CrossedRegion") { - Hashtable info = null; - if(message == "TeleportFinish") - info = (Hashtable) body["Info"]; - else - info = (Hashtable) body["RegionData"]; - byte[] bytes = (byte[]) info["SimIP"]; - uint simIP = Helpers.BytesToUIntBig((byte[]) info["SimIP"]); - ushort simPort = (ushort)(int)info["SimPort"]; - string capsURL = (string)info["SeedCapability"]; - GenericCheck(ref simIP, ref simPort, ref capsURL, cap.Sim == activeCircuit); - info["SeedCapability"] = capsURL; - bytes[0] = (byte)(simIP % 256); - bytes[1] = (byte)((simIP >> 8) % 256); - bytes[2] = (byte)((simIP >> 16) % 256); - bytes[3] = (byte)((simIP >> 24) % 256); - info["SimIP"] = bytes; - info["SimPort"] = (int)simPort; - } - } - } - return LLSD.LLSDSerialize(resp); - } */ - private void ProxyLogin(NetworkStream netStream, byte[] content) { lock (this) @@ -1834,7 +1778,6 @@ namespace SLProxy //AddMystery(PacketType.AgentPresenceResponse); incomingCheckers.Add(PacketType.TeleportFinish, new AddressChecker(CheckTeleportFinish)); - incomingCheckers.Add(PacketType.AgentToNewRegion, new AddressChecker(CheckAgentToNewRegion)); incomingCheckers.Add(PacketType.CrossedRegion, new AddressChecker(CheckCrossedRegion)); incomingCheckers.Add(PacketType.EnableSimulator, new AddressChecker(CheckEnableSimulator)); //incomingCheckers.Add("UserLoginLocationReply", new AddressChecker(CheckUserLoginLocationReply)); @@ -1884,24 +1827,6 @@ namespace SLProxy return (Packet)tfp; } - // CheckAgentToNewRegion: check AgentToNewRegion packets - private Packet CheckAgentToNewRegion(Packet packet) - { - if (packet.Type != PacketType.AgentToNewRegion) return packet; - - try - { - AgentToNewRegionPacket atnwp = (AgentToNewRegionPacket)packet; - string simCaps = null; // FIXME: why doesn't this have a SeedCapability field? - GenericCheck(ref atnwp.RegionData.IP, ref atnwp.RegionData.Port, ref simCaps, true); - return (Packet)atnwp; - } - catch (Exception) - { - return packet; - } - } - // CheckEnableSimulator: check EnableSimulator packets private Packet CheckEnableSimulator(Packet packet) { diff --git a/libsecondlife/AvatarManager.cs b/libsecondlife/AvatarManager.cs index 3370270d..cb8318ae 100644 --- a/libsecondlife/AvatarManager.cs +++ b/libsecondlife/AvatarManager.cs @@ -53,7 +53,7 @@ namespace libsecondlife /// /// /// - public delegate void AvatarStatisticsCallback(LLUUID avatarID, Avatar.Statistics statistics); + // public delegate void AvatarStatisticsCallback(LLUUID avatarID, Avatar.Statistics statistics); /// /// Triggered when a response for avatar interests is returned /// @@ -118,7 +118,7 @@ namespace libsecondlife /// public event AvatarNamesCallback OnAvatarNames; /// - public event AvatarStatisticsCallback OnAvatarStatistics; + // public event AvatarStatisticsCallback OnAvatarStatistics; /// public event AvatarInterestsCallback OnAvatarInterests; /// @@ -151,7 +151,7 @@ namespace libsecondlife // Avatar profile callbacks Client.Network.RegisterCallback(PacketType.AvatarPropertiesReply, new NetworkManager.PacketCallback(AvatarPropertiesHandler)); - Client.Network.RegisterCallback(PacketType.AvatarStatisticsReply, new NetworkManager.PacketCallback(AvatarStatisticsHandler)); + // Client.Network.RegisterCallback(PacketType.AvatarStatisticsReply, new NetworkManager.PacketCallback(AvatarStatisticsHandler)); Client.Network.RegisterCallback(PacketType.AvatarInterestsReply, new NetworkManager.PacketCallback(AvatarInterestsHandler)); // Avatar group callback @@ -282,7 +282,7 @@ namespace libsecondlife /// /// /// - private void AvatarStatisticsHandler(Packet packet, Simulator simulator) +/* private void AvatarStatisticsHandler(Packet packet, Simulator simulator) { if (OnAvatarStatistics != null) { @@ -319,7 +319,7 @@ namespace libsecondlife OnAvatarStatistics(asr.AvatarData.AvatarID, stats); } - } + } */ /// /// Process incoming avatar properties (profile data) diff --git a/libsecondlife/Helpers.cs b/libsecondlife/Helpers.cs index b080e7c2..ba0ab05a 100644 --- a/libsecondlife/Helpers.cs +++ b/libsecondlife/Helpers.cs @@ -787,8 +787,8 @@ namespace libsecondlife try { - Buffer.BlockCopy(src, 0, dest, 0, 4); - zerolen = 4; + Buffer.BlockCopy(src, 0, dest, 0, 6); + zerolen = 6; bodylen = srclen; for (i = zerolen; i < bodylen; i++) @@ -835,7 +835,7 @@ namespace libsecondlife /// The output byte array to encode to public static void ZeroDecodeCommand(byte[] src, byte[] dest) { - for (int srcPos = 4, destPos = 4; destPos < 8; ++srcPos) + for (int srcPos = 6, destPos = 6; destPos < 10; ++srcPos) { if (src[srcPos] == 0x00) { @@ -870,8 +870,8 @@ namespace libsecondlife uint zerolen = 0; byte zerocount = 0; - Buffer.BlockCopy(src, 0, dest, 0, 4); - zerolen += 4; + Buffer.BlockCopy(src, 0, dest, 0, 6); + zerolen += 6; int bodylen; if ((src[0] & MSG_APPENDED_ACKS) == 0) diff --git a/libsecondlife/MainAvatar.cs b/libsecondlife/MainAvatar.cs index df22de18..4298f2f2 100644 --- a/libsecondlife/MainAvatar.cs +++ b/libsecondlife/MainAvatar.cs @@ -792,11 +792,8 @@ namespace libsecondlife // Health callback Client.Network.RegisterCallback(PacketType.HealthMessage, new NetworkManager.PacketCallback(HealthHandler)); - // Money callbacks - callback = new NetworkManager.PacketCallback(BalanceHandler); - Client.Network.RegisterCallback(PacketType.MoneyBalanceReply, callback); - Client.Network.RegisterCallback(PacketType.MoneySummaryReply, callback); - Client.Network.RegisterCallback(PacketType.AdjustBalance, callback); + // Money callback + Client.Network.RegisterCallback(PacketType.MoneyBalanceReply, new NetworkManager.PacketCallback(BalanceHandler)); // Group callbacks Client.Network.RegisterCallback(PacketType.JoinGroupReply, new NetworkManager.PacketCallback(JoinGroupHandler)); @@ -1491,7 +1488,7 @@ namespace libsecondlife /// Target to look at public void RequestTeleport(ulong regionHandle, LLVector3 position, LLVector3 lookAt) { - if (Client.Network.CurrentCaps != null && Client.Network.CurrentCaps.IsEventQueueRunning) + if (Client.Network.CurrentSim != null && Client.Network.CurrentSim.SimCaps != null && Client.Network.CurrentSim.SimCaps.IsEventQueueRunning) { TeleportLocationRequestPacket teleport = new TeleportLocationRequestPacket(); teleport.AgentData.AgentID = Client.Network.AgentID; @@ -1957,27 +1954,16 @@ namespace libsecondlife /// Unused private void BalanceHandler(Packet packet, Simulator simulator) { - if (packet.Type == PacketType.MoneySummaryReply) - { - balance = ((MoneySummaryReplyPacket)packet).MoneyData.Balance; - } - else if (packet.Type == PacketType.AdjustBalance) - { - balance += ((AdjustBalancePacket)packet).AgentData.Delta; - } - else if (packet.Type == PacketType.MoneyBalanceReply) - { - MoneyBalanceReplyPacket mbrp = (MoneyBalanceReplyPacket)packet; - balance = mbrp.MoneyData.MoneyBalance; + MoneyBalanceReplyPacket mbrp = (MoneyBalanceReplyPacket)packet; + balance = mbrp.MoneyData.MoneyBalance; - if (OnMoneyBalanceReplyReceived != null) - { - try { OnMoneyBalanceReplyReceived(mbrp.MoneyData.TransactionID, - mbrp.MoneyData.TransactionSuccess, mbrp.MoneyData.MoneyBalance, - mbrp.MoneyData.SquareMetersCredit, mbrp.MoneyData.SquareMetersCommitted, - Helpers.FieldToUTF8String(mbrp.MoneyData.Description)); } - catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); } - } + if (OnMoneyBalanceReplyReceived != null) + { + try { OnMoneyBalanceReplyReceived(mbrp.MoneyData.TransactionID, + mbrp.MoneyData.TransactionSuccess, mbrp.MoneyData.MoneyBalance, + mbrp.MoneyData.SquareMetersCredit, mbrp.MoneyData.SquareMetersCommitted, + Helpers.FieldToUTF8String(mbrp.MoneyData.Description)); } + catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); } } if (OnBalanceUpdated != null) @@ -2011,6 +1997,23 @@ namespace libsecondlife caps.Simulator.ToString(), packet.Info.SimIP, packet.Info.LocationID, packet.Info.RegionHandle)); TeleportHandler(packet, Client.Network.CurrentSim); + } + else if(message == "EstablishAgentCommunication" && Client.Settings.MULTIPLE_SIMS) + { + string ipAndPort = (string)body["sim-ip-and-port"]; + string[] pieces = ipAndPort.Split(':'); + IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(pieces[0]), Convert.ToInt32(pieces[1])); + Simulator sim = Client.Network.FindSimulator(endPoint); + if(sim == null) { + Client.Log("Got EstablishAgentCommunication for unknown sim " + + ipAndPort, Helpers.LogLevel.Error); + } + else + { + Client.Log("Got EstablishAgentCommunication for sim " + + ipAndPort + ", seed cap " + (string)body["seed-capability"], Helpers.LogLevel.Info); + sim.setSeedCaps((string)body["seed-capability"]); + } } else { @@ -2092,7 +2095,7 @@ namespace libsecondlife // Attempt to reconnect to the previous simulator // TODO: This hasn't been tested at all Client.Network.Connect(simulator.IPEndPoint.Address, (ushort)simulator.IPEndPoint.Port, - true, Client.Network.CurrentCaps.Seedcaps); + true, simulator.SimCaps.Seedcaps); Client.Log(teleportMessage, Helpers.LogLevel.Warning); } diff --git a/libsecondlife/NetworkManager.cs b/libsecondlife/NetworkManager.cs index bad650c3..0741556b 100644 --- a/libsecondlife/NetworkManager.cs +++ b/libsecondlife/NetworkManager.cs @@ -171,8 +171,6 @@ namespace libsecondlife /// The simulator that the logged in avatar is currently /// occupying public Simulator CurrentSim = null; - /// The capabilities for the current simulator - public Caps CurrentCaps = null; /// All of the simulators we are currently connected to public List Simulators = new List(); @@ -451,9 +449,9 @@ namespace libsecondlife DisconnectTimer.Stop(); // Insist on shutdown - LogoutDemandPacket logoutDemand = new LogoutDemandPacket(); - logoutDemand.LogoutBlock.SessionID = SessionID; - CurrentSim.SendPacket(logoutDemand, true); + // LogoutDemandPacket logoutDemand = new LogoutDemandPacket(); // FIXME: packet is no more + // logoutDemand.LogoutBlock.SessionID = SessionID; + // CurrentSim.SendPacket(logoutDemand, true); FinalizeLogout(); } @@ -649,18 +647,7 @@ namespace libsecondlife Simulator oldSim = CurrentSim; lock (Simulators) CurrentSim = simulator; // CurrentSim is synchronized against Simulators - // Disable any current running CAPS system - if (CurrentCaps != null) CurrentCaps.Disconnect(false); - CurrentCaps = null; - - if (Client.Settings.ENABLE_CAPS) - { - // Connect to the new CAPS system - if (!String.IsNullOrEmpty(seedcaps)) - CurrentCaps = new Caps(Client, simulator, seedcaps); - else - Client.Log("Setting the current sim without a capabilities server!", Helpers.LogLevel.Error); - } + simulator.setSeedCaps(seedcaps); // If the current simulator changed fire the callback if (OnCurrentSimChanged != null && simulator != oldSim) @@ -745,12 +732,6 @@ namespace libsecondlife lock (Simulators) CurrentSim = null; } - // Kill the current CAPS system - if (CurrentCaps != null) - { - CurrentCaps.Disconnect(true); - CurrentCaps = null; - } // Clear out all of the packets that never had time to process lock (PacketInbox) PacketInbox.Clear(); @@ -758,7 +739,7 @@ namespace libsecondlife connected = false; } - private Simulator FindSimulator(IPEndPoint endPoint) + public Simulator FindSimulator(IPEndPoint endPoint) { lock (Simulators) { diff --git a/libsecondlife/Simulator.cs b/libsecondlife/Simulator.cs index dfc969c6..7c72cb38 100644 --- a/libsecondlife/Simulator.cs +++ b/libsecondlife/Simulator.cs @@ -136,6 +136,8 @@ namespace libsecondlife public SecondLife Client; /// public LLUUID ID = LLUUID.Zero; + /// The capabilities for this simulator + public Caps SimCaps = null; /// public ulong Handle; /// @@ -404,6 +406,26 @@ namespace libsecondlife return false; } + public void setSeedCaps(string seedcaps) { + if(SimCaps != null) { + if(SimCaps.Seedcaps == seedcaps) return; + + Client.Log("Unexpected change of seed capability", Helpers.LogLevel.Warning); + SimCaps.Disconnect(true); + SimCaps = null; + } + + if (Client.Settings.ENABLE_CAPS) // [TODO] Implement caps + { + // Connect to the new CAPS system + if (!String.IsNullOrEmpty(seedcaps)) + SimCaps = new Caps(Client, this, seedcaps); + else + Client.Log("Setting up a sim without a valid capabilities server!", Helpers.LogLevel.Error); + } + + } + /// /// Disconnect from this simulator /// @@ -414,6 +436,14 @@ namespace libsecondlife StatsTimer.Stop(); if (Client.Settings.SEND_PINGS) PingTimer.Stop(); + // Kill the current CAPS system + if (SimCaps != null) + { + SimCaps.Disconnect(true); + SimCaps = null; + } + + // Make sure the socket is hooked up if (!Connection.Connected) return; diff --git a/libsecondlife/_Packets_.cs b/libsecondlife/_Packets_.cs index f56da9f3..fe6ae08a 100644 --- a/libsecondlife/_Packets_.cs +++ b/libsecondlife/_Packets_.cs @@ -109,8 +109,11 @@ namespace libsecondlife.Packets [XmlIgnore] public uint Sequence { - get { return (uint)((Data[1] << 16) + (Data[2] << 8) + Data[3]); } - set { Data[1] = (byte)(value >> 16); Data[2] = (byte)(value >> 8); Data[3] = (byte)(value % 256); } + get { return (uint)((Data[1] << 24) + (Data[2] << 16) + (Data[3] << 8) + Data[4]); } + set { + Data[1] = (byte)(value >> 24); Data[2] = (byte)(value >> 16); + Data[3] = (byte)(value >> 8); Data[4] = (byte)(value % 256); + } } /// Numeric ID number of this packet [XmlIgnore] @@ -152,9 +155,9 @@ namespace libsecondlife.Packets /// public static Header BuildHeader(byte[] bytes, ref int pos, ref int packetEnd) { - if (bytes[4] == 0xFF) + if (bytes[6] == 0xFF) { - if (bytes[5] == 0xFF) + if (bytes[7] == 0xFF) { return new LowHeader(bytes, ref pos, ref packetEnd); } @@ -215,8 +218,8 @@ namespace libsecondlife.Packets /// public override ushort ID { - get { return (ushort)((Data[6] << 8) + Data[7]); } - set { Data[6] = (byte)(value >> 8); Data[7] = (byte)(value % 256); } + get { return (ushort)((Data[8] << 8) + Data[9]); } + set { Data[8] = (byte)(value >> 8); Data[9] = (byte)(value % 256); } } /// public override PacketFrequency Frequency { get { return PacketFrequency.Low; } } @@ -226,8 +229,8 @@ namespace libsecondlife.Packets /// public LowHeader() { - Data = new byte[8]; - Data[4] = Data[5] = 0xFF; + Data = new byte[10]; + Data[6] = Data[7] = 0xFF; AckList = new uint[0]; } @@ -239,15 +242,15 @@ namespace libsecondlife.Packets /// public LowHeader(byte[] bytes, ref int pos, ref int packetEnd) { - if (bytes.Length < 8) { throw new MalformedDataException(); } - Data = new byte[8]; - Buffer.BlockCopy(bytes, 0, Data, 0, 8); + if (bytes.Length < 10) { throw new MalformedDataException(); } + Data = new byte[10]; + Buffer.BlockCopy(bytes, 0, Data, 0, 10); - if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0 && bytes[6] == 0) + if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0 && bytes[8] == 0) { - if (bytes[7] == 1) + if (bytes[9] == 1) { - Data[7] = bytes[8]; + Data[9] = bytes[10]; } else { @@ -255,6 +258,57 @@ namespace libsecondlife.Packets } } + pos = 10; + CreateAckList(bytes, ref packetEnd); + } + + /// + /// + /// + /// + /// + public override void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(Data, 0, bytes, i, 10); + i += 10; + } + } + + /// + /// + /// + public class MediumHeader : Header + { + /// + public override ushort ID + { + get { return (ushort)Data[7]; } + set { Data[7] = (byte)value; } + } + /// + public override PacketFrequency Frequency { get { return PacketFrequency.Medium; } } + + /// + /// + /// + public MediumHeader() + { + Data = new byte[8]; + Data[6] = 0xFF; + AckList = new uint[0]; + } + + /// + /// + /// + /// + /// + /// + public MediumHeader(byte[] bytes, ref int pos, ref int packetEnd) + { + if (bytes.Length < 8) { throw new MalformedDataException(); } + Data = new byte[8]; + Buffer.BlockCopy(bytes, 0, Data, 0, 8); pos = 8; CreateAckList(bytes, ref packetEnd); } @@ -271,57 +325,6 @@ namespace libsecondlife.Packets } } - /// - /// - /// - public class MediumHeader : Header - { - /// - public override ushort ID - { - get { return (ushort)Data[5]; } - set { Data[5] = (byte)value; } - } - /// - public override PacketFrequency Frequency { get { return PacketFrequency.Medium; } } - - /// - /// - /// - public MediumHeader() - { - Data = new byte[6]; - Data[4] = 0xFF; - AckList = new uint[0]; - } - - /// - /// - /// - /// - /// - /// - public MediumHeader(byte[] bytes, ref int pos, ref int packetEnd) - { - if (bytes.Length < 6) { throw new MalformedDataException(); } - Data = new byte[6]; - Buffer.BlockCopy(bytes, 0, Data, 0, 6); - pos = 6; - CreateAckList(bytes, ref packetEnd); - } - - /// - /// - /// - /// - /// - public override void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(Data, 0, bytes, i, 6); - i += 6; - } - } - /// /// /// @@ -330,8 +333,8 @@ namespace libsecondlife.Packets /// public override ushort ID { - get { return (ushort)Data[4]; } - set { Data[4] = (byte)value; } + get { return (ushort)Data[6]; } + set { Data[6] = (byte)value; } } /// public override PacketFrequency Frequency { get { return PacketFrequency.High; } } @@ -341,7 +344,7 @@ namespace libsecondlife.Packets /// public HighHeader() { - Data = new byte[5]; + Data = new byte[7]; AckList = new uint[0]; } @@ -353,10 +356,10 @@ namespace libsecondlife.Packets /// public HighHeader(byte[] bytes, ref int pos, ref int packetEnd) { - if (bytes.Length < 5) { throw new MalformedDataException(); } - Data = new byte[5]; - Buffer.BlockCopy(bytes, 0, Data, 0, 5); - pos = 5; + if (bytes.Length < 7) { throw new MalformedDataException(); } + Data = new byte[7]; + Buffer.BlockCopy(bytes, 0, Data, 0, 7); + pos = 7; CreateAckList(bytes, ref packetEnd); } @@ -367,8 +370,8 @@ namespace libsecondlife.Packets /// public override void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(Data, 0, bytes, i, 5); - i += 5; + Buffer.BlockCopy(Data, 0, bytes, i, 7); + i += 7; } } @@ -376,443 +379,401 @@ namespace libsecondlife.Packets { /// A generic value, not an actual packet type Default, - TestMessage, - UseCircuitCode, - LogControl, - LogMessages, - TelehubInfo, - EconomyDataRequest, - EconomyData, - AvatarPickerRequest, - AvatarPickerReply, - PlacesQuery, - PlacesReply, - DirFindQuery, - DirPlacesQuery, - DirPlacesReply, - DirPeopleReply, - DirEventsReply, - DirGroupsReply, - DirClassifiedQuery, - DirClassifiedReply, - AvatarClassifiedReply, - ClassifiedInfoRequest, - ClassifiedInfoReply, - ClassifiedInfoUpdate, - ClassifiedDelete, - ClassifiedGodDelete, - DirPicksQuery, - DirPicksReply, - DirLandQuery, - DirLandReply, - DirPopularQuery, - DirPopularReply, - ParcelInfoRequest, - ParcelInfoReply, - ParcelObjectOwnersRequest, - ParcelObjectOwnersReply, - GroupNoticesListRequest, - GroupNoticesListReply, - GroupNoticeRequest, - GroupNoticeDelete, - TeleportRequest, - TeleportLocationRequest, - TeleportLocal, - TeleportLandmarkRequest, - TeleportProgress, - TeleportFinish, - StartLure, - TeleportLureRequest, - TeleportCancel, - TeleportStart, - TeleportFailed, - LeaderBoardRequest, - LeaderBoardData, - Undo, - Redo, - UndoLand, - RedoLand, - AgentPause, - AgentResume, - ChatFromViewer, - AgentThrottle, - AgentFOV, - AgentHeightWidth, - AgentSetAppearance, - AgentQuit, - AgentQuitCopy, - ImageNotInDatabase, - RebakeAvatarTextures, - SetAlwaysRun, - ObjectDelete, - ObjectDuplicate, - ObjectDuplicateOnRay, - ObjectScale, - ObjectRotation, - ObjectFlagUpdate, - ObjectClickAction, - ObjectImage, - ObjectMaterial, - ObjectShape, - ObjectExtraParams, - ObjectOwner, - ObjectGroup, - ObjectBuy, - BuyObjectInventory, - DerezContainer, - ObjectPermissions, - ObjectSaleInfo, - ObjectName, - ObjectDescription, - ObjectCategory, - ObjectSelect, - ObjectDeselect, - ObjectAttach, - ObjectDetach, - ObjectDrop, - ObjectLink, - ObjectDelink, - ObjectHinge, - ObjectDehinge, - ObjectGrab, - ObjectGrabUpdate, - ObjectDeGrab, - ObjectSpinStart, - ObjectSpinUpdate, - ObjectSpinStop, - ObjectExportSelected, - ObjectImport, - ModifyLand, - VelocityInterpolateOn, - VelocityInterpolateOff, - StateSave, - ReportAutosaveCrash, - SimWideDeletes, - TrackAgent, - ViewerStats, - ScriptAnswerYes, - UserReport, - AlertMessage, - AgentAlertMessage, - MeanCollisionAlert, - ViewerFrozenMessage, - HealthMessage, - ChatFromSimulator, - SimStats, - RequestRegionInfo, - RegionInfo, - GodUpdateRegionInfo, - NearestLandingRegionUpdated, - RegionHandshake, - RegionHandshakeReply, - SimulatorViewerTimeMessage, - EnableSimulator, - DisableSimulator, - TransferRequest, - TransferInfo, - TransferAbort, - TransferPriority, - RequestXfer, - AbortXfer, - RequestAvatarInfo, - AvatarAppearance, - SetFollowCamProperties, - ClearFollowCamProperties, - RequestPayPrice, - PayPriceReply, - KickUser, - KickUserAck, - GodKickUser, - EjectUser, - FreezeUser, - AvatarPropertiesRequest, - AvatarPropertiesReply, - AvatarInterestsReply, - AvatarGroupsReply, - AvatarPropertiesUpdate, - AvatarInterestsUpdate, - AvatarStatisticsReply, - AvatarNotesReply, - AvatarNotesUpdate, - AvatarPicksReply, - EventInfoRequest, - EventInfoReply, - EventNotificationAddRequest, - EventNotificationRemoveRequest, - EventGodDelete, - PickInfoRequest, - PickInfoReply, - PickInfoUpdate, - PickDelete, - PickGodDelete, - ScriptQuestion, - ScriptControlChange, - ScriptDialog, - ScriptDialogReply, - ForceScriptControlRelease, - RevokePermissions, - LoadURL, - ScriptTeleportRequest, - ParcelOverlay, - ParcelPropertiesRequestByID, - ParcelPropertiesUpdate, - ParcelReturnObjects, - ParcelSetOtherCleanTime, - ParcelDisableObjects, - ParcelSelectObjects, - EstateCovenantRequest, - EstateCovenantReply, - ForceObjectSelect, - ParcelBuyPass, - ParcelDeedToGroup, - ParcelReclaim, - ParcelClaim, - ParcelJoin, - ParcelDivide, - ParcelRelease, - ParcelBuy, - ParcelGodForceOwner, - ParcelAccessListRequest, - ParcelAccessListReply, - ParcelAccessListUpdate, - ParcelDwellRequest, - ParcelDwellReply, - ParcelGodMarkAsContent, - ViewerStartAuction, - UUIDNameRequest, - UUIDNameReply, - UUIDGroupNameRequest, - UUIDGroupNameReply, - ChildAgentDying, - ChildAgentUnknown, - GetScriptRunning, - ScriptRunningReply, - SetScriptRunning, - ScriptReset, - ScriptSensorRequest, - ScriptSensorReply, - CompleteAgentMovement, - AgentMovementComplete, - ConnectAgentToUserserver, - ConnectToUserserver, - LogoutRequest, - FinalizeLogout, - LogoutReply, - LogoutDemand, - ImprovedInstantMessage, - RetrieveInstantMessages, - FindAgent, - RequestGodlikePowers, - GrantGodlikePowers, - GodlikeMessage, - EstateOwnerMessage, - GenericMessage, - MuteListRequest, - UpdateMuteListEntry, - RemoveMuteListEntry, - CopyInventoryFromNotecard, - UpdateInventoryItem, - UpdateCreateInventoryItem, - MoveInventoryItem, - CopyInventoryItem, - RemoveInventoryItem, - ChangeInventoryItemFlags, - SaveAssetIntoInventory, - CreateInventoryFolder, - UpdateInventoryFolder, - MoveInventoryFolder, - RemoveInventoryFolder, - FetchInventoryDescendents, - InventoryDescendents, - FetchInventory, - FetchInventoryReply, - BulkUpdateInventory, - RequestInventoryAsset, - InventoryAssetResponse, - RemoveInventoryObjects, - PurgeInventoryDescendents, - UpdateTaskInventory, - RemoveTaskInventory, - MoveTaskInventory, - RequestTaskInventory, - ReplyTaskInventory, - DeRezObject, - DeRezAck, - RezObject, - RezObjectFromNotecard, - DeclineInventory, - RequestFriendship, - AcceptFriendship, - DeclineFriendship, - FormFriendship, - TerminateFriendship, - OfferCallingCard, - AcceptCallingCard, - DeclineCallingCard, - RezScript, - CreateInventoryItem, - CreateLandmarkForEvent, - RegionHandleRequest, - RegionIDAndHandleReply, - MoneyTransferRequest, - AdjustBalance, - MoneyBalanceRequest, - MoneyBalanceReply, - RoutedMoneyBalanceReply, - MoneyHistoryRequest, - MoneyHistoryReply, - MoneySummaryRequest, - MoneySummaryReply, - MoneyDetailsRequest, - MoneyDetailsReply, - MoneyTransactionsRequest, - MoneyTransactionsReply, - ActivateGestures, - DeactivateGestures, - MuteListUpdate, - UseCachedMuteList, - GrantUserRights, - ChangeUserRights, - OnlineNotification, - OfflineNotification, - SetStartLocationRequest, - AssetUploadRequest, - AssetUploadComplete, - ReputationAgentAssign, - ReputationIndividualRequest, - ReputationIndividualReply, - CreateGroupRequest, - CreateGroupReply, - UpdateGroupInfo, - GroupRoleChanges, - JoinGroupRequest, - JoinGroupReply, - EjectGroupMemberRequest, - EjectGroupMemberReply, - LeaveGroupRequest, - LeaveGroupReply, - InviteGroupRequest, - GroupProfileRequest, - GroupProfileReply, - GroupAccountSummaryRequest, - GroupAccountSummaryReply, - GroupAccountDetailsRequest, - GroupAccountDetailsReply, - GroupAccountTransactionsRequest, - GroupAccountTransactionsReply, - GroupActiveProposalsRequest, - GroupActiveProposalItemReply, - GroupVoteHistoryRequest, - GroupVoteHistoryItemReply, - StartGroupProposal, - GroupProposalBallot, - GroupMembersRequest, - GroupMembersReply, - ActivateGroup, - SetGroupContribution, - SetGroupAcceptNotices, - GroupRoleDataRequest, - GroupRoleDataReply, - GroupRoleMembersRequest, - GroupRoleMembersReply, - GroupTitlesRequest, - GroupTitlesReply, - GroupTitleUpdate, - GroupRoleUpdate, - LiveHelpGroupRequest, - LiveHelpGroupReply, - AgentWearablesRequest, - AgentWearablesUpdate, - AgentIsNowWearing, - AgentCachedTexture, - AgentCachedTextureResponse, - AgentDataUpdateRequest, - AgentDataUpdate, - GroupDataUpdate, - AgentGroupDataUpdate, - AgentDropGroup, - CreateTrustedCircuit, - DenyTrustedCircuit, - RequestTrustedCircuit, - RezSingleAttachmentFromInv, - RezMultipleAttachmentsFromInv, - DetachAttachmentIntoInv, - CreateNewOutfitAttachments, - UserInfoRequest, - UserInfoReply, - UpdateUserInfo, - StartParcelRemoveAck, - InitiateDownload, - SystemMessage, - MapLayerRequest, - MapLayerReply, - MapBlockRequest, - MapNameRequest, - MapBlockReply, - MapItemRequest, - MapItemReply, - SendPostcard, - ParcelMediaCommandMessage, - ParcelMediaUpdate, - LandStatRequest, - LandStatReply, - SecuredTemplateChecksumRequest, - PacketAck, - OpenCircuit, - CloseCircuit, - TemplateChecksumRequest, - TemplateChecksumReply, - ObjectAdd, - MultipleObjectUpdate, - RequestMultipleObjects, - ObjectPosition, - RequestObjectPropertiesFamily, - CoarseLocationUpdate, - CrossedRegion, - ConfirmEnableSimulator, - ObjectProperties, - ObjectPropertiesFamily, - ParcelPropertiesRequest, - AttachedSound, - AttachedSoundGainChange, - AttachedSoundCutoffRadius, - PreloadSound, - ViewerEffect, - SetSunPhase, - StartPingCheck, - CompletePingCheck, - AgentUpdate, - AgentAnimation, - AgentRequestSit, - AgentSit, - RequestImage, - ImageData, - ImagePacket, - LayerData, - ObjectUpdate, - ObjectUpdateCompressed, - ObjectUpdateCached, - ImprovedTerseObjectUpdate, - KillObject, - AgentToNewRegion, - TransferPacket, - SendXferPacket, - ConfirmXferPacket, - AvatarAnimation, - AvatarSitResponse, - CameraConstraint, - ParcelProperties, - ChildAgentUpdate, - ChildAgentAlive, - ChildAgentPositionUpdate, - SoundTrigger, + TestMessage = 65537, + UseCircuitCode = 65539, + TelehubInfo = 65546, + EconomyDataRequest = 65560, + EconomyData = 65561, + AvatarPickerRequest = 65562, + AvatarPickerReply = 65564, + PlacesQuery = 65565, + PlacesReply = 65566, + DirFindQuery = 65567, + DirPlacesQuery = 65569, + DirPlacesReply = 65571, + DirPeopleReply = 65572, + DirEventsReply = 65573, + DirGroupsReply = 65574, + DirClassifiedQuery = 65575, + DirClassifiedReply = 65577, + AvatarClassifiedReply = 65578, + ClassifiedInfoRequest = 65579, + ClassifiedInfoReply = 65580, + ClassifiedInfoUpdate = 65581, + ClassifiedDelete = 65582, + ClassifiedGodDelete = 65583, + DirLandQuery = 65584, + DirLandReply = 65586, + DirPopularQuery = 65587, + DirPopularReply = 65589, + ParcelInfoRequest = 65590, + ParcelInfoReply = 65591, + ParcelObjectOwnersRequest = 65592, + ParcelObjectOwnersReply = 65593, + GroupNoticesListRequest = 65594, + GroupNoticesListReply = 65595, + GroupNoticeRequest = 65596, + TeleportRequest = 65598, + TeleportLocationRequest = 65599, + TeleportLocal = 65600, + TeleportLandmarkRequest = 65601, + TeleportProgress = 65602, + TeleportFinish = 65605, + StartLure = 65606, + TeleportLureRequest = 65607, + TeleportCancel = 65608, + TeleportStart = 65609, + TeleportFailed = 65610, + Undo = 65611, + Redo = 65612, + UndoLand = 65613, + AgentPause = 65614, + AgentResume = 65615, + ChatFromViewer = 65616, + AgentThrottle = 65617, + AgentFOV = 65618, + AgentHeightWidth = 65619, + AgentSetAppearance = 65620, + AgentQuitCopy = 65621, + ImageNotInDatabase = 65622, + RebakeAvatarTextures = 65623, + SetAlwaysRun = 65624, + ObjectDelete = 65625, + ObjectDuplicate = 65626, + ObjectDuplicateOnRay = 65627, + ObjectScale = 65628, + ObjectRotation = 65629, + ObjectFlagUpdate = 65630, + ObjectClickAction = 65631, + ObjectImage = 65632, + ObjectMaterial = 65633, + ObjectShape = 65634, + ObjectExtraParams = 65635, + ObjectOwner = 65636, + ObjectGroup = 65637, + ObjectBuy = 65638, + BuyObjectInventory = 65639, + DerezContainer = 65640, + ObjectPermissions = 65641, + ObjectSaleInfo = 65642, + ObjectName = 65643, + ObjectDescription = 65644, + ObjectCategory = 65645, + ObjectSelect = 65646, + ObjectDeselect = 65647, + ObjectAttach = 65648, + ObjectDetach = 65649, + ObjectDrop = 65650, + ObjectLink = 65651, + ObjectDelink = 65652, + ObjectGrab = 65653, + ObjectGrabUpdate = 65654, + ObjectDeGrab = 65655, + ObjectSpinStart = 65656, + ObjectSpinUpdate = 65657, + ObjectSpinStop = 65658, + ObjectExportSelected = 65659, + ModifyLand = 65660, + VelocityInterpolateOn = 65661, + VelocityInterpolateOff = 65662, + StateSave = 65663, + ReportAutosaveCrash = 65664, + SimWideDeletes = 65665, + TrackAgent = 65666, + ViewerStats = 65667, + ScriptAnswerYes = 65668, + UserReport = 65669, + AlertMessage = 65670, + AgentAlertMessage = 65671, + MeanCollisionAlert = 65672, + ViewerFrozenMessage = 65673, + HealthMessage = 65674, + ChatFromSimulator = 65675, + SimStats = 65676, + RequestRegionInfo = 65677, + RegionInfo = 65678, + GodUpdateRegionInfo = 65679, + NearestLandingRegionUpdated = 65682, + RegionHandshake = 65684, + RegionHandshakeReply = 65685, + SimulatorViewerTimeMessage = 65686, + EnableSimulator = 65687, + DisableSimulator = 65688, + TransferRequest = 65689, + TransferInfo = 65690, + TransferAbort = 65691, + RequestXfer = 65692, + AbortXfer = 65693, + AvatarAppearance = 65694, + SetFollowCamProperties = 65695, + ClearFollowCamProperties = 65696, + RequestPayPrice = 65697, + PayPriceReply = 65698, + KickUser = 65699, + KickUserAck = 65700, + GodKickUser = 65701, + EjectUser = 65703, + FreezeUser = 65704, + AvatarPropertiesRequest = 65705, + AvatarPropertiesReply = 65707, + AvatarInterestsReply = 65708, + AvatarGroupsReply = 65709, + AvatarPropertiesUpdate = 65710, + AvatarInterestsUpdate = 65711, + AvatarNotesReply = 65712, + AvatarNotesUpdate = 65713, + AvatarPicksReply = 65714, + EventInfoRequest = 65715, + EventInfoReply = 65716, + EventNotificationAddRequest = 65717, + EventNotificationRemoveRequest = 65718, + EventGodDelete = 65719, + PickInfoReply = 65720, + PickInfoUpdate = 65721, + PickDelete = 65722, + PickGodDelete = 65723, + ScriptQuestion = 65724, + ScriptControlChange = 65725, + ScriptDialog = 65726, + ScriptDialogReply = 65727, + ForceScriptControlRelease = 65728, + RevokePermissions = 65729, + LoadURL = 65730, + ScriptTeleportRequest = 65731, + ParcelOverlay = 65732, + ParcelPropertiesRequestByID = 65733, + ParcelPropertiesUpdate = 65734, + ParcelReturnObjects = 65735, + ParcelSetOtherCleanTime = 65736, + ParcelDisableObjects = 65737, + ParcelSelectObjects = 65738, + EstateCovenantRequest = 65739, + EstateCovenantReply = 65740, + ForceObjectSelect = 65741, + ParcelBuyPass = 65742, + ParcelDeedToGroup = 65743, + ParcelReclaim = 65744, + ParcelClaim = 65745, + ParcelJoin = 65746, + ParcelDivide = 65747, + ParcelRelease = 65748, + ParcelBuy = 65749, + ParcelGodForceOwner = 65750, + ParcelAccessListRequest = 65751, + ParcelAccessListReply = 65752, + ParcelAccessListUpdate = 65753, + ParcelDwellRequest = 65754, + ParcelDwellReply = 65755, + ParcelGodMarkAsContent = 65763, + ViewerStartAuction = 65764, + UUIDNameRequest = 65771, + UUIDNameReply = 65772, + UUIDGroupNameRequest = 65773, + UUIDGroupNameReply = 65774, + ChildAgentDying = 65776, + ChildAgentUnknown = 65777, + GetScriptRunning = 65779, + ScriptRunningReply = 65780, + SetScriptRunning = 65781, + ScriptReset = 65782, + ScriptSensorRequest = 65783, + ScriptSensorReply = 65784, + CompleteAgentMovement = 65785, + AgentMovementComplete = 65786, + LogoutRequest = 65788, + LogoutReply = 65789, + ImprovedInstantMessage = 65790, + RetrieveInstantMessages = 65791, + FindAgent = 65792, + RequestGodlikePowers = 65793, + GrantGodlikePowers = 65794, + GodlikeMessage = 65795, + EstateOwnerMessage = 65796, + GenericMessage = 65797, + MuteListRequest = 65798, + UpdateMuteListEntry = 65799, + RemoveMuteListEntry = 65800, + CopyInventoryFromNotecard = 65801, + UpdateInventoryItem = 65802, + UpdateCreateInventoryItem = 65803, + MoveInventoryItem = 65804, + CopyInventoryItem = 65805, + RemoveInventoryItem = 65806, + ChangeInventoryItemFlags = 65807, + SaveAssetIntoInventory = 65808, + CreateInventoryFolder = 65809, + UpdateInventoryFolder = 65810, + MoveInventoryFolder = 65811, + RemoveInventoryFolder = 65812, + FetchInventoryDescendents = 65813, + InventoryDescendents = 65814, + FetchInventory = 65815, + FetchInventoryReply = 65816, + BulkUpdateInventory = 65817, + RequestInventoryAsset = 65818, + InventoryAssetResponse = 65819, + RemoveInventoryObjects = 65820, + PurgeInventoryDescendents = 65821, + UpdateTaskInventory = 65822, + RemoveTaskInventory = 65823, + MoveTaskInventory = 65824, + RequestTaskInventory = 65825, + ReplyTaskInventory = 65826, + DeRezObject = 65827, + DeRezAck = 65828, + RezObject = 65829, + RezObjectFromNotecard = 65830, + AcceptFriendship = 65833, + DeclineFriendship = 65834, + FormFriendship = 65835, + TerminateFriendship = 65836, + OfferCallingCard = 65837, + AcceptCallingCard = 65838, + DeclineCallingCard = 65839, + RezScript = 65840, + CreateInventoryItem = 65841, + CreateLandmarkForEvent = 65842, + RegionHandleRequest = 65845, + RegionIDAndHandleReply = 65846, + MoneyTransferRequest = 65847, + MoneyBalanceRequest = 65849, + MoneyBalanceReply = 65850, + RoutedMoneyBalanceReply = 65851, + ActivateGestures = 65852, + DeactivateGestures = 65853, + MuteListUpdate = 65854, + UseCachedMuteList = 65855, + GrantUserRights = 65856, + ChangeUserRights = 65857, + OnlineNotification = 65858, + OfflineNotification = 65859, + SetStartLocationRequest = 65860, + AssetUploadRequest = 65869, + AssetUploadComplete = 65870, + CreateGroupRequest = 65875, + CreateGroupReply = 65876, + UpdateGroupInfo = 65877, + GroupRoleChanges = 65878, + JoinGroupRequest = 65879, + JoinGroupReply = 65880, + EjectGroupMemberRequest = 65881, + EjectGroupMemberReply = 65882, + LeaveGroupRequest = 65883, + LeaveGroupReply = 65884, + InviteGroupRequest = 65885, + GroupProfileRequest = 65887, + GroupProfileReply = 65888, + GroupAccountSummaryRequest = 65889, + GroupAccountSummaryReply = 65890, + GroupAccountDetailsRequest = 65891, + GroupAccountDetailsReply = 65892, + GroupAccountTransactionsRequest = 65893, + GroupAccountTransactionsReply = 65894, + GroupActiveProposalsRequest = 65895, + GroupActiveProposalItemReply = 65896, + GroupVoteHistoryRequest = 65897, + GroupVoteHistoryItemReply = 65898, + StartGroupProposal = 65899, + GroupProposalBallot = 65900, + GroupMembersRequest = 65902, + GroupMembersReply = 65903, + ActivateGroup = 65904, + SetGroupContribution = 65905, + SetGroupAcceptNotices = 65906, + GroupRoleDataRequest = 65907, + GroupRoleDataReply = 65908, + GroupRoleMembersRequest = 65909, + GroupRoleMembersReply = 65910, + GroupTitlesRequest = 65911, + GroupTitlesReply = 65912, + GroupTitleUpdate = 65913, + GroupRoleUpdate = 65914, + LiveHelpGroupRequest = 65915, + LiveHelpGroupReply = 65916, + AgentWearablesRequest = 65917, + AgentWearablesUpdate = 65918, + AgentIsNowWearing = 65919, + AgentCachedTexture = 65920, + AgentCachedTextureResponse = 65921, + AgentDataUpdateRequest = 65922, + AgentDataUpdate = 65923, + GroupDataUpdate = 65924, + AgentGroupDataUpdate = 65925, + AgentDropGroup = 65926, + CreateTrustedCircuit = 65928, + DenyTrustedCircuit = 65929, + RequestTrustedCircuit = 65930, + RezSingleAttachmentFromInv = 65931, + RezMultipleAttachmentsFromInv = 65932, + DetachAttachmentIntoInv = 65933, + CreateNewOutfitAttachments = 65934, + UserInfoRequest = 65935, + UserInfoReply = 65936, + UpdateUserInfo = 65937, + InitiateDownload = 65939, + SystemMessage = 65940, + MapLayerRequest = 65941, + MapLayerReply = 65942, + MapBlockRequest = 65943, + MapNameRequest = 65944, + MapBlockReply = 65945, + MapItemRequest = 65946, + MapItemReply = 65947, + SendPostcard = 65948, + ParcelMediaCommandMessage = 65955, + ParcelMediaUpdate = 65956, + LandStatRequest = 65957, + LandStatReply = 65958, + Error = 65959, + PacketAck = 131067, + OpenCircuit = 131068, + CloseCircuit = 131069, + ObjectAdd = 131073, + MultipleObjectUpdate = 131074, + RequestMultipleObjects = 131075, + ObjectPosition = 131076, + RequestObjectPropertiesFamily = 131077, + CoarseLocationUpdate = 131078, + CrossedRegion = 131079, + ConfirmEnableSimulator = 131080, + ObjectProperties = 131081, + ObjectPropertiesFamily = 131082, + ParcelPropertiesRequest = 131083, + AttachedSound = 131085, + AttachedSoundGainChange = 131086, + PreloadSound = 131087, + ViewerEffect = 131089, + StartPingCheck = 196609, + CompletePingCheck = 196610, + AgentUpdate = 196612, + AgentAnimation = 196613, + AgentRequestSit = 196614, + AgentSit = 196615, + RequestImage = 196616, + ImageData = 196617, + ImagePacket = 196618, + LayerData = 196619, + ObjectUpdate = 196620, + ObjectUpdateCompressed = 196621, + ObjectUpdateCached = 196622, + ImprovedTerseObjectUpdate = 196623, + KillObject = 196624, + TransferPacket = 196625, + SendXferPacket = 196626, + ConfirmXferPacket = 196627, + AvatarAnimation = 196628, + AvatarSitResponse = 196629, + CameraConstraint = 196630, + ParcelProperties = 196631, + ChildAgentUpdate = 196633, + ChildAgentAlive = 196634, + ChildAgentPositionUpdate = 196635, + SoundTrigger = 196637, } #if PACKETSERIALIZE [XmlInclude(typeof(TestMessagePacket))] [XmlInclude(typeof(UseCircuitCodePacket))] - [XmlInclude(typeof(LogControlPacket))] - [XmlInclude(typeof(LogMessagesPacket))] [XmlInclude(typeof(TelehubInfoPacket))] [XmlInclude(typeof(EconomyDataRequestPacket))] [XmlInclude(typeof(EconomyDataPacket))] @@ -834,8 +795,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(ClassifiedInfoUpdatePacket))] [XmlInclude(typeof(ClassifiedDeletePacket))] [XmlInclude(typeof(ClassifiedGodDeletePacket))] - [XmlInclude(typeof(DirPicksQueryPacket))] - [XmlInclude(typeof(DirPicksReplyPacket))] [XmlInclude(typeof(DirLandQueryPacket))] [XmlInclude(typeof(DirLandReplyPacket))] [XmlInclude(typeof(DirPopularQueryPacket))] @@ -847,7 +806,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(GroupNoticesListRequestPacket))] [XmlInclude(typeof(GroupNoticesListReplyPacket))] [XmlInclude(typeof(GroupNoticeRequestPacket))] - [XmlInclude(typeof(GroupNoticeDeletePacket))] [XmlInclude(typeof(TeleportRequestPacket))] [XmlInclude(typeof(TeleportLocationRequestPacket))] [XmlInclude(typeof(TeleportLocalPacket))] @@ -859,12 +817,9 @@ namespace libsecondlife.Packets [XmlInclude(typeof(TeleportCancelPacket))] [XmlInclude(typeof(TeleportStartPacket))] [XmlInclude(typeof(TeleportFailedPacket))] - [XmlInclude(typeof(LeaderBoardRequestPacket))] - [XmlInclude(typeof(LeaderBoardDataPacket))] [XmlInclude(typeof(UndoPacket))] [XmlInclude(typeof(RedoPacket))] [XmlInclude(typeof(UndoLandPacket))] - [XmlInclude(typeof(RedoLandPacket))] [XmlInclude(typeof(AgentPausePacket))] [XmlInclude(typeof(AgentResumePacket))] [XmlInclude(typeof(ChatFromViewerPacket))] @@ -872,7 +827,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(AgentFOVPacket))] [XmlInclude(typeof(AgentHeightWidthPacket))] [XmlInclude(typeof(AgentSetAppearancePacket))] - [XmlInclude(typeof(AgentQuitPacket))] [XmlInclude(typeof(AgentQuitCopyPacket))] [XmlInclude(typeof(ImageNotInDatabasePacket))] [XmlInclude(typeof(RebakeAvatarTexturesPacket))] @@ -905,8 +859,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(ObjectDropPacket))] [XmlInclude(typeof(ObjectLinkPacket))] [XmlInclude(typeof(ObjectDelinkPacket))] - [XmlInclude(typeof(ObjectHingePacket))] - [XmlInclude(typeof(ObjectDehingePacket))] [XmlInclude(typeof(ObjectGrabPacket))] [XmlInclude(typeof(ObjectGrabUpdatePacket))] [XmlInclude(typeof(ObjectDeGrabPacket))] @@ -914,7 +866,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(ObjectSpinUpdatePacket))] [XmlInclude(typeof(ObjectSpinStopPacket))] [XmlInclude(typeof(ObjectExportSelectedPacket))] - [XmlInclude(typeof(ObjectImportPacket))] [XmlInclude(typeof(ModifyLandPacket))] [XmlInclude(typeof(VelocityInterpolateOnPacket))] [XmlInclude(typeof(VelocityInterpolateOffPacket))] @@ -944,10 +895,8 @@ namespace libsecondlife.Packets [XmlInclude(typeof(TransferRequestPacket))] [XmlInclude(typeof(TransferInfoPacket))] [XmlInclude(typeof(TransferAbortPacket))] - [XmlInclude(typeof(TransferPriorityPacket))] [XmlInclude(typeof(RequestXferPacket))] [XmlInclude(typeof(AbortXferPacket))] - [XmlInclude(typeof(RequestAvatarInfoPacket))] [XmlInclude(typeof(AvatarAppearancePacket))] [XmlInclude(typeof(SetFollowCamPropertiesPacket))] [XmlInclude(typeof(ClearFollowCamPropertiesPacket))] @@ -964,7 +913,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(AvatarGroupsReplyPacket))] [XmlInclude(typeof(AvatarPropertiesUpdatePacket))] [XmlInclude(typeof(AvatarInterestsUpdatePacket))] - [XmlInclude(typeof(AvatarStatisticsReplyPacket))] [XmlInclude(typeof(AvatarNotesReplyPacket))] [XmlInclude(typeof(AvatarNotesUpdatePacket))] [XmlInclude(typeof(AvatarPicksReplyPacket))] @@ -973,7 +921,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(EventNotificationAddRequestPacket))] [XmlInclude(typeof(EventNotificationRemoveRequestPacket))] [XmlInclude(typeof(EventGodDeletePacket))] - [XmlInclude(typeof(PickInfoRequestPacket))] [XmlInclude(typeof(PickInfoReplyPacket))] [XmlInclude(typeof(PickInfoUpdatePacket))] [XmlInclude(typeof(PickDeletePacket))] @@ -1026,12 +973,8 @@ namespace libsecondlife.Packets [XmlInclude(typeof(ScriptSensorReplyPacket))] [XmlInclude(typeof(CompleteAgentMovementPacket))] [XmlInclude(typeof(AgentMovementCompletePacket))] - [XmlInclude(typeof(ConnectAgentToUserserverPacket))] - [XmlInclude(typeof(ConnectToUserserverPacket))] [XmlInclude(typeof(LogoutRequestPacket))] - [XmlInclude(typeof(FinalizeLogoutPacket))] [XmlInclude(typeof(LogoutReplyPacket))] - [XmlInclude(typeof(LogoutDemandPacket))] [XmlInclude(typeof(ImprovedInstantMessagePacket))] [XmlInclude(typeof(RetrieveInstantMessagesPacket))] [XmlInclude(typeof(FindAgentPacket))] @@ -1073,8 +1016,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(DeRezAckPacket))] [XmlInclude(typeof(RezObjectPacket))] [XmlInclude(typeof(RezObjectFromNotecardPacket))] - [XmlInclude(typeof(DeclineInventoryPacket))] - [XmlInclude(typeof(RequestFriendshipPacket))] [XmlInclude(typeof(AcceptFriendshipPacket))] [XmlInclude(typeof(DeclineFriendshipPacket))] [XmlInclude(typeof(FormFriendshipPacket))] @@ -1088,18 +1029,9 @@ namespace libsecondlife.Packets [XmlInclude(typeof(RegionHandleRequestPacket))] [XmlInclude(typeof(RegionIDAndHandleReplyPacket))] [XmlInclude(typeof(MoneyTransferRequestPacket))] - [XmlInclude(typeof(AdjustBalancePacket))] [XmlInclude(typeof(MoneyBalanceRequestPacket))] [XmlInclude(typeof(MoneyBalanceReplyPacket))] [XmlInclude(typeof(RoutedMoneyBalanceReplyPacket))] - [XmlInclude(typeof(MoneyHistoryRequestPacket))] - [XmlInclude(typeof(MoneyHistoryReplyPacket))] - [XmlInclude(typeof(MoneySummaryRequestPacket))] - [XmlInclude(typeof(MoneySummaryReplyPacket))] - [XmlInclude(typeof(MoneyDetailsRequestPacket))] - [XmlInclude(typeof(MoneyDetailsReplyPacket))] - [XmlInclude(typeof(MoneyTransactionsRequestPacket))] - [XmlInclude(typeof(MoneyTransactionsReplyPacket))] [XmlInclude(typeof(ActivateGesturesPacket))] [XmlInclude(typeof(DeactivateGesturesPacket))] [XmlInclude(typeof(MuteListUpdatePacket))] @@ -1111,9 +1043,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(SetStartLocationRequestPacket))] [XmlInclude(typeof(AssetUploadRequestPacket))] [XmlInclude(typeof(AssetUploadCompletePacket))] - [XmlInclude(typeof(ReputationAgentAssignPacket))] - [XmlInclude(typeof(ReputationIndividualRequestPacket))] - [XmlInclude(typeof(ReputationIndividualReplyPacket))] [XmlInclude(typeof(CreateGroupRequestPacket))] [XmlInclude(typeof(CreateGroupReplyPacket))] [XmlInclude(typeof(UpdateGroupInfoPacket))] @@ -1174,7 +1103,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(UserInfoRequestPacket))] [XmlInclude(typeof(UserInfoReplyPacket))] [XmlInclude(typeof(UpdateUserInfoPacket))] - [XmlInclude(typeof(StartParcelRemoveAckPacket))] [XmlInclude(typeof(InitiateDownloadPacket))] [XmlInclude(typeof(SystemMessagePacket))] [XmlInclude(typeof(MapLayerRequestPacket))] @@ -1189,12 +1117,10 @@ namespace libsecondlife.Packets [XmlInclude(typeof(ParcelMediaUpdatePacket))] [XmlInclude(typeof(LandStatRequestPacket))] [XmlInclude(typeof(LandStatReplyPacket))] - [XmlInclude(typeof(SecuredTemplateChecksumRequestPacket))] + [XmlInclude(typeof(ErrorPacket))] [XmlInclude(typeof(PacketAckPacket))] [XmlInclude(typeof(OpenCircuitPacket))] [XmlInclude(typeof(CloseCircuitPacket))] - [XmlInclude(typeof(TemplateChecksumRequestPacket))] - [XmlInclude(typeof(TemplateChecksumReplyPacket))] [XmlInclude(typeof(ObjectAddPacket))] [XmlInclude(typeof(MultipleObjectUpdatePacket))] [XmlInclude(typeof(RequestMultipleObjectsPacket))] @@ -1208,10 +1134,8 @@ namespace libsecondlife.Packets [XmlInclude(typeof(ParcelPropertiesRequestPacket))] [XmlInclude(typeof(AttachedSoundPacket))] [XmlInclude(typeof(AttachedSoundGainChangePacket))] - [XmlInclude(typeof(AttachedSoundCutoffRadiusPacket))] [XmlInclude(typeof(PreloadSoundPacket))] [XmlInclude(typeof(ViewerEffectPacket))] - [XmlInclude(typeof(SetSunPhasePacket))] [XmlInclude(typeof(StartPingCheckPacket))] [XmlInclude(typeof(CompletePingCheckPacket))] [XmlInclude(typeof(AgentUpdatePacket))] @@ -1227,7 +1151,6 @@ namespace libsecondlife.Packets [XmlInclude(typeof(ObjectUpdateCachedPacket))] [XmlInclude(typeof(ImprovedTerseObjectUpdatePacket))] [XmlInclude(typeof(KillObjectPacket))] - [XmlInclude(typeof(AgentToNewRegionPacket))] [XmlInclude(typeof(TransferPacketPacket))] [XmlInclude(typeof(SendXferPacketPacket))] [XmlInclude(typeof(ConfirmXferPacketPacket))] @@ -1262,412 +1185,373 @@ namespace libsecondlife.Packets { case 1: return PacketType.TestMessage; case 3: return PacketType.UseCircuitCode; - case 4: return PacketType.LogControl; - case 6: return PacketType.LogMessages; - case 16: return PacketType.TelehubInfo; - case 36: return PacketType.EconomyDataRequest; - case 37: return PacketType.EconomyData; - case 38: return PacketType.AvatarPickerRequest; - case 40: return PacketType.AvatarPickerReply; - case 41: return PacketType.PlacesQuery; - case 42: return PacketType.PlacesReply; - case 43: return PacketType.DirFindQuery; - case 45: return PacketType.DirPlacesQuery; - case 47: return PacketType.DirPlacesReply; - case 48: return PacketType.DirPeopleReply; - case 49: return PacketType.DirEventsReply; - case 50: return PacketType.DirGroupsReply; - case 51: return PacketType.DirClassifiedQuery; - case 53: return PacketType.DirClassifiedReply; - case 54: return PacketType.AvatarClassifiedReply; - case 55: return PacketType.ClassifiedInfoRequest; - case 56: return PacketType.ClassifiedInfoReply; - case 57: return PacketType.ClassifiedInfoUpdate; - case 58: return PacketType.ClassifiedDelete; - case 59: return PacketType.ClassifiedGodDelete; - case 60: return PacketType.DirPicksQuery; - case 62: return PacketType.DirPicksReply; - case 63: return PacketType.DirLandQuery; - case 65: return PacketType.DirLandReply; - case 66: return PacketType.DirPopularQuery; - case 68: return PacketType.DirPopularReply; - case 69: return PacketType.ParcelInfoRequest; - case 70: return PacketType.ParcelInfoReply; - case 71: return PacketType.ParcelObjectOwnersRequest; - case 74: return PacketType.ParcelObjectOwnersReply; - case 75: return PacketType.GroupNoticesListRequest; - case 76: return PacketType.GroupNoticesListReply; - case 77: return PacketType.GroupNoticeRequest; - case 79: return PacketType.GroupNoticeDelete; - case 80: return PacketType.TeleportRequest; - case 81: return PacketType.TeleportLocationRequest; - case 82: return PacketType.TeleportLocal; - case 83: return PacketType.TeleportLandmarkRequest; - case 84: return PacketType.TeleportProgress; - case 89: return PacketType.TeleportFinish; - case 90: return PacketType.StartLure; - case 91: return PacketType.TeleportLureRequest; - case 92: return PacketType.TeleportCancel; - case 94: return PacketType.TeleportStart; - case 95: return PacketType.TeleportFailed; - case 96: return PacketType.LeaderBoardRequest; - case 97: return PacketType.LeaderBoardData; - case 98: return PacketType.Undo; - case 99: return PacketType.Redo; - case 100: return PacketType.UndoLand; - case 101: return PacketType.RedoLand; - case 102: return PacketType.AgentPause; - case 103: return PacketType.AgentResume; - case 104: return PacketType.ChatFromViewer; - case 105: return PacketType.AgentThrottle; - case 106: return PacketType.AgentFOV; - case 107: return PacketType.AgentHeightWidth; - case 108: return PacketType.AgentSetAppearance; - case 109: return PacketType.AgentQuit; - case 110: return PacketType.AgentQuitCopy; - case 111: return PacketType.ImageNotInDatabase; - case 112: return PacketType.RebakeAvatarTextures; - case 113: return PacketType.SetAlwaysRun; - case 114: return PacketType.ObjectDelete; - case 115: return PacketType.ObjectDuplicate; - case 116: return PacketType.ObjectDuplicateOnRay; - case 117: return PacketType.ObjectScale; - case 118: return PacketType.ObjectRotation; - case 119: return PacketType.ObjectFlagUpdate; - case 120: return PacketType.ObjectClickAction; - case 121: return PacketType.ObjectImage; - case 122: return PacketType.ObjectMaterial; - case 123: return PacketType.ObjectShape; - case 124: return PacketType.ObjectExtraParams; - case 125: return PacketType.ObjectOwner; - case 126: return PacketType.ObjectGroup; - case 127: return PacketType.ObjectBuy; - case 128: return PacketType.BuyObjectInventory; - case 129: return PacketType.DerezContainer; - case 130: return PacketType.ObjectPermissions; - case 131: return PacketType.ObjectSaleInfo; - case 132: return PacketType.ObjectName; - case 133: return PacketType.ObjectDescription; - case 134: return PacketType.ObjectCategory; - case 135: return PacketType.ObjectSelect; - case 136: return PacketType.ObjectDeselect; - case 137: return PacketType.ObjectAttach; - case 138: return PacketType.ObjectDetach; - case 139: return PacketType.ObjectDrop; - case 140: return PacketType.ObjectLink; - case 141: return PacketType.ObjectDelink; - case 142: return PacketType.ObjectHinge; - case 143: return PacketType.ObjectDehinge; - case 144: return PacketType.ObjectGrab; - case 145: return PacketType.ObjectGrabUpdate; - case 146: return PacketType.ObjectDeGrab; - case 147: return PacketType.ObjectSpinStart; - case 148: return PacketType.ObjectSpinUpdate; - case 149: return PacketType.ObjectSpinStop; - case 150: return PacketType.ObjectExportSelected; - case 151: return PacketType.ObjectImport; - case 152: return PacketType.ModifyLand; - case 153: return PacketType.VelocityInterpolateOn; - case 154: return PacketType.VelocityInterpolateOff; - case 155: return PacketType.StateSave; - case 156: return PacketType.ReportAutosaveCrash; - case 157: return PacketType.SimWideDeletes; - case 158: return PacketType.TrackAgent; - case 159: return PacketType.ViewerStats; - case 160: return PacketType.ScriptAnswerYes; - case 161: return PacketType.UserReport; - case 162: return PacketType.AlertMessage; - case 163: return PacketType.AgentAlertMessage; - case 164: return PacketType.MeanCollisionAlert; - case 165: return PacketType.ViewerFrozenMessage; - case 166: return PacketType.HealthMessage; - case 167: return PacketType.ChatFromSimulator; - case 168: return PacketType.SimStats; - case 169: return PacketType.RequestRegionInfo; - case 170: return PacketType.RegionInfo; - case 171: return PacketType.GodUpdateRegionInfo; - case 174: return PacketType.NearestLandingRegionUpdated; - case 176: return PacketType.RegionHandshake; - case 177: return PacketType.RegionHandshakeReply; - case 178: return PacketType.SimulatorViewerTimeMessage; - case 179: return PacketType.EnableSimulator; - case 180: return PacketType.DisableSimulator; - case 181: return PacketType.TransferRequest; - case 182: return PacketType.TransferInfo; - case 183: return PacketType.TransferAbort; - case 184: return PacketType.TransferPriority; - case 185: return PacketType.RequestXfer; - case 186: return PacketType.AbortXfer; - case 187: return PacketType.RequestAvatarInfo; - case 188: return PacketType.AvatarAppearance; - case 189: return PacketType.SetFollowCamProperties; - case 190: return PacketType.ClearFollowCamProperties; - case 191: return PacketType.RequestPayPrice; - case 192: return PacketType.PayPriceReply; - case 193: return PacketType.KickUser; - case 194: return PacketType.KickUserAck; - case 195: return PacketType.GodKickUser; - case 197: return PacketType.EjectUser; - case 198: return PacketType.FreezeUser; - case 199: return PacketType.AvatarPropertiesRequest; - case 201: return PacketType.AvatarPropertiesReply; - case 202: return PacketType.AvatarInterestsReply; - case 203: return PacketType.AvatarGroupsReply; - case 204: return PacketType.AvatarPropertiesUpdate; - case 205: return PacketType.AvatarInterestsUpdate; - case 206: return PacketType.AvatarStatisticsReply; - case 207: return PacketType.AvatarNotesReply; - case 208: return PacketType.AvatarNotesUpdate; - case 209: return PacketType.AvatarPicksReply; - case 210: return PacketType.EventInfoRequest; - case 211: return PacketType.EventInfoReply; - case 212: return PacketType.EventNotificationAddRequest; - case 213: return PacketType.EventNotificationRemoveRequest; - case 214: return PacketType.EventGodDelete; - case 215: return PacketType.PickInfoRequest; - case 216: return PacketType.PickInfoReply; - case 217: return PacketType.PickInfoUpdate; - case 218: return PacketType.PickDelete; - case 219: return PacketType.PickGodDelete; - case 220: return PacketType.ScriptQuestion; - case 221: return PacketType.ScriptControlChange; - case 222: return PacketType.ScriptDialog; - case 223: return PacketType.ScriptDialogReply; - case 224: return PacketType.ForceScriptControlRelease; - case 225: return PacketType.RevokePermissions; - case 226: return PacketType.LoadURL; - case 227: return PacketType.ScriptTeleportRequest; - case 228: return PacketType.ParcelOverlay; - case 229: return PacketType.ParcelPropertiesRequestByID; - case 230: return PacketType.ParcelPropertiesUpdate; - case 231: return PacketType.ParcelReturnObjects; - case 232: return PacketType.ParcelSetOtherCleanTime; - case 233: return PacketType.ParcelDisableObjects; - case 234: return PacketType.ParcelSelectObjects; - case 235: return PacketType.EstateCovenantRequest; - case 236: return PacketType.EstateCovenantReply; - case 237: return PacketType.ForceObjectSelect; - case 238: return PacketType.ParcelBuyPass; - case 239: return PacketType.ParcelDeedToGroup; - case 240: return PacketType.ParcelReclaim; - case 241: return PacketType.ParcelClaim; - case 242: return PacketType.ParcelJoin; - case 243: return PacketType.ParcelDivide; - case 244: return PacketType.ParcelRelease; - case 245: return PacketType.ParcelBuy; - case 246: return PacketType.ParcelGodForceOwner; - case 247: return PacketType.ParcelAccessListRequest; - case 248: return PacketType.ParcelAccessListReply; - case 249: return PacketType.ParcelAccessListUpdate; - case 250: return PacketType.ParcelDwellRequest; - case 251: return PacketType.ParcelDwellReply; - case 259: return PacketType.ParcelGodMarkAsContent; - case 260: return PacketType.ViewerStartAuction; - case 267: return PacketType.UUIDNameRequest; - case 268: return PacketType.UUIDNameReply; - case 269: return PacketType.UUIDGroupNameRequest; - case 270: return PacketType.UUIDGroupNameReply; - case 272: return PacketType.ChildAgentDying; - case 273: return PacketType.ChildAgentUnknown; - case 275: return PacketType.GetScriptRunning; - case 276: return PacketType.ScriptRunningReply; - case 277: return PacketType.SetScriptRunning; - case 278: return PacketType.ScriptReset; - case 279: return PacketType.ScriptSensorRequest; - case 280: return PacketType.ScriptSensorReply; - case 281: return PacketType.CompleteAgentMovement; - case 282: return PacketType.AgentMovementComplete; - case 284: return PacketType.ConnectAgentToUserserver; - case 285: return PacketType.ConnectToUserserver; - case 287: return PacketType.LogoutRequest; - case 288: return PacketType.FinalizeLogout; - case 289: return PacketType.LogoutReply; - case 290: return PacketType.LogoutDemand; - case 291: return PacketType.ImprovedInstantMessage; - case 292: return PacketType.RetrieveInstantMessages; - case 293: return PacketType.FindAgent; - case 294: return PacketType.RequestGodlikePowers; - case 295: return PacketType.GrantGodlikePowers; - case 296: return PacketType.GodlikeMessage; - case 297: return PacketType.EstateOwnerMessage; - case 298: return PacketType.GenericMessage; - case 299: return PacketType.MuteListRequest; - case 300: return PacketType.UpdateMuteListEntry; - case 301: return PacketType.RemoveMuteListEntry; - case 302: return PacketType.CopyInventoryFromNotecard; - case 303: return PacketType.UpdateInventoryItem; - case 304: return PacketType.UpdateCreateInventoryItem; - case 305: return PacketType.MoveInventoryItem; - case 306: return PacketType.CopyInventoryItem; - case 307: return PacketType.RemoveInventoryItem; - case 308: return PacketType.ChangeInventoryItemFlags; - case 309: return PacketType.SaveAssetIntoInventory; - case 310: return PacketType.CreateInventoryFolder; - case 311: return PacketType.UpdateInventoryFolder; - case 312: return PacketType.MoveInventoryFolder; - case 313: return PacketType.RemoveInventoryFolder; - case 314: return PacketType.FetchInventoryDescendents; - case 315: return PacketType.InventoryDescendents; - case 316: return PacketType.FetchInventory; - case 317: return PacketType.FetchInventoryReply; - case 318: return PacketType.BulkUpdateInventory; - case 319: return PacketType.RequestInventoryAsset; - case 320: return PacketType.InventoryAssetResponse; - case 321: return PacketType.RemoveInventoryObjects; - case 322: return PacketType.PurgeInventoryDescendents; - case 323: return PacketType.UpdateTaskInventory; - case 324: return PacketType.RemoveTaskInventory; - case 325: return PacketType.MoveTaskInventory; - case 326: return PacketType.RequestTaskInventory; - case 327: return PacketType.ReplyTaskInventory; - case 328: return PacketType.DeRezObject; - case 329: return PacketType.DeRezAck; - case 330: return PacketType.RezObject; - case 331: return PacketType.RezObjectFromNotecard; - case 332: return PacketType.DeclineInventory; - case 335: return PacketType.RequestFriendship; - case 336: return PacketType.AcceptFriendship; - case 337: return PacketType.DeclineFriendship; - case 338: return PacketType.FormFriendship; - case 339: return PacketType.TerminateFriendship; - case 340: return PacketType.OfferCallingCard; - case 341: return PacketType.AcceptCallingCard; - case 342: return PacketType.DeclineCallingCard; - case 343: return PacketType.RezScript; - case 344: return PacketType.CreateInventoryItem; - case 345: return PacketType.CreateLandmarkForEvent; - case 348: return PacketType.RegionHandleRequest; - case 349: return PacketType.RegionIDAndHandleReply; - case 350: return PacketType.MoneyTransferRequest; - case 353: return PacketType.AdjustBalance; - case 354: return PacketType.MoneyBalanceRequest; - case 355: return PacketType.MoneyBalanceReply; - case 356: return PacketType.RoutedMoneyBalanceReply; - case 357: return PacketType.MoneyHistoryRequest; - case 358: return PacketType.MoneyHistoryReply; - case 359: return PacketType.MoneySummaryRequest; - case 360: return PacketType.MoneySummaryReply; - case 361: return PacketType.MoneyDetailsRequest; - case 362: return PacketType.MoneyDetailsReply; - case 363: return PacketType.MoneyTransactionsRequest; - case 364: return PacketType.MoneyTransactionsReply; - case 365: return PacketType.ActivateGestures; - case 366: return PacketType.DeactivateGestures; - case 367: return PacketType.MuteListUpdate; - case 368: return PacketType.UseCachedMuteList; - case 369: return PacketType.GrantUserRights; - case 370: return PacketType.ChangeUserRights; - case 371: return PacketType.OnlineNotification; - case 372: return PacketType.OfflineNotification; - case 373: return PacketType.SetStartLocationRequest; - case 383: return PacketType.AssetUploadRequest; - case 384: return PacketType.AssetUploadComplete; - case 385: return PacketType.ReputationAgentAssign; - case 386: return PacketType.ReputationIndividualRequest; - case 387: return PacketType.ReputationIndividualReply; - case 392: return PacketType.CreateGroupRequest; - case 393: return PacketType.CreateGroupReply; - case 394: return PacketType.UpdateGroupInfo; - case 395: return PacketType.GroupRoleChanges; - case 396: return PacketType.JoinGroupRequest; - case 397: return PacketType.JoinGroupReply; - case 398: return PacketType.EjectGroupMemberRequest; - case 399: return PacketType.EjectGroupMemberReply; - case 400: return PacketType.LeaveGroupRequest; - case 401: return PacketType.LeaveGroupReply; - case 402: return PacketType.InviteGroupRequest; - case 404: return PacketType.GroupProfileRequest; - case 405: return PacketType.GroupProfileReply; - case 406: return PacketType.GroupAccountSummaryRequest; - case 407: return PacketType.GroupAccountSummaryReply; - case 408: return PacketType.GroupAccountDetailsRequest; - case 409: return PacketType.GroupAccountDetailsReply; - case 410: return PacketType.GroupAccountTransactionsRequest; - case 411: return PacketType.GroupAccountTransactionsReply; - case 412: return PacketType.GroupActiveProposalsRequest; - case 413: return PacketType.GroupActiveProposalItemReply; - case 414: return PacketType.GroupVoteHistoryRequest; - case 415: return PacketType.GroupVoteHistoryItemReply; - case 416: return PacketType.StartGroupProposal; - case 417: return PacketType.GroupProposalBallot; - case 419: return PacketType.GroupMembersRequest; - case 420: return PacketType.GroupMembersReply; - case 421: return PacketType.ActivateGroup; - case 422: return PacketType.SetGroupContribution; - case 423: return PacketType.SetGroupAcceptNotices; - case 424: return PacketType.GroupRoleDataRequest; - case 425: return PacketType.GroupRoleDataReply; - case 426: return PacketType.GroupRoleMembersRequest; - case 427: return PacketType.GroupRoleMembersReply; - case 428: return PacketType.GroupTitlesRequest; - case 429: return PacketType.GroupTitlesReply; - case 430: return PacketType.GroupTitleUpdate; - case 431: return PacketType.GroupRoleUpdate; - case 432: return PacketType.LiveHelpGroupRequest; - case 433: return PacketType.LiveHelpGroupReply; - case 434: return PacketType.AgentWearablesRequest; - case 435: return PacketType.AgentWearablesUpdate; - case 436: return PacketType.AgentIsNowWearing; - case 437: return PacketType.AgentCachedTexture; - case 438: return PacketType.AgentCachedTextureResponse; - case 439: return PacketType.AgentDataUpdateRequest; - case 440: return PacketType.AgentDataUpdate; - case 441: return PacketType.GroupDataUpdate; - case 442: return PacketType.AgentGroupDataUpdate; - case 443: return PacketType.AgentDropGroup; - case 445: return PacketType.CreateTrustedCircuit; - case 446: return PacketType.DenyTrustedCircuit; - case 447: return PacketType.RequestTrustedCircuit; - case 448: return PacketType.RezSingleAttachmentFromInv; - case 449: return PacketType.RezMultipleAttachmentsFromInv; - case 450: return PacketType.DetachAttachmentIntoInv; - case 451: return PacketType.CreateNewOutfitAttachments; - case 452: return PacketType.UserInfoRequest; - case 453: return PacketType.UserInfoReply; - case 454: return PacketType.UpdateUserInfo; - case 460: return PacketType.StartParcelRemoveAck; - case 462: return PacketType.InitiateDownload; - case 463: return PacketType.SystemMessage; - case 464: return PacketType.MapLayerRequest; - case 465: return PacketType.MapLayerReply; - case 466: return PacketType.MapBlockRequest; - case 467: return PacketType.MapNameRequest; - case 468: return PacketType.MapBlockReply; - case 469: return PacketType.MapItemRequest; - case 470: return PacketType.MapItemReply; - case 471: return PacketType.SendPostcard; - case 480: return PacketType.ParcelMediaCommandMessage; - case 481: return PacketType.ParcelMediaUpdate; - case 482: return PacketType.LandStatRequest; - case 483: return PacketType.LandStatReply; - case 65530: return PacketType.SecuredTemplateChecksumRequest; + case 10: return PacketType.TelehubInfo; + case 24: return PacketType.EconomyDataRequest; + case 25: return PacketType.EconomyData; + case 26: return PacketType.AvatarPickerRequest; + case 28: return PacketType.AvatarPickerReply; + case 29: return PacketType.PlacesQuery; + case 30: return PacketType.PlacesReply; + case 31: return PacketType.DirFindQuery; + case 33: return PacketType.DirPlacesQuery; + case 35: return PacketType.DirPlacesReply; + case 36: return PacketType.DirPeopleReply; + case 37: return PacketType.DirEventsReply; + case 38: return PacketType.DirGroupsReply; + case 39: return PacketType.DirClassifiedQuery; + case 41: return PacketType.DirClassifiedReply; + case 42: return PacketType.AvatarClassifiedReply; + case 43: return PacketType.ClassifiedInfoRequest; + case 44: return PacketType.ClassifiedInfoReply; + case 45: return PacketType.ClassifiedInfoUpdate; + case 46: return PacketType.ClassifiedDelete; + case 47: return PacketType.ClassifiedGodDelete; + case 48: return PacketType.DirLandQuery; + case 50: return PacketType.DirLandReply; + case 51: return PacketType.DirPopularQuery; + case 53: return PacketType.DirPopularReply; + case 54: return PacketType.ParcelInfoRequest; + case 55: return PacketType.ParcelInfoReply; + case 56: return PacketType.ParcelObjectOwnersRequest; + case 57: return PacketType.ParcelObjectOwnersReply; + case 58: return PacketType.GroupNoticesListRequest; + case 59: return PacketType.GroupNoticesListReply; + case 60: return PacketType.GroupNoticeRequest; + case 62: return PacketType.TeleportRequest; + case 63: return PacketType.TeleportLocationRequest; + case 64: return PacketType.TeleportLocal; + case 65: return PacketType.TeleportLandmarkRequest; + case 66: return PacketType.TeleportProgress; + case 69: return PacketType.TeleportFinish; + case 70: return PacketType.StartLure; + case 71: return PacketType.TeleportLureRequest; + case 72: return PacketType.TeleportCancel; + case 73: return PacketType.TeleportStart; + case 74: return PacketType.TeleportFailed; + case 75: return PacketType.Undo; + case 76: return PacketType.Redo; + case 77: return PacketType.UndoLand; + case 78: return PacketType.AgentPause; + case 79: return PacketType.AgentResume; + case 80: return PacketType.ChatFromViewer; + case 81: return PacketType.AgentThrottle; + case 82: return PacketType.AgentFOV; + case 83: return PacketType.AgentHeightWidth; + case 84: return PacketType.AgentSetAppearance; + case 85: return PacketType.AgentQuitCopy; + case 86: return PacketType.ImageNotInDatabase; + case 87: return PacketType.RebakeAvatarTextures; + case 88: return PacketType.SetAlwaysRun; + case 89: return PacketType.ObjectDelete; + case 90: return PacketType.ObjectDuplicate; + case 91: return PacketType.ObjectDuplicateOnRay; + case 92: return PacketType.ObjectScale; + case 93: return PacketType.ObjectRotation; + case 94: return PacketType.ObjectFlagUpdate; + case 95: return PacketType.ObjectClickAction; + case 96: return PacketType.ObjectImage; + case 97: return PacketType.ObjectMaterial; + case 98: return PacketType.ObjectShape; + case 99: return PacketType.ObjectExtraParams; + case 100: return PacketType.ObjectOwner; + case 101: return PacketType.ObjectGroup; + case 102: return PacketType.ObjectBuy; + case 103: return PacketType.BuyObjectInventory; + case 104: return PacketType.DerezContainer; + case 105: return PacketType.ObjectPermissions; + case 106: return PacketType.ObjectSaleInfo; + case 107: return PacketType.ObjectName; + case 108: return PacketType.ObjectDescription; + case 109: return PacketType.ObjectCategory; + case 110: return PacketType.ObjectSelect; + case 111: return PacketType.ObjectDeselect; + case 112: return PacketType.ObjectAttach; + case 113: return PacketType.ObjectDetach; + case 114: return PacketType.ObjectDrop; + case 115: return PacketType.ObjectLink; + case 116: return PacketType.ObjectDelink; + case 117: return PacketType.ObjectGrab; + case 118: return PacketType.ObjectGrabUpdate; + case 119: return PacketType.ObjectDeGrab; + case 120: return PacketType.ObjectSpinStart; + case 121: return PacketType.ObjectSpinUpdate; + case 122: return PacketType.ObjectSpinStop; + case 123: return PacketType.ObjectExportSelected; + case 124: return PacketType.ModifyLand; + case 125: return PacketType.VelocityInterpolateOn; + case 126: return PacketType.VelocityInterpolateOff; + case 127: return PacketType.StateSave; + case 128: return PacketType.ReportAutosaveCrash; + case 129: return PacketType.SimWideDeletes; + case 130: return PacketType.TrackAgent; + case 131: return PacketType.ViewerStats; + case 132: return PacketType.ScriptAnswerYes; + case 133: return PacketType.UserReport; + case 134: return PacketType.AlertMessage; + case 135: return PacketType.AgentAlertMessage; + case 136: return PacketType.MeanCollisionAlert; + case 137: return PacketType.ViewerFrozenMessage; + case 138: return PacketType.HealthMessage; + case 139: return PacketType.ChatFromSimulator; + case 140: return PacketType.SimStats; + case 141: return PacketType.RequestRegionInfo; + case 142: return PacketType.RegionInfo; + case 143: return PacketType.GodUpdateRegionInfo; + case 146: return PacketType.NearestLandingRegionUpdated; + case 148: return PacketType.RegionHandshake; + case 149: return PacketType.RegionHandshakeReply; + case 150: return PacketType.SimulatorViewerTimeMessage; + case 151: return PacketType.EnableSimulator; + case 152: return PacketType.DisableSimulator; + case 153: return PacketType.TransferRequest; + case 154: return PacketType.TransferInfo; + case 155: return PacketType.TransferAbort; + case 156: return PacketType.RequestXfer; + case 157: return PacketType.AbortXfer; + case 158: return PacketType.AvatarAppearance; + case 159: return PacketType.SetFollowCamProperties; + case 160: return PacketType.ClearFollowCamProperties; + case 161: return PacketType.RequestPayPrice; + case 162: return PacketType.PayPriceReply; + case 163: return PacketType.KickUser; + case 164: return PacketType.KickUserAck; + case 165: return PacketType.GodKickUser; + case 167: return PacketType.EjectUser; + case 168: return PacketType.FreezeUser; + case 169: return PacketType.AvatarPropertiesRequest; + case 171: return PacketType.AvatarPropertiesReply; + case 172: return PacketType.AvatarInterestsReply; + case 173: return PacketType.AvatarGroupsReply; + case 174: return PacketType.AvatarPropertiesUpdate; + case 175: return PacketType.AvatarInterestsUpdate; + case 176: return PacketType.AvatarNotesReply; + case 177: return PacketType.AvatarNotesUpdate; + case 178: return PacketType.AvatarPicksReply; + case 179: return PacketType.EventInfoRequest; + case 180: return PacketType.EventInfoReply; + case 181: return PacketType.EventNotificationAddRequest; + case 182: return PacketType.EventNotificationRemoveRequest; + case 183: return PacketType.EventGodDelete; + case 184: return PacketType.PickInfoReply; + case 185: return PacketType.PickInfoUpdate; + case 186: return PacketType.PickDelete; + case 187: return PacketType.PickGodDelete; + case 188: return PacketType.ScriptQuestion; + case 189: return PacketType.ScriptControlChange; + case 190: return PacketType.ScriptDialog; + case 191: return PacketType.ScriptDialogReply; + case 192: return PacketType.ForceScriptControlRelease; + case 193: return PacketType.RevokePermissions; + case 194: return PacketType.LoadURL; + case 195: return PacketType.ScriptTeleportRequest; + case 196: return PacketType.ParcelOverlay; + case 197: return PacketType.ParcelPropertiesRequestByID; + case 198: return PacketType.ParcelPropertiesUpdate; + case 199: return PacketType.ParcelReturnObjects; + case 200: return PacketType.ParcelSetOtherCleanTime; + case 201: return PacketType.ParcelDisableObjects; + case 202: return PacketType.ParcelSelectObjects; + case 203: return PacketType.EstateCovenantRequest; + case 204: return PacketType.EstateCovenantReply; + case 205: return PacketType.ForceObjectSelect; + case 206: return PacketType.ParcelBuyPass; + case 207: return PacketType.ParcelDeedToGroup; + case 208: return PacketType.ParcelReclaim; + case 209: return PacketType.ParcelClaim; + case 210: return PacketType.ParcelJoin; + case 211: return PacketType.ParcelDivide; + case 212: return PacketType.ParcelRelease; + case 213: return PacketType.ParcelBuy; + case 214: return PacketType.ParcelGodForceOwner; + case 215: return PacketType.ParcelAccessListRequest; + case 216: return PacketType.ParcelAccessListReply; + case 217: return PacketType.ParcelAccessListUpdate; + case 218: return PacketType.ParcelDwellRequest; + case 219: return PacketType.ParcelDwellReply; + case 227: return PacketType.ParcelGodMarkAsContent; + case 228: return PacketType.ViewerStartAuction; + case 235: return PacketType.UUIDNameRequest; + case 236: return PacketType.UUIDNameReply; + case 237: return PacketType.UUIDGroupNameRequest; + case 238: return PacketType.UUIDGroupNameReply; + case 240: return PacketType.ChildAgentDying; + case 241: return PacketType.ChildAgentUnknown; + case 243: return PacketType.GetScriptRunning; + case 244: return PacketType.ScriptRunningReply; + case 245: return PacketType.SetScriptRunning; + case 246: return PacketType.ScriptReset; + case 247: return PacketType.ScriptSensorRequest; + case 248: return PacketType.ScriptSensorReply; + case 249: return PacketType.CompleteAgentMovement; + case 250: return PacketType.AgentMovementComplete; + case 252: return PacketType.LogoutRequest; + case 253: return PacketType.LogoutReply; + case 254: return PacketType.ImprovedInstantMessage; + case 255: return PacketType.RetrieveInstantMessages; + case 256: return PacketType.FindAgent; + case 257: return PacketType.RequestGodlikePowers; + case 258: return PacketType.GrantGodlikePowers; + case 259: return PacketType.GodlikeMessage; + case 260: return PacketType.EstateOwnerMessage; + case 261: return PacketType.GenericMessage; + case 262: return PacketType.MuteListRequest; + case 263: return PacketType.UpdateMuteListEntry; + case 264: return PacketType.RemoveMuteListEntry; + case 265: return PacketType.CopyInventoryFromNotecard; + case 266: return PacketType.UpdateInventoryItem; + case 267: return PacketType.UpdateCreateInventoryItem; + case 268: return PacketType.MoveInventoryItem; + case 269: return PacketType.CopyInventoryItem; + case 270: return PacketType.RemoveInventoryItem; + case 271: return PacketType.ChangeInventoryItemFlags; + case 272: return PacketType.SaveAssetIntoInventory; + case 273: return PacketType.CreateInventoryFolder; + case 274: return PacketType.UpdateInventoryFolder; + case 275: return PacketType.MoveInventoryFolder; + case 276: return PacketType.RemoveInventoryFolder; + case 277: return PacketType.FetchInventoryDescendents; + case 278: return PacketType.InventoryDescendents; + case 279: return PacketType.FetchInventory; + case 280: return PacketType.FetchInventoryReply; + case 281: return PacketType.BulkUpdateInventory; + case 282: return PacketType.RequestInventoryAsset; + case 283: return PacketType.InventoryAssetResponse; + case 284: return PacketType.RemoveInventoryObjects; + case 285: return PacketType.PurgeInventoryDescendents; + case 286: return PacketType.UpdateTaskInventory; + case 287: return PacketType.RemoveTaskInventory; + case 288: return PacketType.MoveTaskInventory; + case 289: return PacketType.RequestTaskInventory; + case 290: return PacketType.ReplyTaskInventory; + case 291: return PacketType.DeRezObject; + case 292: return PacketType.DeRezAck; + case 293: return PacketType.RezObject; + case 294: return PacketType.RezObjectFromNotecard; + case 297: return PacketType.AcceptFriendship; + case 298: return PacketType.DeclineFriendship; + case 299: return PacketType.FormFriendship; + case 300: return PacketType.TerminateFriendship; + case 301: return PacketType.OfferCallingCard; + case 302: return PacketType.AcceptCallingCard; + case 303: return PacketType.DeclineCallingCard; + case 304: return PacketType.RezScript; + case 305: return PacketType.CreateInventoryItem; + case 306: return PacketType.CreateLandmarkForEvent; + case 309: return PacketType.RegionHandleRequest; + case 310: return PacketType.RegionIDAndHandleReply; + case 311: return PacketType.MoneyTransferRequest; + case 313: return PacketType.MoneyBalanceRequest; + case 314: return PacketType.MoneyBalanceReply; + case 315: return PacketType.RoutedMoneyBalanceReply; + case 316: return PacketType.ActivateGestures; + case 317: return PacketType.DeactivateGestures; + case 318: return PacketType.MuteListUpdate; + case 319: return PacketType.UseCachedMuteList; + case 320: return PacketType.GrantUserRights; + case 321: return PacketType.ChangeUserRights; + case 322: return PacketType.OnlineNotification; + case 323: return PacketType.OfflineNotification; + case 324: return PacketType.SetStartLocationRequest; + case 333: return PacketType.AssetUploadRequest; + case 334: return PacketType.AssetUploadComplete; + case 339: return PacketType.CreateGroupRequest; + case 340: return PacketType.CreateGroupReply; + case 341: return PacketType.UpdateGroupInfo; + case 342: return PacketType.GroupRoleChanges; + case 343: return PacketType.JoinGroupRequest; + case 344: return PacketType.JoinGroupReply; + case 345: return PacketType.EjectGroupMemberRequest; + case 346: return PacketType.EjectGroupMemberReply; + case 347: return PacketType.LeaveGroupRequest; + case 348: return PacketType.LeaveGroupReply; + case 349: return PacketType.InviteGroupRequest; + case 351: return PacketType.GroupProfileRequest; + case 352: return PacketType.GroupProfileReply; + case 353: return PacketType.GroupAccountSummaryRequest; + case 354: return PacketType.GroupAccountSummaryReply; + case 355: return PacketType.GroupAccountDetailsRequest; + case 356: return PacketType.GroupAccountDetailsReply; + case 357: return PacketType.GroupAccountTransactionsRequest; + case 358: return PacketType.GroupAccountTransactionsReply; + case 359: return PacketType.GroupActiveProposalsRequest; + case 360: return PacketType.GroupActiveProposalItemReply; + case 361: return PacketType.GroupVoteHistoryRequest; + case 362: return PacketType.GroupVoteHistoryItemReply; + case 363: return PacketType.StartGroupProposal; + case 364: return PacketType.GroupProposalBallot; + case 366: return PacketType.GroupMembersRequest; + case 367: return PacketType.GroupMembersReply; + case 368: return PacketType.ActivateGroup; + case 369: return PacketType.SetGroupContribution; + case 370: return PacketType.SetGroupAcceptNotices; + case 371: return PacketType.GroupRoleDataRequest; + case 372: return PacketType.GroupRoleDataReply; + case 373: return PacketType.GroupRoleMembersRequest; + case 374: return PacketType.GroupRoleMembersReply; + case 375: return PacketType.GroupTitlesRequest; + case 376: return PacketType.GroupTitlesReply; + case 377: return PacketType.GroupTitleUpdate; + case 378: return PacketType.GroupRoleUpdate; + case 379: return PacketType.LiveHelpGroupRequest; + case 380: return PacketType.LiveHelpGroupReply; + case 381: return PacketType.AgentWearablesRequest; + case 382: return PacketType.AgentWearablesUpdate; + case 383: return PacketType.AgentIsNowWearing; + case 384: return PacketType.AgentCachedTexture; + case 385: return PacketType.AgentCachedTextureResponse; + case 386: return PacketType.AgentDataUpdateRequest; + case 387: return PacketType.AgentDataUpdate; + case 388: return PacketType.GroupDataUpdate; + case 389: return PacketType.AgentGroupDataUpdate; + case 390: return PacketType.AgentDropGroup; + case 392: return PacketType.CreateTrustedCircuit; + case 393: return PacketType.DenyTrustedCircuit; + case 394: return PacketType.RequestTrustedCircuit; + case 395: return PacketType.RezSingleAttachmentFromInv; + case 396: return PacketType.RezMultipleAttachmentsFromInv; + case 397: return PacketType.DetachAttachmentIntoInv; + case 398: return PacketType.CreateNewOutfitAttachments; + case 399: return PacketType.UserInfoRequest; + case 400: return PacketType.UserInfoReply; + case 401: return PacketType.UpdateUserInfo; + case 403: return PacketType.InitiateDownload; + case 404: return PacketType.SystemMessage; + case 405: return PacketType.MapLayerRequest; + case 406: return PacketType.MapLayerReply; + case 407: return PacketType.MapBlockRequest; + case 408: return PacketType.MapNameRequest; + case 409: return PacketType.MapBlockReply; + case 410: return PacketType.MapItemRequest; + case 411: return PacketType.MapItemReply; + case 412: return PacketType.SendPostcard; + case 419: return PacketType.ParcelMediaCommandMessage; + case 420: return PacketType.ParcelMediaUpdate; + case 421: return PacketType.LandStatRequest; + case 422: return PacketType.LandStatReply; + case 423: return PacketType.Error; case 65531: return PacketType.PacketAck; case 65532: return PacketType.OpenCircuit; case 65533: return PacketType.CloseCircuit; - case 65534: return PacketType.TemplateChecksumRequest; - case 65535: return PacketType.TemplateChecksumReply; } break; case PacketFrequency.Medium: switch (id) { - case 2: return PacketType.ObjectAdd; - case 3: return PacketType.MultipleObjectUpdate; - case 4: return PacketType.RequestMultipleObjects; - case 5: return PacketType.ObjectPosition; - case 6: return PacketType.RequestObjectPropertiesFamily; - case 7: return PacketType.CoarseLocationUpdate; - case 8: return PacketType.CrossedRegion; - case 9: return PacketType.ConfirmEnableSimulator; - case 10: return PacketType.ObjectProperties; - case 11: return PacketType.ObjectPropertiesFamily; - case 12: return PacketType.ParcelPropertiesRequest; - case 14: return PacketType.AttachedSound; - case 15: return PacketType.AttachedSoundGainChange; - case 16: return PacketType.AttachedSoundCutoffRadius; - case 17: return PacketType.PreloadSound; - case 19: return PacketType.ViewerEffect; - case 20: return PacketType.SetSunPhase; + case 1: return PacketType.ObjectAdd; + case 2: return PacketType.MultipleObjectUpdate; + case 3: return PacketType.RequestMultipleObjects; + case 4: return PacketType.ObjectPosition; + case 5: return PacketType.RequestObjectPropertiesFamily; + case 6: return PacketType.CoarseLocationUpdate; + case 7: return PacketType.CrossedRegion; + case 8: return PacketType.ConfirmEnableSimulator; + case 9: return PacketType.ObjectProperties; + case 10: return PacketType.ObjectPropertiesFamily; + case 11: return PacketType.ParcelPropertiesRequest; + case 13: return PacketType.AttachedSound; + case 14: return PacketType.AttachedSoundGainChange; + case 15: return PacketType.PreloadSound; + case 17: return PacketType.ViewerEffect; } break; case PacketFrequency.High: @@ -1688,18 +1572,17 @@ namespace libsecondlife.Packets case 14: return PacketType.ObjectUpdateCached; case 15: return PacketType.ImprovedTerseObjectUpdate; case 16: return PacketType.KillObject; - case 17: return PacketType.AgentToNewRegion; - case 18: return PacketType.TransferPacket; - case 19: return PacketType.SendXferPacket; - case 20: return PacketType.ConfirmXferPacket; - case 21: return PacketType.AvatarAnimation; - case 22: return PacketType.AvatarSitResponse; - case 23: return PacketType.CameraConstraint; - case 24: return PacketType.ParcelProperties; - case 26: return PacketType.ChildAgentUpdate; - case 27: return PacketType.ChildAgentAlive; - case 28: return PacketType.ChildAgentPositionUpdate; - case 31: return PacketType.SoundTrigger; + case 17: return PacketType.TransferPacket; + case 18: return PacketType.SendXferPacket; + case 19: return PacketType.ConfirmXferPacket; + case 20: return PacketType.AvatarAnimation; + case 21: return PacketType.AvatarSitResponse; + case 22: return PacketType.CameraConstraint; + case 23: return PacketType.ParcelProperties; + case 25: return PacketType.ChildAgentUpdate; + case 26: return PacketType.ChildAgentAlive; + case 27: return PacketType.ChildAgentPositionUpdate; + case 29: return PacketType.SoundTrigger; } break; } @@ -1709,7 +1592,7 @@ namespace libsecondlife.Packets public static Packet BuildPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer) { - ushort id; + ushort id; PacketFrequency freq; int i = 0; Header header = Header.BuildHeader(bytes, ref i, ref packetEnd); if (header.Zerocoded) @@ -1718,429 +1601,390 @@ namespace libsecondlife.Packets bytes = zeroBuffer; } - if (bytes[4] == 0xFF) + if (bytes[6] == 0xFF) { - if (bytes[5] == 0xFF) + if (bytes[7] == 0xFF) { - id = (ushort)((bytes[6] << 8) + bytes[7]); + id = (ushort)((bytes[8] << 8) + bytes[9]); freq = PacketFrequency.Low; switch (id) { case 1: return new TestMessagePacket(header, bytes, ref i); case 3: return new UseCircuitCodePacket(header, bytes, ref i); - case 4: return new LogControlPacket(header, bytes, ref i); - case 6: return new LogMessagesPacket(header, bytes, ref i); - case 16: return new TelehubInfoPacket(header, bytes, ref i); - case 36: return new EconomyDataRequestPacket(header, bytes, ref i); - case 37: return new EconomyDataPacket(header, bytes, ref i); - case 38: return new AvatarPickerRequestPacket(header, bytes, ref i); - case 40: return new AvatarPickerReplyPacket(header, bytes, ref i); - case 41: return new PlacesQueryPacket(header, bytes, ref i); - case 42: return new PlacesReplyPacket(header, bytes, ref i); - case 43: return new DirFindQueryPacket(header, bytes, ref i); - case 45: return new DirPlacesQueryPacket(header, bytes, ref i); - case 47: return new DirPlacesReplyPacket(header, bytes, ref i); - case 48: return new DirPeopleReplyPacket(header, bytes, ref i); - case 49: return new DirEventsReplyPacket(header, bytes, ref i); - case 50: return new DirGroupsReplyPacket(header, bytes, ref i); - case 51: return new DirClassifiedQueryPacket(header, bytes, ref i); - case 53: return new DirClassifiedReplyPacket(header, bytes, ref i); - case 54: return new AvatarClassifiedReplyPacket(header, bytes, ref i); - case 55: return new ClassifiedInfoRequestPacket(header, bytes, ref i); - case 56: return new ClassifiedInfoReplyPacket(header, bytes, ref i); - case 57: return new ClassifiedInfoUpdatePacket(header, bytes, ref i); - case 58: return new ClassifiedDeletePacket(header, bytes, ref i); - case 59: return new ClassifiedGodDeletePacket(header, bytes, ref i); - case 60: return new DirPicksQueryPacket(header, bytes, ref i); - case 62: return new DirPicksReplyPacket(header, bytes, ref i); - case 63: return new DirLandQueryPacket(header, bytes, ref i); - case 65: return new DirLandReplyPacket(header, bytes, ref i); - case 66: return new DirPopularQueryPacket(header, bytes, ref i); - case 68: return new DirPopularReplyPacket(header, bytes, ref i); - case 69: return new ParcelInfoRequestPacket(header, bytes, ref i); - case 70: return new ParcelInfoReplyPacket(header, bytes, ref i); - case 71: return new ParcelObjectOwnersRequestPacket(header, bytes, ref i); - case 74: return new ParcelObjectOwnersReplyPacket(header, bytes, ref i); - case 75: return new GroupNoticesListRequestPacket(header, bytes, ref i); - case 76: return new GroupNoticesListReplyPacket(header, bytes, ref i); - case 77: return new GroupNoticeRequestPacket(header, bytes, ref i); - case 79: return new GroupNoticeDeletePacket(header, bytes, ref i); - case 80: return new TeleportRequestPacket(header, bytes, ref i); - case 81: return new TeleportLocationRequestPacket(header, bytes, ref i); - case 82: return new TeleportLocalPacket(header, bytes, ref i); - case 83: return new TeleportLandmarkRequestPacket(header, bytes, ref i); - case 84: return new TeleportProgressPacket(header, bytes, ref i); - case 89: return new TeleportFinishPacket(header, bytes, ref i); - case 90: return new StartLurePacket(header, bytes, ref i); - case 91: return new TeleportLureRequestPacket(header, bytes, ref i); - case 92: return new TeleportCancelPacket(header, bytes, ref i); - case 94: return new TeleportStartPacket(header, bytes, ref i); - case 95: return new TeleportFailedPacket(header, bytes, ref i); - case 96: return new LeaderBoardRequestPacket(header, bytes, ref i); - case 97: return new LeaderBoardDataPacket(header, bytes, ref i); - case 98: return new UndoPacket(header, bytes, ref i); - case 99: return new RedoPacket(header, bytes, ref i); - case 100: return new UndoLandPacket(header, bytes, ref i); - case 101: return new RedoLandPacket(header, bytes, ref i); - case 102: return new AgentPausePacket(header, bytes, ref i); - case 103: return new AgentResumePacket(header, bytes, ref i); - case 104: return new ChatFromViewerPacket(header, bytes, ref i); - case 105: return new AgentThrottlePacket(header, bytes, ref i); - case 106: return new AgentFOVPacket(header, bytes, ref i); - case 107: return new AgentHeightWidthPacket(header, bytes, ref i); - case 108: return new AgentSetAppearancePacket(header, bytes, ref i); - case 109: return new AgentQuitPacket(header, bytes, ref i); - case 110: return new AgentQuitCopyPacket(header, bytes, ref i); - case 111: return new ImageNotInDatabasePacket(header, bytes, ref i); - case 112: return new RebakeAvatarTexturesPacket(header, bytes, ref i); - case 113: return new SetAlwaysRunPacket(header, bytes, ref i); - case 114: return new ObjectDeletePacket(header, bytes, ref i); - case 115: return new ObjectDuplicatePacket(header, bytes, ref i); - case 116: return new ObjectDuplicateOnRayPacket(header, bytes, ref i); - case 117: return new ObjectScalePacket(header, bytes, ref i); - case 118: return new ObjectRotationPacket(header, bytes, ref i); - case 119: return new ObjectFlagUpdatePacket(header, bytes, ref i); - case 120: return new ObjectClickActionPacket(header, bytes, ref i); - case 121: return new ObjectImagePacket(header, bytes, ref i); - case 122: return new ObjectMaterialPacket(header, bytes, ref i); - case 123: return new ObjectShapePacket(header, bytes, ref i); - case 124: return new ObjectExtraParamsPacket(header, bytes, ref i); - case 125: return new ObjectOwnerPacket(header, bytes, ref i); - case 126: return new ObjectGroupPacket(header, bytes, ref i); - case 127: return new ObjectBuyPacket(header, bytes, ref i); - case 128: return new BuyObjectInventoryPacket(header, bytes, ref i); - case 129: return new DerezContainerPacket(header, bytes, ref i); - case 130: return new ObjectPermissionsPacket(header, bytes, ref i); - case 131: return new ObjectSaleInfoPacket(header, bytes, ref i); - case 132: return new ObjectNamePacket(header, bytes, ref i); - case 133: return new ObjectDescriptionPacket(header, bytes, ref i); - case 134: return new ObjectCategoryPacket(header, bytes, ref i); - case 135: return new ObjectSelectPacket(header, bytes, ref i); - case 136: return new ObjectDeselectPacket(header, bytes, ref i); - case 137: return new ObjectAttachPacket(header, bytes, ref i); - case 138: return new ObjectDetachPacket(header, bytes, ref i); - case 139: return new ObjectDropPacket(header, bytes, ref i); - case 140: return new ObjectLinkPacket(header, bytes, ref i); - case 141: return new ObjectDelinkPacket(header, bytes, ref i); - case 142: return new ObjectHingePacket(header, bytes, ref i); - case 143: return new ObjectDehingePacket(header, bytes, ref i); - case 144: return new ObjectGrabPacket(header, bytes, ref i); - case 145: return new ObjectGrabUpdatePacket(header, bytes, ref i); - case 146: return new ObjectDeGrabPacket(header, bytes, ref i); - case 147: return new ObjectSpinStartPacket(header, bytes, ref i); - case 148: return new ObjectSpinUpdatePacket(header, bytes, ref i); - case 149: return new ObjectSpinStopPacket(header, bytes, ref i); - case 150: return new ObjectExportSelectedPacket(header, bytes, ref i); - case 151: return new ObjectImportPacket(header, bytes, ref i); - case 152: return new ModifyLandPacket(header, bytes, ref i); - case 153: return new VelocityInterpolateOnPacket(header, bytes, ref i); - case 154: return new VelocityInterpolateOffPacket(header, bytes, ref i); - case 155: return new StateSavePacket(header, bytes, ref i); - case 156: return new ReportAutosaveCrashPacket(header, bytes, ref i); - case 157: return new SimWideDeletesPacket(header, bytes, ref i); - case 158: return new TrackAgentPacket(header, bytes, ref i); - case 159: return new ViewerStatsPacket(header, bytes, ref i); - case 160: return new ScriptAnswerYesPacket(header, bytes, ref i); - case 161: return new UserReportPacket(header, bytes, ref i); - case 162: return new AlertMessagePacket(header, bytes, ref i); - case 163: return new AgentAlertMessagePacket(header, bytes, ref i); - case 164: return new MeanCollisionAlertPacket(header, bytes, ref i); - case 165: return new ViewerFrozenMessagePacket(header, bytes, ref i); - case 166: return new HealthMessagePacket(header, bytes, ref i); - case 167: return new ChatFromSimulatorPacket(header, bytes, ref i); - case 168: return new SimStatsPacket(header, bytes, ref i); - case 169: return new RequestRegionInfoPacket(header, bytes, ref i); - case 170: return new RegionInfoPacket(header, bytes, ref i); - case 171: return new GodUpdateRegionInfoPacket(header, bytes, ref i); - case 174: return new NearestLandingRegionUpdatedPacket(header, bytes, ref i); - case 176: return new RegionHandshakePacket(header, bytes, ref i); - case 177: return new RegionHandshakeReplyPacket(header, bytes, ref i); - case 178: return new SimulatorViewerTimeMessagePacket(header, bytes, ref i); - case 179: return new EnableSimulatorPacket(header, bytes, ref i); - case 180: return new DisableSimulatorPacket(header, bytes, ref i); - case 181: return new TransferRequestPacket(header, bytes, ref i); - case 182: return new TransferInfoPacket(header, bytes, ref i); - case 183: return new TransferAbortPacket(header, bytes, ref i); - case 184: return new TransferPriorityPacket(header, bytes, ref i); - case 185: return new RequestXferPacket(header, bytes, ref i); - case 186: return new AbortXferPacket(header, bytes, ref i); - case 187: return new RequestAvatarInfoPacket(header, bytes, ref i); - case 188: return new AvatarAppearancePacket(header, bytes, ref i); - case 189: return new SetFollowCamPropertiesPacket(header, bytes, ref i); - case 190: return new ClearFollowCamPropertiesPacket(header, bytes, ref i); - case 191: return new RequestPayPricePacket(header, bytes, ref i); - case 192: return new PayPriceReplyPacket(header, bytes, ref i); - case 193: return new KickUserPacket(header, bytes, ref i); - case 194: return new KickUserAckPacket(header, bytes, ref i); - case 195: return new GodKickUserPacket(header, bytes, ref i); - case 197: return new EjectUserPacket(header, bytes, ref i); - case 198: return new FreezeUserPacket(header, bytes, ref i); - case 199: return new AvatarPropertiesRequestPacket(header, bytes, ref i); - case 201: return new AvatarPropertiesReplyPacket(header, bytes, ref i); - case 202: return new AvatarInterestsReplyPacket(header, bytes, ref i); - case 203: return new AvatarGroupsReplyPacket(header, bytes, ref i); - case 204: return new AvatarPropertiesUpdatePacket(header, bytes, ref i); - case 205: return new AvatarInterestsUpdatePacket(header, bytes, ref i); - case 206: return new AvatarStatisticsReplyPacket(header, bytes, ref i); - case 207: return new AvatarNotesReplyPacket(header, bytes, ref i); - case 208: return new AvatarNotesUpdatePacket(header, bytes, ref i); - case 209: return new AvatarPicksReplyPacket(header, bytes, ref i); - case 210: return new EventInfoRequestPacket(header, bytes, ref i); - case 211: return new EventInfoReplyPacket(header, bytes, ref i); - case 212: return new EventNotificationAddRequestPacket(header, bytes, ref i); - case 213: return new EventNotificationRemoveRequestPacket(header, bytes, ref i); - case 214: return new EventGodDeletePacket(header, bytes, ref i); - case 215: return new PickInfoRequestPacket(header, bytes, ref i); - case 216: return new PickInfoReplyPacket(header, bytes, ref i); - case 217: return new PickInfoUpdatePacket(header, bytes, ref i); - case 218: return new PickDeletePacket(header, bytes, ref i); - case 219: return new PickGodDeletePacket(header, bytes, ref i); - case 220: return new ScriptQuestionPacket(header, bytes, ref i); - case 221: return new ScriptControlChangePacket(header, bytes, ref i); - case 222: return new ScriptDialogPacket(header, bytes, ref i); - case 223: return new ScriptDialogReplyPacket(header, bytes, ref i); - case 224: return new ForceScriptControlReleasePacket(header, bytes, ref i); - case 225: return new RevokePermissionsPacket(header, bytes, ref i); - case 226: return new LoadURLPacket(header, bytes, ref i); - case 227: return new ScriptTeleportRequestPacket(header, bytes, ref i); - case 228: return new ParcelOverlayPacket(header, bytes, ref i); - case 229: return new ParcelPropertiesRequestByIDPacket(header, bytes, ref i); - case 230: return new ParcelPropertiesUpdatePacket(header, bytes, ref i); - case 231: return new ParcelReturnObjectsPacket(header, bytes, ref i); - case 232: return new ParcelSetOtherCleanTimePacket(header, bytes, ref i); - case 233: return new ParcelDisableObjectsPacket(header, bytes, ref i); - case 234: return new ParcelSelectObjectsPacket(header, bytes, ref i); - case 235: return new EstateCovenantRequestPacket(header, bytes, ref i); - case 236: return new EstateCovenantReplyPacket(header, bytes, ref i); - case 237: return new ForceObjectSelectPacket(header, bytes, ref i); - case 238: return new ParcelBuyPassPacket(header, bytes, ref i); - case 239: return new ParcelDeedToGroupPacket(header, bytes, ref i); - case 240: return new ParcelReclaimPacket(header, bytes, ref i); - case 241: return new ParcelClaimPacket(header, bytes, ref i); - case 242: return new ParcelJoinPacket(header, bytes, ref i); - case 243: return new ParcelDividePacket(header, bytes, ref i); - case 244: return new ParcelReleasePacket(header, bytes, ref i); - case 245: return new ParcelBuyPacket(header, bytes, ref i); - case 246: return new ParcelGodForceOwnerPacket(header, bytes, ref i); - case 247: return new ParcelAccessListRequestPacket(header, bytes, ref i); - case 248: return new ParcelAccessListReplyPacket(header, bytes, ref i); - case 249: return new ParcelAccessListUpdatePacket(header, bytes, ref i); - case 250: return new ParcelDwellRequestPacket(header, bytes, ref i); - case 251: return new ParcelDwellReplyPacket(header, bytes, ref i); - case 259: return new ParcelGodMarkAsContentPacket(header, bytes, ref i); - case 260: return new ViewerStartAuctionPacket(header, bytes, ref i); - case 267: return new UUIDNameRequestPacket(header, bytes, ref i); - case 268: return new UUIDNameReplyPacket(header, bytes, ref i); - case 269: return new UUIDGroupNameRequestPacket(header, bytes, ref i); - case 270: return new UUIDGroupNameReplyPacket(header, bytes, ref i); - case 272: return new ChildAgentDyingPacket(header, bytes, ref i); - case 273: return new ChildAgentUnknownPacket(header, bytes, ref i); - case 275: return new GetScriptRunningPacket(header, bytes, ref i); - case 276: return new ScriptRunningReplyPacket(header, bytes, ref i); - case 277: return new SetScriptRunningPacket(header, bytes, ref i); - case 278: return new ScriptResetPacket(header, bytes, ref i); - case 279: return new ScriptSensorRequestPacket(header, bytes, ref i); - case 280: return new ScriptSensorReplyPacket(header, bytes, ref i); - case 281: return new CompleteAgentMovementPacket(header, bytes, ref i); - case 282: return new AgentMovementCompletePacket(header, bytes, ref i); - case 284: return new ConnectAgentToUserserverPacket(header, bytes, ref i); - case 285: return new ConnectToUserserverPacket(header, bytes, ref i); - case 287: return new LogoutRequestPacket(header, bytes, ref i); - case 288: return new FinalizeLogoutPacket(header, bytes, ref i); - case 289: return new LogoutReplyPacket(header, bytes, ref i); - case 290: return new LogoutDemandPacket(header, bytes, ref i); - case 291: return new ImprovedInstantMessagePacket(header, bytes, ref i); - case 292: return new RetrieveInstantMessagesPacket(header, bytes, ref i); - case 293: return new FindAgentPacket(header, bytes, ref i); - case 294: return new RequestGodlikePowersPacket(header, bytes, ref i); - case 295: return new GrantGodlikePowersPacket(header, bytes, ref i); - case 296: return new GodlikeMessagePacket(header, bytes, ref i); - case 297: return new EstateOwnerMessagePacket(header, bytes, ref i); - case 298: return new GenericMessagePacket(header, bytes, ref i); - case 299: return new MuteListRequestPacket(header, bytes, ref i); - case 300: return new UpdateMuteListEntryPacket(header, bytes, ref i); - case 301: return new RemoveMuteListEntryPacket(header, bytes, ref i); - case 302: return new CopyInventoryFromNotecardPacket(header, bytes, ref i); - case 303: return new UpdateInventoryItemPacket(header, bytes, ref i); - case 304: return new UpdateCreateInventoryItemPacket(header, bytes, ref i); - case 305: return new MoveInventoryItemPacket(header, bytes, ref i); - case 306: return new CopyInventoryItemPacket(header, bytes, ref i); - case 307: return new RemoveInventoryItemPacket(header, bytes, ref i); - case 308: return new ChangeInventoryItemFlagsPacket(header, bytes, ref i); - case 309: return new SaveAssetIntoInventoryPacket(header, bytes, ref i); - case 310: return new CreateInventoryFolderPacket(header, bytes, ref i); - case 311: return new UpdateInventoryFolderPacket(header, bytes, ref i); - case 312: return new MoveInventoryFolderPacket(header, bytes, ref i); - case 313: return new RemoveInventoryFolderPacket(header, bytes, ref i); - case 314: return new FetchInventoryDescendentsPacket(header, bytes, ref i); - case 315: return new InventoryDescendentsPacket(header, bytes, ref i); - case 316: return new FetchInventoryPacket(header, bytes, ref i); - case 317: return new FetchInventoryReplyPacket(header, bytes, ref i); - case 318: return new BulkUpdateInventoryPacket(header, bytes, ref i); - case 319: return new RequestInventoryAssetPacket(header, bytes, ref i); - case 320: return new InventoryAssetResponsePacket(header, bytes, ref i); - case 321: return new RemoveInventoryObjectsPacket(header, bytes, ref i); - case 322: return new PurgeInventoryDescendentsPacket(header, bytes, ref i); - case 323: return new UpdateTaskInventoryPacket(header, bytes, ref i); - case 324: return new RemoveTaskInventoryPacket(header, bytes, ref i); - case 325: return new MoveTaskInventoryPacket(header, bytes, ref i); - case 326: return new RequestTaskInventoryPacket(header, bytes, ref i); - case 327: return new ReplyTaskInventoryPacket(header, bytes, ref i); - case 328: return new DeRezObjectPacket(header, bytes, ref i); - case 329: return new DeRezAckPacket(header, bytes, ref i); - case 330: return new RezObjectPacket(header, bytes, ref i); - case 331: return new RezObjectFromNotecardPacket(header, bytes, ref i); - case 332: return new DeclineInventoryPacket(header, bytes, ref i); - case 335: return new RequestFriendshipPacket(header, bytes, ref i); - case 336: return new AcceptFriendshipPacket(header, bytes, ref i); - case 337: return new DeclineFriendshipPacket(header, bytes, ref i); - case 338: return new FormFriendshipPacket(header, bytes, ref i); - case 339: return new TerminateFriendshipPacket(header, bytes, ref i); - case 340: return new OfferCallingCardPacket(header, bytes, ref i); - case 341: return new AcceptCallingCardPacket(header, bytes, ref i); - case 342: return new DeclineCallingCardPacket(header, bytes, ref i); - case 343: return new RezScriptPacket(header, bytes, ref i); - case 344: return new CreateInventoryItemPacket(header, bytes, ref i); - case 345: return new CreateLandmarkForEventPacket(header, bytes, ref i); - case 348: return new RegionHandleRequestPacket(header, bytes, ref i); - case 349: return new RegionIDAndHandleReplyPacket(header, bytes, ref i); - case 350: return new MoneyTransferRequestPacket(header, bytes, ref i); - case 353: return new AdjustBalancePacket(header, bytes, ref i); - case 354: return new MoneyBalanceRequestPacket(header, bytes, ref i); - case 355: return new MoneyBalanceReplyPacket(header, bytes, ref i); - case 356: return new RoutedMoneyBalanceReplyPacket(header, bytes, ref i); - case 357: return new MoneyHistoryRequestPacket(header, bytes, ref i); - case 358: return new MoneyHistoryReplyPacket(header, bytes, ref i); - case 359: return new MoneySummaryRequestPacket(header, bytes, ref i); - case 360: return new MoneySummaryReplyPacket(header, bytes, ref i); - case 361: return new MoneyDetailsRequestPacket(header, bytes, ref i); - case 362: return new MoneyDetailsReplyPacket(header, bytes, ref i); - case 363: return new MoneyTransactionsRequestPacket(header, bytes, ref i); - case 364: return new MoneyTransactionsReplyPacket(header, bytes, ref i); - case 365: return new ActivateGesturesPacket(header, bytes, ref i); - case 366: return new DeactivateGesturesPacket(header, bytes, ref i); - case 367: return new MuteListUpdatePacket(header, bytes, ref i); - case 368: return new UseCachedMuteListPacket(header, bytes, ref i); - case 369: return new GrantUserRightsPacket(header, bytes, ref i); - case 370: return new ChangeUserRightsPacket(header, bytes, ref i); - case 371: return new OnlineNotificationPacket(header, bytes, ref i); - case 372: return new OfflineNotificationPacket(header, bytes, ref i); - case 373: return new SetStartLocationRequestPacket(header, bytes, ref i); - case 383: return new AssetUploadRequestPacket(header, bytes, ref i); - case 384: return new AssetUploadCompletePacket(header, bytes, ref i); - case 385: return new ReputationAgentAssignPacket(header, bytes, ref i); - case 386: return new ReputationIndividualRequestPacket(header, bytes, ref i); - case 387: return new ReputationIndividualReplyPacket(header, bytes, ref i); - case 392: return new CreateGroupRequestPacket(header, bytes, ref i); - case 393: return new CreateGroupReplyPacket(header, bytes, ref i); - case 394: return new UpdateGroupInfoPacket(header, bytes, ref i); - case 395: return new GroupRoleChangesPacket(header, bytes, ref i); - case 396: return new JoinGroupRequestPacket(header, bytes, ref i); - case 397: return new JoinGroupReplyPacket(header, bytes, ref i); - case 398: return new EjectGroupMemberRequestPacket(header, bytes, ref i); - case 399: return new EjectGroupMemberReplyPacket(header, bytes, ref i); - case 400: return new LeaveGroupRequestPacket(header, bytes, ref i); - case 401: return new LeaveGroupReplyPacket(header, bytes, ref i); - case 402: return new InviteGroupRequestPacket(header, bytes, ref i); - case 404: return new GroupProfileRequestPacket(header, bytes, ref i); - case 405: return new GroupProfileReplyPacket(header, bytes, ref i); - case 406: return new GroupAccountSummaryRequestPacket(header, bytes, ref i); - case 407: return new GroupAccountSummaryReplyPacket(header, bytes, ref i); - case 408: return new GroupAccountDetailsRequestPacket(header, bytes, ref i); - case 409: return new GroupAccountDetailsReplyPacket(header, bytes, ref i); - case 410: return new GroupAccountTransactionsRequestPacket(header, bytes, ref i); - case 411: return new GroupAccountTransactionsReplyPacket(header, bytes, ref i); - case 412: return new GroupActiveProposalsRequestPacket(header, bytes, ref i); - case 413: return new GroupActiveProposalItemReplyPacket(header, bytes, ref i); - case 414: return new GroupVoteHistoryRequestPacket(header, bytes, ref i); - case 415: return new GroupVoteHistoryItemReplyPacket(header, bytes, ref i); - case 416: return new StartGroupProposalPacket(header, bytes, ref i); - case 417: return new GroupProposalBallotPacket(header, bytes, ref i); - case 419: return new GroupMembersRequestPacket(header, bytes, ref i); - case 420: return new GroupMembersReplyPacket(header, bytes, ref i); - case 421: return new ActivateGroupPacket(header, bytes, ref i); - case 422: return new SetGroupContributionPacket(header, bytes, ref i); - case 423: return new SetGroupAcceptNoticesPacket(header, bytes, ref i); - case 424: return new GroupRoleDataRequestPacket(header, bytes, ref i); - case 425: return new GroupRoleDataReplyPacket(header, bytes, ref i); - case 426: return new GroupRoleMembersRequestPacket(header, bytes, ref i); - case 427: return new GroupRoleMembersReplyPacket(header, bytes, ref i); - case 428: return new GroupTitlesRequestPacket(header, bytes, ref i); - case 429: return new GroupTitlesReplyPacket(header, bytes, ref i); - case 430: return new GroupTitleUpdatePacket(header, bytes, ref i); - case 431: return new GroupRoleUpdatePacket(header, bytes, ref i); - case 432: return new LiveHelpGroupRequestPacket(header, bytes, ref i); - case 433: return new LiveHelpGroupReplyPacket(header, bytes, ref i); - case 434: return new AgentWearablesRequestPacket(header, bytes, ref i); - case 435: return new AgentWearablesUpdatePacket(header, bytes, ref i); - case 436: return new AgentIsNowWearingPacket(header, bytes, ref i); - case 437: return new AgentCachedTexturePacket(header, bytes, ref i); - case 438: return new AgentCachedTextureResponsePacket(header, bytes, ref i); - case 439: return new AgentDataUpdateRequestPacket(header, bytes, ref i); - case 440: return new AgentDataUpdatePacket(header, bytes, ref i); - case 441: return new GroupDataUpdatePacket(header, bytes, ref i); - case 442: return new AgentGroupDataUpdatePacket(header, bytes, ref i); - case 443: return new AgentDropGroupPacket(header, bytes, ref i); - case 445: return new CreateTrustedCircuitPacket(header, bytes, ref i); - case 446: return new DenyTrustedCircuitPacket(header, bytes, ref i); - case 447: return new RequestTrustedCircuitPacket(header, bytes, ref i); - case 448: return new RezSingleAttachmentFromInvPacket(header, bytes, ref i); - case 449: return new RezMultipleAttachmentsFromInvPacket(header, bytes, ref i); - case 450: return new DetachAttachmentIntoInvPacket(header, bytes, ref i); - case 451: return new CreateNewOutfitAttachmentsPacket(header, bytes, ref i); - case 452: return new UserInfoRequestPacket(header, bytes, ref i); - case 453: return new UserInfoReplyPacket(header, bytes, ref i); - case 454: return new UpdateUserInfoPacket(header, bytes, ref i); - case 460: return new StartParcelRemoveAckPacket(header, bytes, ref i); - case 462: return new InitiateDownloadPacket(header, bytes, ref i); - case 463: return new SystemMessagePacket(header, bytes, ref i); - case 464: return new MapLayerRequestPacket(header, bytes, ref i); - case 465: return new MapLayerReplyPacket(header, bytes, ref i); - case 466: return new MapBlockRequestPacket(header, bytes, ref i); - case 467: return new MapNameRequestPacket(header, bytes, ref i); - case 468: return new MapBlockReplyPacket(header, bytes, ref i); - case 469: return new MapItemRequestPacket(header, bytes, ref i); - case 470: return new MapItemReplyPacket(header, bytes, ref i); - case 471: return new SendPostcardPacket(header, bytes, ref i); - case 480: return new ParcelMediaCommandMessagePacket(header, bytes, ref i); - case 481: return new ParcelMediaUpdatePacket(header, bytes, ref i); - case 482: return new LandStatRequestPacket(header, bytes, ref i); - case 483: return new LandStatReplyPacket(header, bytes, ref i); - case 65530: return new SecuredTemplateChecksumRequestPacket(header, bytes, ref i); + case 10: return new TelehubInfoPacket(header, bytes, ref i); + case 24: return new EconomyDataRequestPacket(header, bytes, ref i); + case 25: return new EconomyDataPacket(header, bytes, ref i); + case 26: return new AvatarPickerRequestPacket(header, bytes, ref i); + case 28: return new AvatarPickerReplyPacket(header, bytes, ref i); + case 29: return new PlacesQueryPacket(header, bytes, ref i); + case 30: return new PlacesReplyPacket(header, bytes, ref i); + case 31: return new DirFindQueryPacket(header, bytes, ref i); + case 33: return new DirPlacesQueryPacket(header, bytes, ref i); + case 35: return new DirPlacesReplyPacket(header, bytes, ref i); + case 36: return new DirPeopleReplyPacket(header, bytes, ref i); + case 37: return new DirEventsReplyPacket(header, bytes, ref i); + case 38: return new DirGroupsReplyPacket(header, bytes, ref i); + case 39: return new DirClassifiedQueryPacket(header, bytes, ref i); + case 41: return new DirClassifiedReplyPacket(header, bytes, ref i); + case 42: return new AvatarClassifiedReplyPacket(header, bytes, ref i); + case 43: return new ClassifiedInfoRequestPacket(header, bytes, ref i); + case 44: return new ClassifiedInfoReplyPacket(header, bytes, ref i); + case 45: return new ClassifiedInfoUpdatePacket(header, bytes, ref i); + case 46: return new ClassifiedDeletePacket(header, bytes, ref i); + case 47: return new ClassifiedGodDeletePacket(header, bytes, ref i); + case 48: return new DirLandQueryPacket(header, bytes, ref i); + case 50: return new DirLandReplyPacket(header, bytes, ref i); + case 51: return new DirPopularQueryPacket(header, bytes, ref i); + case 53: return new DirPopularReplyPacket(header, bytes, ref i); + case 54: return new ParcelInfoRequestPacket(header, bytes, ref i); + case 55: return new ParcelInfoReplyPacket(header, bytes, ref i); + case 56: return new ParcelObjectOwnersRequestPacket(header, bytes, ref i); + case 57: return new ParcelObjectOwnersReplyPacket(header, bytes, ref i); + case 58: return new GroupNoticesListRequestPacket(header, bytes, ref i); + case 59: return new GroupNoticesListReplyPacket(header, bytes, ref i); + case 60: return new GroupNoticeRequestPacket(header, bytes, ref i); + case 62: return new TeleportRequestPacket(header, bytes, ref i); + case 63: return new TeleportLocationRequestPacket(header, bytes, ref i); + case 64: return new TeleportLocalPacket(header, bytes, ref i); + case 65: return new TeleportLandmarkRequestPacket(header, bytes, ref i); + case 66: return new TeleportProgressPacket(header, bytes, ref i); + case 69: return new TeleportFinishPacket(header, bytes, ref i); + case 70: return new StartLurePacket(header, bytes, ref i); + case 71: return new TeleportLureRequestPacket(header, bytes, ref i); + case 72: return new TeleportCancelPacket(header, bytes, ref i); + case 73: return new TeleportStartPacket(header, bytes, ref i); + case 74: return new TeleportFailedPacket(header, bytes, ref i); + case 75: return new UndoPacket(header, bytes, ref i); + case 76: return new RedoPacket(header, bytes, ref i); + case 77: return new UndoLandPacket(header, bytes, ref i); + case 78: return new AgentPausePacket(header, bytes, ref i); + case 79: return new AgentResumePacket(header, bytes, ref i); + case 80: return new ChatFromViewerPacket(header, bytes, ref i); + case 81: return new AgentThrottlePacket(header, bytes, ref i); + case 82: return new AgentFOVPacket(header, bytes, ref i); + case 83: return new AgentHeightWidthPacket(header, bytes, ref i); + case 84: return new AgentSetAppearancePacket(header, bytes, ref i); + case 85: return new AgentQuitCopyPacket(header, bytes, ref i); + case 86: return new ImageNotInDatabasePacket(header, bytes, ref i); + case 87: return new RebakeAvatarTexturesPacket(header, bytes, ref i); + case 88: return new SetAlwaysRunPacket(header, bytes, ref i); + case 89: return new ObjectDeletePacket(header, bytes, ref i); + case 90: return new ObjectDuplicatePacket(header, bytes, ref i); + case 91: return new ObjectDuplicateOnRayPacket(header, bytes, ref i); + case 92: return new ObjectScalePacket(header, bytes, ref i); + case 93: return new ObjectRotationPacket(header, bytes, ref i); + case 94: return new ObjectFlagUpdatePacket(header, bytes, ref i); + case 95: return new ObjectClickActionPacket(header, bytes, ref i); + case 96: return new ObjectImagePacket(header, bytes, ref i); + case 97: return new ObjectMaterialPacket(header, bytes, ref i); + case 98: return new ObjectShapePacket(header, bytes, ref i); + case 99: return new ObjectExtraParamsPacket(header, bytes, ref i); + case 100: return new ObjectOwnerPacket(header, bytes, ref i); + case 101: return new ObjectGroupPacket(header, bytes, ref i); + case 102: return new ObjectBuyPacket(header, bytes, ref i); + case 103: return new BuyObjectInventoryPacket(header, bytes, ref i); + case 104: return new DerezContainerPacket(header, bytes, ref i); + case 105: return new ObjectPermissionsPacket(header, bytes, ref i); + case 106: return new ObjectSaleInfoPacket(header, bytes, ref i); + case 107: return new ObjectNamePacket(header, bytes, ref i); + case 108: return new ObjectDescriptionPacket(header, bytes, ref i); + case 109: return new ObjectCategoryPacket(header, bytes, ref i); + case 110: return new ObjectSelectPacket(header, bytes, ref i); + case 111: return new ObjectDeselectPacket(header, bytes, ref i); + case 112: return new ObjectAttachPacket(header, bytes, ref i); + case 113: return new ObjectDetachPacket(header, bytes, ref i); + case 114: return new ObjectDropPacket(header, bytes, ref i); + case 115: return new ObjectLinkPacket(header, bytes, ref i); + case 116: return new ObjectDelinkPacket(header, bytes, ref i); + case 117: return new ObjectGrabPacket(header, bytes, ref i); + case 118: return new ObjectGrabUpdatePacket(header, bytes, ref i); + case 119: return new ObjectDeGrabPacket(header, bytes, ref i); + case 120: return new ObjectSpinStartPacket(header, bytes, ref i); + case 121: return new ObjectSpinUpdatePacket(header, bytes, ref i); + case 122: return new ObjectSpinStopPacket(header, bytes, ref i); + case 123: return new ObjectExportSelectedPacket(header, bytes, ref i); + case 124: return new ModifyLandPacket(header, bytes, ref i); + case 125: return new VelocityInterpolateOnPacket(header, bytes, ref i); + case 126: return new VelocityInterpolateOffPacket(header, bytes, ref i); + case 127: return new StateSavePacket(header, bytes, ref i); + case 128: return new ReportAutosaveCrashPacket(header, bytes, ref i); + case 129: return new SimWideDeletesPacket(header, bytes, ref i); + case 130: return new TrackAgentPacket(header, bytes, ref i); + case 131: return new ViewerStatsPacket(header, bytes, ref i); + case 132: return new ScriptAnswerYesPacket(header, bytes, ref i); + case 133: return new UserReportPacket(header, bytes, ref i); + case 134: return new AlertMessagePacket(header, bytes, ref i); + case 135: return new AgentAlertMessagePacket(header, bytes, ref i); + case 136: return new MeanCollisionAlertPacket(header, bytes, ref i); + case 137: return new ViewerFrozenMessagePacket(header, bytes, ref i); + case 138: return new HealthMessagePacket(header, bytes, ref i); + case 139: return new ChatFromSimulatorPacket(header, bytes, ref i); + case 140: return new SimStatsPacket(header, bytes, ref i); + case 141: return new RequestRegionInfoPacket(header, bytes, ref i); + case 142: return new RegionInfoPacket(header, bytes, ref i); + case 143: return new GodUpdateRegionInfoPacket(header, bytes, ref i); + case 146: return new NearestLandingRegionUpdatedPacket(header, bytes, ref i); + case 148: return new RegionHandshakePacket(header, bytes, ref i); + case 149: return new RegionHandshakeReplyPacket(header, bytes, ref i); + case 150: return new SimulatorViewerTimeMessagePacket(header, bytes, ref i); + case 151: return new EnableSimulatorPacket(header, bytes, ref i); + case 152: return new DisableSimulatorPacket(header, bytes, ref i); + case 153: return new TransferRequestPacket(header, bytes, ref i); + case 154: return new TransferInfoPacket(header, bytes, ref i); + case 155: return new TransferAbortPacket(header, bytes, ref i); + case 156: return new RequestXferPacket(header, bytes, ref i); + case 157: return new AbortXferPacket(header, bytes, ref i); + case 158: return new AvatarAppearancePacket(header, bytes, ref i); + case 159: return new SetFollowCamPropertiesPacket(header, bytes, ref i); + case 160: return new ClearFollowCamPropertiesPacket(header, bytes, ref i); + case 161: return new RequestPayPricePacket(header, bytes, ref i); + case 162: return new PayPriceReplyPacket(header, bytes, ref i); + case 163: return new KickUserPacket(header, bytes, ref i); + case 164: return new KickUserAckPacket(header, bytes, ref i); + case 165: return new GodKickUserPacket(header, bytes, ref i); + case 167: return new EjectUserPacket(header, bytes, ref i); + case 168: return new FreezeUserPacket(header, bytes, ref i); + case 169: return new AvatarPropertiesRequestPacket(header, bytes, ref i); + case 171: return new AvatarPropertiesReplyPacket(header, bytes, ref i); + case 172: return new AvatarInterestsReplyPacket(header, bytes, ref i); + case 173: return new AvatarGroupsReplyPacket(header, bytes, ref i); + case 174: return new AvatarPropertiesUpdatePacket(header, bytes, ref i); + case 175: return new AvatarInterestsUpdatePacket(header, bytes, ref i); + case 176: return new AvatarNotesReplyPacket(header, bytes, ref i); + case 177: return new AvatarNotesUpdatePacket(header, bytes, ref i); + case 178: return new AvatarPicksReplyPacket(header, bytes, ref i); + case 179: return new EventInfoRequestPacket(header, bytes, ref i); + case 180: return new EventInfoReplyPacket(header, bytes, ref i); + case 181: return new EventNotificationAddRequestPacket(header, bytes, ref i); + case 182: return new EventNotificationRemoveRequestPacket(header, bytes, ref i); + case 183: return new EventGodDeletePacket(header, bytes, ref i); + case 184: return new PickInfoReplyPacket(header, bytes, ref i); + case 185: return new PickInfoUpdatePacket(header, bytes, ref i); + case 186: return new PickDeletePacket(header, bytes, ref i); + case 187: return new PickGodDeletePacket(header, bytes, ref i); + case 188: return new ScriptQuestionPacket(header, bytes, ref i); + case 189: return new ScriptControlChangePacket(header, bytes, ref i); + case 190: return new ScriptDialogPacket(header, bytes, ref i); + case 191: return new ScriptDialogReplyPacket(header, bytes, ref i); + case 192: return new ForceScriptControlReleasePacket(header, bytes, ref i); + case 193: return new RevokePermissionsPacket(header, bytes, ref i); + case 194: return new LoadURLPacket(header, bytes, ref i); + case 195: return new ScriptTeleportRequestPacket(header, bytes, ref i); + case 196: return new ParcelOverlayPacket(header, bytes, ref i); + case 197: return new ParcelPropertiesRequestByIDPacket(header, bytes, ref i); + case 198: return new ParcelPropertiesUpdatePacket(header, bytes, ref i); + case 199: return new ParcelReturnObjectsPacket(header, bytes, ref i); + case 200: return new ParcelSetOtherCleanTimePacket(header, bytes, ref i); + case 201: return new ParcelDisableObjectsPacket(header, bytes, ref i); + case 202: return new ParcelSelectObjectsPacket(header, bytes, ref i); + case 203: return new EstateCovenantRequestPacket(header, bytes, ref i); + case 204: return new EstateCovenantReplyPacket(header, bytes, ref i); + case 205: return new ForceObjectSelectPacket(header, bytes, ref i); + case 206: return new ParcelBuyPassPacket(header, bytes, ref i); + case 207: return new ParcelDeedToGroupPacket(header, bytes, ref i); + case 208: return new ParcelReclaimPacket(header, bytes, ref i); + case 209: return new ParcelClaimPacket(header, bytes, ref i); + case 210: return new ParcelJoinPacket(header, bytes, ref i); + case 211: return new ParcelDividePacket(header, bytes, ref i); + case 212: return new ParcelReleasePacket(header, bytes, ref i); + case 213: return new ParcelBuyPacket(header, bytes, ref i); + case 214: return new ParcelGodForceOwnerPacket(header, bytes, ref i); + case 215: return new ParcelAccessListRequestPacket(header, bytes, ref i); + case 216: return new ParcelAccessListReplyPacket(header, bytes, ref i); + case 217: return new ParcelAccessListUpdatePacket(header, bytes, ref i); + case 218: return new ParcelDwellRequestPacket(header, bytes, ref i); + case 219: return new ParcelDwellReplyPacket(header, bytes, ref i); + case 227: return new ParcelGodMarkAsContentPacket(header, bytes, ref i); + case 228: return new ViewerStartAuctionPacket(header, bytes, ref i); + case 235: return new UUIDNameRequestPacket(header, bytes, ref i); + case 236: return new UUIDNameReplyPacket(header, bytes, ref i); + case 237: return new UUIDGroupNameRequestPacket(header, bytes, ref i); + case 238: return new UUIDGroupNameReplyPacket(header, bytes, ref i); + case 240: return new ChildAgentDyingPacket(header, bytes, ref i); + case 241: return new ChildAgentUnknownPacket(header, bytes, ref i); + case 243: return new GetScriptRunningPacket(header, bytes, ref i); + case 244: return new ScriptRunningReplyPacket(header, bytes, ref i); + case 245: return new SetScriptRunningPacket(header, bytes, ref i); + case 246: return new ScriptResetPacket(header, bytes, ref i); + case 247: return new ScriptSensorRequestPacket(header, bytes, ref i); + case 248: return new ScriptSensorReplyPacket(header, bytes, ref i); + case 249: return new CompleteAgentMovementPacket(header, bytes, ref i); + case 250: return new AgentMovementCompletePacket(header, bytes, ref i); + case 252: return new LogoutRequestPacket(header, bytes, ref i); + case 253: return new LogoutReplyPacket(header, bytes, ref i); + case 254: return new ImprovedInstantMessagePacket(header, bytes, ref i); + case 255: return new RetrieveInstantMessagesPacket(header, bytes, ref i); + case 256: return new FindAgentPacket(header, bytes, ref i); + case 257: return new RequestGodlikePowersPacket(header, bytes, ref i); + case 258: return new GrantGodlikePowersPacket(header, bytes, ref i); + case 259: return new GodlikeMessagePacket(header, bytes, ref i); + case 260: return new EstateOwnerMessagePacket(header, bytes, ref i); + case 261: return new GenericMessagePacket(header, bytes, ref i); + case 262: return new MuteListRequestPacket(header, bytes, ref i); + case 263: return new UpdateMuteListEntryPacket(header, bytes, ref i); + case 264: return new RemoveMuteListEntryPacket(header, bytes, ref i); + case 265: return new CopyInventoryFromNotecardPacket(header, bytes, ref i); + case 266: return new UpdateInventoryItemPacket(header, bytes, ref i); + case 267: return new UpdateCreateInventoryItemPacket(header, bytes, ref i); + case 268: return new MoveInventoryItemPacket(header, bytes, ref i); + case 269: return new CopyInventoryItemPacket(header, bytes, ref i); + case 270: return new RemoveInventoryItemPacket(header, bytes, ref i); + case 271: return new ChangeInventoryItemFlagsPacket(header, bytes, ref i); + case 272: return new SaveAssetIntoInventoryPacket(header, bytes, ref i); + case 273: return new CreateInventoryFolderPacket(header, bytes, ref i); + case 274: return new UpdateInventoryFolderPacket(header, bytes, ref i); + case 275: return new MoveInventoryFolderPacket(header, bytes, ref i); + case 276: return new RemoveInventoryFolderPacket(header, bytes, ref i); + case 277: return new FetchInventoryDescendentsPacket(header, bytes, ref i); + case 278: return new InventoryDescendentsPacket(header, bytes, ref i); + case 279: return new FetchInventoryPacket(header, bytes, ref i); + case 280: return new FetchInventoryReplyPacket(header, bytes, ref i); + case 281: return new BulkUpdateInventoryPacket(header, bytes, ref i); + case 282: return new RequestInventoryAssetPacket(header, bytes, ref i); + case 283: return new InventoryAssetResponsePacket(header, bytes, ref i); + case 284: return new RemoveInventoryObjectsPacket(header, bytes, ref i); + case 285: return new PurgeInventoryDescendentsPacket(header, bytes, ref i); + case 286: return new UpdateTaskInventoryPacket(header, bytes, ref i); + case 287: return new RemoveTaskInventoryPacket(header, bytes, ref i); + case 288: return new MoveTaskInventoryPacket(header, bytes, ref i); + case 289: return new RequestTaskInventoryPacket(header, bytes, ref i); + case 290: return new ReplyTaskInventoryPacket(header, bytes, ref i); + case 291: return new DeRezObjectPacket(header, bytes, ref i); + case 292: return new DeRezAckPacket(header, bytes, ref i); + case 293: return new RezObjectPacket(header, bytes, ref i); + case 294: return new RezObjectFromNotecardPacket(header, bytes, ref i); + case 297: return new AcceptFriendshipPacket(header, bytes, ref i); + case 298: return new DeclineFriendshipPacket(header, bytes, ref i); + case 299: return new FormFriendshipPacket(header, bytes, ref i); + case 300: return new TerminateFriendshipPacket(header, bytes, ref i); + case 301: return new OfferCallingCardPacket(header, bytes, ref i); + case 302: return new AcceptCallingCardPacket(header, bytes, ref i); + case 303: return new DeclineCallingCardPacket(header, bytes, ref i); + case 304: return new RezScriptPacket(header, bytes, ref i); + case 305: return new CreateInventoryItemPacket(header, bytes, ref i); + case 306: return new CreateLandmarkForEventPacket(header, bytes, ref i); + case 309: return new RegionHandleRequestPacket(header, bytes, ref i); + case 310: return new RegionIDAndHandleReplyPacket(header, bytes, ref i); + case 311: return new MoneyTransferRequestPacket(header, bytes, ref i); + case 313: return new MoneyBalanceRequestPacket(header, bytes, ref i); + case 314: return new MoneyBalanceReplyPacket(header, bytes, ref i); + case 315: return new RoutedMoneyBalanceReplyPacket(header, bytes, ref i); + case 316: return new ActivateGesturesPacket(header, bytes, ref i); + case 317: return new DeactivateGesturesPacket(header, bytes, ref i); + case 318: return new MuteListUpdatePacket(header, bytes, ref i); + case 319: return new UseCachedMuteListPacket(header, bytes, ref i); + case 320: return new GrantUserRightsPacket(header, bytes, ref i); + case 321: return new ChangeUserRightsPacket(header, bytes, ref i); + case 322: return new OnlineNotificationPacket(header, bytes, ref i); + case 323: return new OfflineNotificationPacket(header, bytes, ref i); + case 324: return new SetStartLocationRequestPacket(header, bytes, ref i); + case 333: return new AssetUploadRequestPacket(header, bytes, ref i); + case 334: return new AssetUploadCompletePacket(header, bytes, ref i); + case 339: return new CreateGroupRequestPacket(header, bytes, ref i); + case 340: return new CreateGroupReplyPacket(header, bytes, ref i); + case 341: return new UpdateGroupInfoPacket(header, bytes, ref i); + case 342: return new GroupRoleChangesPacket(header, bytes, ref i); + case 343: return new JoinGroupRequestPacket(header, bytes, ref i); + case 344: return new JoinGroupReplyPacket(header, bytes, ref i); + case 345: return new EjectGroupMemberRequestPacket(header, bytes, ref i); + case 346: return new EjectGroupMemberReplyPacket(header, bytes, ref i); + case 347: return new LeaveGroupRequestPacket(header, bytes, ref i); + case 348: return new LeaveGroupReplyPacket(header, bytes, ref i); + case 349: return new InviteGroupRequestPacket(header, bytes, ref i); + case 351: return new GroupProfileRequestPacket(header, bytes, ref i); + case 352: return new GroupProfileReplyPacket(header, bytes, ref i); + case 353: return new GroupAccountSummaryRequestPacket(header, bytes, ref i); + case 354: return new GroupAccountSummaryReplyPacket(header, bytes, ref i); + case 355: return new GroupAccountDetailsRequestPacket(header, bytes, ref i); + case 356: return new GroupAccountDetailsReplyPacket(header, bytes, ref i); + case 357: return new GroupAccountTransactionsRequestPacket(header, bytes, ref i); + case 358: return new GroupAccountTransactionsReplyPacket(header, bytes, ref i); + case 359: return new GroupActiveProposalsRequestPacket(header, bytes, ref i); + case 360: return new GroupActiveProposalItemReplyPacket(header, bytes, ref i); + case 361: return new GroupVoteHistoryRequestPacket(header, bytes, ref i); + case 362: return new GroupVoteHistoryItemReplyPacket(header, bytes, ref i); + case 363: return new StartGroupProposalPacket(header, bytes, ref i); + case 364: return new GroupProposalBallotPacket(header, bytes, ref i); + case 366: return new GroupMembersRequestPacket(header, bytes, ref i); + case 367: return new GroupMembersReplyPacket(header, bytes, ref i); + case 368: return new ActivateGroupPacket(header, bytes, ref i); + case 369: return new SetGroupContributionPacket(header, bytes, ref i); + case 370: return new SetGroupAcceptNoticesPacket(header, bytes, ref i); + case 371: return new GroupRoleDataRequestPacket(header, bytes, ref i); + case 372: return new GroupRoleDataReplyPacket(header, bytes, ref i); + case 373: return new GroupRoleMembersRequestPacket(header, bytes, ref i); + case 374: return new GroupRoleMembersReplyPacket(header, bytes, ref i); + case 375: return new GroupTitlesRequestPacket(header, bytes, ref i); + case 376: return new GroupTitlesReplyPacket(header, bytes, ref i); + case 377: return new GroupTitleUpdatePacket(header, bytes, ref i); + case 378: return new GroupRoleUpdatePacket(header, bytes, ref i); + case 379: return new LiveHelpGroupRequestPacket(header, bytes, ref i); + case 380: return new LiveHelpGroupReplyPacket(header, bytes, ref i); + case 381: return new AgentWearablesRequestPacket(header, bytes, ref i); + case 382: return new AgentWearablesUpdatePacket(header, bytes, ref i); + case 383: return new AgentIsNowWearingPacket(header, bytes, ref i); + case 384: return new AgentCachedTexturePacket(header, bytes, ref i); + case 385: return new AgentCachedTextureResponsePacket(header, bytes, ref i); + case 386: return new AgentDataUpdateRequestPacket(header, bytes, ref i); + case 387: return new AgentDataUpdatePacket(header, bytes, ref i); + case 388: return new GroupDataUpdatePacket(header, bytes, ref i); + case 389: return new AgentGroupDataUpdatePacket(header, bytes, ref i); + case 390: return new AgentDropGroupPacket(header, bytes, ref i); + case 392: return new CreateTrustedCircuitPacket(header, bytes, ref i); + case 393: return new DenyTrustedCircuitPacket(header, bytes, ref i); + case 394: return new RequestTrustedCircuitPacket(header, bytes, ref i); + case 395: return new RezSingleAttachmentFromInvPacket(header, bytes, ref i); + case 396: return new RezMultipleAttachmentsFromInvPacket(header, bytes, ref i); + case 397: return new DetachAttachmentIntoInvPacket(header, bytes, ref i); + case 398: return new CreateNewOutfitAttachmentsPacket(header, bytes, ref i); + case 399: return new UserInfoRequestPacket(header, bytes, ref i); + case 400: return new UserInfoReplyPacket(header, bytes, ref i); + case 401: return new UpdateUserInfoPacket(header, bytes, ref i); + case 403: return new InitiateDownloadPacket(header, bytes, ref i); + case 404: return new SystemMessagePacket(header, bytes, ref i); + case 405: return new MapLayerRequestPacket(header, bytes, ref i); + case 406: return new MapLayerReplyPacket(header, bytes, ref i); + case 407: return new MapBlockRequestPacket(header, bytes, ref i); + case 408: return new MapNameRequestPacket(header, bytes, ref i); + case 409: return new MapBlockReplyPacket(header, bytes, ref i); + case 410: return new MapItemRequestPacket(header, bytes, ref i); + case 411: return new MapItemReplyPacket(header, bytes, ref i); + case 412: return new SendPostcardPacket(header, bytes, ref i); + case 419: return new ParcelMediaCommandMessagePacket(header, bytes, ref i); + case 420: return new ParcelMediaUpdatePacket(header, bytes, ref i); + case 421: return new LandStatRequestPacket(header, bytes, ref i); + case 422: return new LandStatReplyPacket(header, bytes, ref i); + case 423: return new ErrorPacket(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]; + id = (ushort)bytes[7]; freq = PacketFrequency.Medium; switch (id) { - case 2: return new ObjectAddPacket(header, bytes, ref i); - case 3: return new MultipleObjectUpdatePacket(header, bytes, ref i); - case 4: return new RequestMultipleObjectsPacket(header, bytes, ref i); - case 5: return new ObjectPositionPacket(header, bytes, ref i); - case 6: return new RequestObjectPropertiesFamilyPacket(header, bytes, ref i); - case 7: return new CoarseLocationUpdatePacket(header, bytes, ref i); - case 8: return new CrossedRegionPacket(header, bytes, ref i); - case 9: return new ConfirmEnableSimulatorPacket(header, bytes, ref i); - case 10: return new ObjectPropertiesPacket(header, bytes, ref i); - case 11: return new ObjectPropertiesFamilyPacket(header, bytes, ref i); - case 12: return new ParcelPropertiesRequestPacket(header, bytes, ref i); - case 14: return new AttachedSoundPacket(header, bytes, ref i); - case 15: return new AttachedSoundGainChangePacket(header, bytes, ref i); - case 16: return new AttachedSoundCutoffRadiusPacket(header, bytes, ref i); - case 17: return new PreloadSoundPacket(header, bytes, ref i); - case 19: return new ViewerEffectPacket(header, bytes, ref i); - case 20: return new SetSunPhasePacket(header, bytes, ref i); + case 1: return new ObjectAddPacket(header, bytes, ref i); + case 2: return new MultipleObjectUpdatePacket(header, bytes, ref i); + case 3: return new RequestMultipleObjectsPacket(header, bytes, ref i); + case 4: return new ObjectPositionPacket(header, bytes, ref i); + case 5: return new RequestObjectPropertiesFamilyPacket(header, bytes, ref i); + case 6: return new CoarseLocationUpdatePacket(header, bytes, ref i); + case 7: return new CrossedRegionPacket(header, bytes, ref i); + case 8: return new ConfirmEnableSimulatorPacket(header, bytes, ref i); + case 9: return new ObjectPropertiesPacket(header, bytes, ref i); + case 10: return new ObjectPropertiesFamilyPacket(header, bytes, ref i); + case 11: return new ParcelPropertiesRequestPacket(header, bytes, ref i); + case 13: return new AttachedSoundPacket(header, bytes, ref i); + case 14: return new AttachedSoundGainChangePacket(header, bytes, ref i); + case 15: return new PreloadSoundPacket(header, bytes, ref i); + case 17: return new ViewerEffectPacket(header, bytes, ref i); } } } else { - id = (ushort)bytes[4]; + id = (ushort)bytes[6]; freq = PacketFrequency.High; switch (id) { case 1: return new StartPingCheckPacket(header, bytes, ref i); @@ -2158,22 +2002,21 @@ namespace libsecondlife.Packets case 14: return new ObjectUpdateCachedPacket(header, bytes, ref i); case 15: return new ImprovedTerseObjectUpdatePacket(header, bytes, ref i); case 16: return new KillObjectPacket(header, bytes, ref i); - case 17: return new AgentToNewRegionPacket(header, bytes, ref i); - case 18: return new TransferPacketPacket(header, bytes, ref i); - case 19: return new SendXferPacketPacket(header, bytes, ref i); - case 20: return new ConfirmXferPacketPacket(header, bytes, ref i); - case 21: return new AvatarAnimationPacket(header, bytes, ref i); - case 22: return new AvatarSitResponsePacket(header, bytes, ref i); - case 23: return new CameraConstraintPacket(header, bytes, ref i); - case 24: return new ParcelPropertiesPacket(header, bytes, ref i); - case 26: return new ChildAgentUpdatePacket(header, bytes, ref i); - case 27: return new ChildAgentAlivePacket(header, bytes, ref i); - case 28: return new ChildAgentPositionUpdatePacket(header, bytes, ref i); - case 31: return new SoundTriggerPacket(header, bytes, ref i); + case 17: return new TransferPacketPacket(header, bytes, ref i); + case 18: return new SendXferPacketPacket(header, bytes, ref i); + case 19: return new ConfirmXferPacketPacket(header, bytes, ref i); + case 20: return new AvatarAnimationPacket(header, bytes, ref i); + case 21: return new AvatarSitResponsePacket(header, bytes, ref i); + case 22: return new CameraConstraintPacket(header, bytes, ref i); + case 23: return new ParcelPropertiesPacket(header, bytes, ref i); + case 25: return new ChildAgentUpdatePacket(header, bytes, ref i); + case 26: return new ChildAgentAlivePacket(header, bytes, ref i); + case 27: return new ChildAgentPositionUpdatePacket(header, bytes, ref i); + case 29: return new SoundTriggerPacket(header, bytes, ref i); } } - throw new MalformedDataException("Unknown packet ID"); + throw new MalformedDataException("Unknown packet ID "+freq+" "+id); } } @@ -2295,7 +2138,6 @@ namespace libsecondlife.Packets Header = new LowHeader(); Header.ID = 1; Header.Reliable = true; - Header.Zerocoded = true; TestBlock1 = new TestBlock1Block(); NeighborBlock = new NeighborBlockBlock[4]; } @@ -2321,7 +2163,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; 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; } @@ -2354,9 +2196,9 @@ namespace libsecondlife.Packets [XmlType("usecircuitcode_circuitcode")] public class CircuitCodeBlock { - public LLUUID ID; - public LLUUID SessionID; public uint Code; + public LLUUID SessionID; + public LLUUID ID; [XmlIgnore] public int Length @@ -2372,9 +2214,9 @@ namespace libsecondlife.Packets { 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)); + SessionID = new LLUUID(bytes, i); i += 16; + ID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -2384,21 +2226,21 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- CircuitCode --"); - output.AppendLine(String.Format("ID: {0}", ID)); + output.AppendLine(String.Format("Code: {0}", Code)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("Code: {0}", Code)); + output.Append(String.Format("ID: {0}", ID)); return output.ToString(); } } @@ -2431,7 +2273,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += CircuitCode.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -2451,211 +2293,6 @@ namespace libsecondlife.Packets } - /// - public class LogControlPacket : Packet - { - /// - [XmlType("logcontrol_options")] - public class OptionsBlock - { - public uint Mask; - public bool Time; - public bool RemoteInfos; - public bool Location; - public byte Level; - - [XmlIgnore] - public int Length - { - get - { - return 8; - } - } - - public OptionsBlock() { } - public OptionsBlock(byte[] bytes, ref int i) - { - try - { - Mask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Time = (bytes[i++] != 0) ? (bool)true : (bool)false; - RemoteInfos = (bytes[i++] != 0) ? (bool)true : (bool)false; - Location = (bytes[i++] != 0) ? (bool)true : (bool)false; - Level = (byte)bytes[i++]; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(Mask % 256); - bytes[i++] = (byte)((Mask >> 8) % 256); - bytes[i++] = (byte)((Mask >> 16) % 256); - bytes[i++] = (byte)((Mask >> 24) % 256); - bytes[i++] = (byte)((Time) ? 1 : 0); - bytes[i++] = (byte)((RemoteInfos) ? 1 : 0); - bytes[i++] = (byte)((Location) ? 1 : 0); - bytes[i++] = Level; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Options --"); - output.AppendLine(String.Format("Mask: {0}", Mask)); - output.AppendLine(String.Format("Time: {0}", Time)); - output.AppendLine(String.Format("RemoteInfos: {0}", RemoteInfos)); - output.AppendLine(String.Format("Location: {0}", Location)); - output.Append(String.Format("Level: {0}", Level)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.LogControl; } } - public OptionsBlock Options; - - public LogControlPacket() - { - Header = new LowHeader(); - Header.ID = 4; - Header.Reliable = true; - Options = new OptionsBlock(); - } - - public LogControlPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Options = new OptionsBlock(bytes, ref i); - } - - public LogControlPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Options = new OptionsBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Options.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Options.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- LogControl ---" + Environment.NewLine; - output += Options.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class LogMessagesPacket : Packet - { - /// - [XmlType("logmessages_options")] - public class OptionsBlock - { - public bool Enable; - - [XmlIgnore] - public int Length - { - get - { - return 1; - } - } - - public OptionsBlock() { } - public OptionsBlock(byte[] bytes, ref int i) - { - try - { - Enable = (bytes[i++] != 0) ? (bool)true : (bool)false; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)((Enable) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Options --"); - output.Append(String.Format("Enable: {0}", Enable)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.LogMessages; } } - public OptionsBlock Options; - - public LogMessagesPacket() - { - Header = new LowHeader(); - Header.ID = 6; - Header.Reliable = true; - Options = new OptionsBlock(); - } - - public LogMessagesPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Options = new OptionsBlock(bytes, ref i); - } - - public LogMessagesPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Options = new OptionsBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Options.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Options.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- LogMessages ---" + Environment.NewLine; - output += Options.ToString() + Environment.NewLine; - return output; - } - - } - /// public class TelehubInfoPacket : Packet { @@ -2663,6 +2300,7 @@ namespace libsecondlife.Packets [XmlType("telehubinfo_telehubblock")] public class TelehubBlockBlock { + public LLUUID ObjectID; private byte[] _objectname; public byte[] ObjectName { @@ -2674,7 +2312,6 @@ namespace libsecondlife.Packets else { _objectname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _objectname, 0, value.Length); } } } - public LLUUID ObjectID; public LLVector3 TelehubPos; public LLQuaternion TelehubRot; @@ -2695,10 +2332,10 @@ namespace libsecondlife.Packets int length; try { + ObjectID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _objectname = new byte[length]; Buffer.BlockCopy(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; } @@ -2710,10 +2347,10 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); } bytes[i++] = (byte)ObjectName.Length; Buffer.BlockCopy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length; - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(TelehubPos.GetBytes(), 0, bytes, i, 12); i += 12; Buffer.BlockCopy(TelehubRot.GetBytes(), 0, bytes, i, 12); i += 12; } @@ -2722,9 +2359,9 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- TelehubBlock --"); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); Helpers.FieldToString(output, ObjectName, "ObjectName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); output.AppendLine(String.Format("TelehubPos: {0}", TelehubPos)); output.Append(String.Format("TelehubRot: {0}", TelehubRot)); return output.ToString(); @@ -2782,7 +2419,7 @@ namespace libsecondlife.Packets public TelehubInfoPacket() { Header = new LowHeader(); - Header.ID = 16; + Header.ID = 10; Header.Reliable = true; TelehubBlock = new TelehubBlockBlock(); SpawnPointBlock = new SpawnPointBlockBlock[0]; @@ -2811,7 +2448,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TelehubBlock.Length;; length++; for (int j = 0; j < SpawnPointBlock.Length; j++) { length += SpawnPointBlock[j].Length; } @@ -2849,7 +2486,7 @@ namespace libsecondlife.Packets public EconomyDataRequestPacket() { Header = new LowHeader(); - Header.ID = 36; + Header.ID = 24; Header.Reliable = true; } @@ -2866,7 +2503,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -2891,23 +2528,23 @@ namespace libsecondlife.Packets [XmlType("economydata_info")] public class InfoBlock { - public float PriceParcelClaimFactor; public int ObjectCapacity; - public float EnergyEfficiency; public int ObjectCount; - public float TeleportPriceExponent; - public int PriceGroupCreate; - public float PriceObjectRent; - public int PricePublicObjectDelete; public int PriceEnergyUnit; - public int TeleportMinPrice; - public int PricePublicObjectDecay; public int PriceObjectClaim; + public int PricePublicObjectDecay; + public int PricePublicObjectDelete; public int PriceParcelClaim; - public float PriceObjectScaleFactor; - public int PriceRentLight; - public int PriceParcelRent; + public float PriceParcelClaimFactor; public int PriceUpload; + public int PriceRentLight; + public int TeleportMinPrice; + public float TeleportPriceExponent; + public float EnergyEfficiency; + public float PriceObjectRent; + public float PriceObjectScaleFactor; + public int PriceParcelRent; + public int PriceGroupCreate; [XmlIgnore] public int Length @@ -2923,28 +2560,28 @@ namespace libsecondlife.Packets { 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)); + PricePublicObjectDecay = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PricePublicObjectDelete = (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)); + PriceParcelClaimFactor = BitConverter.ToSingle(bytes, i); i += 4; PriceUpload = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PriceRentLight = (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)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + TeleportPriceExponent = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + EnergyEfficiency = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + PriceObjectRent = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + PriceObjectScaleFactor = BitConverter.ToSingle(bytes, i); i += 4; + PriceParcelRent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PriceGroupCreate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -2955,92 +2592,92 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - ba = BitConverter.GetBytes(PriceParcelClaimFactor); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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)(PricePublicObjectDecay % 256); + bytes[i++] = (byte)((PricePublicObjectDecay >> 8) % 256); + bytes[i++] = (byte)((PricePublicObjectDecay >> 16) % 256); + bytes[i++] = (byte)((PricePublicObjectDecay >> 24) % 256); + 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)(PriceParcelClaim % 256); bytes[i++] = (byte)((PriceParcelClaim >> 8) % 256); bytes[i++] = (byte)((PriceParcelClaim >> 16) % 256); bytes[i++] = (byte)((PriceParcelClaim >> 24) % 256); - ba = BitConverter.GetBytes(PriceObjectScaleFactor); + ba = BitConverter.GetBytes(PriceParcelClaimFactor); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(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); + 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)(TeleportMinPrice % 256); + bytes[i++] = (byte)((TeleportMinPrice >> 8) % 256); + bytes[i++] = (byte)((TeleportMinPrice >> 16) % 256); + bytes[i++] = (byte)((TeleportMinPrice >> 24) % 256); + ba = BitConverter.GetBytes(TeleportPriceExponent); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(EnergyEfficiency); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(PriceObjectRent); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(PriceObjectScaleFactor); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + 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)(PriceGroupCreate % 256); + bytes[i++] = (byte)((PriceGroupCreate >> 8) % 256); + bytes[i++] = (byte)((PriceGroupCreate >> 16) % 256); + bytes[i++] = (byte)((PriceGroupCreate >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Info --"); - output.AppendLine(String.Format("PriceParcelClaimFactor: {0}", PriceParcelClaimFactor)); output.AppendLine(String.Format("ObjectCapacity: {0}", ObjectCapacity)); - output.AppendLine(String.Format("EnergyEfficiency: {0}", EnergyEfficiency)); output.AppendLine(String.Format("ObjectCount: {0}", ObjectCount)); - output.AppendLine(String.Format("TeleportPriceExponent: {0}", TeleportPriceExponent)); - output.AppendLine(String.Format("PriceGroupCreate: {0}", PriceGroupCreate)); - output.AppendLine(String.Format("PriceObjectRent: {0}", PriceObjectRent)); - output.AppendLine(String.Format("PricePublicObjectDelete: {0}", PricePublicObjectDelete)); output.AppendLine(String.Format("PriceEnergyUnit: {0}", PriceEnergyUnit)); - output.AppendLine(String.Format("TeleportMinPrice: {0}", TeleportMinPrice)); - output.AppendLine(String.Format("PricePublicObjectDecay: {0}", PricePublicObjectDecay)); output.AppendLine(String.Format("PriceObjectClaim: {0}", PriceObjectClaim)); + output.AppendLine(String.Format("PricePublicObjectDecay: {0}", PricePublicObjectDecay)); + output.AppendLine(String.Format("PricePublicObjectDelete: {0}", PricePublicObjectDelete)); output.AppendLine(String.Format("PriceParcelClaim: {0}", PriceParcelClaim)); - output.AppendLine(String.Format("PriceObjectScaleFactor: {0}", PriceObjectScaleFactor)); + output.AppendLine(String.Format("PriceParcelClaimFactor: {0}", PriceParcelClaimFactor)); + output.AppendLine(String.Format("PriceUpload: {0}", PriceUpload)); output.AppendLine(String.Format("PriceRentLight: {0}", PriceRentLight)); + output.AppendLine(String.Format("TeleportMinPrice: {0}", TeleportMinPrice)); + output.AppendLine(String.Format("TeleportPriceExponent: {0}", TeleportPriceExponent)); + output.AppendLine(String.Format("EnergyEfficiency: {0}", EnergyEfficiency)); + output.AppendLine(String.Format("PriceObjectRent: {0}", PriceObjectRent)); + output.AppendLine(String.Format("PriceObjectScaleFactor: {0}", PriceObjectScaleFactor)); output.AppendLine(String.Format("PriceParcelRent: {0}", PriceParcelRent)); - output.Append(String.Format("PriceUpload: {0}", PriceUpload)); + output.Append(String.Format("PriceGroupCreate: {0}", PriceGroupCreate)); return output.ToString(); } } @@ -3053,9 +2690,8 @@ namespace libsecondlife.Packets public EconomyDataPacket() { Header = new LowHeader(); - Header.ID = 37; + Header.ID = 25; Header.Reliable = true; - Header.Zerocoded = true; Info = new InfoBlock(); } @@ -3074,7 +2710,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -3097,6 +2733,56 @@ namespace libsecondlife.Packets /// public class AvatarPickerRequestPacket : Packet { + /// + [XmlType("avatarpickerrequest_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public LLUUID QueryID; + + [XmlIgnore] + public int Length + { + get + { + return 48; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + QueryID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("QueryID: {0}", QueryID)); + return output.ToString(); + } + } + /// [XmlType("avatarpickerrequest_data")] public class DataBlock @@ -3156,96 +2842,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("avatarpickerrequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - public LLUUID QueryID; - - [XmlIgnore] - public int Length - { - get - { - return 48; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - QueryID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("QueryID: {0}", QueryID)); - return output.ToString(); - } - } - 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 DataBlock Data; public AvatarPickerRequestPacket() { Header = new LowHeader(); - Header.ID = 38; + Header.ID = 26; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -3253,8 +2889,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarPickerRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -3263,90 +2899,6 @@ namespace libsecondlife.Packets /// public class AvatarPickerReplyPacket : Packet { - /// - [XmlType("avatarpickerreply_data")] - public class DataBlock - { - private byte[] _lastname; - public byte[] LastName - { - get { return _lastname; } - set - { - if (value == null) { _lastname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _lastname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _lastname, 0, 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]; Buffer.BlockCopy(value, 0, _firstname, 0, value.Length); } - } - } - public LLUUID AvatarID; - - [XmlIgnore] - public int Length - { - get - { - int length = 16; - if (LastName != null) { length += 1 + LastName.Length; } - if (FirstName != null) { length += 1 + FirstName.Length; } - return length; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _lastname = new byte[length]; - Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; - length = (ushort)bytes[i++]; - _firstname = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length; - Buffer.BlockCopy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - Helpers.FieldToString(output, LastName, "LastName"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, FirstName, "FirstName"); - output.Append(Environment.NewLine); - output.Append(String.Format("AvatarID: {0}", AvatarID)); - return output.ToString(); - } - } - /// [XmlType("avatarpickerreply_agentdata")] public class AgentDataBlock @@ -3393,101 +2945,31 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AvatarPickerReply; } } - public DataBlock[] Data; - public AgentDataBlock AgentData; - - public AvatarPickerReplyPacket() - { - Header = new LowHeader(); - Header.ID = 40; - Header.Reliable = true; - Data = new DataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public AvatarPickerReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AvatarPickerReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)Data.Length; - for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AvatarPickerReply ---" + Environment.NewLine; - for (int j = 0; j < Data.Length; j++) - { - output += Data[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class PlacesQueryPacket : Packet - { /// - [XmlType("placesquery_querydata")] - public class QueryDataBlock + [XmlType("avatarpickerreply_data")] + public class DataBlock { - private byte[] _simname; - public byte[] SimName + public LLUUID AvatarID; + private byte[] _firstname; + public byte[] FirstName { - get { return _simname; } + get { return _firstname; } set { - if (value == null) { _simname = null; return; } + if (value == null) { _firstname = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + else { _firstname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _firstname, 0, value.Length); } } } - public sbyte Category; - public uint QueryFlags; - private byte[] _querytext; - public byte[] QueryText + private byte[] _lastname; + public byte[] LastName { - get { return _querytext; } + get { return _lastname; } set { - if (value == null) { _querytext = null; return; } + if (value == null) { _lastname = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _querytext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } + else { _lastname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _lastname, 0, value.Length); } } } @@ -3496,27 +2978,26 @@ namespace libsecondlife.Packets { get { - int length = 5; - if (SimName != null) { length += 1 + SimName.Length; } - if (QueryText != null) { length += 1 + QueryText.Length; } + int length = 16; + if (FirstName != null) { length += 1 + FirstName.Length; } + if (LastName != null) { length += 1 + LastName.Length; } return length; } } - public QueryDataBlock() { } - public QueryDataBlock(byte[] bytes, ref int i) + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) { int length; try { + AvatarID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; - _simname = new byte[length]; - Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; - Category = (sbyte)bytes[i++]; - QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + _firstname = new byte[length]; + Buffer.BlockCopy(bytes, i, _firstname, 0, length); i += length; length = (ushort)bytes[i++]; - _querytext = new byte[length]; - Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; + _lastname = new byte[length]; + Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; } catch (Exception) { @@ -3526,32 +3007,96 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; + Buffer.BlockCopy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16; + if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); } + bytes[i++] = (byte)FirstName.Length; + Buffer.BlockCopy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length; + if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); } + bytes[i++] = (byte)LastName.Length; + Buffer.BlockCopy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryData --"); - Helpers.FieldToString(output, SimName, "SimName"); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("AvatarID: {0}", AvatarID)); + Helpers.FieldToString(output, FirstName, "FirstName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); - Helpers.FieldToString(output, QueryText, "QueryText"); + Helpers.FieldToString(output, LastName, "LastName"); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.AvatarPickerReply; } } + public AgentDataBlock AgentData; + public DataBlock[] Data; + + public AvatarPickerReplyPacket() + { + Header = new LowHeader(); + Header.ID = 28; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock[0]; + } + + public AvatarPickerReplyPacket(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++]; + Data = new DataBlock[count]; + for (int j = 0; j < count; j++) + { Data[j] = new DataBlock(bytes, ref i); } + } + + public AvatarPickerReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(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); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.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 = "--- AvatarPickerReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < Data.Length; j++) + { + output += Data[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class PlacesQueryPacket : Packet + { /// [XmlType("placesquery_agentdata")] public class AgentDataBlock @@ -3644,74 +3189,23 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.PlacesQuery; } } - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - public TransactionDataBlock TransactionData; - - public PlacesQueryPacket() - { - Header = new LowHeader(); - Header.ID = 41; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - TransactionData = new TransactionDataBlock(); - } - - public PlacesQueryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - TransactionData = new TransactionDataBlock(bytes, ref i); - } - - public PlacesQueryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - TransactionData = new TransactionDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length; length += TransactionData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - TransactionData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- PlacesQuery ---" + Environment.NewLine; - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - output += TransactionData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class PlacesReplyPacket : Packet - { /// - [XmlType("placesreply_querydata")] + [XmlType("placesquery_querydata")] public class QueryDataBlock { + 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]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } + } + } + public uint QueryFlags; + public sbyte Category; private byte[] _simname; public byte[] SimName { @@ -3723,48 +3217,15 @@ namespace libsecondlife.Packets else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } - } - } - public LLUUID OwnerID; - public LLUUID SnapshotID; - public byte Flags; - public int Price; - public float Dwell; [XmlIgnore] public int Length { get { - int length = 61; + int length = 5; + if (QueryText != null) { length += 1 + QueryText.Length; } if (SimName != null) { length += 1 + SimName.Length; } - if (Name != null) { length += 1 + Name.Length; } - if (Desc != null) { length += 1 + Desc.Length; } return length; } } @@ -3775,29 +3236,14 @@ namespace libsecondlife.Packets int length; try { + length = (ushort)bytes[i++]; + _querytext = new byte[length]; + Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; + QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Category = (sbyte)bytes[i++]; length = (ushort)bytes[i++]; _simname = new byte[length]; Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - length = (ushort)bytes[i++]; - _desc = new byte[length]; - Buffer.BlockCopy(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) { @@ -3807,69 +3253,95 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - byte[] ba; + if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); } + bytes[i++] = (byte)QueryText.Length; + Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; + 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)Category; if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } bytes[i++] = (byte)SimName.Length; Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(GlobalY); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(GlobalZ); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } - bytes[i++] = (byte)Name.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- QueryData --"); + Helpers.FieldToString(output, QueryText, "QueryText"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); + output.AppendLine(String.Format("Category: {0}", Category)); Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("BillableArea: {0}", BillableArea)); - output.AppendLine(String.Format("ActualArea: {0}", ActualArea)); - output.AppendLine(String.Format("GlobalX: {0}", GlobalX)); - output.AppendLine(String.Format("GlobalY: {0}", GlobalY)); - output.AppendLine(String.Format("GlobalZ: {0}", GlobalZ)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Desc, "Desc"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("Price: {0}", Price)); - output.Append(String.Format("Dwell: {0}", Dwell)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.PlacesQuery; } } + public AgentDataBlock AgentData; + public TransactionDataBlock TransactionData; + public QueryDataBlock QueryData; + + public PlacesQueryPacket() + { + Header = new LowHeader(); + Header.ID = 29; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + TransactionData = new TransactionDataBlock(); + QueryData = new QueryDataBlock(); + } + + public PlacesQueryPacket(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); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public PlacesQueryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + TransactionData = new TransactionDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += TransactionData.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); + AgentData.ToBytes(bytes, ref i); + TransactionData.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 = "--- PlacesQuery ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += TransactionData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class PlacesReplyPacket : Packet + { /// [XmlType("placesreply_agentdata")] public class AgentDataBlock @@ -3958,108 +3430,63 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.PlacesReply; } } - public QueryDataBlock[] QueryData; - public AgentDataBlock AgentData; - public TransactionDataBlock TransactionData; - - public PlacesReplyPacket() - { - Header = new LowHeader(); - Header.ID = 42; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock[0]; - AgentData = new AgentDataBlock(); - TransactionData = new TransactionDataBlock(); - } - - public PlacesReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - QueryData = new QueryDataBlock[count]; - for (int j = 0; j < count; j++) - { QueryData[j] = new QueryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - TransactionData = new TransactionDataBlock(bytes, ref i); - } - - public PlacesReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - QueryData = new QueryDataBlock[count]; - for (int j = 0; j < count; j++) - { QueryData[j] = new QueryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - TransactionData = new TransactionDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length; length += TransactionData.Length;; - length++; - for (int j = 0; j < QueryData.Length; j++) { length += QueryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)QueryData.Length; - for (int j = 0; j < QueryData.Length; j++) { QueryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - TransactionData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- PlacesReply ---" + Environment.NewLine; - for (int j = 0; j < QueryData.Length; j++) - { - output += QueryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - output += TransactionData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirFindQueryPacket : Packet - { /// - [XmlType("dirfindquery_querydata")] + [XmlType("placesreply_querydata")] public class QueryDataBlock { - public LLUUID QueryID; - public uint QueryFlags; - public int QueryStart; - private byte[] _querytext; - public byte[] QueryText + public LLUUID OwnerID; + private byte[] _name; + public byte[] Name { - get { return _querytext; } + get { return _name; } set { - if (value == null) { _querytext = null; return; } + if (value == null) { _name = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _querytext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } + else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } + } + } + public int ActualArea; + public int BillableArea; + public byte Flags; + public float GlobalX; + public float GlobalY; + public float GlobalZ; + 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public LLUUID SnapshotID; + public float Dwell; + public int Price; [XmlIgnore] public int Length { get { - int length = 24; - if (QueryText != null) { length += 1 + QueryText.Length; } + int length = 61; + if (Name != null) { length += 1 + Name.Length; } + if (Desc != null) { length += 1 + Desc.Length; } + if (SimName != null) { length += 1 + SimName.Length; } return length; } } @@ -4070,12 +3497,29 @@ namespace libsecondlife.Packets 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)); + OwnerID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; - _querytext = new byte[length]; - Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _desc = new byte[length]; + Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; + ActualArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + BillableArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Flags = (byte)bytes[i++]; + 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++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + SnapshotID = new LLUUID(bytes, i); i += 16; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Dwell = BitConverter.ToSingle(bytes, i); i += 4; + Price = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -4085,32 +3529,144 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(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; - Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; + byte[] ba; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; + 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)(BillableArea % 256); + bytes[i++] = (byte)((BillableArea >> 8) % 256); + bytes[i++] = (byte)((BillableArea >> 16) % 256); + bytes[i++] = (byte)((BillableArea >> 24) % 256); + bytes[i++] = Flags; + ba = BitConverter.GetBytes(GlobalX); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(GlobalY); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(GlobalZ); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } + bytes[i++] = (byte)SimName.Length; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; + Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + ba = BitConverter.GetBytes(Dwell); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = (byte)(Price % 256); + bytes[i++] = (byte)((Price >> 8) % 256); + bytes[i++] = (byte)((Price >> 16) % 256); + bytes[i++] = (byte)((Price >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- QueryData --"); - output.AppendLine(String.Format("QueryID: {0}", QueryID)); - output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); - output.AppendLine(String.Format("QueryStart: {0}", QueryStart)); - Helpers.FieldToString(output, QueryText, "QueryText"); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Desc, "Desc"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ActualArea: {0}", ActualArea)); + output.AppendLine(String.Format("BillableArea: {0}", BillableArea)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("GlobalX: {0}", GlobalX)); + output.AppendLine(String.Format("GlobalY: {0}", GlobalY)); + output.AppendLine(String.Format("GlobalZ: {0}", GlobalZ)); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); + output.AppendLine(String.Format("Dwell: {0}", Dwell)); + output.Append(String.Format("Price: {0}", Price)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.PlacesReply; } } + public AgentDataBlock AgentData; + public TransactionDataBlock TransactionData; + public QueryDataBlock[] QueryData; + + public PlacesReplyPacket() + { + Header = new LowHeader(); + Header.ID = 30; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + TransactionData = new TransactionDataBlock(); + QueryData = new QueryDataBlock[0]; + } + + public PlacesReplyPacket(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); + int count = (int)bytes[i++]; + QueryData = new QueryDataBlock[count]; + for (int j = 0; j < count; j++) + { QueryData[j] = new QueryDataBlock(bytes, ref i); } + } + + public PlacesReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + TransactionData = new TransactionDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryData = new QueryDataBlock[count]; + for (int j = 0; j < count; j++) + { QueryData[j] = new QueryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + TransactionData.ToBytes(bytes, ref i); + bytes[i++] = (byte)QueryData.Length; + for (int j = 0; j < QueryData.Length; j++) { QueryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- PlacesReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += TransactionData.ToString() + Environment.NewLine; + for (int j = 0; j < QueryData.Length; j++) + { + output += QueryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class DirFindQueryPacket : Packet + { /// [XmlType("dirfindquery_agentdata")] public class AgentDataBlock @@ -4157,83 +3713,11 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirFindQuery; } } - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirFindQueryPacket() - { - Header = new LowHeader(); - Header.ID = 43; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirFindQueryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirFindQueryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirFindQuery ---" + Environment.NewLine; - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirPlacesQueryPacket : Packet - { /// - [XmlType("dirplacesquery_querydata")] + [XmlType("dirfindquery_querydata")] public class QueryDataBlock { - private byte[] _simname; - public byte[] SimName - { - get { return _simname; } - set - { - if (value == null) { _simname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } - } - } public LLUUID QueryID; - public sbyte Category; - public uint QueryFlags; - public int QueryStart; private byte[] _querytext; public byte[] QueryText { @@ -4245,14 +3729,15 @@ namespace libsecondlife.Packets else { _querytext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } } } + public uint QueryFlags; + public int QueryStart; [XmlIgnore] public int Length { get { - int length = 25; - if (SimName != null) { length += 1 + SimName.Length; } + int length = 24; if (QueryText != null) { length += 1 + QueryText.Length; } return length; } @@ -4264,16 +3749,12 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)bytes[i++]; - _simname = new byte[length]; - Buffer.BlockCopy(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]; Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; + 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)); } catch (Exception) { @@ -4283,11 +3764,10 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)Category; + if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); } + bytes[i++] = (byte)QueryText.Length; + Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; bytes[i++] = (byte)(QueryFlags % 256); bytes[i++] = (byte)((QueryFlags >> 8) % 256); bytes[i++] = (byte)((QueryFlags >> 16) % 256); @@ -4296,26 +3776,78 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- QueryData --"); - Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("QueryID: {0}", QueryID)); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); - output.AppendLine(String.Format("QueryStart: {0}", QueryStart)); Helpers.FieldToString(output, QueryText, "QueryText"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); + output.Append(String.Format("QueryStart: {0}", QueryStart)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirFindQuery; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + + public DirFindQueryPacket() + { + Header = new LowHeader(); + Header.ID = 31; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + } + + public DirFindQueryPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public DirFindQueryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- DirFindQuery ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class DirPlacesQueryPacket : Packet + { /// [XmlType("dirplacesquery_agentdata")] public class AgentDataBlock @@ -4362,109 +3894,65 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirPlacesQuery; } } - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirPlacesQueryPacket() - { - Header = new LowHeader(); - Header.ID = 45; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirPlacesQueryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirPlacesQueryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirPlacesQuery ---" + Environment.NewLine; - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirPlacesReplyPacket : Packet - { /// - [XmlType("dirplacesreply_queryreplies")] - public class QueryRepliesBlock + [XmlType("dirplacesquery_querydata")] + public class QueryDataBlock { - public bool ForSale; - public LLUUID ParcelID; - private byte[] _name; - public byte[] Name + public LLUUID QueryID; + private byte[] _querytext; + public byte[] QueryText { - get { return _name; } + get { return _querytext; } set { - if (value == null) { _name = null; return; } + if (value == null) { _querytext = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + else { _querytext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } } } - public bool Auction; - public float Dwell; + public uint QueryFlags; + public sbyte Category; + 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public int QueryStart; [XmlIgnore] public int Length { get { - int length = 22; - if (Name != null) { length += 1 + Name.Length; } + int length = 25; + if (QueryText != null) { length += 1 + QueryText.Length; } + if (SimName != null) { length += 1 + SimName.Length; } return length; } } - public QueryRepliesBlock() { } - public QueryRepliesBlock(byte[] bytes, ref int i) + public QueryDataBlock() { } + public QueryDataBlock(byte[] bytes, ref int i) { int length; try { - ForSale = (bytes[i++] != 0) ? (bool)true : (bool)false; - ParcelID = new LLUUID(bytes, i); i += 16; + QueryID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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; + _querytext = new byte[length]; + Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; + QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Category = (sbyte)bytes[i++]; + length = (ushort)bytes[i++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -4474,28 +3962,135 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - byte[] ba; - bytes[i++] = (byte)((ForSale) ? 1 : 0); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + Buffer.BlockCopy(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; + Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; + 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)Category; + if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } + bytes[i++] = (byte)SimName.Length; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; + bytes[i++] = (byte)(QueryStart % 256); + bytes[i++] = (byte)((QueryStart >> 8) % 256); + bytes[i++] = (byte)((QueryStart >> 16) % 256); + bytes[i++] = (byte)((QueryStart >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryReplies --"); - output.AppendLine(String.Format("ForSale: {0}", ForSale)); - output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); - Helpers.FieldToString(output, Name, "Name"); + output.AppendLine("-- QueryData --"); + output.AppendLine(String.Format("QueryID: {0}", QueryID)); + Helpers.FieldToString(output, QueryText, "QueryText"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("Auction: {0}", Auction)); - output.Append(String.Format("Dwell: {0}", Dwell)); + output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); + output.AppendLine(String.Format("Category: {0}", Category)); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.Append(String.Format("QueryStart: {0}", QueryStart)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirPlacesQuery; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + + public DirPlacesQueryPacket() + { + Header = new LowHeader(); + Header.ID = 33; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + } + + public DirPlacesQueryPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public DirPlacesQueryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- DirPlacesQuery ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class DirPlacesReplyPacket : Packet + { + /// + [XmlType("dirplacesreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.Append(String.Format("AgentID: {0}", AgentID)); return output.ToString(); } } @@ -4543,7 +4138,174 @@ namespace libsecondlife.Packets } /// - [XmlType("dirplacesreply_agentdata")] + [XmlType("dirplacesreply_queryreplies")] + public class QueryRepliesBlock + { + public LLUUID ParcelID; + private byte[] _name; + public byte[] Name + { + get { return _name; } + set + { + if (value == null) { _name = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + public bool ForSale; + public bool Auction; + public float Dwell; + + [XmlIgnore] + public int Length + { + get + { + int length = 22; + 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]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + ForSale = (bytes[i++] != 0) ? (bool)true : (bool)false; + 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; + Buffer.BlockCopy(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; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + bytes[i++] = (byte)((ForSale) ? 1 : 0); + bytes[i++] = (byte)((Auction) ? 1 : 0); + ba = BitConverter.GetBytes(Dwell); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- QueryReplies --"); + output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ForSale: {0}", ForSale)); + output.AppendLine(String.Format("Auction: {0}", Auction)); + output.Append(String.Format("Dwell: {0}", Dwell)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirPlacesReply; } } + public AgentDataBlock AgentData; + public QueryDataBlock[] QueryData; + public QueryRepliesBlock[] QueryReplies; + + public DirPlacesReplyPacket() + { + Header = new LowHeader(); + Header.ID = 35; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock[0]; + QueryReplies = new QueryRepliesBlock[0]; + } + + public DirPlacesReplyPacket(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++]; + QueryData = new QueryDataBlock[count]; + for (int j = 0; j < count; j++) + { QueryData[j] = new QueryDataBlock(bytes, ref i); } + count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public DirPlacesReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryData = new QueryDataBlock[count]; + for (int j = 0; j < count; j++) + { QueryData[j] = new QueryDataBlock(bytes, ref i); } + count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length;; + length++; + for (int j = 0; j < QueryData.Length; j++) { length += QueryData[j].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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)QueryData.Length; + for (int j = 0; j < QueryData.Length; j++) { QueryData[j].ToBytes(bytes, ref i); } + bytes[i++] = (byte)QueryReplies.Length; + for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- DirPlacesReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < QueryData.Length; j++) + { + output += QueryData[j].ToString() + Environment.NewLine; + } + for (int j = 0; j < QueryReplies.Length; j++) + { + output += QueryReplies[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class DirPeopleReplyPacket : Packet + { + /// + [XmlType("dirpeoplereply_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -4584,208 +4346,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirPlacesReply; } } - public QueryRepliesBlock[] QueryReplies; - public QueryDataBlock[] QueryData; - public AgentDataBlock AgentData; - - public DirPlacesReplyPacket() - { - Header = new LowHeader(); - Header.ID = 47; - Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public DirPlacesReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - count = (int)bytes[i++]; - QueryData = new QueryDataBlock[count]; - for (int j = 0; j < count; j++) - { QueryData[j] = new QueryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirPlacesReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - count = (int)bytes[i++]; - QueryData = new QueryDataBlock[count]; - for (int j = 0; j < count; j++) - { QueryData[j] = new QueryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; } - length++; - for (int j = 0; j < QueryData.Length; j++) { length += QueryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)QueryReplies.Length; - for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } - bytes[i++] = (byte)QueryData.Length; - for (int j = 0; j < QueryData.Length; j++) { QueryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirPlacesReply ---" + Environment.NewLine; - for (int j = 0; j < QueryReplies.Length; j++) - { - output += QueryReplies[j].ToString() + Environment.NewLine; - } - for (int j = 0; j < QueryData.Length; j++) - { - output += QueryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirPeopleReplyPacket : Packet - { - /// - [XmlType("dirpeoplereply_queryreplies")] - public class QueryRepliesBlock - { - public LLUUID AgentID; - private byte[] _lastname; - public byte[] LastName - { - get { return _lastname; } - set - { - if (value == null) { _lastname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _lastname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _lastname, 0, 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]; Buffer.BlockCopy(value, 0, _firstname, 0, 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]; Buffer.BlockCopy(value, 0, _group, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 21; - if (LastName != null) { length += 1 + LastName.Length; } - if (FirstName != null) { length += 1 + FirstName.Length; } - if (Group != null) { length += 1 + Group.Length; } - return length; - } - } - - public QueryRepliesBlock() { } - public QueryRepliesBlock(byte[] bytes, ref int i) - { - int length; - try - { - AgentID = new LLUUID(bytes, i); i += 16; - length = (ushort)bytes[i++]; - _lastname = new byte[length]; - Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; - length = (ushort)bytes[i++]; - _firstname = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _group, 0, length); i += length; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Group, 0, bytes, i, Group.Length); i += Group.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryReplies --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - Helpers.FieldToString(output, LastName, "LastName"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, FirstName, "FirstName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Online: {0}", Online)); - output.AppendLine(String.Format("Reputation: {0}", Reputation)); - Helpers.FieldToString(output, Group, "Group"); - return output.ToString(); - } - } - /// [XmlType("dirpeoplereply_querydata")] public class QueryDataBlock @@ -4829,7 +4389,197 @@ namespace libsecondlife.Packets } /// - [XmlType("dirpeoplereply_agentdata")] + [XmlType("dirpeoplereply_queryreplies")] + public class QueryRepliesBlock + { + public LLUUID AgentID; + 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]; Buffer.BlockCopy(value, 0, _firstname, 0, 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]; Buffer.BlockCopy(value, 0, _lastname, 0, 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]; Buffer.BlockCopy(value, 0, _group, 0, value.Length); } + } + } + public bool Online; + public int Reputation; + + [XmlIgnore] + public int Length + { + get + { + int length = 21; + if (FirstName != null) { length += 1 + FirstName.Length; } + if (LastName != null) { length += 1 + LastName.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++]; + _firstname = new byte[length]; + Buffer.BlockCopy(bytes, i, _firstname, 0, length); i += length; + length = (ushort)bytes[i++]; + _lastname = new byte[length]; + Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; + length = (ushort)bytes[i++]; + _group = new byte[length]; + Buffer.BlockCopy(bytes, i, _group, 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)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); } + bytes[i++] = (byte)FirstName.Length; + Buffer.BlockCopy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length; + if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); } + bytes[i++] = (byte)LastName.Length; + Buffer.BlockCopy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length; + if(Group == null) { Console.WriteLine("Warning: Group is null, in " + this.GetType()); } + bytes[i++] = (byte)Group.Length; + Buffer.BlockCopy(Group, 0, bytes, i, Group.Length); i += Group.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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- QueryReplies --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + Helpers.FieldToString(output, FirstName, "FirstName"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, LastName, "LastName"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Group, "Group"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Online: {0}", Online)); + output.Append(String.Format("Reputation: {0}", Reputation)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirPeopleReply; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + public QueryRepliesBlock[] QueryReplies; + + public DirPeopleReplyPacket() + { + Header = new LowHeader(); + Header.ID = 36; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + QueryReplies = new QueryRepliesBlock[0]; + } + + public DirPeopleReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public DirPeopleReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += QueryData.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); + AgentData.ToBytes(bytes, ref i); + QueryData.ToBytes(bytes, ref i); + bytes[i++] = (byte)QueryReplies.Length; + for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- DirPeopleReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + for (int j = 0; j < QueryReplies.Length; j++) + { + output += QueryReplies[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class DirEventsReplyPacket : Packet + { + /// + [XmlType("direventsreply_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -4870,187 +4620,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirPeopleReply; } } - public QueryRepliesBlock[] QueryReplies; - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirPeopleReplyPacket() - { - Header = new LowHeader(); - Header.ID = 48; - Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirPeopleReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirPeopleReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)QueryReplies.Length; - for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirPeopleReply ---" + Environment.NewLine; - for (int j = 0; j < QueryReplies.Length; j++) - { - output += QueryReplies[j].ToString() + Environment.NewLine; - } - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirEventsReplyPacket : Packet - { - /// - [XmlType("direventsreply_queryreplies")] - public class QueryRepliesBlock - { - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _date, 0, value.Length); } - } - } - public uint EventID; - public LLUUID OwnerID; - public uint EventFlags; - public uint UnixTime; - - [XmlIgnore] - public int Length - { - get - { - int length = 28; - if (Name != null) { length += 1 + Name.Length; } - if (Date != null) { length += 1 + Date.Length; } - return length; - } - } - - public QueryRepliesBlock() { } - public QueryRepliesBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - length = (ushort)bytes[i++]; - _date = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryReplies --"); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Date, "Date"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("EventID: {0}", EventID)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("EventFlags: {0}", EventFlags)); - output.Append(String.Format("UnixTime: {0}", UnixTime)); - return output.ToString(); - } - } - /// [XmlType("direventsreply_querydata")] public class QueryDataBlock @@ -5094,7 +4663,187 @@ namespace libsecondlife.Packets } /// - [XmlType("direventsreply_agentdata")] + [XmlType("direventsreply_queryreplies")] + public class QueryRepliesBlock + { + public LLUUID OwnerID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + public uint EventID; + 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]; Buffer.BlockCopy(value, 0, _date, 0, value.Length); } + } + } + public uint UnixTime; + public uint EventFlags; + + [XmlIgnore] + public int Length + { + get + { + int length = 28; + if (Name != null) { length += 1 + Name.Length; } + if (Date != null) { length += 1 + Date.Length; } + return length; + } + } + + public QueryRepliesBlock() { } + public QueryRepliesBlock(byte[] bytes, ref int i) + { + int length; + try + { + OwnerID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _date = new byte[length]; + Buffer.BlockCopy(bytes, i, _date, 0, length); i += length; + UnixTime = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + EventFlags = (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) + { + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.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(Date == null) { Console.WriteLine("Warning: Date is null, in " + this.GetType()); } + bytes[i++] = (byte)Date.Length; + Buffer.BlockCopy(Date, 0, bytes, i, Date.Length); i += Date.Length; + bytes[i++] = (byte)(UnixTime % 256); + bytes[i++] = (byte)((UnixTime >> 8) % 256); + bytes[i++] = (byte)((UnixTime >> 16) % 256); + bytes[i++] = (byte)((UnixTime >> 24) % 256); + bytes[i++] = (byte)(EventFlags % 256); + bytes[i++] = (byte)((EventFlags >> 8) % 256); + bytes[i++] = (byte)((EventFlags >> 16) % 256); + bytes[i++] = (byte)((EventFlags >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- QueryReplies --"); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("EventID: {0}", EventID)); + Helpers.FieldToString(output, Date, "Date"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("UnixTime: {0}", UnixTime)); + output.Append(String.Format("EventFlags: {0}", EventFlags)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirEventsReply; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + public QueryRepliesBlock[] QueryReplies; + + public DirEventsReplyPacket() + { + Header = new LowHeader(); + Header.ID = 37; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + QueryReplies = new QueryRepliesBlock[0]; + } + + public DirEventsReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public DirEventsReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += QueryData.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); + AgentData.ToBytes(bytes, ref i); + QueryData.ToBytes(bytes, ref i); + bytes[i++] = (byte)QueryReplies.Length; + for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- DirEventsReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + for (int j = 0; j < QueryReplies.Length; j++) + { + output += QueryReplies[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class DirGroupsReplyPacket : Packet + { + /// + [XmlType("dirgroupsreply_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -5135,160 +4884,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirEventsReply; } } - public QueryRepliesBlock[] QueryReplies; - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirEventsReplyPacket() - { - Header = new LowHeader(); - Header.ID = 49; - Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirEventsReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirEventsReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)QueryReplies.Length; - for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirEventsReply ---" + Environment.NewLine; - for (int j = 0; j < QueryReplies.Length; j++) - { - output += QueryReplies[j].ToString() + Environment.NewLine; - } - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirGroupsReplyPacket : Packet - { - /// - [XmlType("dirgroupsreply_queryreplies")] - public class QueryRepliesBlock - { - public int Members; - public LLUUID GroupID; - public float SearchOrder; - 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]; Buffer.BlockCopy(value, 0, _groupname, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 24; - 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; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - SearchOrder = BitConverter.ToSingle(bytes, i); i += 4; - length = (ushort)bytes[i++]; - _groupname = new byte[length]; - Buffer.BlockCopy(bytes, i, _groupname, 0, length); i += length; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - bytes[i++] = (byte)(Members % 256); - bytes[i++] = (byte)((Members >> 8) % 256); - bytes[i++] = (byte)((Members >> 16) % 256); - bytes[i++] = (byte)((Members >> 24) % 256); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(SearchOrder); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); } - bytes[i++] = (byte)GroupName.Length; - Buffer.BlockCopy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryReplies --"); - output.AppendLine(String.Format("Members: {0}", Members)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SearchOrder: {0}", SearchOrder)); - Helpers.FieldToString(output, GroupName, "GroupName"); - return output.ToString(); - } - } - /// [XmlType("dirgroupsreply_querydata")] public class QueryDataBlock @@ -5332,26 +4927,48 @@ namespace libsecondlife.Packets } /// - [XmlType("dirgroupsreply_agentdata")] - public class AgentDataBlock + [XmlType("dirgroupsreply_queryreplies")] + public class QueryRepliesBlock { - public LLUUID AgentID; + public LLUUID GroupID; + 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]; Buffer.BlockCopy(value, 0, _groupname, 0, value.Length); } + } + } + public int Members; + public float SearchOrder; [XmlIgnore] public int Length { get { - return 16; + int length = 24; + if (GroupName != null) { length += 1 + GroupName.Length; } + return length; } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public QueryRepliesBlock() { } + public QueryRepliesBlock(byte[] bytes, ref int i) { + int length; try { - AgentID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _groupname = new byte[length]; + Buffer.BlockCopy(bytes, i, _groupname, 0, length); i += length; + Members = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + SearchOrder = BitConverter.ToSingle(bytes, i); i += 4; } catch (Exception) { @@ -5361,14 +4978,29 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + byte[] ba; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); } + bytes[i++] = (byte)GroupName.Length; + Buffer.BlockCopy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length; + bytes[i++] = (byte)(Members % 256); + bytes[i++] = (byte)((Members >> 8) % 256); + bytes[i++] = (byte)((Members >> 16) % 256); + bytes[i++] = (byte)((Members >> 24) % 256); + ba = BitConverter.GetBytes(SearchOrder); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); + output.AppendLine("-- QueryReplies --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + Helpers.FieldToString(output, GroupName, "GroupName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Members: {0}", Members)); + output.Append(String.Format("SearchOrder: {0}", SearchOrder)); return output.ToString(); } } @@ -5376,58 +5008,57 @@ namespace libsecondlife.Packets 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 QueryDataBlock QueryData; + public QueryRepliesBlock[] QueryReplies; public DirGroupsReplyPacket() { Header = new LowHeader(); - Header.ID = 50; + Header.ID = 38; Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock(); AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + QueryReplies = new QueryRepliesBlock[0]; } public DirGroupsReplyPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += QueryData.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); + AgentData.ToBytes(bytes, ref i); + QueryData.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; } @@ -5435,12 +5066,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- DirGroupsReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; for (int j = 0; j < QueryReplies.Length; j++) { output += QueryReplies[j].ToString() + Environment.NewLine; } - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -5449,90 +5080,6 @@ namespace libsecondlife.Packets /// public class DirClassifiedQueryPacket : Packet { - /// - [XmlType("dirclassifiedquery_querydata")] - public class QueryDataBlock - { - public LLUUID QueryID; - public uint Category; - public uint QueryFlags; - public int QueryStart; - private byte[] _querytext; - public byte[] QueryText - { - get { return _querytext; } - set - { - if (value == null) { _querytext = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _querytext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 28; - if (QueryText != null) { length += 1 + QueryText.Length; } - return length; - } - } - - public QueryDataBlock() { } - public QueryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - QueryID = new LLUUID(bytes, i); i += 16; - Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _querytext = new byte[length]; - Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)(Category % 256); - bytes[i++] = (byte)((Category >> 8) % 256); - bytes[i++] = (byte)((Category >> 16) % 256); - bytes[i++] = (byte)((Category >> 24) % 256); - bytes[i++] = (byte)(QueryFlags % 256); - bytes[i++] = (byte)((QueryFlags >> 8) % 256); - bytes[i++] = (byte)((QueryFlags >> 16) % 256); - bytes[i++] = (byte)((QueryFlags >> 24) % 256); - bytes[i++] = (byte)(QueryStart % 256); - bytes[i++] = (byte)((QueryStart >> 8) % 256); - bytes[i++] = (byte)((QueryStart >> 16) % 256); - bytes[i++] = (byte)((QueryStart >> 24) % 256); - if(QueryText == null) { Console.WriteLine("Warning: QueryText is null, in " + this.GetType()); } - bytes[i++] = (byte)QueryText.Length; - Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryData --"); - output.AppendLine(String.Format("QueryID: {0}", QueryID)); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); - output.AppendLine(String.Format("QueryStart: {0}", QueryStart)); - Helpers.FieldToString(output, QueryText, "QueryText"); - return output.ToString(); - } - } - /// [XmlType("dirclassifiedquery_agentdata")] public class AgentDataBlock @@ -5579,110 +5126,50 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirClassifiedQuery; } } - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirClassifiedQueryPacket() - { - Header = new LowHeader(); - Header.ID = 51; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirClassifiedQueryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirClassifiedQueryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirClassifiedQuery ---" + Environment.NewLine; - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirClassifiedReplyPacket : Packet - { /// - [XmlType("dirclassifiedreply_queryreplies")] - public class QueryRepliesBlock + [XmlType("dirclassifiedquery_querydata")] + public class QueryDataBlock { - public byte ClassifiedFlags; - public uint CreationDate; - public LLUUID ClassifiedID; - private byte[] _name; - public byte[] Name + public LLUUID QueryID; + private byte[] _querytext; + public byte[] QueryText { - get { return _name; } + get { return _querytext; } set { - if (value == null) { _name = null; return; } + if (value == null) { _querytext = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + else { _querytext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } } } - public int PriceForListing; - public uint ExpirationDate; + public uint QueryFlags; + public uint Category; + public int QueryStart; [XmlIgnore] public int Length { get { - int length = 29; - if (Name != null) { length += 1 + Name.Length; } + int length = 28; + if (QueryText != null) { length += 1 + QueryText.Length; } return length; } } - public QueryRepliesBlock() { } - public QueryRepliesBlock(byte[] bytes, ref int i) + public QueryDataBlock() { } + public QueryDataBlock(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; + QueryID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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)); + _querytext = new byte[length]; + Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; + QueryFlags = (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)); + QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -5692,36 +5179,133 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + Buffer.BlockCopy(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; + Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; + 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)(Category % 256); + bytes[i++] = (byte)((Category >> 8) % 256); + bytes[i++] = (byte)((Category >> 16) % 256); + bytes[i++] = (byte)((Category >> 24) % 256); + bytes[i++] = (byte)(QueryStart % 256); + bytes[i++] = (byte)((QueryStart >> 8) % 256); + bytes[i++] = (byte)((QueryStart >> 16) % 256); + bytes[i++] = (byte)((QueryStart >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryReplies --"); - output.AppendLine(String.Format("ClassifiedFlags: {0}", ClassifiedFlags)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("ClassifiedID: {0}", ClassifiedID)); - Helpers.FieldToString(output, Name, "Name"); + output.AppendLine("-- QueryData --"); + output.AppendLine(String.Format("QueryID: {0}", QueryID)); + Helpers.FieldToString(output, QueryText, "QueryText"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("PriceForListing: {0}", PriceForListing)); - output.Append(String.Format("ExpirationDate: {0}", ExpirationDate)); + output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); + output.AppendLine(String.Format("Category: {0}", Category)); + output.Append(String.Format("QueryStart: {0}", QueryStart)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirClassifiedQuery; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + + public DirClassifiedQueryPacket() + { + Header = new LowHeader(); + Header.ID = 39; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + } + + public DirClassifiedQueryPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public DirClassifiedQueryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- DirClassifiedQuery ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class DirClassifiedReplyPacket : Packet + { + /// + [XmlType("dirclassifiedreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.Append(String.Format("AgentID: {0}", AgentID)); return output.ToString(); } } @@ -5769,17 +5353,182 @@ namespace libsecondlife.Packets } /// - [XmlType("dirclassifiedreply_agentdata")] - public class AgentDataBlock + [XmlType("dirclassifiedreply_queryreplies")] + public class QueryRepliesBlock { - public LLUUID AgentID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + public byte ClassifiedFlags; + public uint CreationDate; + public uint ExpirationDate; + public int PriceForListing; [XmlIgnore] public int Length { get { - return 16; + int length = 29; + if (Name != null) { length += 1 + Name.Length; } + return length; + } + } + + public QueryRepliesBlock() { } + public QueryRepliesBlock(byte[] bytes, ref int i) + { + int length; + try + { + ClassifiedID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + ClassifiedFlags = (byte)bytes[i++]; + CreationDate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ExpirationDate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PriceForListing = (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) + { + Buffer.BlockCopy(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; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + 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); + 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)(PriceForListing % 256); + bytes[i++] = (byte)((PriceForListing >> 8) % 256); + bytes[i++] = (byte)((PriceForListing >> 16) % 256); + bytes[i++] = (byte)((PriceForListing >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- QueryReplies --"); + output.AppendLine(String.Format("ClassifiedID: {0}", ClassifiedID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ClassifiedFlags: {0}", ClassifiedFlags)); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.AppendLine(String.Format("ExpirationDate: {0}", ExpirationDate)); + output.Append(String.Format("PriceForListing: {0}", PriceForListing)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirClassifiedReply; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + public QueryRepliesBlock[] QueryReplies; + + public DirClassifiedReplyPacket() + { + Header = new LowHeader(); + Header.ID = 41; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + QueryReplies = new QueryRepliesBlock[0]; + } + + public DirClassifiedReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public DirClassifiedReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += QueryData.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); + AgentData.ToBytes(bytes, ref i); + QueryData.ToBytes(bytes, ref i); + bytes[i++] = (byte)QueryReplies.Length; + for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- DirClassifiedReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + for (int j = 0; j < QueryReplies.Length; j++) + { + output += QueryReplies[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class AvatarClassifiedReplyPacket : Packet + { + /// + [XmlType("avatarclassifiedreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID TargetID; + + [XmlIgnore] + public int Length + { + get + { + return 32; } } @@ -5789,6 +5538,7 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; + TargetID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -5799,93 +5549,19 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("TargetID: {0}", TargetID)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirClassifiedReply; } } - public QueryRepliesBlock[] QueryReplies; - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirClassifiedReplyPacket() - { - Header = new LowHeader(); - Header.ID = 53; - Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirClassifiedReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirClassifiedReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)QueryReplies.Length; - for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirClassifiedReply ---" + Environment.NewLine; - for (int j = 0; j < QueryReplies.Length; j++) - { - output += QueryReplies[j].ToString() + Environment.NewLine; - } - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AvatarClassifiedReplyPacket : Packet - { /// [XmlType("avatarclassifiedreply_data")] public class DataBlock @@ -5949,91 +5625,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("avatarclassifiedreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID TargetID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - TargetID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("TargetID: {0}", TargetID)); - return output.ToString(); - } - } - 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 DataBlock[] Data; public AvatarClassifiedReplyPacket() { Header = new LowHeader(); - Header.ID = 54; + Header.ID = 42; Header.Reliable = true; - Data = new DataBlock[0]; AgentData = new AgentDataBlock(); + Data = new DataBlock[0]; } public AvatarClassifiedReplyPacket(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++]; 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; + AgentData = new AgentDataBlock(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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } @@ -6041,9 +5671,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -6051,11 +5681,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarClassifiedReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < Data.Length; j++) { output += Data[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -6064,48 +5694,6 @@ namespace libsecondlife.Packets /// public class ClassifiedInfoRequestPacket : Packet { - /// - [XmlType("classifiedinforequest_data")] - public class DataBlock - { - public LLUUID ClassifiedID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - ClassifiedID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.Append(String.Format("ClassifiedID: {0}", ClassifiedID)); - return output.ToString(); - } - } - /// [XmlType("classifiedinforequest_agentdata")] public class AgentDataBlock @@ -6152,167 +5740,27 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ClassifiedInfoRequest; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ClassifiedInfoRequestPacket() - { - Header = new LowHeader(); - Header.ID = 55; - Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ClassifiedInfoRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ClassifiedInfoRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ClassifiedInfoRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ClassifiedInfoReplyPacket : Packet - { /// - [XmlType("classifiedinforeply_data")] + [XmlType("classifiedinforequest_data")] public class DataBlock { - public byte ClassifiedFlags; - public uint CreationDate; - private byte[] _simname; - public byte[] SimName - { - get { return _simname; } - set - { - if (value == null) { _simname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - private byte[] _desc; - public byte[] Desc - { - get { return _desc; } - set - { - if (value == null) { _desc = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, 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]; Buffer.BlockCopy(value, 0, _parcelname, 0, value.Length); } - } - } - public uint Category; - public LLUUID CreatorID; - public LLUUID SnapshotID; - public int PriceForListing; - public uint ExpirationDate; - public uint ParentEstate; [XmlIgnore] public int Length { get { - int length = 109; - if (SimName != null) { length += 1 + SimName.Length; } - if (Name != null) { length += 1 + Name.Length; } - if (Desc != null) { length += 2 + Desc.Length; } - if (ParcelName != null) { length += 1 + ParcelName.Length; } - return length; + return 16; } } 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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _desc = new byte[length]; - Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; - length = (ushort)bytes[i++]; - _parcelname = new byte[length]; - Buffer.BlockCopy(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) { @@ -6322,74 +5770,75 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; Buffer.BlockCopy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("ClassifiedFlags: {0}", ClassifiedFlags)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ClassifiedID: {0}", ClassifiedID)); - output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); - output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Desc, "Desc"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, ParcelName, "ParcelName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.AppendLine(String.Format("PriceForListing: {0}", PriceForListing)); - output.AppendLine(String.Format("ExpirationDate: {0}", ExpirationDate)); - output.Append(String.Format("ParentEstate: {0}", ParentEstate)); + output.Append(String.Format("ClassifiedID: {0}", ClassifiedID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ClassifiedInfoRequest; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ClassifiedInfoRequestPacket() + { + Header = new LowHeader(); + Header.ID = 43; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ClassifiedInfoRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ClassifiedInfoRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ClassifiedInfoRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ClassifiedInfoReplyPacket : Packet + { /// [XmlType("classifiedinforeply_agentdata")] public class AgentDataBlock @@ -6432,71 +5881,15 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ClassifiedInfoReply; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ClassifiedInfoReplyPacket() - { - Header = new LowHeader(); - Header.ID = 56; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ClassifiedInfoReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ClassifiedInfoReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ClassifiedInfoReply ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ClassifiedInfoUpdatePacket : Packet - { /// - [XmlType("classifiedinfoupdate_data")] + [XmlType("classifiedinforeply_data")] public class DataBlock { - public byte ClassifiedFlags; public LLUUID ClassifiedID; - public LLVector3d PosGlobal; - public LLUUID ParcelID; + public LLUUID CreatorID; + public uint CreationDate; + public uint ExpirationDate; + public uint Category; private byte[] _name; public byte[] Name { @@ -6519,19 +5912,45 @@ namespace libsecondlife.Packets else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } } } - public uint Category; - public LLUUID SnapshotID; - public int PriceForListing; + public LLUUID ParcelID; public uint ParentEstate; + public LLUUID SnapshotID; + 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public LLVector3d PosGlobal; + 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]; Buffer.BlockCopy(value, 0, _parcelname, 0, value.Length); } + } + } + public byte ClassifiedFlags; + public int PriceForListing; [XmlIgnore] public int Length { get { - int length = 85; + int length = 109; if (Name != null) { length += 1 + Name.Length; } if (Desc != null) { length += 2 + Desc.Length; } + if (SimName != null) { length += 1 + SimName.Length; } + if (ParcelName != null) { length += 1 + ParcelName.Length; } return length; } } @@ -6542,20 +5961,29 @@ namespace libsecondlife.Packets 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; + CreatorID = new LLUUID(bytes, i); i += 16; + CreationDate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ExpirationDate = (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)); length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _desc = new byte[length]; Buffer.BlockCopy(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)); + ParcelID = new LLUUID(bytes, i); i += 16; ParentEstate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SnapshotID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + PosGlobal = new LLVector3d(bytes, i); i += 24; + length = (ushort)bytes[i++]; + _parcelname = new byte[length]; + Buffer.BlockCopy(bytes, i, _parcelname, 0, length); i += length; + ClassifiedFlags = (byte)bytes[i++]; + PriceForListing = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -6565,10 +5993,20 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = ClassifiedFlags; Buffer.BlockCopy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; - Buffer.BlockCopy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(ExpirationDate % 256); + bytes[i++] = (byte)((ExpirationDate >> 8) % 256); + bytes[i++] = (byte)((ExpirationDate >> 16) % 256); + bytes[i++] = (byte)((ExpirationDate >> 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(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } bytes[i++] = (byte)Name.Length; Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; @@ -6576,41 +6014,110 @@ namespace libsecondlife.Packets bytes[i++] = (byte)(Desc.Length % 256); bytes[i++] = (byte)((Desc.Length >> 8) % 256); Buffer.BlockCopy(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); - Buffer.BlockCopy(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); + Buffer.BlockCopy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(ParentEstate % 256); bytes[i++] = (byte)((ParentEstate >> 8) % 256); bytes[i++] = (byte)((ParentEstate >> 16) % 256); bytes[i++] = (byte)((ParentEstate >> 24) % 256); + Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } + bytes[i++] = (byte)SimName.Length; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; + Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; + if(ParcelName == null) { Console.WriteLine("Warning: ParcelName is null, in " + this.GetType()); } + bytes[i++] = (byte)ParcelName.Length; + Buffer.BlockCopy(ParcelName, 0, bytes, i, ParcelName.Length); i += ParcelName.Length; + bytes[i++] = ClassifiedFlags; + bytes[i++] = (byte)(PriceForListing % 256); + bytes[i++] = (byte)((PriceForListing >> 8) % 256); + bytes[i++] = (byte)((PriceForListing >> 16) % 256); + bytes[i++] = (byte)((PriceForListing >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("ClassifiedFlags: {0}", ClassifiedFlags)); output.AppendLine(String.Format("ClassifiedID: {0}", ClassifiedID)); - output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); - output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.AppendLine(String.Format("ExpirationDate: {0}", ExpirationDate)); + output.AppendLine(String.Format("Category: {0}", Category)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); Helpers.FieldToString(output, Desc, "Desc"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("Category: {0}", Category)); + output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); + output.AppendLine(String.Format("ParentEstate: {0}", ParentEstate)); output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.AppendLine(String.Format("PriceForListing: {0}", PriceForListing)); - output.Append(String.Format("ParentEstate: {0}", ParentEstate)); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); + Helpers.FieldToString(output, ParcelName, "ParcelName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ClassifiedFlags: {0}", ClassifiedFlags)); + output.Append(String.Format("PriceForListing: {0}", PriceForListing)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ClassifiedInfoReply; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ClassifiedInfoReplyPacket() + { + Header = new LowHeader(); + Header.ID = 44; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ClassifiedInfoReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ClassifiedInfoReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ClassifiedInfoReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ClassifiedInfoUpdatePacket : Packet + { /// [XmlType("classifiedinfoupdate_agentdata")] public class AgentDataBlock @@ -6657,84 +6164,73 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ClassifiedInfoUpdate; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ClassifiedInfoUpdatePacket() - { - Header = new LowHeader(); - Header.ID = 57; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ClassifiedInfoUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ClassifiedInfoUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ClassifiedInfoUpdate ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ClassifiedDeletePacket : Packet - { /// - [XmlType("classifieddelete_data")] + [XmlType("classifiedinfoupdate_data")] public class DataBlock { public LLUUID ClassifiedID; + public uint Category; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + private byte[] _desc; + public byte[] Desc + { + get { return _desc; } + set + { + if (value == null) { _desc = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } + } + } + public LLUUID ParcelID; + public uint ParentEstate; + public LLUUID SnapshotID; + public LLVector3d PosGlobal; + public byte ClassifiedFlags; + public int PriceForListing; [XmlIgnore] public int Length { get { - return 16; + 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 { ClassifiedID = new LLUUID(bytes, i); i += 16; + Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _desc = new byte[length]; + Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; + ParcelID = new LLUUID(bytes, i); i += 16; + ParentEstate = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SnapshotID = new LLUUID(bytes, i); i += 16; + PosGlobal = new LLVector3d(bytes, i); i += 24; + ClassifiedFlags = (byte)bytes[i++]; + PriceForListing = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -6745,17 +6241,108 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(ClassifiedID.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); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(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); + Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; + Buffer.BlockCopy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(ParentEstate % 256); + bytes[i++] = (byte)((ParentEstate >> 8) % 256); + bytes[i++] = (byte)((ParentEstate >> 16) % 256); + bytes[i++] = (byte)((ParentEstate >> 24) % 256); + Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; + bytes[i++] = ClassifiedFlags; + bytes[i++] = (byte)(PriceForListing % 256); + bytes[i++] = (byte)((PriceForListing >> 8) % 256); + bytes[i++] = (byte)((PriceForListing >> 16) % 256); + bytes[i++] = (byte)((PriceForListing >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.Append(String.Format("ClassifiedID: {0}", ClassifiedID)); + output.AppendLine(String.Format("ClassifiedID: {0}", ClassifiedID)); + output.AppendLine(String.Format("Category: {0}", Category)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Desc, "Desc"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); + output.AppendLine(String.Format("ParentEstate: {0}", ParentEstate)); + output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); + output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); + output.AppendLine(String.Format("ClassifiedFlags: {0}", ClassifiedFlags)); + output.Append(String.Format("PriceForListing: {0}", PriceForListing)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ClassifiedInfoUpdate; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ClassifiedInfoUpdatePacket() + { + Header = new LowHeader(); + Header.ID = 45; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ClassifiedInfoUpdatePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ClassifiedInfoUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ClassifiedInfoUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ClassifiedDeletePacket : Packet + { /// [XmlType("classifieddelete_agentdata")] public class AgentDataBlock @@ -6802,76 +6389,18 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ClassifiedDelete; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ClassifiedDeletePacket() - { - Header = new LowHeader(); - Header.ID = 58; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ClassifiedDeletePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ClassifiedDeletePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ClassifiedDelete ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ClassifiedGodDeletePacket : Packet - { /// - [XmlType("classifiedgoddelete_data")] + [XmlType("classifieddelete_data")] public class DataBlock { public LLUUID ClassifiedID; - public LLUUID QueryID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } @@ -6881,7 +6410,6 @@ namespace libsecondlife.Packets try { ClassifiedID = new LLUUID(bytes, i); i += 16; - QueryID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -6892,19 +6420,74 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("ClassifiedID: {0}", ClassifiedID)); - output.Append(String.Format("QueryID: {0}", QueryID)); + output.Append(String.Format("ClassifiedID: {0}", ClassifiedID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ClassifiedDelete; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ClassifiedDeletePacket() + { + Header = new LowHeader(); + Header.ID = 46; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ClassifiedDeletePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ClassifiedDeletePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ClassifiedDelete ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ClassifiedGodDeletePacket : Packet + { /// [XmlType("classifiedgoddelete_agentdata")] public class AgentDataBlock @@ -6951,118 +6534,12 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ClassifiedGodDelete; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ClassifiedGodDeletePacket() - { - Header = new LowHeader(); - Header.ID = 59; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ClassifiedGodDeletePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ClassifiedGodDeletePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ClassifiedGodDelete ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirPicksQueryPacket : Packet - { /// - [XmlType("dirpicksquery_querydata")] - public class QueryDataBlock + [XmlType("classifiedgoddelete_data")] + public class DataBlock { + public LLUUID ClassifiedID; public LLUUID QueryID; - public uint QueryFlags; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public QueryDataBlock() { } - public QueryDataBlock(byte[] bytes, ref int i) - { - try - { - QueryID = new LLUUID(bytes, i); i += 16; - QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryData --"); - output.AppendLine(String.Format("QueryID: {0}", QueryID)); - output.Append(String.Format("QueryFlags: {0}", QueryFlags)); - return output.ToString(); - } - } - - /// - [XmlType("dirpicksquery_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; [XmlIgnore] public int Length @@ -7073,182 +6550,12 @@ namespace libsecondlife.Packets } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirPicksQuery; } } - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirPicksQueryPacket() - { - Header = new LowHeader(); - Header.ID = 60; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirPicksQueryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirPicksQueryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirPicksQuery ---" + Environment.NewLine; - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirPicksReplyPacket : Packet - { - /// - [XmlType("dirpicksreply_queryreplies")] - public class QueryRepliesBlock - { - public bool Enabled; - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - public LLUUID PickID; - - [XmlIgnore] - public int Length - { - get - { - int length = 17; - if (Name != null) { length += 1 + Name.Length; } - return length; - } - } - - public QueryRepliesBlock() { } - public QueryRepliesBlock(byte[] bytes, ref int i) - { - int length; - try - { - Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false; - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryReplies --"); - output.AppendLine(String.Format("Enabled: {0}", Enabled)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.Append(String.Format("PickID: {0}", PickID)); - return output.ToString(); - } - } - - /// - [XmlType("dirpicksreply_querydata")] - public class QueryDataBlock - { - public LLUUID QueryID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public QueryDataBlock() { } - public QueryDataBlock(byte[] bytes, ref int i) + 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) @@ -7259,128 +6566,69 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(ClassifiedID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryData --"); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("ClassifiedID: {0}", ClassifiedID)); output.Append(String.Format("QueryID: {0}", QueryID)); return output.ToString(); } } - /// - [XmlType("dirpicksreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - 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 override PacketType Type { get { return PacketType.ClassifiedGodDelete; } } public AgentDataBlock AgentData; + public DataBlock Data; - public DirPicksReplyPacket() + public ClassifiedGodDeletePacket() { Header = new LowHeader(); - Header.ID = 62; + Header.ID = 47; Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } - public DirPicksReplyPacket(byte[] bytes, ref int i) + public ClassifiedGodDeletePacket(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); + Data = new DataBlock(bytes, ref i); } - public DirPicksReplyPacket(Header head, byte[] bytes, ref int i) + public ClassifiedGodDeletePacket(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); + Data = new DataBlock(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; } + int length = 10; + length += AgentData.Length; 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); - 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); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } public override string ToString() { - string output = "--- DirPicksReply ---" + Environment.NewLine; - for (int j = 0; j < QueryReplies.Length; j++) - { - output += QueryReplies[j].ToString() + Environment.NewLine; - } - output += QueryData.ToString() + Environment.NewLine; + string output = "--- ClassifiedGodDelete ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -7389,83 +6637,6 @@ namespace libsecondlife.Packets /// public class DirLandQueryPacket : Packet { - /// - [XmlType("dirlandquery_querydata")] - public class QueryDataBlock - { - public uint SearchType; - public int Area; - public LLUUID QueryID; - public uint QueryFlags; - public int Price; - public int QueryStart; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public QueryDataBlock() { } - public QueryDataBlock(byte[] bytes, ref int i) - { - try - { - SearchType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Area = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - QueryID = new LLUUID(bytes, i); i += 16; - QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Price = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(SearchType % 256); - bytes[i++] = (byte)((SearchType >> 8) % 256); - bytes[i++] = (byte)((SearchType >> 16) % 256); - bytes[i++] = (byte)((SearchType >> 24) % 256); - bytes[i++] = (byte)(Area % 256); - bytes[i++] = (byte)((Area >> 8) % 256); - bytes[i++] = (byte)((Area >> 16) % 256); - bytes[i++] = (byte)((Area >> 24) % 256); - Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)(QueryFlags % 256); - bytes[i++] = (byte)((QueryFlags >> 8) % 256); - bytes[i++] = (byte)((QueryFlags >> 16) % 256); - bytes[i++] = (byte)((QueryFlags >> 24) % 256); - bytes[i++] = (byte)(Price % 256); - bytes[i++] = (byte)((Price >> 8) % 256); - bytes[i++] = (byte)((Price >> 16) % 256); - bytes[i++] = (byte)((Price >> 24) % 256); - bytes[i++] = (byte)(QueryStart % 256); - bytes[i++] = (byte)((QueryStart >> 8) % 256); - bytes[i++] = (byte)((QueryStart >> 16) % 256); - bytes[i++] = (byte)((QueryStart >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryData --"); - output.AppendLine(String.Format("SearchType: {0}", SearchType)); - output.AppendLine(String.Format("Area: {0}", Area)); - output.AppendLine(String.Format("QueryID: {0}", QueryID)); - output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); - output.AppendLine(String.Format("Price: {0}", Price)); - output.Append(String.Format("QueryStart: {0}", QueryStart)); - return output.ToString(); - } - } - /// [XmlType("dirlandquery_agentdata")] public class AgentDataBlock @@ -7512,110 +6683,37 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirLandQuery; } } - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirLandQueryPacket() - { - Header = new LowHeader(); - Header.ID = 63; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirLandQueryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirLandQueryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirLandQuery ---" + Environment.NewLine; - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirLandReplyPacket : Packet - { /// - [XmlType("dirlandreply_queryreplies")] - public class QueryRepliesBlock + [XmlType("dirlandquery_querydata")] + public class QueryDataBlock { - 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - public bool Auction; - public int SalePrice; + public LLUUID QueryID; + public uint QueryFlags; + public uint SearchType; + public int Price; + public int Area; + public int QueryStart; [XmlIgnore] public int Length { get { - int length = 26; - if (Name != null) { length += 1 + Name.Length; } - return length; + return 36; } } - public QueryRepliesBlock() { } - public QueryRepliesBlock(byte[] bytes, ref int i) + public QueryDataBlock() { } + public QueryDataBlock(byte[] bytes, ref int i) { - int length; try { - 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]; - Buffer.BlockCopy(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)); + QueryID = new LLUUID(bytes, i); i += 16; + QueryFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SearchType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Price = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Area = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + QueryStart = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -7625,33 +6723,138 @@ namespace libsecondlife.Packets 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); - bytes[i++] = (byte)((ForSale) ? 1 : 0); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + Buffer.BlockCopy(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)(SearchType % 256); + bytes[i++] = (byte)((SearchType >> 8) % 256); + bytes[i++] = (byte)((SearchType >> 16) % 256); + bytes[i++] = (byte)((SearchType >> 24) % 256); + bytes[i++] = (byte)(Price % 256); + bytes[i++] = (byte)((Price >> 8) % 256); + bytes[i++] = (byte)((Price >> 16) % 256); + bytes[i++] = (byte)((Price >> 24) % 256); + bytes[i++] = (byte)(Area % 256); + bytes[i++] = (byte)((Area >> 8) % 256); + bytes[i++] = (byte)((Area >> 16) % 256); + bytes[i++] = (byte)((Area >> 24) % 256); + bytes[i++] = (byte)(QueryStart % 256); + bytes[i++] = (byte)((QueryStart >> 8) % 256); + bytes[i++] = (byte)((QueryStart >> 16) % 256); + bytes[i++] = (byte)((QueryStart >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryReplies --"); - output.AppendLine(String.Format("ActualArea: {0}", ActualArea)); - output.AppendLine(String.Format("ForSale: {0}", ForSale)); - output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Auction: {0}", Auction)); - output.Append(String.Format("SalePrice: {0}", SalePrice)); + output.AppendLine("-- QueryData --"); + output.AppendLine(String.Format("QueryID: {0}", QueryID)); + output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); + output.AppendLine(String.Format("SearchType: {0}", SearchType)); + output.AppendLine(String.Format("Price: {0}", Price)); + output.AppendLine(String.Format("Area: {0}", Area)); + output.Append(String.Format("QueryStart: {0}", QueryStart)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirLandQuery; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + + public DirLandQueryPacket() + { + Header = new LowHeader(); + Header.ID = 48; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + } + + public DirLandQueryPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public DirLandQueryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- DirLandQuery ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class DirLandReplyPacket : Packet + { + /// + [XmlType("dirlandreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.Append(String.Format("AgentID: {0}", AgentID)); return output.ToString(); } } @@ -7699,17 +6902,179 @@ namespace libsecondlife.Packets } /// - [XmlType("dirlandreply_agentdata")] - public class AgentDataBlock + [XmlType("dirlandreply_queryreplies")] + public class QueryRepliesBlock { - public LLUUID AgentID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + public bool Auction; + public bool ForSale; + public int SalePrice; + public int ActualArea; [XmlIgnore] public int Length { get { - return 16; + int length = 26; + 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]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + Auction = (bytes[i++] != 0) ? (bool)true : (bool)false; + ForSale = (bytes[i++] != 0) ? (bool)true : (bool)false; + SalePrice = (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)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(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; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + bytes[i++] = (byte)((Auction) ? 1 : 0); + bytes[i++] = (byte)((ForSale) ? 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); + bytes[i++] = (byte)(ActualArea % 256); + bytes[i++] = (byte)((ActualArea >> 8) % 256); + bytes[i++] = (byte)((ActualArea >> 16) % 256); + bytes[i++] = (byte)((ActualArea >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- QueryReplies --"); + output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Auction: {0}", Auction)); + output.AppendLine(String.Format("ForSale: {0}", ForSale)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + output.Append(String.Format("ActualArea: {0}", ActualArea)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirLandReply; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + public QueryRepliesBlock[] QueryReplies; + + public DirLandReplyPacket() + { + Header = new LowHeader(); + Header.ID = 50; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + QueryReplies = new QueryRepliesBlock[0]; + } + + public DirLandReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public DirLandReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + QueryReplies = new QueryRepliesBlock[count]; + for (int j = 0; j < count; j++) + { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += QueryData.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); + AgentData.ToBytes(bytes, ref i); + QueryData.ToBytes(bytes, ref i); + bytes[i++] = (byte)QueryReplies.Length; + for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- DirLandReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + for (int j = 0; j < QueryReplies.Length; j++) + { + output += QueryReplies[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class DirPopularQueryPacket : Packet + { + /// + [XmlType("dirpopularquery_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; } } @@ -7719,6 +7084,7 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -7729,93 +7095,19 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.DirLandReply; } } - public QueryRepliesBlock[] QueryReplies; - public QueryDataBlock QueryData; - public AgentDataBlock AgentData; - - public DirLandReplyPacket() - { - Header = new LowHeader(); - Header.ID = 65; - Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public DirLandReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirLandReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - QueryReplies = new QueryRepliesBlock[count]; - for (int j = 0; j < count; j++) - { QueryReplies[j] = new QueryRepliesBlock(bytes, ref i); } - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < QueryReplies.Length; j++) { length += QueryReplies[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)QueryReplies.Length; - for (int j = 0; j < QueryReplies.Length; j++) { QueryReplies[j].ToBytes(bytes, ref i); } - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirLandReply ---" + Environment.NewLine; - for (int j = 0; j < QueryReplies.Length; j++) - { - output += QueryReplies[j].ToString() + Environment.NewLine; - } - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirPopularQueryPacket : Packet - { /// [XmlType("dirpopularquery_querydata")] public class QueryDataBlock @@ -7865,19 +7157,75 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.DirPopularQuery; } } + public AgentDataBlock AgentData; + public QueryDataBlock QueryData; + + public DirPopularQueryPacket() + { + Header = new LowHeader(); + Header.ID = 51; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + } + + public DirPopularQueryPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public DirPopularQueryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- DirPopularQuery ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class DirPopularReplyPacket : Packet + { /// - [XmlType("dirpopularquery_agentdata")] + [XmlType("dirpopularreply_agentdata")] public class AgentDataBlock { public LLUUID AgentID; - public LLUUID SessionID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } @@ -7887,7 +7235,6 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -7898,77 +7245,59 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("AgentID: {0}", AgentID)); return output.ToString(); } } - 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() + /// + [XmlType("dirpopularreply_querydata")] + public class QueryDataBlock { - Header = new LowHeader(); - Header.ID = 66; - Header.Reliable = true; - Header.Zerocoded = true; - QueryData = new QueryDataBlock(); - AgentData = new AgentDataBlock(); + public LLUUID QueryID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public QueryDataBlock() { } + public QueryDataBlock(byte[] bytes, ref int i) + { + try + { + QueryID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- QueryData --"); + output.Append(String.Format("QueryID: {0}", QueryID)); + return output.ToString(); + } } - public DirPopularQueryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public DirPopularQueryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - QueryData = new QueryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += QueryData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - QueryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DirPopularQuery ---" + Environment.NewLine; - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DirPopularReplyPacket : Packet - { /// [XmlType("dirpopularreply_queryreplies")] public class QueryRepliesBlock @@ -8041,145 +7370,60 @@ namespace libsecondlife.Packets } } - /// - [XmlType("dirpopularreply_querydata")] - public class QueryDataBlock - { - public LLUUID QueryID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public QueryDataBlock() { } - public QueryDataBlock(byte[] bytes, ref int i) - { - try - { - QueryID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- QueryData --"); - output.Append(String.Format("QueryID: {0}", QueryID)); - return output.ToString(); - } - } - - /// - [XmlType("dirpopularreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - 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 QueryDataBlock QueryData; + public QueryRepliesBlock[] QueryReplies; public DirPopularReplyPacket() { Header = new LowHeader(); - Header.ID = 68; + Header.ID = 53; Header.Reliable = true; - Header.Zerocoded = true; - QueryReplies = new QueryRepliesBlock[0]; - QueryData = new QueryDataBlock(); AgentData = new AgentDataBlock(); + QueryData = new QueryDataBlock(); + QueryReplies = new QueryRepliesBlock[0]; } public DirPopularReplyPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + QueryData = new QueryDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += QueryData.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); + AgentData.ToBytes(bytes, ref i); + QueryData.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; } @@ -8187,12 +7431,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- DirPopularReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += QueryData.ToString() + Environment.NewLine; for (int j = 0; j < QueryReplies.Length; j++) { output += QueryReplies[j].ToString() + Environment.NewLine; } - output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -8201,48 +7445,6 @@ namespace libsecondlife.Packets /// public class ParcelInfoRequestPacket : Packet { - /// - [XmlType("parcelinforequest_data")] - public class DataBlock - { - public LLUUID ParcelID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - ParcelID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.Append(String.Format("ParcelID: {0}", ParcelID)); - return output.ToString(); - } - } - /// [XmlType("parcelinforequest_agentdata")] public class AgentDataBlock @@ -8289,157 +7491,27 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelInfoRequest; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelInfoRequestPacket() - { - Header = new LowHeader(); - Header.ID = 69; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelInfoRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelInfoRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelInfoRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelInfoReplyPacket : Packet - { /// - [XmlType("parcelinforeply_data")] + [XmlType("parcelinforequest_data")] public class DataBlock { - private byte[] _simname; - public byte[] SimName - { - get { return _simname; } - set - { - if (value == null) { _simname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } - } - } - public int SalePrice; - public LLUUID OwnerID; - public LLUUID SnapshotID; - public byte Flags; - public int AuctionID; - public float Dwell; [XmlIgnore] public int Length { get { - int length = 81; - if (SimName != null) { length += 1 + SimName.Length; } - if (Name != null) { length += 1 + Name.Length; } - if (Desc != null) { length += 1 + Desc.Length; } - return length; + return 16; } } public DataBlock() { } public DataBlock(byte[] bytes, ref int i) { - int length; try { - length = (ushort)bytes[i++]; - _simname = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - length = (ushort)bytes[i++]; - _desc = new byte[length]; - Buffer.BlockCopy(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) { @@ -8449,76 +7521,75 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(GlobalY); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(GlobalZ); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("BillableArea: {0}", BillableArea)); - output.AppendLine(String.Format("ActualArea: {0}", ActualArea)); - output.AppendLine(String.Format("GlobalX: {0}", GlobalX)); - output.AppendLine(String.Format("GlobalY: {0}", GlobalY)); - output.AppendLine(String.Format("GlobalZ: {0}", GlobalZ)); - output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Desc, "Desc"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("AuctionID: {0}", AuctionID)); - output.Append(String.Format("Dwell: {0}", Dwell)); + output.Append(String.Format("ParcelID: {0}", ParcelID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelInfoRequest; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ParcelInfoRequestPacket() + { + Header = new LowHeader(); + Header.ID = 54; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ParcelInfoRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ParcelInfoRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelInfoRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelInfoReplyPacket : Packet + { /// [XmlType("parcelinforeply_agentdata")] public class AgentDataBlock @@ -8561,85 +7632,100 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelInfoReply; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelInfoReplyPacket() - { - Header = new LowHeader(); - Header.ID = 70; - Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelInfoReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelInfoReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelInfoReply ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelObjectOwnersRequestPacket : Packet - { /// - [XmlType("parcelobjectownersrequest_parceldata")] - public class ParcelDataBlock + [XmlType("parcelinforeply_data")] + public class DataBlock { - public int LocalID; + public LLUUID ParcelID; + public LLUUID OwnerID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } + } + } + public int ActualArea; + public int BillableArea; + public byte Flags; + public float GlobalX; + public float GlobalY; + public float GlobalZ; + 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public LLUUID SnapshotID; + public float Dwell; + public int SalePrice; + public int AuctionID; [XmlIgnore] public int Length { get { - return 4; + int length = 81; + if (Name != null) { length += 1 + Name.Length; } + if (Desc != null) { length += 1 + Desc.Length; } + if (SimName != null) { length += 1 + SimName.Length; } + return length; } } - public ParcelDataBlock() { } - public ParcelDataBlock(byte[] bytes, ref int i) + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) { + int length; try { - LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ParcelID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _desc = new byte[length]; + Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; + ActualArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + BillableArea = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Flags = (byte)bytes[i++]; + 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++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + SnapshotID = new LLUUID(bytes, i); i += 16; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Dwell = BitConverter.ToSingle(bytes, i); i += 4; + SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + AuctionID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -8649,21 +7735,133 @@ namespace libsecondlife.Packets 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); + byte[] ba; + Buffer.BlockCopy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; + 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)(BillableArea % 256); + bytes[i++] = (byte)((BillableArea >> 8) % 256); + bytes[i++] = (byte)((BillableArea >> 16) % 256); + bytes[i++] = (byte)((BillableArea >> 24) % 256); + bytes[i++] = Flags; + ba = BitConverter.GetBytes(GlobalX); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(GlobalY); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(GlobalZ); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } + bytes[i++] = (byte)SimName.Length; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; + Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + ba = BitConverter.GetBytes(Dwell); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + 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)(AuctionID % 256); + bytes[i++] = (byte)((AuctionID >> 8) % 256); + bytes[i++] = (byte)((AuctionID >> 16) % 256); + bytes[i++] = (byte)((AuctionID >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- ParcelData --"); - output.Append(String.Format("LocalID: {0}", LocalID)); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Desc, "Desc"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ActualArea: {0}", ActualArea)); + output.AppendLine(String.Format("BillableArea: {0}", BillableArea)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("GlobalX: {0}", GlobalX)); + output.AppendLine(String.Format("GlobalY: {0}", GlobalY)); + output.AppendLine(String.Format("GlobalZ: {0}", GlobalZ)); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); + output.AppendLine(String.Format("Dwell: {0}", Dwell)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + output.Append(String.Format("AuctionID: {0}", AuctionID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelInfoReply; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ParcelInfoReplyPacket() + { + Header = new LowHeader(); + Header.ID = 55; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ParcelInfoReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ParcelInfoReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelInfoReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelObjectOwnersRequestPacket : Packet + { /// [XmlType("parcelobjectownersrequest_agentdata")] public class AgentDataBlock @@ -8710,46 +7908,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("parcelobjectownersrequest_parceldata")] + public class ParcelDataBlock + { + public int LocalID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public ParcelDataBlock() { } + public ParcelDataBlock(byte[] bytes, ref int i) + { + try + { + LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(LocalID % 256); + bytes[i++] = (byte)((LocalID >> 8) % 256); + bytes[i++] = (byte)((LocalID >> 16) % 256); + bytes[i++] = (byte)((LocalID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ParcelData --"); + output.Append(String.Format("LocalID: {0}", LocalID)); + return output.ToString(); + } + } + 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 ParcelDataBlock ParcelData; public ParcelObjectOwnersRequestPacket() { Header = new LowHeader(); - Header.ID = 71; + Header.ID = 56; Header.Reliable = true; - ParcelData = new ParcelDataBlock(); AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); } 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); + ParcelData = new ParcelDataBlock(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); + ParcelData = new ParcelDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + ParcelData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -8757,8 +8000,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelObjectOwnersRequest ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; return output; } @@ -8771,10 +8014,10 @@ namespace libsecondlife.Packets [XmlType("parcelobjectownersreply_data")] public class DataBlock { - public bool OnlineStatus; - public bool IsGroupOwned; public LLUUID OwnerID; + public bool IsGroupOwned; public int Count; + public bool OnlineStatus; [XmlIgnore] public int Length @@ -8790,10 +8033,10 @@ namespace libsecondlife.Packets { try { - OnlineStatus = (bytes[i++] != 0) ? (bool)true : (bool)false; - IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; OwnerID = new LLUUID(bytes, i); i += 16; + IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; Count = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + OnlineStatus = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -8803,23 +8046,23 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((OnlineStatus) ? 1 : 0); - bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0); Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0); bytes[i++] = (byte)(Count % 256); bytes[i++] = (byte)((Count >> 8) % 256); bytes[i++] = (byte)((Count >> 16) % 256); bytes[i++] = (byte)((Count >> 24) % 256); + bytes[i++] = (byte)((OnlineStatus) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("OnlineStatus: {0}", OnlineStatus)); - output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.Append(String.Format("Count: {0}", Count)); + output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); + output.AppendLine(String.Format("Count: {0}", Count)); + output.Append(String.Format("OnlineStatus: {0}", OnlineStatus)); return output.ToString(); } } @@ -8832,9 +8075,8 @@ namespace libsecondlife.Packets public ParcelObjectOwnersReplyPacket() { Header = new LowHeader(); - Header.ID = 74; + Header.ID = 57; Header.Reliable = true; - Header.Zerocoded = true; Data = new DataBlock[0]; } @@ -8859,7 +8101,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } @@ -8888,48 +8130,6 @@ namespace libsecondlife.Packets /// public class GroupNoticesListRequestPacket : Packet { - /// - [XmlType("groupnoticeslistrequest_data")] - public class DataBlock - { - public LLUUID GroupID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - GroupID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - /// [XmlType("groupnoticeslistrequest_agentdata")] public class AgentDataBlock @@ -8976,122 +8176,27 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.GroupNoticesListRequest; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public GroupNoticesListRequestPacket() - { - Header = new LowHeader(); - Header.ID = 75; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public GroupNoticesListRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GroupNoticesListRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupNoticesListRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupNoticesListReplyPacket : Packet - { /// - [XmlType("groupnoticeslistreply_data")] + [XmlType("groupnoticeslistrequest_data")] public class DataBlock { - public uint Timestamp; - private byte[] _subject; - public byte[] Subject - { - get { return _subject; } - set - { - if (value == null) { _subject = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _subject = new byte[value.Length]; Buffer.BlockCopy(value, 0, _subject, 0, 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 > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _fromname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _fromname, 0, value.Length); } - } - } - public byte AssetType; + public LLUUID GroupID; [XmlIgnore] public int Length { get { - int length = 22; - if (Subject != null) { length += 2 + Subject.Length; } - if (FromName != null) { length += 2 + FromName.Length; } - return length; + return 16; } } 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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _fromname, 0, length); i += length; - AssetType = (byte)bytes[i++]; + GroupID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -9101,39 +8206,75 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(Subject, 0, bytes, i, Subject.Length); i += Subject.Length; - bytes[i++] = (byte)((HasAttachment) ? 1 : 0); - Buffer.BlockCopy(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); - Buffer.BlockCopy(FromName, 0, bytes, i, FromName.Length); i += FromName.Length; - bytes[i++] = AssetType; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("Timestamp: {0}", Timestamp)); - Helpers.FieldToString(output, Subject, "Subject"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("HasAttachment: {0}", HasAttachment)); - output.AppendLine(String.Format("NoticeID: {0}", NoticeID)); - Helpers.FieldToString(output, FromName, "FromName"); - output.Append(Environment.NewLine); - output.Append(String.Format("AssetType: {0}", AssetType)); + output.Append(String.Format("GroupID: {0}", GroupID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GroupNoticesListRequest; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public GroupNoticesListRequestPacket() + { + Header = new LowHeader(); + Header.ID = 58; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public GroupNoticesListRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public GroupNoticesListRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- GroupNoticesListRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class GroupNoticesListReplyPacket : Packet + { /// [XmlType("groupnoticeslistreply_agentdata")] public class AgentDataBlock @@ -9180,96 +8321,65 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.GroupNoticesListReply; } } - public DataBlock[] Data; - public AgentDataBlock AgentData; - - public GroupNoticesListReplyPacket() - { - Header = new LowHeader(); - Header.ID = 76; - Header.Reliable = true; - Data = new DataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public GroupNoticesListReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GroupNoticesListReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)Data.Length; - for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupNoticesListReply ---" + Environment.NewLine; - for (int j = 0; j < Data.Length; j++) - { - output += Data[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupNoticeRequestPacket : Packet - { /// - [XmlType("groupnoticerequest_data")] + [XmlType("groupnoticeslistreply_data")] public class DataBlock { - public LLUUID GroupNoticeID; + public LLUUID NoticeID; + public uint Timestamp; + private byte[] _fromname; + public byte[] FromName + { + get { return _fromname; } + set + { + if (value == null) { _fromname = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _fromname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _fromname, 0, value.Length); } + } + } + private byte[] _subject; + public byte[] Subject + { + get { return _subject; } + set + { + if (value == null) { _subject = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _subject = new byte[value.Length]; Buffer.BlockCopy(value, 0, _subject, 0, value.Length); } + } + } + public bool HasAttachment; + public byte AssetType; [XmlIgnore] public int Length { get { - return 16; + int length = 22; + if (FromName != null) { length += 2 + FromName.Length; } + if (Subject != null) { length += 2 + Subject.Length; } + return length; } } public DataBlock() { } public DataBlock(byte[] bytes, ref int i) { + int length; try { - GroupNoticeID = new LLUUID(bytes, i); i += 16; + NoticeID = new LLUUID(bytes, i); i += 16; + Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _fromname = new byte[length]; + Buffer.BlockCopy(bytes, i, _fromname, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _subject = new byte[length]; + Buffer.BlockCopy(bytes, i, _subject, 0, length); i += length; + HasAttachment = (bytes[i++] != 0) ? (bool)true : (bool)false; + AssetType = (byte)bytes[i++]; } catch (Exception) { @@ -9279,18 +8389,108 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(GroupNoticeID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(NoticeID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(Timestamp % 256); + bytes[i++] = (byte)((Timestamp >> 8) % 256); + bytes[i++] = (byte)((Timestamp >> 16) % 256); + bytes[i++] = (byte)((Timestamp >> 24) % 256); + 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); + Buffer.BlockCopy(FromName, 0, bytes, i, FromName.Length); i += FromName.Length; + 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); + Buffer.BlockCopy(Subject, 0, bytes, i, Subject.Length); i += Subject.Length; + bytes[i++] = (byte)((HasAttachment) ? 1 : 0); + bytes[i++] = AssetType; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.Append(String.Format("GroupNoticeID: {0}", GroupNoticeID)); + output.AppendLine(String.Format("NoticeID: {0}", NoticeID)); + output.AppendLine(String.Format("Timestamp: {0}", Timestamp)); + Helpers.FieldToString(output, FromName, "FromName"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Subject, "Subject"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("HasAttachment: {0}", HasAttachment)); + output.Append(String.Format("AssetType: {0}", AssetType)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GroupNoticesListReply; } } + public AgentDataBlock AgentData; + public DataBlock[] Data; + + public GroupNoticesListReplyPacket() + { + Header = new LowHeader(); + Header.ID = 59; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock[0]; + } + + public GroupNoticesListReplyPacket(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++]; + Data = new DataBlock[count]; + for (int j = 0; j < count; j++) + { Data[j] = new DataBlock(bytes, ref i); } + } + + public GroupNoticesListReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(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); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.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 = "--- GroupNoticesListReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < Data.Length; j++) + { + output += Data[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class GroupNoticeRequestPacket : Packet + { /// [XmlType("groupnoticerequest_agentdata")] public class AgentDataBlock @@ -9337,76 +8537,18 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.GroupNoticeRequest; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public GroupNoticeRequestPacket() - { - Header = new LowHeader(); - Header.ID = 77; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public GroupNoticeRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GroupNoticeRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupNoticeRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupNoticeDeletePacket : Packet - { /// - [XmlType("groupnoticedelete_data")] + [XmlType("groupnoticerequest_data")] public class DataBlock { public LLUUID GroupNoticeID; - public LLUUID GroupID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } @@ -9416,7 +8558,6 @@ namespace libsecondlife.Packets try { GroupNoticeID = new LLUUID(bytes, i); i += 16; - GroupID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -9427,114 +8568,66 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(GroupNoticeID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("GroupNoticeID: {0}", GroupNoticeID)); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - - /// - [XmlType("groupnoticedelete_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("GroupNoticeID: {0}", GroupNoticeID)); return output.ToString(); } } 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 override PacketType Type { get { return PacketType.GroupNoticeRequest; } } public AgentDataBlock AgentData; + public DataBlock Data; - public GroupNoticeDeletePacket() + public GroupNoticeRequestPacket() { Header = new LowHeader(); - Header.ID = 79; + Header.ID = 60; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } - public GroupNoticeDeletePacket(byte[] bytes, ref int i) + 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); + Data = new DataBlock(bytes, ref i); } - public GroupNoticeDeletePacket(Header head, byte[] bytes, ref int i) + public GroupNoticeRequestPacket(Header head, byte[] bytes, ref int i) { Header = head; - Data = new DataBlock(bytes, ref i); AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.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 = "--- GroupNoticeDelete ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; + string output = "--- GroupNoticeRequest ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -9543,56 +8636,6 @@ namespace libsecondlife.Packets /// public class TeleportRequestPacket : Packet { - /// - [XmlType("teleportrequest_info")] - public class InfoBlock - { - public LLUUID RegionID; - public LLVector3 LookAt; - public LLVector3 Position; - - [XmlIgnore] - public int Length - { - get - { - return 40; - } - } - - public InfoBlock() { } - public InfoBlock(byte[] bytes, ref int i) - { - try - { - RegionID = new LLUUID(bytes, i); i += 16; - LookAt = new LLVector3(bytes, i); i += 12; - Position = new LLVector3(bytes, i); i += 12; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Info --"); - output.AppendLine(String.Format("RegionID: {0}", RegionID)); - output.AppendLine(String.Format("LookAt: {0}", LookAt)); - output.Append(String.Format("Position: {0}", Position)); - return output.ToString(); - } - } - /// [XmlType("teleportrequest_agentdata")] public class AgentDataBlock @@ -9639,77 +8682,20 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.TeleportRequest; } } - public InfoBlock Info; - public AgentDataBlock AgentData; - - public TeleportRequestPacket() - { - Header = new LowHeader(); - Header.ID = 80; - Header.Reliable = true; - Info = new InfoBlock(); - AgentData = new AgentDataBlock(); - } - - public TeleportRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Info = new InfoBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public TeleportRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Info = new InfoBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Info.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Info.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- TeleportRequest ---" + Environment.NewLine; - output += Info.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class TeleportLocationRequestPacket : Packet - { /// - [XmlType("teleportlocationrequest_info")] + [XmlType("teleportrequest_info")] public class InfoBlock { - public ulong RegionHandle; - public LLVector3 LookAt; + public LLUUID RegionID; public LLVector3 Position; + public LLVector3 LookAt; [XmlIgnore] public int Length { get { - return 32; + return 40; } } @@ -9718,9 +8704,9 @@ namespace libsecondlife.Packets { 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; + RegionID = new LLUUID(bytes, i); i += 16; Position = new LLVector3(bytes, i); i += 12; + LookAt = new LLVector3(bytes, i); i += 12; } catch (Exception) { @@ -9730,29 +8716,79 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Info --"); - output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.AppendLine(String.Format("LookAt: {0}", LookAt)); - output.Append(String.Format("Position: {0}", Position)); + output.AppendLine(String.Format("RegionID: {0}", RegionID)); + output.AppendLine(String.Format("Position: {0}", Position)); + output.Append(String.Format("LookAt: {0}", LookAt)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.TeleportRequest; } } + public AgentDataBlock AgentData; + public InfoBlock Info; + + public TeleportRequestPacket() + { + Header = new LowHeader(); + Header.ID = 62; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Info = new InfoBlock(); + } + + public TeleportRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Info = new InfoBlock(bytes, ref i); + } + + public TeleportRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Info = new InfoBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- TeleportRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Info.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class TeleportLocationRequestPacket : Packet + { /// [XmlType("teleportlocationrequest_agentdata")] public class AgentDataBlock @@ -9799,46 +8835,103 @@ namespace libsecondlife.Packets } } + /// + [XmlType("teleportlocationrequest_info")] + public class InfoBlock + { + public ulong RegionHandle; + public LLVector3 Position; + public LLVector3 LookAt; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public InfoBlock() { } + public InfoBlock(byte[] bytes, ref int i) + { + try + { + RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); + Position = new LLVector3(bytes, i); i += 12; + LookAt = 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); + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Info --"); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.AppendLine(String.Format("Position: {0}", Position)); + output.Append(String.Format("LookAt: {0}", LookAt)); + return output.ToString(); + } + } + 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 InfoBlock Info; public TeleportLocationRequestPacket() { Header = new LowHeader(); - Header.ID = 81; + Header.ID = 63; Header.Reliable = true; - Info = new InfoBlock(); AgentData = new AgentDataBlock(); + Info = new InfoBlock(); } 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); + Info = new InfoBlock(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); + Info = new InfoBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Info.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Info.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -9846,8 +8939,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- TeleportLocationRequest ---" + Environment.NewLine; - output += Info.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Info.ToString() + Environment.NewLine; return output; } @@ -9862,9 +8955,9 @@ namespace libsecondlife.Packets { public LLUUID AgentID; public uint LocationID; + public LLVector3 Position; public LLVector3 LookAt; public uint TeleportFlags; - public LLVector3 Position; [XmlIgnore] public int Length @@ -9882,9 +8975,9 @@ namespace libsecondlife.Packets { AgentID = new LLUUID(bytes, i); i += 16; LocationID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Position = new LLVector3(bytes, i); i += 12; 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) { @@ -9899,12 +8992,12 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((LocationID >> 8) % 256); bytes[i++] = (byte)((LocationID >> 16) % 256); bytes[i++] = (byte)((LocationID >> 24) % 256); + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; Buffer.BlockCopy(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); - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() @@ -9913,9 +9006,9 @@ namespace libsecondlife.Packets output.AppendLine("-- Info --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("LocationID: {0}", LocationID)); + output.AppendLine(String.Format("Position: {0}", Position)); output.AppendLine(String.Format("LookAt: {0}", LookAt)); - output.AppendLine(String.Format("TeleportFlags: {0}", TeleportFlags)); - output.Append(String.Format("Position: {0}", Position)); + output.Append(String.Format("TeleportFlags: {0}", TeleportFlags)); return output.ToString(); } } @@ -9928,7 +9021,7 @@ namespace libsecondlife.Packets public TeleportLocalPacket() { Header = new LowHeader(); - Header.ID = 82; + Header.ID = 64; Header.Reliable = true; Info = new InfoBlock(); } @@ -9948,7 +9041,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -10029,9 +9122,8 @@ namespace libsecondlife.Packets public TeleportLandmarkRequestPacket() { Header = new LowHeader(); - Header.ID = 83; + Header.ID = 65; Header.Reliable = true; - Header.Zerocoded = true; Info = new InfoBlock(); } @@ -10050,7 +9142,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -10073,73 +9165,6 @@ namespace libsecondlife.Packets /// public class TeleportProgressPacket : Packet { - /// - [XmlType("teleportprogress_info")] - public class InfoBlock - { - private byte[] _message; - public byte[] Message - { - get { return _message; } - set - { - if (value == null) { _message = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } - } - } - public uint TeleportFlags; - - [XmlIgnore] - public int Length - { - get - { - int length = 4; - if (Message != null) { length += 1 + Message.Length; } - return length; - } - } - - public InfoBlock() { } - public InfoBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _message = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Info --"); - Helpers.FieldToString(output, Message, "Message"); - output.Append(Environment.NewLine); - output.Append(String.Format("TeleportFlags: {0}", TeleportFlags)); - return output.ToString(); - } - } - /// [XmlType("teleportprogress_agentdata")] public class AgentDataBlock @@ -10182,46 +9207,112 @@ namespace libsecondlife.Packets } } + /// + [XmlType("teleportprogress_info")] + public class InfoBlock + { + public uint TeleportFlags; + 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]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 4; + if (Message != null) { length += 1 + Message.Length; } + return length; + } + } + + public InfoBlock() { } + public InfoBlock(byte[] bytes, ref int i) + { + int length; + try + { + TeleportFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + } + 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); + if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); } + bytes[i++] = (byte)Message.Length; + Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Info --"); + output.AppendLine(String.Format("TeleportFlags: {0}", TeleportFlags)); + Helpers.FieldToString(output, Message, "Message"); + return output.ToString(); + } + } + 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 InfoBlock Info; public TeleportProgressPacket() { Header = new LowHeader(); - Header.ID = 84; + Header.ID = 66; Header.Reliable = true; - Info = new InfoBlock(); AgentData = new AgentDataBlock(); + Info = new InfoBlock(); } 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); + Info = new InfoBlock(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); + Info = new InfoBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Info.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Info.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -10229,8 +9320,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- TeleportProgress ---" + Environment.NewLine; - output += Info.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Info.ToString() + Environment.NewLine; return output; } @@ -10243,6 +9334,11 @@ namespace libsecondlife.Packets [XmlType("teleportfinish_info")] public class InfoBlock { + public LLUUID AgentID; + public uint LocationID; + public uint SimIP; + public ushort SimPort; + public ulong RegionHandle; private byte[] _seedcapability; public byte[] SeedCapability { @@ -10254,12 +9350,7 @@ namespace libsecondlife.Packets else { _seedcapability = new byte[value.Length]; Buffer.BlockCopy(value, 0, _seedcapability, 0, value.Length); } } } - public LLUUID AgentID; - public ushort SimPort; - public ulong RegionHandle; - public uint LocationID; public byte SimAccess; - public uint SimIP; public uint TeleportFlags; [XmlIgnore] @@ -10279,15 +9370,15 @@ namespace libsecondlife.Packets int length; try { + AgentID = new LLUUID(bytes, i); i += 16; + LocationID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SimIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _seedcapability = new byte[length]; Buffer.BlockCopy(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) @@ -10298,11 +9389,15 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(SeedCapability, 0, bytes, i, SeedCapability.Length); i += SeedCapability.Length; Buffer.BlockCopy(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); + 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)((SimPort >> 8) % 256); bytes[i++] = (byte)(SimPort % 256); bytes[i++] = (byte)(RegionHandle % 256); @@ -10313,15 +9408,11 @@ namespace libsecondlife.Packets 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(SeedCapability == null) { Console.WriteLine("Warning: SeedCapability is null, in " + this.GetType()); } + bytes[i++] = (byte)(SeedCapability.Length % 256); + bytes[i++] = (byte)((SeedCapability.Length >> 8) % 256); + Buffer.BlockCopy(SeedCapability, 0, bytes, i, SeedCapability.Length); i += SeedCapability.Length; 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); @@ -10332,14 +9423,14 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- Info --"); - Helpers.FieldToString(output, SeedCapability, "SeedCapability"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("LocationID: {0}", LocationID)); + output.AppendLine(String.Format("SimIP: {0}", SimIP)); output.AppendLine(String.Format("SimPort: {0}", SimPort)); output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.AppendLine(String.Format("LocationID: {0}", LocationID)); + Helpers.FieldToString(output, SeedCapability, "SeedCapability"); + output.Append(Environment.NewLine); output.AppendLine(String.Format("SimAccess: {0}", SimAccess)); - output.AppendLine(String.Format("SimIP: {0}", SimIP)); output.Append(String.Format("TeleportFlags: {0}", TeleportFlags)); return output.ToString(); } @@ -10353,7 +9444,7 @@ namespace libsecondlife.Packets public TeleportFinishPacket() { Header = new LowHeader(); - Header.ID = 89; + Header.ID = 69; Header.Reliable = true; Info = new InfoBlock(); } @@ -10373,7 +9464,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -10396,112 +9487,6 @@ namespace libsecondlife.Packets /// public class StartLurePacket : Packet { - /// - [XmlType("startlure_info")] - public class InfoBlock - { - private byte[] _message; - public byte[] Message - { - get { return _message; } - set - { - if (value == null) { _message = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } - } - } - public byte LureType; - - [XmlIgnore] - public int Length - { - get - { - int length = 1; - if (Message != null) { length += 1 + Message.Length; } - return length; - } - } - - public InfoBlock() { } - public InfoBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _message = new byte[length]; - Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; - LureType = (byte)bytes[i++]; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); } - bytes[i++] = (byte)Message.Length; - Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; - bytes[i++] = LureType; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Info --"); - Helpers.FieldToString(output, Message, "Message"); - output.Append(Environment.NewLine); - output.Append(String.Format("LureType: {0}", LureType)); - return output.ToString(); - } - } - - /// - [XmlType("startlure_targetdata")] - public class TargetDataBlock - { - public LLUUID TargetID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TargetDataBlock() { } - public TargetDataBlock(byte[] bytes, ref int i) - { - try - { - TargetID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TargetData --"); - output.Append(String.Format("TargetID: {0}", TargetID)); - return output.ToString(); - } - } - /// [XmlType("startlure_agentdata")] public class AgentDataBlock @@ -10548,60 +9533,165 @@ namespace libsecondlife.Packets } } + /// + [XmlType("startlure_info")] + public class InfoBlock + { + public byte LureType; + 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]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 1; + if (Message != null) { length += 1 + Message.Length; } + return length; + } + } + + public InfoBlock() { } + public InfoBlock(byte[] bytes, ref int i) + { + int length; + try + { + LureType = (byte)bytes[i++]; + length = (ushort)bytes[i++]; + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = LureType; + if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); } + bytes[i++] = (byte)Message.Length; + Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Info --"); + output.AppendLine(String.Format("LureType: {0}", LureType)); + Helpers.FieldToString(output, Message, "Message"); + return output.ToString(); + } + } + + /// + [XmlType("startlure_targetdata")] + public class TargetDataBlock + { + public LLUUID TargetID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public TargetDataBlock() { } + public TargetDataBlock(byte[] bytes, ref int i) + { + try + { + TargetID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TargetData --"); + output.Append(String.Format("TargetID: {0}", TargetID)); + return output.ToString(); + } + } + private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.StartLure; } } + public AgentDataBlock AgentData; public InfoBlock Info; public TargetDataBlock[] TargetData; - public AgentDataBlock AgentData; public StartLurePacket() { Header = new LowHeader(); - Header.ID = 90; + Header.ID = 70; Header.Reliable = true; + AgentData = new AgentDataBlock(); Info = new InfoBlock(); TargetData = new TargetDataBlock[0]; - AgentData = new AgentDataBlock(); } public StartLurePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); Info = new InfoBlock(bytes, ref i); int count = (int)bytes[i++]; TargetData = new TargetDataBlock[count]; for (int j = 0; j < count; j++) { TargetData[j] = new TargetDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); } public StartLurePacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); Info = new InfoBlock(bytes, ref i); int count = (int)bytes[i++]; TargetData = new TargetDataBlock[count]; for (int j = 0; j < count; j++) { TargetData[j] = new TargetDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Info.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += Info.Length;; length++; for (int j = 0; j < TargetData.Length; j++) { length += TargetData[j].Length; } if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.ToBytes(bytes, ref i); Info.ToBytes(bytes, ref i); bytes[i++] = (byte)TargetData.Length; for (int j = 0; j < TargetData.Length; j++) { TargetData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -10609,12 +9699,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- StartLure ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; output += Info.ToString() + Environment.NewLine; for (int j = 0; j < TargetData.Length; j++) { output += TargetData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -10688,7 +9778,7 @@ namespace libsecondlife.Packets public TeleportLureRequestPacket() { Header = new LowHeader(); - Header.ID = 91; + Header.ID = 71; Header.Reliable = true; Info = new InfoBlock(); } @@ -10708,7 +9798,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -10785,7 +9875,7 @@ namespace libsecondlife.Packets public TeleportCancelPacket() { Header = new LowHeader(); - Header.ID = 92; + Header.ID = 72; Header.Reliable = true; Info = new InfoBlock(); } @@ -10805,7 +9895,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -10881,7 +9971,7 @@ namespace libsecondlife.Packets public TeleportStartPacket() { Header = new LowHeader(); - Header.ID = 94; + Header.ID = 73; Header.Reliable = true; Info = new InfoBlock(); } @@ -10901,7 +9991,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -10995,7 +10085,7 @@ namespace libsecondlife.Packets public TeleportFailedPacket() { Header = new LowHeader(); - Header.ID = 95; + Header.ID = 74; Header.Reliable = true; Info = new InfoBlock(); } @@ -11015,7 +10105,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Info.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -11035,423 +10125,9 @@ namespace libsecondlife.Packets } - /// - public class LeaderBoardRequestPacket : Packet - { - /// - [XmlType("leaderboardrequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - public int Type; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("Type: {0}", Type)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.LeaderBoardRequest; } } - public AgentDataBlock AgentData; - - public LeaderBoardRequestPacket() - { - Header = new LowHeader(); - Header.ID = 96; - Header.Reliable = true; - AgentData = new AgentDataBlock(); - } - - public LeaderBoardRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public LeaderBoardRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- LeaderBoardRequest ---" + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class LeaderBoardDataPacket : Packet - { - /// - [XmlType("leaderboarddata_boarddata")] - public class BoardDataBlock - { - private byte[] _timestring; - public byte[] TimeString - { - get { return _timestring; } - set - { - if (value == null) { _timestring = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _timestring = new byte[value.Length]; Buffer.BlockCopy(value, 0, _timestring, 0, value.Length); } - } - } - public int MaxPlace; - public int MinPlace; - public int Type; - - [XmlIgnore] - public int Length - { - get - { - int length = 12; - if (TimeString != null) { length += 1 + TimeString.Length; } - return length; - } - } - - public BoardDataBlock() { } - public BoardDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _timestring = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- BoardData --"); - Helpers.FieldToString(output, TimeString, "TimeString"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("MaxPlace: {0}", MaxPlace)); - output.AppendLine(String.Format("MinPlace: {0}", MinPlace)); - output.Append(String.Format("Type: {0}", Type)); - return output.ToString(); - } - } - - /// - [XmlType("leaderboarddata_entry")] - public class EntryBlock - { - public LLUUID ID; - public byte[] Name; - public int Sequence; - public int Place; - public int Score; - - [XmlIgnore] - public int Length - { - get - { - return 60; - } - } - - public EntryBlock() { } - public EntryBlock(byte[] bytes, ref int i) - { - try - { - ID = new LLUUID(bytes, i); i += 16; - Name = new byte[32]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Entry --"); - output.AppendLine(String.Format("ID: {0}", ID)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Sequence: {0}", Sequence)); - output.AppendLine(String.Format("Place: {0}", Place)); - output.Append(String.Format("Score: {0}", Score)); - return output.ToString(); - } - } - - /// - [XmlType("leaderboarddata_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.LeaderBoardData; } } - public BoardDataBlock BoardData; - public EntryBlock[] Entry; - public AgentDataBlock AgentData; - - public LeaderBoardDataPacket() - { - Header = new LowHeader(); - Header.ID = 97; - Header.Reliable = true; - Header.Zerocoded = true; - BoardData = new BoardDataBlock(); - Entry = new EntryBlock[0]; - AgentData = new AgentDataBlock(); - } - - public LeaderBoardDataPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - BoardData = new BoardDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - Entry = new EntryBlock[count]; - for (int j = 0; j < count; j++) - { Entry[j] = new EntryBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public LeaderBoardDataPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - BoardData = new BoardDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - Entry = new EntryBlock[count]; - for (int j = 0; j < count; j++) - { Entry[j] = new EntryBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += BoardData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < Entry.Length; j++) { length += Entry[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - BoardData.ToBytes(bytes, ref i); - bytes[i++] = (byte)Entry.Length; - for (int j = 0; j < Entry.Length; j++) { Entry[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- LeaderBoardData ---" + Environment.NewLine; - output += BoardData.ToString() + Environment.NewLine; - for (int j = 0; j < Entry.Length; j++) - { - output += Entry[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - /// public class UndoPacket : Packet { - /// - [XmlType("undo_objectdata")] - public class ObjectDataBlock - { - public LLUUID ObjectID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectID: {0}", ObjectID)); - return output.ToString(); - } - } - /// [XmlType("undo_agentdata")] public class AgentDataBlock @@ -11502,77 +10178,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.Undo; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public UndoPacket() - { - Header = new LowHeader(); - Header.ID = 98; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public UndoPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public UndoPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- Undo ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RedoPacket : Packet - { /// - [XmlType("redo_objectdata")] + [XmlType("undo_objectdata")] public class ObjectDataBlock { public LLUUID ObjectID; @@ -11613,6 +10220,75 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.Undo; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public UndoPacket() + { + Header = new LowHeader(); + Header.ID = 75; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public UndoPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public UndoPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- Undo ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class RedoPacket : Packet + { /// [XmlType("redo_agentdata")] public class AgentDataBlock @@ -11663,45 +10339,87 @@ namespace libsecondlife.Packets } } + /// + [XmlType("redo_objectdata")] + public class ObjectDataBlock + { + public LLUUID ObjectID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.Append(String.Format("ObjectID: {0}", ObjectID)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public RedoPacket() { Header = new LowHeader(); - Header.ID = 99; + Header.ID = 76; Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public RedoPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -11709,9 +10427,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -11719,11 +10437,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- Redo ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -11786,7 +10504,7 @@ namespace libsecondlife.Packets public UndoLandPacket() { Header = new LowHeader(); - Header.ID = 100; + Header.ID = 77; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -11806,7 +10524,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -11826,103 +10544,6 @@ namespace libsecondlife.Packets } - /// - public class RedoLandPacket : Packet - { - /// - [XmlType("redoland_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.RedoLand; } } - public AgentDataBlock AgentData; - - public RedoLandPacket() - { - Header = new LowHeader(); - Header.ID = 101; - Header.Reliable = true; - AgentData = new AgentDataBlock(); - } - - public RedoLandPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RedoLandPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RedoLand ---" + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - /// public class AgentPausePacket : Packet { @@ -11930,9 +10551,9 @@ namespace libsecondlife.Packets [XmlType("agentpause_agentdata")] public class AgentDataBlock { - public uint SerialNum; public LLUUID AgentID; public LLUUID SessionID; + public uint SerialNum; [XmlIgnore] public int Length @@ -11948,9 +10569,9 @@ namespace libsecondlife.Packets { 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; + SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -11960,21 +10581,21 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(SerialNum % 256); bytes[i++] = (byte)((SerialNum >> 8) % 256); bytes[i++] = (byte)((SerialNum >> 16) % 256); bytes[i++] = (byte)((SerialNum >> 24) % 256); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("SerialNum: {0}", SerialNum)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("SerialNum: {0}", SerialNum)); return output.ToString(); } } @@ -11987,7 +10608,7 @@ namespace libsecondlife.Packets public AgentPausePacket() { Header = new LowHeader(); - Header.ID = 102; + Header.ID = 78; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -12007,7 +10628,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -12034,9 +10655,9 @@ namespace libsecondlife.Packets [XmlType("agentresume_agentdata")] public class AgentDataBlock { - public uint SerialNum; public LLUUID AgentID; public LLUUID SessionID; + public uint SerialNum; [XmlIgnore] public int Length @@ -12052,9 +10673,9 @@ namespace libsecondlife.Packets { 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; + SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -12064,21 +10685,21 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(SerialNum % 256); bytes[i++] = (byte)((SerialNum >> 8) % 256); bytes[i++] = (byte)((SerialNum >> 16) % 256); bytes[i++] = (byte)((SerialNum >> 24) % 256); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("SerialNum: {0}", SerialNum)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("SerialNum: {0}", SerialNum)); return output.ToString(); } } @@ -12091,7 +10712,7 @@ namespace libsecondlife.Packets public AgentResumePacket() { Header = new LowHeader(); - Header.ID = 103; + Header.ID = 79; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -12111,7 +10732,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -12134,78 +10755,6 @@ namespace libsecondlife.Packets /// public class ChatFromViewerPacket : Packet { - /// - [XmlType("chatfromviewer_chatdata")] - public class ChatDataBlock - { - public int Channel; - private byte[] _message; - public byte[] Message - { - get { return _message; } - set - { - if (value == null) { _message = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } - } - } - public byte Type; - - [XmlIgnore] - public int Length - { - get - { - int length = 5; - if (Message != null) { length += 2 + Message.Length; } - return length; - } - } - - public ChatDataBlock() { } - public ChatDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Channel = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _message = new byte[length]; - Buffer.BlockCopy(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); - Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; - bytes[i++] = Type; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ChatData --"); - output.AppendLine(String.Format("Channel: {0}", Channel)); - Helpers.FieldToString(output, Message, "Message"); - output.Append(Environment.NewLine); - output.Append(String.Format("Type: {0}", Type)); - return output.ToString(); - } - } - /// [XmlType("chatfromviewer_agentdata")] public class AgentDataBlock @@ -12252,47 +10801,118 @@ namespace libsecondlife.Packets } } + /// + [XmlType("chatfromviewer_chatdata")] + public class ChatDataBlock + { + private byte[] _message; + public byte[] Message + { + get { return _message; } + set + { + if (value == null) { _message = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } + public byte Type; + public int Channel; + + [XmlIgnore] + public int Length + { + get + { + int length = 5; + if (Message != null) { length += 2 + Message.Length; } + return length; + } + } + + public ChatDataBlock() { } + public ChatDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + Type = (byte)bytes[i++]; + Channel = (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(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); } + bytes[i++] = (byte)(Message.Length % 256); + bytes[i++] = (byte)((Message.Length >> 8) % 256); + Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; + bytes[i++] = Type; + bytes[i++] = (byte)(Channel % 256); + bytes[i++] = (byte)((Channel >> 8) % 256); + bytes[i++] = (byte)((Channel >> 16) % 256); + bytes[i++] = (byte)((Channel >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ChatData --"); + Helpers.FieldToString(output, Message, "Message"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Type: {0}", Type)); + output.Append(String.Format("Channel: {0}", Channel)); + return output.ToString(); + } + } + 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 ChatDataBlock ChatData; public ChatFromViewerPacket() { Header = new LowHeader(); - Header.ID = 104; + Header.ID = 80; Header.Reliable = true; - Header.Zerocoded = true; - ChatData = new ChatDataBlock(); AgentData = new AgentDataBlock(); + ChatData = new ChatDataBlock(); } 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); + ChatData = new ChatDataBlock(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); + ChatData = new ChatDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ChatData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + ChatData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -12300,8 +10920,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ChatFromViewer ---" + Environment.NewLine; - output += ChatData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ChatData.ToString() + Environment.NewLine; return output; } @@ -12310,6 +10930,59 @@ namespace libsecondlife.Packets /// public class AgentThrottlePacket : Packet { + /// + [XmlType("agentthrottle_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public uint CircuitCode; + + [XmlIgnore] + public int Length + { + get + { + return 36; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("CircuitCode: {0}", CircuitCode)); + return output.ToString(); + } + } + /// [XmlType("agentthrottle_throttle")] public class ThrottleBlock @@ -12376,100 +11049,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("agentthrottle_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - public uint CircuitCode; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("CircuitCode: {0}", CircuitCode)); - return output.ToString(); - } - } - 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 ThrottleBlock Throttle; public AgentThrottlePacket() { Header = new LowHeader(); - Header.ID = 105; + Header.ID = 81; Header.Reliable = true; - Header.Zerocoded = true; - Throttle = new ThrottleBlock(); AgentData = new AgentDataBlock(); + Throttle = new ThrottleBlock(); } 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); + Throttle = new ThrottleBlock(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); + Throttle = new ThrottleBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Throttle.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.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); - Throttle.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + Throttle.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -12477,8 +11096,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentThrottle ---" + Environment.NewLine; - output += Throttle.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Throttle.ToString() + Environment.NewLine; return output; } @@ -12487,59 +11106,6 @@ namespace libsecondlife.Packets /// public class AgentFOVPacket : Packet { - /// - [XmlType("agentfov_fovblock")] - public class FOVBlockBlock - { - public uint GenCounter; - public float VerticalAngle; - - [XmlIgnore] - public int Length - { - get - { - return 8; - } - } - - public FOVBlockBlock() { } - public FOVBlockBlock(byte[] bytes, ref int i) - { - try - { - GenCounter = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - VerticalAngle = BitConverter.ToSingle(bytes, i); i += 4; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - bytes[i++] = (byte)(GenCounter % 256); - bytes[i++] = (byte)((GenCounter >> 8) % 256); - bytes[i++] = (byte)((GenCounter >> 16) % 256); - bytes[i++] = (byte)((GenCounter >> 24) % 256); - ba = BitConverter.GetBytes(VerticalAngle); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- FOVBlock --"); - output.AppendLine(String.Format("GenCounter: {0}", GenCounter)); - output.Append(String.Format("VerticalAngle: {0}", VerticalAngle)); - return output.ToString(); - } - } - /// [XmlType("agentfov_agentdata")] public class AgentDataBlock @@ -12593,46 +11159,99 @@ namespace libsecondlife.Packets } } + /// + [XmlType("agentfov_fovblock")] + public class FOVBlockBlock + { + public uint GenCounter; + public float VerticalAngle; + + [XmlIgnore] + public int Length + { + get + { + return 8; + } + } + + public FOVBlockBlock() { } + public FOVBlockBlock(byte[] bytes, ref int i) + { + try + { + GenCounter = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + VerticalAngle = BitConverter.ToSingle(bytes, i); i += 4; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + bytes[i++] = (byte)(GenCounter % 256); + bytes[i++] = (byte)((GenCounter >> 8) % 256); + bytes[i++] = (byte)((GenCounter >> 16) % 256); + bytes[i++] = (byte)((GenCounter >> 24) % 256); + ba = BitConverter.GetBytes(VerticalAngle); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- FOVBlock --"); + output.AppendLine(String.Format("GenCounter: {0}", GenCounter)); + output.Append(String.Format("VerticalAngle: {0}", VerticalAngle)); + return output.ToString(); + } + } + 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 FOVBlockBlock FOVBlock; public AgentFOVPacket() { Header = new LowHeader(); - Header.ID = 106; + Header.ID = 82; Header.Reliable = true; - FOVBlock = new FOVBlockBlock(); AgentData = new AgentDataBlock(); + FOVBlock = new FOVBlockBlock(); } 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); + FOVBlock = new FOVBlockBlock(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); + FOVBlock = new FOVBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += FOVBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += FOVBlock.Length;; 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); + FOVBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -12640,8 +11259,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentFOV ---" + Environment.NewLine; - output += FOVBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += FOVBlock.ToString() + Environment.NewLine; return output; } @@ -12650,6 +11269,59 @@ namespace libsecondlife.Packets /// public class AgentHeightWidthPacket : Packet { + /// + [XmlType("agentheightwidth_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public uint CircuitCode; + + [XmlIgnore] + public int Length + { + get + { + return 36; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + CircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("CircuitCode: {0}", CircuitCode)); + return output.ToString(); + } + } + /// [XmlType("agentheightwidth_heightwidthblock")] public class HeightWidthBlockBlock @@ -12705,20 +11377,78 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.AgentHeightWidth; } } + public AgentDataBlock AgentData; + public HeightWidthBlockBlock HeightWidthBlock; + + public AgentHeightWidthPacket() + { + Header = new LowHeader(); + Header.ID = 83; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + HeightWidthBlock = new HeightWidthBlockBlock(); + } + + public AgentHeightWidthPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + HeightWidthBlock = new HeightWidthBlockBlock(bytes, ref i); + } + + public AgentHeightWidthPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + HeightWidthBlock = new HeightWidthBlockBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += HeightWidthBlock.Length;; + 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); + HeightWidthBlock.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- AgentHeightWidth ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += HeightWidthBlock.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class AgentSetAppearancePacket : Packet + { /// - [XmlType("agentheightwidth_agentdata")] + [XmlType("agentsetappearance_agentdata")] public class AgentDataBlock { public LLUUID AgentID; public LLUUID SessionID; - public uint CircuitCode; + public uint SerialNum; + public LLVector3 Size; [XmlIgnore] public int Length { get { - return 36; + return 48; } } @@ -12729,7 +11459,8 @@ namespace libsecondlife.Packets { 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)); + SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Size = new LLVector3(bytes, i); i += 12; } catch (Exception) { @@ -12741,10 +11472,11 @@ namespace libsecondlife.Packets { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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); + bytes[i++] = (byte)(SerialNum % 256); + bytes[i++] = (byte)((SerialNum >> 8) % 256); + bytes[i++] = (byte)((SerialNum >> 16) % 256); + bytes[i++] = (byte)((SerialNum >> 24) % 256); + Buffer.BlockCopy(Size.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() @@ -12753,89 +11485,35 @@ namespace libsecondlife.Packets output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("CircuitCode: {0}", CircuitCode)); + output.AppendLine(String.Format("SerialNum: {0}", SerialNum)); + output.Append(String.Format("Size: {0}", Size)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AgentHeightWidth; } } - public HeightWidthBlockBlock HeightWidthBlock; - public AgentDataBlock AgentData; - - public AgentHeightWidthPacket() - { - Header = new LowHeader(); - Header.ID = 107; - Header.Reliable = true; - HeightWidthBlock = new HeightWidthBlockBlock(); - AgentData = new AgentDataBlock(); - } - - public AgentHeightWidthPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - HeightWidthBlock = new HeightWidthBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AgentHeightWidthPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - HeightWidthBlock = new HeightWidthBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += HeightWidthBlock.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - HeightWidthBlock.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AgentHeightWidth ---" + Environment.NewLine; - output += HeightWidthBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AgentSetAppearancePacket : Packet - { /// - [XmlType("agentsetappearance_visualparam")] - public class VisualParamBlock + [XmlType("agentsetappearance_wearabledata")] + public class WearableDataBlock { - public byte ParamValue; + public LLUUID CacheID; + public byte TextureIndex; [XmlIgnore] public int Length { get { - return 1; + return 17; } } - public VisualParamBlock() { } - public VisualParamBlock(byte[] bytes, ref int i) + public WearableDataBlock() { } + public WearableDataBlock(byte[] bytes, ref int i) { try { - ParamValue = (byte)bytes[i++]; + CacheID = new LLUUID(bytes, i); i += 16; + TextureIndex = (byte)bytes[i++]; } catch (Exception) { @@ -12845,14 +11523,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = ParamValue; + Buffer.BlockCopy(CacheID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = TextureIndex; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- VisualParam --"); - output.Append(String.Format("ParamValue: {0}", ParamValue)); + output.AppendLine("-- WearableData --"); + output.AppendLine(String.Format("CacheID: {0}", CacheID)); + output.Append(String.Format("TextureIndex: {0}", TextureIndex)); return output.ToString(); } } @@ -12918,28 +11598,26 @@ namespace libsecondlife.Packets } /// - [XmlType("agentsetappearance_wearabledata")] - public class WearableDataBlock + [XmlType("agentsetappearance_visualparam")] + public class VisualParamBlock { - public byte TextureIndex; - public LLUUID CacheID; + public byte ParamValue; [XmlIgnore] public int Length { get { - return 17; + return 1; } } - public WearableDataBlock() { } - public WearableDataBlock(byte[] bytes, ref int i) + public VisualParamBlock() { } + public VisualParamBlock(byte[] bytes, ref int i) { try { - TextureIndex = (byte)bytes[i++]; - CacheID = new LLUUID(bytes, i); i += 16; + ParamValue = (byte)bytes[i++]; } catch (Exception) { @@ -12949,73 +11627,14 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = TextureIndex; - Buffer.BlockCopy(CacheID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = ParamValue; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- WearableData --"); - output.AppendLine(String.Format("TextureIndex: {0}", TextureIndex)); - output.Append(String.Format("CacheID: {0}", CacheID)); - return output.ToString(); - } - } - - /// - [XmlType("agentsetappearance_agentdata")] - public class AgentDataBlock - { - public uint SerialNum; - public LLUUID AgentID; - public LLUUID SessionID; - public LLVector3 Size; - - [XmlIgnore] - public int Length - { - get - { - return 48; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - Size = new LLVector3(bytes, i); i += 12; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(SerialNum % 256); - bytes[i++] = (byte)((SerialNum >> 8) % 256); - bytes[i++] = (byte)((SerialNum >> 16) % 256); - bytes[i++] = (byte)((SerialNum >> 24) % 256); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Size.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("SerialNum: {0}", SerialNum)); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("Size: {0}", Size)); + output.AppendLine("-- VisualParam --"); + output.Append(String.Format("ParamValue: {0}", ParamValue)); return output.ToString(); } } @@ -13023,72 +11642,71 @@ namespace libsecondlife.Packets 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 WearableDataBlock[] WearableData; + public ObjectDataBlock ObjectData; + public VisualParamBlock[] VisualParam; public AgentSetAppearancePacket() { Header = new LowHeader(); - Header.ID = 108; + Header.ID = 84; Header.Reliable = true; - Header.Zerocoded = true; - VisualParam = new VisualParamBlock[0]; - ObjectData = new ObjectDataBlock(); - WearableData = new WearableDataBlock[0]; AgentData = new AgentDataBlock(); + WearableData = new WearableDataBlock[0]; + ObjectData = new ObjectDataBlock(); + VisualParam = new VisualParamBlock[0]; } public AgentSetAppearancePacket(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++]; - 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); + ObjectData = new ObjectDataBlock(bytes, ref i); + count = (int)bytes[i++]; + VisualParam = new VisualParamBlock[count]; + for (int j = 0; j < count; j++) + { VisualParam[j] = new VisualParamBlock(bytes, ref i); } } public AgentSetAppearancePacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); 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); + ObjectData = new ObjectDataBlock(bytes, ref i); + count = (int)bytes[i++]; + VisualParam = new VisualParamBlock[count]; + for (int j = 0; j < count; j++) + { VisualParam[j] = new VisualParamBlock(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; } + int length = 10; + length += AgentData.Length; length += ObjectData.Length;; length++; for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].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); + AgentData.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); + ObjectData.ToBytes(bytes, ref i); + bytes[i++] = (byte)VisualParam.Length; + for (int j = 0; j < VisualParam.Length; j++) { VisualParam[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -13096,113 +11714,16 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentSetAppearance ---" + Environment.NewLine; - for (int j = 0; j < VisualParam.Length; j++) - { - output += VisualParam[j].ToString() + Environment.NewLine; - } - output += ObjectData.ToString() + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < WearableData.Length; j++) { output += WearableData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AgentQuitPacket : Packet - { - /// - [XmlType("agentquit_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length + output += ObjectData.ToString() + Environment.NewLine; + for (int j = 0; j < VisualParam.Length; j++) { - get - { - return 32; - } + output += VisualParam[j].ToString() + Environment.NewLine; } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AgentQuit; } } - public AgentDataBlock AgentData; - - public AgentQuitPacket() - { - Header = new LowHeader(); - Header.ID = 109; - Header.Reliable = true; - AgentData = new AgentDataBlock(); - } - - public AgentQuitPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AgentQuitPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AgentQuit ---" + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -13211,51 +11732,6 @@ namespace libsecondlife.Packets /// public class AgentQuitCopyPacket : Packet { - /// - [XmlType("agentquitcopy_fuseblock")] - public class FuseBlockBlock - { - public uint ViewerCircuitCode; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public FuseBlockBlock() { } - public FuseBlockBlock(byte[] bytes, ref int i) - { - try - { - ViewerCircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ViewerCircuitCode % 256); - bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256); - bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256); - bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- FuseBlock --"); - output.Append(String.Format("ViewerCircuitCode: {0}", ViewerCircuitCode)); - return output.ToString(); - } - } - /// [XmlType("agentquitcopy_agentdata")] public class AgentDataBlock @@ -13302,46 +11778,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("agentquitcopy_fuseblock")] + public class FuseBlockBlock + { + public uint ViewerCircuitCode; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public FuseBlockBlock() { } + public FuseBlockBlock(byte[] bytes, ref int i) + { + try + { + ViewerCircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(ViewerCircuitCode % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- FuseBlock --"); + output.Append(String.Format("ViewerCircuitCode: {0}", ViewerCircuitCode)); + return output.ToString(); + } + } + 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 FuseBlockBlock FuseBlock; public AgentQuitCopyPacket() { Header = new LowHeader(); - Header.ID = 110; + Header.ID = 85; Header.Reliable = true; - FuseBlock = new FuseBlockBlock(); AgentData = new AgentDataBlock(); + FuseBlock = new FuseBlockBlock(); } 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); + FuseBlock = new FuseBlockBlock(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); + FuseBlock = new FuseBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += FuseBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += FuseBlock.Length;; 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); + FuseBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -13349,8 +11870,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentQuitCopy ---" + Environment.NewLine; - output += FuseBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += FuseBlock.ToString() + Environment.NewLine; return output; } @@ -13409,7 +11930,7 @@ namespace libsecondlife.Packets public ImageNotInDatabasePacket() { Header = new LowHeader(); - Header.ID = 111; + Header.ID = 86; Header.Reliable = true; ImageID = new ImageIDBlock(); } @@ -13429,7 +11950,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ImageID.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -13502,7 +12023,7 @@ namespace libsecondlife.Packets public RebakeAvatarTexturesPacket() { Header = new LowHeader(); - Header.ID = 112; + Header.ID = 87; Header.Reliable = true; TextureData = new TextureDataBlock(); } @@ -13522,7 +12043,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TextureData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -13603,7 +12124,7 @@ namespace libsecondlife.Packets public SetAlwaysRunPacket() { Header = new LowHeader(); - Header.ID = 113; + Header.ID = 88; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -13623,7 +12144,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -13646,51 +12167,6 @@ namespace libsecondlife.Packets /// public class ObjectDeletePacket : Packet { - /// - [XmlType("objectdelete_objectdata")] - public class ObjectDataBlock - { - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - /// [XmlType("objectdelete_agentdata")] public class AgentDataBlock @@ -13741,78 +12217,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectDelete; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectDeletePacket() - { - Header = new LowHeader(); - Header.ID = 114; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectDeletePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectDeletePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectDelete ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectDuplicatePacket : Packet - { /// - [XmlType("objectduplicate_objectdata")] + [XmlType("objectdelete_objectdata")] public class ObjectDataBlock { public uint ObjectLocalID; @@ -13856,55 +12262,75 @@ namespace libsecondlife.Packets } } - /// - [XmlType("objectduplicate_shareddata")] - public class SharedDataBlock + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectDelete; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectDeletePacket() { - public uint DuplicateFlags; - public LLVector3 Offset; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public SharedDataBlock() { } - public SharedDataBlock(byte[] bytes, ref int i) - { - try - { - DuplicateFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Offset = new LLVector3(bytes, i); i += 12; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(DuplicateFlags % 256); - bytes[i++] = (byte)((DuplicateFlags >> 8) % 256); - bytes[i++] = (byte)((DuplicateFlags >> 16) % 256); - bytes[i++] = (byte)((DuplicateFlags >> 24) % 256); - Buffer.BlockCopy(Offset.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- SharedData --"); - output.AppendLine(String.Format("DuplicateFlags: {0}", DuplicateFlags)); - output.Append(String.Format("Offset: {0}", Offset)); - return output.ToString(); - } + Header = new LowHeader(); + Header.ID = 89; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } + public ObjectDeletePacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectDeletePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectDelete ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectDuplicatePacket : Packet + { /// [XmlType("objectduplicate_agentdata")] public class AgentDataBlock @@ -13955,61 +12381,154 @@ namespace libsecondlife.Packets } } + /// + [XmlType("objectduplicate_shareddata")] + public class SharedDataBlock + { + public LLVector3 Offset; + public uint DuplicateFlags; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public SharedDataBlock() { } + public SharedDataBlock(byte[] bytes, ref int i) + { + try + { + Offset = new LLVector3(bytes, i); i += 12; + DuplicateFlags = (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) + { + Buffer.BlockCopy(Offset.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = (byte)(DuplicateFlags % 256); + bytes[i++] = (byte)((DuplicateFlags >> 8) % 256); + bytes[i++] = (byte)((DuplicateFlags >> 16) % 256); + bytes[i++] = (byte)((DuplicateFlags >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- SharedData --"); + output.AppendLine(String.Format("Offset: {0}", Offset)); + output.Append(String.Format("DuplicateFlags: {0}", DuplicateFlags)); + return output.ToString(); + } + } + + /// + [XmlType("objectduplicate_objectdata")] + public class ObjectDataBlock + { + public uint ObjectLocalID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(ObjectLocalID % 256); + bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + return output.ToString(); + } + } + 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 SharedDataBlock SharedData; + public ObjectDataBlock[] ObjectData; public ObjectDuplicatePacket() { Header = new LowHeader(); - Header.ID = 115; + Header.ID = 90; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - SharedData = new SharedDataBlock(); AgentData = new AgentDataBlock(); + SharedData = new SharedDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectDuplicatePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + SharedData = new SharedDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + SharedData = new SharedDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += SharedData.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); + AgentData.ToBytes(bytes, ref i); + SharedData.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; } @@ -14017,12 +12536,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectDuplicate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += SharedData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += SharedData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -14031,6 +12550,91 @@ namespace libsecondlife.Packets /// public class ObjectDuplicateOnRayPacket : Packet { + /// + [XmlType("objectduplicateonray_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public LLUUID GroupID; + public LLVector3 RayStart; + public LLVector3 RayEnd; + public bool BypassRaycast; + public bool RayEndIsIntersection; + public bool CopyCenters; + public bool CopyRotates; + public LLUUID RayTargetID; + public uint DuplicateFlags; + + [XmlIgnore] + public int Length + { + get + { + return 96; + } + } + + 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; + RayStart = new LLVector3(bytes, i); i += 12; + RayEnd = new LLVector3(bytes, i); i += 12; + BypassRaycast = (bytes[i++] != 0) ? (bool)true : (bool)false; + RayEndIsIntersection = (bytes[i++] != 0) ? (bool)true : (bool)false; + CopyCenters = (bytes[i++] != 0) ? (bool)true : (bool)false; + CopyRotates = (bytes[i++] != 0) ? (bool)true : (bool)false; + RayTargetID = new LLUUID(bytes, i); i += 16; + DuplicateFlags = (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) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = (byte)((BypassRaycast) ? 1 : 0); + bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0); + bytes[i++] = (byte)((CopyCenters) ? 1 : 0); + bytes[i++] = (byte)((CopyRotates) ? 1 : 0); + Buffer.BlockCopy(RayTargetID.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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("RayStart: {0}", RayStart)); + output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); + output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); + output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); + output.AppendLine(String.Format("CopyCenters: {0}", CopyCenters)); + output.AppendLine(String.Format("CopyRotates: {0}", CopyRotates)); + output.AppendLine(String.Format("RayTargetID: {0}", RayTargetID)); + output.Append(String.Format("DuplicateFlags: {0}", DuplicateFlags)); + return output.ToString(); + } + } + /// [XmlType("objectduplicateonray_objectdata")] public class ObjectDataBlock @@ -14076,28 +12680,88 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectDuplicateOnRay; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectDuplicateOnRayPacket() + { + Header = new LowHeader(); + Header.ID = 91; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectDuplicateOnRayPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectDuplicateOnRayPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectDuplicateOnRay ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectScalePacket : Packet + { /// - [XmlType("objectduplicateonray_agentdata")] + [XmlType("objectscale_agentdata")] public class AgentDataBlock { public LLUUID AgentID; - public uint DuplicateFlags; - public bool CopyRotates; public LLUUID SessionID; - public LLVector3 RayStart; - public LLUUID GroupID; - public bool RayEndIsIntersection; - public LLVector3 RayEnd; - public bool BypassRaycast; - public bool CopyCenters; - public LLUUID RayTargetID; [XmlIgnore] public int Length { get { - return 96; + return 32; } } @@ -14107,16 +12771,7 @@ namespace libsecondlife.Packets 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) { @@ -14127,19 +12782,7 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(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); Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0); - Buffer.BlockCopy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = (byte)((BypassRaycast) ? 1 : 0); - bytes[i++] = (byte)((CopyCenters) ? 1 : 0); - Buffer.BlockCopy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() @@ -14147,90 +12790,11 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("DuplicateFlags: {0}", DuplicateFlags)); - output.AppendLine(String.Format("CopyRotates: {0}", CopyRotates)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("RayStart: {0}", RayStart)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); - output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); - output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); - output.AppendLine(String.Format("CopyCenters: {0}", CopyCenters)); - output.Append(String.Format("RayTargetID: {0}", RayTargetID)); + output.Append(String.Format("SessionID: {0}", SessionID)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectDuplicateOnRay; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectDuplicateOnRayPacket() - { - Header = new LowHeader(); - Header.ID = 116; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectDuplicateOnRayPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectDuplicateOnRayPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectDuplicateOnRay ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectScalePacket : Packet - { /// [XmlType("objectscale_objectdata")] public class ObjectDataBlock @@ -14280,8 +12844,77 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectScale; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectScalePacket() + { + Header = new LowHeader(); + Header.ID = 92; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectScalePacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectScalePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectScale ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectRotationPacket : Packet + { /// - [XmlType("objectscale_agentdata")] + [XmlType("objectrotation_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -14326,76 +12959,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectScale; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectScalePacket() - { - Header = new LowHeader(); - Header.ID = 117; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectScalePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectScalePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectScale ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectRotationPacket : Packet - { /// [XmlType("objectrotation_objectdata")] public class ObjectDataBlock @@ -14445,92 +13008,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("objectrotation_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 ObjectDataBlock[] ObjectData; public ObjectRotationPacket() { Header = new LowHeader(); - Header.ID = 118; + Header.ID = 93; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectRotationPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -14538,9 +13054,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -14548,11 +13064,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectRotation ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -14567,11 +13083,11 @@ namespace libsecondlife.Packets { public LLUUID AgentID; public LLUUID SessionID; - public bool IsTemporary; public uint ObjectLocalID; public bool UsePhysics; - public bool CastsShadows; + public bool IsTemporary; public bool IsPhantom; + public bool CastsShadows; [XmlIgnore] public int Length @@ -14589,11 +13105,11 @@ namespace libsecondlife.Packets { 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; + IsTemporary = (bytes[i++] != 0) ? (bool)true : (bool)false; IsPhantom = (bytes[i++] != 0) ? (bool)true : (bool)false; + CastsShadows = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -14605,14 +13121,14 @@ namespace libsecondlife.Packets { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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)((IsTemporary) ? 1 : 0); bytes[i++] = (byte)((IsPhantom) ? 1 : 0); + bytes[i++] = (byte)((CastsShadows) ? 1 : 0); } public override string ToString() @@ -14621,11 +13137,11 @@ namespace libsecondlife.Packets output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("IsTemporary: {0}", IsTemporary)); output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); output.AppendLine(String.Format("UsePhysics: {0}", UsePhysics)); - output.AppendLine(String.Format("CastsShadows: {0}", CastsShadows)); - output.Append(String.Format("IsPhantom: {0}", IsPhantom)); + output.AppendLine(String.Format("IsTemporary: {0}", IsTemporary)); + output.AppendLine(String.Format("IsPhantom: {0}", IsPhantom)); + output.Append(String.Format("CastsShadows: {0}", CastsShadows)); return output.ToString(); } } @@ -14638,9 +13154,8 @@ namespace libsecondlife.Packets public ObjectFlagUpdatePacket() { Header = new LowHeader(); - Header.ID = 119; + Header.ID = 94; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); } @@ -14659,7 +13174,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -14682,55 +13197,6 @@ namespace libsecondlife.Packets /// public class ObjectClickActionPacket : Packet { - /// - [XmlType("objectclickaction_objectdata")] - public class ObjectDataBlock - { - public byte ClickAction; - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 5; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ClickAction = (byte)bytes[i++]; - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = ClickAction; - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("ClickAction: {0}", ClickAction)); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - /// [XmlType("objectclickaction_agentdata")] public class AgentDataBlock @@ -14777,129 +13243,29 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectClickAction; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectClickActionPacket() - { - Header = new LowHeader(); - Header.ID = 120; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectClickActionPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectClickActionPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectClickAction ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectImagePacket : Packet - { /// - [XmlType("objectimage_objectdata")] + [XmlType("objectclickaction_objectdata")] public class ObjectDataBlock { - private byte[] _mediaurl; - public byte[] MediaURL - { - get { return _mediaurl; } - set - { - if (value == null) { _mediaurl = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _mediaurl = new byte[value.Length]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } - } - } public uint ObjectLocalID; - private byte[] _textureentry; - public byte[] TextureEntry - { - get { return _textureentry; } - set - { - if (value == null) { _textureentry = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _textureentry = new byte[value.Length]; Buffer.BlockCopy(value, 0, _textureentry, 0, value.Length); } - } - } + public byte ClickAction; [XmlIgnore] public int Length { get { - int length = 4; - if (MediaURL != null) { length += 1 + MediaURL.Length; } - if (TextureEntry != null) { length += 2 + TextureEntry.Length; } - return length; + return 5; } } public ObjectDataBlock() { } public ObjectDataBlock(byte[] bytes, ref int i) { - int length; try { - length = (ushort)bytes[i++]; - _mediaurl = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _textureentry, 0, length); i += length; + ClickAction = (byte)bytes[i++]; } catch (Exception) { @@ -14909,31 +13275,92 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length; + bytes[i++] = ClickAction; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - Helpers.FieldToString(output, MediaURL, "MediaURL"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - Helpers.FieldToString(output, TextureEntry, "TextureEntry"); + output.Append(String.Format("ClickAction: {0}", ClickAction)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectClickAction; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectClickActionPacket() + { + Header = new LowHeader(); + Header.ID = 95; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectClickActionPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectClickActionPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectClickAction ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectImagePacket : Packet + { /// [XmlType("objectimage_agentdata")] public class AgentDataBlock @@ -14980,99 +13407,59 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectImage; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectImagePacket() - { - Header = new LowHeader(); - Header.ID = 121; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectImagePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectImagePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectImage ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectMaterialPacket : Packet - { /// - [XmlType("objectmaterial_objectdata")] + [XmlType("objectimage_objectdata")] public class ObjectDataBlock { - public byte Material; public uint ObjectLocalID; + 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]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } + } + } + private byte[] _textureentry; + public byte[] TextureEntry + { + get { return _textureentry; } + set + { + if (value == null) { _textureentry = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _textureentry = new byte[value.Length]; Buffer.BlockCopy(value, 0, _textureentry, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 5; + 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 { - Material = (byte)bytes[i++]; ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _mediaurl = new byte[length]; + Buffer.BlockCopy(bytes, i, _mediaurl, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _textureentry = new byte[length]; + Buffer.BlockCopy(bytes, i, _textureentry, 0, length); i += length; } catch (Exception) { @@ -15082,23 +13469,100 @@ namespace libsecondlife.Packets 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); + if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); } + bytes[i++] = (byte)MediaURL.Length; + Buffer.BlockCopy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.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); + Buffer.BlockCopy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("Material: {0}", Material)); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + Helpers.FieldToString(output, MediaURL, "MediaURL"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, TextureEntry, "TextureEntry"); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectImage; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectImagePacket() + { + Header = new LowHeader(); + Header.ID = 96; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectImagePacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectImagePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectImage ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectMaterialPacket : Packet + { /// [XmlType("objectmaterial_agentdata")] public class AgentDataBlock @@ -15145,106 +13609,19 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectMaterial; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectMaterialPacket() - { - Header = new LowHeader(); - Header.ID = 122; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectMaterialPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectMaterialPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectMaterial ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectShapePacket : Packet - { /// - [XmlType("objectshape_objectdata")] + [XmlType("objectmaterial_objectdata")] public class ObjectDataBlock { - public sbyte PathTwistBegin; - public ushort PathEnd; - public ushort 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 ushort ProfileEnd; - public ushort PathBegin; - public byte PathCurve; - public sbyte PathTwist; - public ushort ProfileHollow; - public byte PathRevolutions; + public byte Material; [XmlIgnore] public int Length { get { - return 27; + return 5; } } @@ -15253,25 +13630,8 @@ namespace libsecondlife.Packets { try { - PathTwistBegin = (sbyte)bytes[i++]; - PathEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); - ProfileBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); - 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 = (ushort)(bytes[i++] + (bytes[i++] << 8)); - PathBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); - PathCurve = (byte)bytes[i++]; - PathTwist = (sbyte)bytes[i++]; - ProfileHollow = (ushort)(bytes[i++] + (bytes[i++] << 8)); - PathRevolutions = (byte)bytes[i++]; + Material = (byte)bytes[i++]; } catch (Exception) { @@ -15281,62 +13641,92 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)PathTwistBegin; - bytes[i++] = (byte)(PathEnd % 256); - bytes[i++] = (byte)((PathEnd >> 8) % 256); - bytes[i++] = (byte)(ProfileBegin % 256); - bytes[i++] = (byte)((ProfileBegin >> 8) % 256); - 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++] = (byte)(ProfileEnd % 256); - bytes[i++] = (byte)((ProfileEnd >> 8) % 256); - bytes[i++] = (byte)(PathBegin % 256); - bytes[i++] = (byte)((PathBegin >> 8) % 256); - bytes[i++] = PathCurve; - bytes[i++] = (byte)PathTwist; - bytes[i++] = (byte)(ProfileHollow % 256); - bytes[i++] = (byte)((ProfileHollow >> 8) % 256); - bytes[i++] = PathRevolutions; + bytes[i++] = Material; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("PathTwistBegin: {0}", PathTwistBegin)); - output.AppendLine(String.Format("PathEnd: {0}", PathEnd)); - output.AppendLine(String.Format("ProfileBegin: {0}", ProfileBegin)); - output.AppendLine(String.Format("PathRadiusOffset: {0}", PathRadiusOffset)); - output.AppendLine(String.Format("PathSkew: {0}", PathSkew)); - output.AppendLine(String.Format("ProfileCurve: {0}", ProfileCurve)); - output.AppendLine(String.Format("PathScaleX: {0}", PathScaleX)); - output.AppendLine(String.Format("PathScaleY: {0}", PathScaleY)); output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - output.AppendLine(String.Format("PathShearX: {0}", PathShearX)); - output.AppendLine(String.Format("PathShearY: {0}", PathShearY)); - output.AppendLine(String.Format("PathTaperX: {0}", PathTaperX)); - output.AppendLine(String.Format("PathTaperY: {0}", PathTaperY)); - output.AppendLine(String.Format("ProfileEnd: {0}", ProfileEnd)); - output.AppendLine(String.Format("PathBegin: {0}", PathBegin)); - output.AppendLine(String.Format("PathCurve: {0}", PathCurve)); - output.AppendLine(String.Format("PathTwist: {0}", PathTwist)); - output.AppendLine(String.Format("ProfileHollow: {0}", ProfileHollow)); - output.Append(String.Format("PathRevolutions: {0}", PathRevolutions)); + output.Append(String.Format("Material: {0}", Material)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectMaterial; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectMaterialPacket() + { + Header = new LowHeader(); + Header.ID = 97; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectMaterialPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectMaterialPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectMaterial ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectShapePacket : Packet + { /// [XmlType("objectshape_agentdata")] public class AgentDataBlock @@ -15383,120 +13773,63 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectShape; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectShapePacket() - { - Header = new LowHeader(); - Header.ID = 123; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectShapePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectShapePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectShape ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectExtraParamsPacket : Packet - { /// - [XmlType("objectextraparams_objectdata")] + [XmlType("objectshape_objectdata")] public class ObjectDataBlock { - public bool ParamInUse; public uint ObjectLocalID; - private byte[] _paramdata; - public byte[] ParamData - { - get { return _paramdata; } - set - { - if (value == null) { _paramdata = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _paramdata = new byte[value.Length]; Buffer.BlockCopy(value, 0, _paramdata, 0, value.Length); } - } - } - public uint ParamSize; - public ushort ParamType; + public byte PathCurve; + public byte ProfileCurve; + public ushort PathBegin; + public ushort PathEnd; + public byte PathScaleX; + public byte PathScaleY; + public byte PathShearX; + public byte PathShearY; + public sbyte PathTwist; + public sbyte PathTwistBegin; + public sbyte PathRadiusOffset; + public sbyte PathTaperX; + public sbyte PathTaperY; + public byte PathRevolutions; + public sbyte PathSkew; + public ushort ProfileBegin; + public ushort ProfileEnd; + public ushort ProfileHollow; [XmlIgnore] public int Length { get { - int length = 11; - if (ParamData != null) { length += 1 + ParamData.Length; } - return length; + return 27; } } 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]; - Buffer.BlockCopy(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)); + PathCurve = (byte)bytes[i++]; + ProfileCurve = (byte)bytes[i++]; + PathBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); + PathEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); + PathScaleX = (byte)bytes[i++]; + PathScaleY = (byte)bytes[i++]; + PathShearX = (byte)bytes[i++]; + PathShearY = (byte)bytes[i++]; + PathTwist = (sbyte)bytes[i++]; + PathTwistBegin = (sbyte)bytes[i++]; + PathRadiusOffset = (sbyte)bytes[i++]; + PathTaperX = (sbyte)bytes[i++]; + PathTaperY = (sbyte)bytes[i++]; + PathRevolutions = (byte)bytes[i++]; + PathSkew = (sbyte)bytes[i++]; + ProfileBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); + ProfileEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); + ProfileHollow = (ushort)(bytes[i++] + (bytes[i++] << 8)); } catch (Exception) { @@ -15506,36 +13839,131 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); + bytes[i++] = PathCurve; + bytes[i++] = ProfileCurve; + bytes[i++] = (byte)(PathBegin % 256); + bytes[i++] = (byte)((PathBegin >> 8) % 256); + bytes[i++] = (byte)(PathEnd % 256); + bytes[i++] = (byte)((PathEnd >> 8) % 256); + bytes[i++] = PathScaleX; + bytes[i++] = PathScaleY; + bytes[i++] = PathShearX; + bytes[i++] = PathShearY; + bytes[i++] = (byte)PathTwist; + bytes[i++] = (byte)PathTwistBegin; + bytes[i++] = (byte)PathRadiusOffset; + bytes[i++] = (byte)PathTaperX; + bytes[i++] = (byte)PathTaperY; + bytes[i++] = PathRevolutions; + bytes[i++] = (byte)PathSkew; + bytes[i++] = (byte)(ProfileBegin % 256); + bytes[i++] = (byte)((ProfileBegin >> 8) % 256); + bytes[i++] = (byte)(ProfileEnd % 256); + bytes[i++] = (byte)((ProfileEnd >> 8) % 256); + bytes[i++] = (byte)(ProfileHollow % 256); + bytes[i++] = (byte)((ProfileHollow >> 8) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("ParamInUse: {0}", ParamInUse)); output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - Helpers.FieldToString(output, ParamData, "ParamData"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ParamSize: {0}", ParamSize)); - output.Append(String.Format("ParamType: {0}", ParamType)); + output.AppendLine(String.Format("PathCurve: {0}", PathCurve)); + output.AppendLine(String.Format("ProfileCurve: {0}", ProfileCurve)); + output.AppendLine(String.Format("PathBegin: {0}", PathBegin)); + output.AppendLine(String.Format("PathEnd: {0}", PathEnd)); + output.AppendLine(String.Format("PathScaleX: {0}", PathScaleX)); + output.AppendLine(String.Format("PathScaleY: {0}", PathScaleY)); + output.AppendLine(String.Format("PathShearX: {0}", PathShearX)); + output.AppendLine(String.Format("PathShearY: {0}", PathShearY)); + output.AppendLine(String.Format("PathTwist: {0}", PathTwist)); + output.AppendLine(String.Format("PathTwistBegin: {0}", PathTwistBegin)); + output.AppendLine(String.Format("PathRadiusOffset: {0}", PathRadiusOffset)); + output.AppendLine(String.Format("PathTaperX: {0}", PathTaperX)); + output.AppendLine(String.Format("PathTaperY: {0}", PathTaperY)); + output.AppendLine(String.Format("PathRevolutions: {0}", PathRevolutions)); + output.AppendLine(String.Format("PathSkew: {0}", PathSkew)); + output.AppendLine(String.Format("ProfileBegin: {0}", ProfileBegin)); + output.AppendLine(String.Format("ProfileEnd: {0}", ProfileEnd)); + output.Append(String.Format("ProfileHollow: {0}", ProfileHollow)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectShape; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectShapePacket() + { + Header = new LowHeader(); + Header.ID = 98; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectShapePacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectShapePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectShape ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectExtraParamsPacket : Packet + { /// [XmlType("objectextraparams_agentdata")] public class AgentDataBlock @@ -15582,97 +14010,50 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectExtraParams; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectExtraParamsPacket() - { - Header = new LowHeader(); - Header.ID = 124; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectExtraParamsPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectExtraParamsPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectExtraParams ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectOwnerPacket : Packet - { /// - [XmlType("objectowner_objectdata")] + [XmlType("objectextraparams_objectdata")] public class ObjectDataBlock { public uint ObjectLocalID; + public ushort ParamType; + public bool ParamInUse; + public uint ParamSize; + 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]; Buffer.BlockCopy(value, 0, _paramdata, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 4; + int length = 11; + if (ParamData != null) { length += 1 + ParamData.Length; } + return length; } } public ObjectDataBlock() { } public ObjectDataBlock(byte[] bytes, ref int i) { + int length; try { ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ParamType = (ushort)(bytes[i++] + (bytes[i++] << 8)); + ParamInUse = (bytes[i++] != 0) ? (bool)true : (bool)false; + ParamSize = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _paramdata = new byte[length]; + Buffer.BlockCopy(bytes, i, _paramdata, 0, length); i += length; } catch (Exception) { @@ -15686,17 +14067,100 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); + bytes[i++] = (byte)(ParamType % 256); + bytes[i++] = (byte)((ParamType >> 8) % 256); + bytes[i++] = (byte)((ParamInUse) ? 1 : 0); + bytes[i++] = (byte)(ParamSize % 256); + bytes[i++] = (byte)((ParamSize >> 8) % 256); + bytes[i++] = (byte)((ParamSize >> 16) % 256); + bytes[i++] = (byte)((ParamSize >> 24) % 256); + if(ParamData == null) { Console.WriteLine("Warning: ParamData is null, in " + this.GetType()); } + bytes[i++] = (byte)ParamData.Length; + Buffer.BlockCopy(ParamData, 0, bytes, i, ParamData.Length); i += ParamData.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.AppendLine(String.Format("ParamType: {0}", ParamType)); + output.AppendLine(String.Format("ParamInUse: {0}", ParamInUse)); + output.AppendLine(String.Format("ParamSize: {0}", ParamSize)); + Helpers.FieldToString(output, ParamData, "ParamData"); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectExtraParams; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectExtraParamsPacket() + { + Header = new LowHeader(); + Header.ID = 99; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectExtraParamsPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectExtraParamsPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectExtraParams ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectOwnerPacket : Packet + { /// [XmlType("objectowner_agentdata")] public class AgentDataBlock @@ -15747,9 +14211,9 @@ namespace libsecondlife.Packets [XmlType("objectowner_headerdata")] public class HeaderDataBlock { - public LLUUID GroupID; - public LLUUID OwnerID; public bool Override; + public LLUUID OwnerID; + public LLUUID GroupID; [XmlIgnore] public int Length @@ -15765,9 +14229,9 @@ namespace libsecondlife.Packets { try { - GroupID = new LLUUID(bytes, i); i += 16; - OwnerID = new LLUUID(bytes, i); i += 16; Override = (bytes[i++] != 0) ? (bool)true : (bool)false; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -15777,100 +14241,24 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)((Override) ? 1 : 0); + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- HeaderData --"); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("Override: {0}", Override)); output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.Append(String.Format("Override: {0}", Override)); + output.Append(String.Format("GroupID: {0}", GroupID)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectOwner; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - public HeaderDataBlock HeaderData; - - public ObjectOwnerPacket() - { - Header = new LowHeader(); - Header.ID = 125; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - HeaderData = new HeaderDataBlock(); - } - - public ObjectOwnerPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - HeaderData = new HeaderDataBlock(bytes, ref i); - } - - public ObjectOwnerPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - HeaderData = new HeaderDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length; length += HeaderData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - HeaderData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectOwner ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - output += HeaderData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectGroupPacket : Packet - { /// - [XmlType("objectgroup_objectdata")] + [XmlType("objectowner_objectdata")] public class ObjectDataBlock { public uint ObjectLocalID; @@ -15914,6 +14302,81 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectOwner; } } + public AgentDataBlock AgentData; + public HeaderDataBlock HeaderData; + public ObjectDataBlock[] ObjectData; + + public ObjectOwnerPacket() + { + Header = new LowHeader(); + Header.ID = 100; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + HeaderData = new HeaderDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectOwnerPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectOwnerPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.ToBytes(bytes, ref i); + HeaderData.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 = "--- ObjectOwner ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += HeaderData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectGroupPacket : Packet + { /// [XmlType("objectgroup_agentdata")] public class AgentDataBlock @@ -15964,82 +14427,10 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectGroup; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectGroupPacket() - { - Header = new LowHeader(); - Header.ID = 126; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectGroupPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectGroupPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectGroup ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectBuyPacket : Packet - { /// - [XmlType("objectbuy_objectdata")] + [XmlType("objectgroup_objectdata")] public class ObjectDataBlock { - public byte SaleType; - public int SalePrice; public uint ObjectLocalID; [XmlIgnore] @@ -16047,7 +14438,7 @@ namespace libsecondlife.Packets { get { - return 9; + return 4; } } @@ -16056,8 +14447,6 @@ namespace libsecondlife.Packets { 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) @@ -16068,11 +14457,6 @@ namespace libsecondlife.Packets 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); @@ -16083,13 +14467,80 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectGroup; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectGroupPacket() + { + Header = new LowHeader(); + Header.ID = 101; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectGroupPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectGroupPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectGroup ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectBuyPacket : Packet + { /// [XmlType("objectbuy_agentdata")] public class AgentDataBlock @@ -16144,46 +14595,101 @@ namespace libsecondlife.Packets } } + /// + [XmlType("objectbuy_objectdata")] + public class ObjectDataBlock + { + public uint ObjectLocalID; + public byte SaleType; + public int SalePrice; + + [XmlIgnore] + public int Length + { + get + { + return 9; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectLocalID = (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)(ObjectLocalID % 256); + bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.Append(String.Format("SalePrice: {0}", SalePrice)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public ObjectBuyPacket() { Header = new LowHeader(); - Header.ID = 127; + Header.ID = 102; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectBuyPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -16191,9 +14697,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -16201,11 +14707,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectBuy ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -16214,6 +14720,52 @@ namespace libsecondlife.Packets /// public class BuyObjectInventoryPacket : Packet { + /// + [XmlType("buyobjectinventory_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("buyobjectinventory_data")] public class DataBlock @@ -16264,93 +14816,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("buyobjectinventory_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 DataBlock Data; public BuyObjectInventoryPacket() { Header = new LowHeader(); - Header.ID = 128; + Header.ID = 103; Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -16358,8 +14863,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- BuyObjectInventory ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -16422,9 +14927,8 @@ namespace libsecondlife.Packets public DerezContainerPacket() { Header = new LowHeader(); - Header.ID = 129; + Header.ID = 104; Header.Reliable = true; - Header.Zerocoded = true; Data = new DataBlock(); } @@ -16443,7 +14947,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Data.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -16466,66 +14970,6 @@ namespace libsecondlife.Packets /// public class ObjectPermissionsPacket : Packet { - /// - [XmlType("objectpermissions_objectdata")] - public class ObjectDataBlock - { - public byte Set; - public uint Mask; - public uint ObjectLocalID; - public byte Field; - - [XmlIgnore] - public int Length - { - get - { - return 10; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - Set = (byte)bytes[i++]; - Mask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Field = (byte)bytes[i++]; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = Set; - bytes[i++] = (byte)(Mask % 256); - bytes[i++] = (byte)((Mask >> 8) % 256); - bytes[i++] = (byte)((Mask >> 16) % 256); - bytes[i++] = (byte)((Mask >> 24) % 256); - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - bytes[i++] = Field; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("Set: {0}", Set)); - output.AppendLine(String.Format("Mask: {0}", Mask)); - output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - output.Append(String.Format("Field: {0}", Field)); - return output.ToString(); - } - } - /// [XmlType("objectpermissions_agentdata")] public class AgentDataBlock @@ -16614,50 +15058,109 @@ namespace libsecondlife.Packets } } + /// + [XmlType("objectpermissions_objectdata")] + public class ObjectDataBlock + { + public uint ObjectLocalID; + public byte Field; + public byte Set; + public uint Mask; + + [XmlIgnore] + public int Length + { + get + { + return 10; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Field = (byte)bytes[i++]; + Set = (byte)bytes[i++]; + Mask = (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); + bytes[i++] = Field; + 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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.AppendLine(String.Format("Field: {0}", Field)); + output.AppendLine(String.Format("Set: {0}", Set)); + output.Append(String.Format("Mask: {0}", Mask)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public ObjectPermissionsPacket() { Header = new LowHeader(); - Header.ID = 130; + Header.ID = 105; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); HeaderData = new HeaderDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectPermissionsPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length; length += HeaderData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -16665,10 +15168,10 @@ namespace libsecondlife.Packets 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); + 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; } @@ -16676,12 +15179,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectPermissions ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += HeaderData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += HeaderData.ToString() + Environment.NewLine; return output; } @@ -16690,6 +15193,52 @@ namespace libsecondlife.Packets /// public class ObjectSaleInfoPacket : Packet { + /// + [XmlType("objectsaleinfo_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("objectsaleinfo_objectdata")] public class ObjectDataBlock @@ -16746,8 +15295,77 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectSaleInfo; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectSaleInfoPacket() + { + Header = new LowHeader(); + Header.ID = 106; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectSaleInfoPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectSaleInfoPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectSaleInfo ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectNamePacket : Packet + { /// - [XmlType("objectsaleinfo_agentdata")] + [XmlType("objectname_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -16792,76 +15410,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectSaleInfo; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectSaleInfoPacket() - { - Header = new LowHeader(); - Header.ID = 131; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectSaleInfoPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectSaleInfoPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectSaleInfo ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectNamePacket : Packet - { /// [XmlType("objectname_objectdata")] public class ObjectDataBlock @@ -16928,8 +15476,77 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectName; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectNamePacket() + { + Header = new LowHeader(); + Header.ID = 107; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectNamePacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectNamePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectName ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectDescriptionPacket : Packet + { /// - [XmlType("objectname_agentdata")] + [XmlType("objectdescription_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -16974,76 +15591,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectName; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectNamePacket() - { - Header = new LowHeader(); - Header.ID = 132; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectNamePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectNamePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectName ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectDescriptionPacket : Packet - { /// [XmlType("objectdescription_objectdata")] public class ObjectDataBlock @@ -17110,8 +15657,77 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectDescription; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectDescriptionPacket() + { + Header = new LowHeader(); + Header.ID = 108; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectDescriptionPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectDescriptionPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectDescription ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectCategoryPacket : Packet + { /// - [XmlType("objectdescription_agentdata")] + [XmlType("objectcategory_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -17156,76 +15772,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectDescription; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectDescriptionPacket() - { - Header = new LowHeader(); - Header.ID = 133; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectDescriptionPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectDescriptionPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectDescription ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectCategoryPacket : Packet - { /// [XmlType("objectcategory_objectdata")] public class ObjectDataBlock @@ -17278,92 +15824,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("objectcategory_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 ObjectDataBlock[] ObjectData; public ObjectCategoryPacket() { Header = new LowHeader(); - Header.ID = 134; + Header.ID = 109; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectCategoryPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -17371,9 +15870,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -17381,11 +15880,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectCategory ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -17394,51 +15893,6 @@ namespace libsecondlife.Packets /// public class ObjectSelectPacket : Packet { - /// - [XmlType("objectselect_objectdata")] - public class ObjectDataBlock - { - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - /// [XmlType("objectselect_agentdata")] public class AgentDataBlock @@ -17485,78 +15939,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectSelect; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectSelectPacket() - { - Header = new LowHeader(); - Header.ID = 135; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectSelectPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectSelectPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectSelect ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectDeselectPacket : Packet - { /// - [XmlType("objectdeselect_objectdata")] + [XmlType("objectselect_objectdata")] public class ObjectDataBlock { public uint ObjectLocalID; @@ -17600,6 +15984,75 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectSelect; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectSelectPacket() + { + Header = new LowHeader(); + Header.ID = 110; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectSelectPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectSelectPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectSelect ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectDeselectPacket : Packet + { /// [XmlType("objectdeselect_agentdata")] public class AgentDataBlock @@ -17646,46 +16099,90 @@ namespace libsecondlife.Packets } } + /// + [XmlType("objectdeselect_objectdata")] + public class ObjectDataBlock + { + public uint ObjectLocalID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(ObjectLocalID % 256); + bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public ObjectDeselectPacket() { Header = new LowHeader(); - Header.ID = 136; + Header.ID = 111; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectDeselectPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -17693,9 +16190,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -17703,11 +16200,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectDeselect ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -17716,6 +16213,56 @@ namespace libsecondlife.Packets /// public class ObjectAttachPacket : Packet { + /// + [XmlType("objectattach_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public byte AttachmentPoint; + + [XmlIgnore] + public int Length + { + get + { + return 33; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + AttachmentPoint = (byte)bytes[i++]; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = AttachmentPoint; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("AttachmentPoint: {0}", AttachmentPoint)); + return output.ToString(); + } + } + /// [XmlType("objectattach_objectdata")] public class ObjectDataBlock @@ -17765,96 +16312,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("objectattach_agentdata")] - public class AgentDataBlock - { - public byte AttachmentPoint; - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 33; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AttachmentPoint = (byte)bytes[i++]; - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = AttachmentPoint; - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AttachmentPoint: {0}", AttachmentPoint)); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 ObjectDataBlock[] ObjectData; public ObjectAttachPacket() { Header = new LowHeader(); - Header.ID = 137; + Header.ID = 112; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectAttachPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -17862,9 +16358,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -17872,11 +16368,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectAttach ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -17885,51 +16381,6 @@ namespace libsecondlife.Packets /// public class ObjectDetachPacket : Packet { - /// - [XmlType("objectdetach_objectdata")] - public class ObjectDataBlock - { - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - /// [XmlType("objectdetach_agentdata")] public class AgentDataBlock @@ -17976,77 +16427,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectDetach; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectDetachPacket() - { - Header = new LowHeader(); - Header.ID = 138; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectDetachPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectDetachPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectDetach ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectDropPacket : Packet - { /// - [XmlType("objectdrop_objectdata")] + [XmlType("objectdetach_objectdata")] public class ObjectDataBlock { public uint ObjectLocalID; @@ -18090,6 +16472,75 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectDetach; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectDetachPacket() + { + Header = new LowHeader(); + Header.ID = 113; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectDetachPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectDetachPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectDetach ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectDropPacket : Packet + { /// [XmlType("objectdrop_agentdata")] public class AgentDataBlock @@ -18136,77 +16587,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectDrop; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectDropPacket() - { - Header = new LowHeader(); - Header.ID = 139; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectDropPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectDropPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectDrop ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectLinkPacket : Packet - { /// - [XmlType("objectlink_objectdata")] + [XmlType("objectdrop_objectdata")] public class ObjectDataBlock { public uint ObjectLocalID; @@ -18250,6 +16632,75 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectDrop; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectDropPacket() + { + Header = new LowHeader(); + Header.ID = 114; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectDropPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectDropPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectDrop ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectLinkPacket : Packet + { /// [XmlType("objectlink_agentdata")] public class AgentDataBlock @@ -18296,77 +16747,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectLink; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectLinkPacket() - { - Header = new LowHeader(); - Header.ID = 140; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectLinkPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectLinkPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectLink ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectDelinkPacket : Packet - { /// - [XmlType("objectdelink_objectdata")] + [XmlType("objectlink_objectdata")] public class ObjectDataBlock { public uint ObjectLocalID; @@ -18410,6 +16792,75 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectLink; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public ObjectLinkPacket() + { + Header = new LowHeader(); + Header.ID = 115; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectLinkPacket(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++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectLinkPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + 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); + AgentData.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 = "--- ObjectLink ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectDelinkPacket : Packet + { /// [XmlType("objectdelink_agentdata")] public class AgentDataBlock @@ -18456,45 +16907,90 @@ namespace libsecondlife.Packets } } + /// + [XmlType("objectdelink_objectdata")] + public class ObjectDataBlock + { + public uint ObjectLocalID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(ObjectLocalID % 256); + bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public ObjectDelinkPacket() { Header = new LowHeader(); - Header.ID = 141; + Header.ID = 116; Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectDelinkPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -18502,9 +16998,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -18512,379 +17008,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectDelink ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectHingePacket : Packet - { - /// - [XmlType("objecthinge_objectdata")] - public class ObjectDataBlock - { - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - - /// - [XmlType("objecthinge_jointtype")] - public class JointTypeBlock - { - public byte Type; - - [XmlIgnore] - public int Length - { - get - { - return 1; - } - } - - public JointTypeBlock() { } - public JointTypeBlock(byte[] bytes, ref int i) - { - try - { - Type = (byte)bytes[i++]; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = Type; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- JointType --"); - output.Append(String.Format("Type: {0}", Type)); - return output.ToString(); - } - } - - /// - [XmlType("objecthinge_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectHinge; } } - public ObjectDataBlock[] ObjectData; - public JointTypeBlock JointType; - public AgentDataBlock AgentData; - - public ObjectHingePacket() - { - Header = new LowHeader(); - Header.ID = 142; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - JointType = new JointTypeBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectHingePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - JointType = new JointTypeBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectHingePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - JointType = new JointTypeBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += JointType.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - JointType.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectHinge ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += JointType.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectDehingePacket : Packet - { - /// - [XmlType("objectdehinge_objectdata")] - public class ObjectDataBlock - { - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - - /// - [XmlType("objectdehinge_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectDehinge; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public ObjectDehingePacket() - { - Header = new LowHeader(); - Header.ID = 143; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ObjectDehingePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectDehingePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectDehinge ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -18893,55 +17021,6 @@ namespace libsecondlife.Packets /// public class ObjectGrabPacket : Packet { - /// - [XmlType("objectgrab_objectdata")] - public class ObjectDataBlock - { - public LLVector3 GrabOffset; - public uint LocalID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - GrabOffset = new LLVector3(bytes, i); i += 12; - LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("GrabOffset: {0}", GrabOffset)); - output.Append(String.Format("LocalID: {0}", LocalID)); - return output.ToString(); - } - } - /// [XmlType("objectgrab_agentdata")] public class AgentDataBlock @@ -18988,79 +17067,19 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectGrab; } } - public ObjectDataBlock ObjectData; - public AgentDataBlock AgentData; - - public ObjectGrabPacket() - { - Header = new LowHeader(); - Header.ID = 144; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectGrabPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectGrabPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectGrab ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectGrabUpdatePacket : Packet - { /// - [XmlType("objectgrabupdate_objectdata")] + [XmlType("objectgrab_objectdata")] public class ObjectDataBlock { - public uint TimeSinceLast; - public LLUUID ObjectID; - public LLVector3 GrabOffsetInitial; - public LLVector3 GrabPosition; + public uint LocalID; + public LLVector3 GrabOffset; [XmlIgnore] public int Length { get { - return 44; + return 16; } } @@ -19069,10 +17088,8 @@ namespace libsecondlife.Packets { 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; + LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + GrabOffset = new LLVector3(bytes, i); i += 12; } catch (Exception) { @@ -19082,27 +17099,80 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GrabOffsetInitial.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(GrabPosition.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); + Buffer.BlockCopy(GrabOffset.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("TimeSinceLast: {0}", TimeSinceLast)); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("GrabOffsetInitial: {0}", GrabOffsetInitial)); - output.Append(String.Format("GrabPosition: {0}", GrabPosition)); + output.AppendLine(String.Format("LocalID: {0}", LocalID)); + output.Append(String.Format("GrabOffset: {0}", GrabOffset)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectGrab; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public ObjectGrabPacket() + { + Header = new LowHeader(); + Header.ID = 117; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public ObjectGrabPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public ObjectGrabPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ObjectGrab ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ObjectGrabUpdatePacket : Packet + { /// [XmlType("objectgrabupdate_agentdata")] public class AgentDataBlock @@ -19149,76 +17219,21 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectGrabUpdate; } } - public ObjectDataBlock ObjectData; - public AgentDataBlock AgentData; - - public ObjectGrabUpdatePacket() - { - Header = new LowHeader(); - Header.ID = 145; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectGrabUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectGrabUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectGrabUpdate ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectDeGrabPacket : Packet - { /// - [XmlType("objectdegrab_objectdata")] + [XmlType("objectgrabupdate_objectdata")] public class ObjectDataBlock { - public uint LocalID; + public LLUUID ObjectID; + public LLVector3 GrabOffsetInitial; + public LLVector3 GrabPosition; + public uint TimeSinceLast; [XmlIgnore] public int Length { get { - return 4; + return 44; } } @@ -19227,7 +17242,10 @@ namespace libsecondlife.Packets { try { - LocalID = (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; + TimeSinceLast = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -19237,21 +17255,84 @@ namespace libsecondlife.Packets 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); + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GrabOffsetInitial.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(GrabPosition.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = (byte)(TimeSinceLast % 256); + bytes[i++] = (byte)((TimeSinceLast >> 8) % 256); + bytes[i++] = (byte)((TimeSinceLast >> 16) % 256); + bytes[i++] = (byte)((TimeSinceLast >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.Append(String.Format("LocalID: {0}", LocalID)); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.AppendLine(String.Format("GrabOffsetInitial: {0}", GrabOffsetInitial)); + output.AppendLine(String.Format("GrabPosition: {0}", GrabPosition)); + output.Append(String.Format("TimeSinceLast: {0}", TimeSinceLast)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectGrabUpdate; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public ObjectGrabUpdatePacket() + { + Header = new LowHeader(); + Header.ID = 118; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public ObjectGrabUpdatePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public ObjectGrabUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ObjectGrabUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ObjectDeGrabPacket : Packet + { /// [XmlType("objectdegrab_agentdata")] public class AgentDataBlock @@ -19298,75 +17379,18 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectDeGrab; } } - public ObjectDataBlock ObjectData; - public AgentDataBlock AgentData; - - public ObjectDeGrabPacket() - { - Header = new LowHeader(); - Header.ID = 146; - Header.Reliable = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectDeGrabPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectDeGrabPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectDeGrab ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectSpinStartPacket : Packet - { /// - [XmlType("objectspinstart_objectdata")] + [XmlType("objectdegrab_objectdata")] public class ObjectDataBlock { - public LLUUID ObjectID; + public uint LocalID; [XmlIgnore] public int Length { get { - return 16; + return 4; } } @@ -19375,7 +17399,7 @@ namespace libsecondlife.Packets { try { - ObjectID = new LLUUID(bytes, i); i += 16; + LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -19385,18 +17409,78 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(ObjectID.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); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectID: {0}", ObjectID)); + output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectDeGrab; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public ObjectDeGrabPacket() + { + Header = new LowHeader(); + Header.ID = 119; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public ObjectDeGrabPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public ObjectDeGrabPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ObjectDeGrab ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ObjectSpinStartPacket : Packet + { /// [XmlType("objectspinstart_agentdata")] public class AgentDataBlock @@ -19443,77 +17527,18 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectSpinStart; } } - public ObjectDataBlock ObjectData; - public AgentDataBlock AgentData; - - public ObjectSpinStartPacket() - { - Header = new LowHeader(); - Header.ID = 147; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectSpinStartPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectSpinStartPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectSpinStart ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectSpinUpdatePacket : Packet - { /// - [XmlType("objectspinupdate_objectdata")] + [XmlType("objectspinstart_objectdata")] public class ObjectDataBlock { public LLUUID ObjectID; - public LLQuaternion Rotation; [XmlIgnore] public int Length { get { - return 28; + return 16; } } @@ -19523,7 +17548,6 @@ namespace libsecondlife.Packets try { ObjectID = new LLUUID(bytes, i); i += 16; - Rotation = new LLQuaternion(bytes, i, true); i += 12; } catch (Exception) { @@ -19534,19 +17558,74 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.Append(String.Format("Rotation: {0}", Rotation)); + output.Append(String.Format("ObjectID: {0}", ObjectID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectSpinStart; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public ObjectSpinStartPacket() + { + Header = new LowHeader(); + Header.ID = 120; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public ObjectSpinStartPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public ObjectSpinStartPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ObjectSpinStart ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ObjectSpinUpdatePacket : Packet + { /// [XmlType("objectspinupdate_agentdata")] public class AgentDataBlock @@ -19593,76 +17672,19 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectSpinUpdate; } } - public ObjectDataBlock ObjectData; - public AgentDataBlock AgentData; - - public ObjectSpinUpdatePacket() - { - Header = new LowHeader(); - Header.ID = 148; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectSpinUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectSpinUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectSpinUpdate ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectSpinStopPacket : Packet - { /// - [XmlType("objectspinstop_objectdata")] + [XmlType("objectspinupdate_objectdata")] public class ObjectDataBlock { public LLUUID ObjectID; + public LLQuaternion Rotation; [XmlIgnore] public int Length { get { - return 16; + return 28; } } @@ -19672,6 +17694,7 @@ namespace libsecondlife.Packets try { ObjectID = new LLUUID(bytes, i); i += 16; + Rotation = new LLQuaternion(bytes, i, true); i += 12; } catch (Exception) { @@ -19682,17 +17705,76 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectID: {0}", ObjectID)); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.Append(String.Format("Rotation: {0}", Rotation)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectSpinUpdate; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public ObjectSpinUpdatePacket() + { + Header = new LowHeader(); + Header.ID = 121; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public ObjectSpinUpdatePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public ObjectSpinUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ObjectSpinUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ObjectSpinStopPacket : Packet + { /// [XmlType("objectspinstop_agentdata")] public class AgentDataBlock @@ -19739,66 +17821,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectSpinStop; } } - public ObjectDataBlock ObjectData; - public AgentDataBlock AgentData; - - public ObjectSpinStopPacket() - { - Header = new LowHeader(); - Header.ID = 149; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectSpinStopPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectSpinStopPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectSpinStop ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectExportSelectedPacket : Packet - { /// - [XmlType("objectexportselected_objectdata")] + [XmlType("objectspinstop_objectdata")] public class ObjectDataBlock { public LLUUID ObjectID; @@ -19839,6 +17863,63 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectSpinStop; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public ObjectSpinStopPacket() + { + Header = new LowHeader(); + Header.ID = 122; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public ObjectSpinStopPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public ObjectSpinStopPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ObjectSpinStop ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ObjectExportSelectedPacket : Packet + { /// [XmlType("objectexportselected_agentdata")] public class AgentDataBlock @@ -19890,46 +17971,87 @@ namespace libsecondlife.Packets } } + /// + [XmlType("objectexportselected_objectdata")] + public class ObjectDataBlock + { + public LLUUID ObjectID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.Append(String.Format("ObjectID: {0}", ObjectID)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public ObjectExportSelectedPacket() { Header = new LowHeader(); - Header.ID = 150; + Header.ID = 123; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectExportSelectedPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -19937,9 +18059,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -19947,198 +18069,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectExportSelected ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectImportPacket : Packet - { - /// - [XmlType("objectimport_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID FolderID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - FolderID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("FolderID: {0}", FolderID)); - return output.ToString(); - } - } - - /// - [XmlType("objectimport_assetdata")] - public class AssetDataBlock - { - private byte[] _objectname; - public byte[] ObjectName - { - get { return _objectname; } - set - { - if (value == null) { _objectname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _objectname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _objectname, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 16; - if (ObjectName != null) { length += 1 + ObjectName.Length; } - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public AssetDataBlock() { } - public AssetDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _objectname = new byte[length]; - Buffer.BlockCopy(bytes, i, _objectname, 0, length); i += length; - FileID = new LLUUID(bytes, i); i += 16; - length = (ushort)bytes[i++]; - _description = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AssetData --"); - Helpers.FieldToString(output, ObjectName, "ObjectName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("FileID: {0}", FileID)); - Helpers.FieldToString(output, Description, "Description"); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectImport; } } - public AgentDataBlock AgentData; - public AssetDataBlock AssetData; - - public ObjectImportPacket() - { - Header = new LowHeader(); - Header.ID = 151; - Header.Reliable = true; - Header.Zerocoded = true; - AgentData = new AgentDataBlock(); - AssetData = new AssetDataBlock(); - } - - public ObjectImportPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentData = new AgentDataBlock(bytes, ref i); - AssetData = new AssetDataBlock(bytes, ref i); - } - - public ObjectImportPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentData = new AgentDataBlock(bytes, ref i); - AssetData = new AssetDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length; length += AssetData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - AssetData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectImport ---" + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - output += AssetData.ToString() + Environment.NewLine; return output; } @@ -20147,141 +18082,6 @@ namespace libsecondlife.Packets /// public class ModifyLandPacket : Packet { - /// - [XmlType("modifyland_modifyblock")] - public class ModifyBlockBlock - { - public byte BrushSize; - public float Seconds; - public float Height; - public byte Action; - - [XmlIgnore] - public int Length - { - get - { - return 10; - } - } - - public ModifyBlockBlock() { } - public ModifyBlockBlock(byte[] bytes, ref int i) - { - try - { - BrushSize = (byte)bytes[i++]; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Seconds = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Height = BitConverter.ToSingle(bytes, i); i += 4; - Action = (byte)bytes[i++]; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - bytes[i++] = BrushSize; - ba = BitConverter.GetBytes(Seconds); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(Height); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - bytes[i++] = Action; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ModifyBlock --"); - output.AppendLine(String.Format("BrushSize: {0}", BrushSize)); - output.AppendLine(String.Format("Seconds: {0}", Seconds)); - output.AppendLine(String.Format("Height: {0}", Height)); - output.Append(String.Format("Action: {0}", Action)); - return output.ToString(); - } - } - - /// - [XmlType("modifyland_parceldata")] - public class ParcelDataBlock - { - public int LocalID; - public float East; - public float West; - public float North; - public float South; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public ParcelDataBlock() { } - public ParcelDataBlock(byte[] bytes, ref int i) - { - try - { - LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - East = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - West = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - North = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - South = BitConverter.ToSingle(bytes, i); i += 4; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - bytes[i++] = (byte)(LocalID % 256); - bytes[i++] = (byte)((LocalID >> 8) % 256); - bytes[i++] = (byte)((LocalID >> 16) % 256); - bytes[i++] = (byte)((LocalID >> 24) % 256); - ba = BitConverter.GetBytes(East); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(West); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(North); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(South); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.AppendLine(String.Format("East: {0}", East)); - output.AppendLine(String.Format("West: {0}", West)); - output.AppendLine(String.Format("North: {0}", North)); - output.Append(String.Format("South: {0}", South)); - return output.ToString(); - } - } - /// [XmlType("modifyland_agentdata")] public class AgentDataBlock @@ -20328,61 +18128,195 @@ namespace libsecondlife.Packets } } + /// + [XmlType("modifyland_modifyblock")] + public class ModifyBlockBlock + { + public byte Action; + public byte BrushSize; + public float Seconds; + public float Height; + + [XmlIgnore] + public int Length + { + get + { + return 10; + } + } + + public ModifyBlockBlock() { } + public ModifyBlockBlock(byte[] bytes, ref int i) + { + try + { + Action = (byte)bytes[i++]; + 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; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + bytes[i++] = Action; + bytes[i++] = BrushSize; + ba = BitConverter.GetBytes(Seconds); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(Height); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ModifyBlock --"); + output.AppendLine(String.Format("Action: {0}", Action)); + output.AppendLine(String.Format("BrushSize: {0}", BrushSize)); + output.AppendLine(String.Format("Seconds: {0}", Seconds)); + output.Append(String.Format("Height: {0}", Height)); + return output.ToString(); + } + } + + /// + [XmlType("modifyland_parceldata")] + public class ParcelDataBlock + { + public int LocalID; + public float West; + public float South; + public float East; + public float North; + + [XmlIgnore] + public int Length + { + get + { + return 20; + } + } + + public ParcelDataBlock() { } + public ParcelDataBlock(byte[] bytes, ref int i) + { + try + { + LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + West = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + South = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + East = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + North = 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(West); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(South); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(East); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(North); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ParcelData --"); + output.AppendLine(String.Format("LocalID: {0}", LocalID)); + output.AppendLine(String.Format("West: {0}", West)); + output.AppendLine(String.Format("South: {0}", South)); + output.AppendLine(String.Format("East: {0}", East)); + output.Append(String.Format("North: {0}", North)); + return output.ToString(); + } + } + private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.ModifyLand; } } + public AgentDataBlock AgentData; public ModifyBlockBlock ModifyBlock; public ParcelDataBlock[] ParcelData; - public AgentDataBlock AgentData; public ModifyLandPacket() { Header = new LowHeader(); - Header.ID = 152; + Header.ID = 124; Header.Reliable = true; - Header.Zerocoded = true; + AgentData = new AgentDataBlock(); 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); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += ModifyBlock.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); + AgentData.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; } @@ -20390,12 +18324,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ModifyLand ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; output += ModifyBlock.ToString() + Environment.NewLine; for (int j = 0; j < ParcelData.Length; j++) { output += ParcelData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -20458,7 +18392,7 @@ namespace libsecondlife.Packets public VelocityInterpolateOnPacket() { Header = new LowHeader(); - Header.ID = 153; + Header.ID = 125; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -20478,7 +18412,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -20555,7 +18489,7 @@ namespace libsecondlife.Packets public VelocityInterpolateOffPacket() { Header = new LowHeader(); - Header.ID = 154; + Header.ID = 126; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -20575,7 +18509,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -20598,6 +18532,52 @@ namespace libsecondlife.Packets /// public class StateSavePacket : Packet { + /// + [XmlType("statesave_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("statesave_datablock")] public class DataBlockBlock @@ -20657,92 +18637,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("statesave_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 DataBlockBlock DataBlock; public StateSavePacket() { Header = new LowHeader(); - Header.ID = 155; + Header.ID = 127; Header.Reliable = true; - DataBlock = new DataBlockBlock(); AgentData = new AgentDataBlock(); + DataBlock = new DataBlockBlock(); } 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); + DataBlock = new DataBlockBlock(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); + DataBlock = new DataBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += DataBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.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); - DataBlock.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + DataBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -20750,8 +18684,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- StateSave ---" + Environment.NewLine; - output += DataBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += DataBlock.ToString() + Environment.NewLine; return output; } @@ -20820,7 +18754,7 @@ namespace libsecondlife.Packets public ReportAutosaveCrashPacket() { Header = new LowHeader(); - Header.ID = 156; + Header.ID = 128; Header.Reliable = true; AutosaveData = new AutosaveDataBlock(); } @@ -20840,7 +18774,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AutosaveData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -20863,6 +18797,52 @@ namespace libsecondlife.Packets /// public class SimWideDeletesPacket : Packet { + /// + [XmlType("simwidedeletes_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("simwidedeletes_datablock")] public class DataBlockBlock @@ -20912,92 +18892,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("simwidedeletes_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 DataBlockBlock DataBlock; public SimWideDeletesPacket() { Header = new LowHeader(); - Header.ID = 157; + Header.ID = 129; Header.Reliable = true; - DataBlock = new DataBlockBlock(); AgentData = new AgentDataBlock(); + DataBlock = new DataBlockBlock(); } 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); + DataBlock = new DataBlockBlock(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); + DataBlock = new DataBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += DataBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.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); - DataBlock.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + DataBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -21005,8 +18939,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- SimWideDeletes ---" + Environment.NewLine; - output += DataBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += DataBlock.ToString() + Environment.NewLine; return output; } @@ -21015,48 +18949,6 @@ namespace libsecondlife.Packets /// public class TrackAgentPacket : Packet { - /// - [XmlType("trackagent_targetdata")] - public class TargetDataBlock - { - public LLUUID PreyID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TargetDataBlock() { } - public TargetDataBlock(byte[] bytes, ref int i) - { - try - { - PreyID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(PreyID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TargetData --"); - output.Append(String.Format("PreyID: {0}", PreyID)); - return output.ToString(); - } - } - /// [XmlType("trackagent_agentdata")] public class AgentDataBlock @@ -21103,46 +18995,88 @@ namespace libsecondlife.Packets } } + /// + [XmlType("trackagent_targetdata")] + public class TargetDataBlock + { + public LLUUID PreyID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public TargetDataBlock() { } + public TargetDataBlock(byte[] bytes, ref int i) + { + try + { + PreyID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(PreyID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TargetData --"); + output.Append(String.Format("PreyID: {0}", PreyID)); + return output.ToString(); + } + } + 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 TargetDataBlock TargetData; public TrackAgentPacket() { Header = new LowHeader(); - Header.ID = 158; + Header.ID = 130; Header.Reliable = true; - TargetData = new TargetDataBlock(); AgentData = new AgentDataBlock(); + TargetData = new TargetDataBlock(); } 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); + TargetData = new TargetDataBlock(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); + TargetData = new TargetDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += TargetData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += TargetData.Length;; 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); + TargetData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -21150,8 +19084,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- TrackAgent ---" + Environment.NewLine; - output += TargetData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += TargetData.ToString() + Environment.NewLine; return output; } @@ -21160,13 +19094,188 @@ namespace libsecondlife.Packets /// public class ViewerStatsPacket : Packet { + /// + [XmlType("viewerstats_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public uint IP; + public uint StartTime; + public float RunTime; + public float SimFPS; + public float FPS; + public byte AgentsInView; + public float Ping; + public double MetersTraveled; + public int RegionsVisited; + public uint SysRAM; + 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]; Buffer.BlockCopy(value, 0, _sysos, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _syscpu, 0, 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]; Buffer.BlockCopy(value, 0, _sysgpu, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 73; + if (SysOS != null) { length += 1 + SysOS.Length; } + if (SysCPU != null) { length += 1 + SysCPU.Length; } + if (SysGPU != null) { length += 1 + SysGPU.Length; } + return length; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + IP = (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)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + RunTime = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + SimFPS = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + FPS = BitConverter.ToSingle(bytes, i); i += 4; + AgentsInView = (byte)bytes[i++]; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Ping = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8); + MetersTraveled = BitConverter.ToDouble(bytes, i); i += 8; + RegionsVisited = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SysRAM = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _sysos = new byte[length]; + Buffer.BlockCopy(bytes, i, _sysos, 0, length); i += length; + length = (ushort)bytes[i++]; + _syscpu = new byte[length]; + Buffer.BlockCopy(bytes, i, _syscpu, 0, length); i += length; + length = (ushort)bytes[i++]; + _sysgpu = new byte[length]; + Buffer.BlockCopy(bytes, i, _sysgpu, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + 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)(StartTime % 256); + bytes[i++] = (byte)((StartTime >> 8) % 256); + bytes[i++] = (byte)((StartTime >> 16) % 256); + bytes[i++] = (byte)((StartTime >> 24) % 256); + ba = BitConverter.GetBytes(RunTime); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(SimFPS); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(FPS); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = AgentsInView; + ba = BitConverter.GetBytes(Ping); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(MetersTraveled); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); } + Buffer.BlockCopy(ba, 0, bytes, i, 8); i += 8; + bytes[i++] = (byte)(RegionsVisited % 256); + bytes[i++] = (byte)((RegionsVisited >> 8) % 256); + bytes[i++] = (byte)((RegionsVisited >> 16) % 256); + bytes[i++] = (byte)((RegionsVisited >> 24) % 256); + bytes[i++] = (byte)(SysRAM % 256); + bytes[i++] = (byte)((SysRAM >> 8) % 256); + bytes[i++] = (byte)((SysRAM >> 16) % 256); + bytes[i++] = (byte)((SysRAM >> 24) % 256); + if(SysOS == null) { Console.WriteLine("Warning: SysOS is null, in " + this.GetType()); } + bytes[i++] = (byte)SysOS.Length; + Buffer.BlockCopy(SysOS, 0, bytes, i, SysOS.Length); i += SysOS.Length; + if(SysCPU == null) { Console.WriteLine("Warning: SysCPU is null, in " + this.GetType()); } + bytes[i++] = (byte)SysCPU.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(SysGPU, 0, bytes, i, SysGPU.Length); i += SysGPU.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("IP: {0}", IP)); + output.AppendLine(String.Format("StartTime: {0}", StartTime)); + output.AppendLine(String.Format("RunTime: {0}", RunTime)); + output.AppendLine(String.Format("SimFPS: {0}", SimFPS)); + output.AppendLine(String.Format("FPS: {0}", FPS)); + output.AppendLine(String.Format("AgentsInView: {0}", AgentsInView)); + output.AppendLine(String.Format("Ping: {0}", Ping)); + output.AppendLine(String.Format("MetersTraveled: {0}", MetersTraveled)); + output.AppendLine(String.Format("RegionsVisited: {0}", RegionsVisited)); + output.AppendLine(String.Format("SysRAM: {0}", SysRAM)); + Helpers.FieldToString(output, SysOS, "SysOS"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, SysCPU, "SysCPU"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, SysGPU, "SysGPU"); + return output.ToString(); + } + } + /// [XmlType("viewerstats_downloadtotals")] public class DownloadTotalsBlock { + public uint World; public uint Objects; public uint Textures; - public uint World; [XmlIgnore] public int Length @@ -21182,9 +19291,9 @@ namespace libsecondlife.Packets { try { + World = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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) { @@ -21194,6 +19303,10 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + bytes[i++] = (byte)(World % 256); + bytes[i++] = (byte)((World >> 8) % 256); + bytes[i++] = (byte)((World >> 16) % 256); + bytes[i++] = (byte)((World >> 24) % 256); bytes[i++] = (byte)(Objects % 256); bytes[i++] = (byte)((Objects >> 8) % 256); bytes[i++] = (byte)((Objects >> 16) % 256); @@ -21202,19 +19315,161 @@ namespace libsecondlife.Packets 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() { StringBuilder output = new StringBuilder(); output.AppendLine("-- DownloadTotals --"); + output.AppendLine(String.Format("World: {0}", World)); output.AppendLine(String.Format("Objects: {0}", Objects)); - output.AppendLine(String.Format("Textures: {0}", Textures)); - output.Append(String.Format("World: {0}", World)); + output.Append(String.Format("Textures: {0}", Textures)); + return output.ToString(); + } + } + + /// + [XmlType("viewerstats_netstats")] + public class NetStatsBlock + { + public uint Bytes; + public uint Packets; + public uint Compressed; + public uint Savings; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public NetStatsBlock() { } + public NetStatsBlock(byte[] bytes, ref int i) + { + try + { + Bytes = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Packets = (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)); + Savings = (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)(Bytes % 256); + bytes[i++] = (byte)((Bytes >> 8) % 256); + bytes[i++] = (byte)((Bytes >> 16) % 256); + bytes[i++] = (byte)((Bytes >> 24) % 256); + 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)(Compressed % 256); + bytes[i++] = (byte)((Compressed >> 8) % 256); + bytes[i++] = (byte)((Compressed >> 16) % 256); + bytes[i++] = (byte)((Compressed >> 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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- NetStats --"); + output.AppendLine(String.Format("Bytes: {0}", Bytes)); + output.AppendLine(String.Format("Packets: {0}", Packets)); + output.AppendLine(String.Format("Compressed: {0}", Compressed)); + output.Append(String.Format("Savings: {0}", Savings)); + return output.ToString(); + } + } + + /// + [XmlType("viewerstats_failstats")] + public class FailStatsBlock + { + public uint SendPacket; + public uint Dropped; + public uint Resent; + public uint FailedResends; + public uint OffCircuit; + public uint Invalid; + + [XmlIgnore] + public int Length + { + get + { + return 24; + } + } + + public FailStatsBlock() { } + public FailStatsBlock(byte[] bytes, ref int i) + { + try + { + 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)); + Resent = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + FailedResends = (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)); + Invalid = (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)(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)(Resent % 256); + bytes[i++] = (byte)((Resent >> 8) % 256); + bytes[i++] = (byte)((Resent >> 16) % 256); + bytes[i++] = (byte)((Resent >> 24) % 256); + 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)(OffCircuit % 256); + bytes[i++] = (byte)((OffCircuit >> 8) % 256); + bytes[i++] = (byte)((OffCircuit >> 16) % 256); + bytes[i++] = (byte)((OffCircuit >> 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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- FailStats --"); + output.AppendLine(String.Format("SendPacket: {0}", SendPacket)); + output.AppendLine(String.Format("Dropped: {0}", Dropped)); + output.AppendLine(String.Format("Resent: {0}", Resent)); + output.AppendLine(String.Format("FailedResends: {0}", FailedResends)); + output.AppendLine(String.Format("OffCircuit: {0}", OffCircuit)); + output.Append(String.Format("Invalid: {0}", Invalid)); return output.ToString(); } } @@ -21272,397 +19527,75 @@ namespace libsecondlife.Packets } } - /// - [XmlType("viewerstats_netstats")] - public class NetStatsBlock - { - public uint Packets; - public uint Savings; - public uint Compressed; - public uint Bytes; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public NetStatsBlock() { } - public NetStatsBlock(byte[] bytes, ref int i) - { - try - { - Packets = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Savings = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Compressed = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Bytes = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(Packets % 256); - bytes[i++] = (byte)((Packets >> 8) % 256); - bytes[i++] = (byte)((Packets >> 16) % 256); - bytes[i++] = (byte)((Packets >> 24) % 256); - bytes[i++] = (byte)(Savings % 256); - bytes[i++] = (byte)((Savings >> 8) % 256); - bytes[i++] = (byte)((Savings >> 16) % 256); - bytes[i++] = (byte)((Savings >> 24) % 256); - bytes[i++] = (byte)(Compressed % 256); - bytes[i++] = (byte)((Compressed >> 8) % 256); - bytes[i++] = (byte)((Compressed >> 16) % 256); - bytes[i++] = (byte)((Compressed >> 24) % 256); - bytes[i++] = (byte)(Bytes % 256); - bytes[i++] = (byte)((Bytes >> 8) % 256); - bytes[i++] = (byte)((Bytes >> 16) % 256); - bytes[i++] = (byte)((Bytes >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- NetStats --"); - output.AppendLine(String.Format("Packets: {0}", Packets)); - output.AppendLine(String.Format("Savings: {0}", Savings)); - output.AppendLine(String.Format("Compressed: {0}", Compressed)); - output.Append(String.Format("Bytes: {0}", Bytes)); - return output.ToString(); - } - } - - /// - [XmlType("viewerstats_failstats")] - public class FailStatsBlock - { - public uint FailedResends; - public uint Invalid; - public uint SendPacket; - public uint Dropped; - public uint OffCircuit; - public uint Resent; - - [XmlIgnore] - public int Length - { - get - { - return 24; - } - } - - public FailStatsBlock() { } - public FailStatsBlock(byte[] bytes, ref int i) - { - try - { - FailedResends = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Invalid = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SendPacket = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Dropped = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - OffCircuit = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Resent = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(FailedResends % 256); - bytes[i++] = (byte)((FailedResends >> 8) % 256); - bytes[i++] = (byte)((FailedResends >> 16) % 256); - bytes[i++] = (byte)((FailedResends >> 24) % 256); - bytes[i++] = (byte)(Invalid % 256); - bytes[i++] = (byte)((Invalid >> 8) % 256); - bytes[i++] = (byte)((Invalid >> 16) % 256); - bytes[i++] = (byte)((Invalid >> 24) % 256); - bytes[i++] = (byte)(SendPacket % 256); - bytes[i++] = (byte)((SendPacket >> 8) % 256); - bytes[i++] = (byte)((SendPacket >> 16) % 256); - bytes[i++] = (byte)((SendPacket >> 24) % 256); - bytes[i++] = (byte)(Dropped % 256); - bytes[i++] = (byte)((Dropped >> 8) % 256); - bytes[i++] = (byte)((Dropped >> 16) % 256); - bytes[i++] = (byte)((Dropped >> 24) % 256); - bytes[i++] = (byte)(OffCircuit % 256); - bytes[i++] = (byte)((OffCircuit >> 8) % 256); - bytes[i++] = (byte)((OffCircuit >> 16) % 256); - bytes[i++] = (byte)((OffCircuit >> 24) % 256); - bytes[i++] = (byte)(Resent % 256); - bytes[i++] = (byte)((Resent >> 8) % 256); - bytes[i++] = (byte)((Resent >> 16) % 256); - bytes[i++] = (byte)((Resent >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- FailStats --"); - output.AppendLine(String.Format("FailedResends: {0}", FailedResends)); - output.AppendLine(String.Format("Invalid: {0}", Invalid)); - output.AppendLine(String.Format("SendPacket: {0}", SendPacket)); - output.AppendLine(String.Format("Dropped: {0}", Dropped)); - output.AppendLine(String.Format("OffCircuit: {0}", OffCircuit)); - output.Append(String.Format("Resent: {0}", Resent)); - return output.ToString(); - } - } - - /// - [XmlType("viewerstats_agentdata")] - public class AgentDataBlock - { - public uint IP; - public byte AgentsInView; - public float FPS; - public LLUUID AgentID; - public int RegionsVisited; - public LLUUID SessionID; - public float Ping; - public float RunTime; - public double MetersTraveled; - public float SimFPS; - private byte[] _syscpu; - public byte[] SysCPU - { - get { return _syscpu; } - set - { - if (value == null) { _syscpu = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _syscpu = new byte[value.Length]; Buffer.BlockCopy(value, 0, _syscpu, 0, 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]; Buffer.BlockCopy(value, 0, _sysgpu, 0, 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]; Buffer.BlockCopy(value, 0, _sysos, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 73; - if (SysCPU != null) { length += 1 + SysCPU.Length; } - if (SysGPU != null) { length += 1 + SysGPU.Length; } - if (SysOS != null) { length += 1 + SysOS.Length; } - return length; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - AgentsInView = (byte)bytes[i++]; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - FPS = BitConverter.ToSingle(bytes, i); i += 4; - AgentID = new LLUUID(bytes, i); i += 16; - RegionsVisited = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SessionID = new LLUUID(bytes, i); i += 16; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Ping = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - RunTime = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8); - MetersTraveled = BitConverter.ToDouble(bytes, i); i += 8; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - SimFPS = BitConverter.ToSingle(bytes, i); i += 4; - length = (ushort)bytes[i++]; - _syscpu = new byte[length]; - Buffer.BlockCopy(bytes, i, _syscpu, 0, length); i += length; - length = (ushort)bytes[i++]; - _sysgpu = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _sysos, 0, length); i += length; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - bytes[i++] = (byte)(IP % 256); - bytes[i++] = (byte)((IP >> 8) % 256); - bytes[i++] = (byte)((IP >> 16) % 256); - bytes[i++] = (byte)((IP >> 24) % 256); - bytes[i++] = AgentsInView; - ba = BitConverter.GetBytes(FPS); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(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); - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(Ping); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(RunTime); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(MetersTraveled); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); } - Buffer.BlockCopy(ba, 0, bytes, i, 8); i += 8; - ba = BitConverter.GetBytes(SimFPS); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - if(SysCPU == null) { Console.WriteLine("Warning: SysCPU is null, in " + this.GetType()); } - bytes[i++] = (byte)SysCPU.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(SysOS, 0, bytes, i, SysOS.Length); i += SysOS.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("IP: {0}", IP)); - output.AppendLine(String.Format("AgentsInView: {0}", AgentsInView)); - output.AppendLine(String.Format("FPS: {0}", FPS)); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("RegionsVisited: {0}", RegionsVisited)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("Ping: {0}", Ping)); - output.AppendLine(String.Format("RunTime: {0}", RunTime)); - output.AppendLine(String.Format("MetersTraveled: {0}", MetersTraveled)); - output.AppendLine(String.Format("SimFPS: {0}", SimFPS)); - Helpers.FieldToString(output, SysCPU, "SysCPU"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, SysGPU, "SysGPU"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("SysRAM: {0}", SysRAM)); - output.AppendLine(String.Format("StartTime: {0}", StartTime)); - Helpers.FieldToString(output, SysOS, "SysOS"); - return output.ToString(); - } - } - private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.ViewerStats; } } + public AgentDataBlock AgentData; public DownloadTotalsBlock DownloadTotals; - public MiscStatsBlock[] MiscStats; public NetStatsBlock[] NetStats; public FailStatsBlock FailStats; - public AgentDataBlock AgentData; + public MiscStatsBlock[] MiscStats; public ViewerStatsPacket() { Header = new LowHeader(); - Header.ID = 159; + Header.ID = 131; Header.Reliable = true; - Header.Zerocoded = true; + AgentData = new AgentDataBlock(); DownloadTotals = new DownloadTotalsBlock(); - MiscStats = new MiscStatsBlock[0]; NetStats = new NetStatsBlock[2]; FailStats = new FailStatsBlock(); - AgentData = new AgentDataBlock(); + MiscStats = new MiscStatsBlock[0]; } public ViewerStatsPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); 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); + int count = (int)bytes[i++]; + MiscStats = new MiscStatsBlock[count]; + for (int j = 0; j < count; j++) + { MiscStats[j] = new MiscStatsBlock(bytes, ref i); } } public ViewerStatsPacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); 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); + int count = (int)bytes[i++]; + MiscStats = new MiscStatsBlock[count]; + for (int j = 0; j < count; j++) + { MiscStats[j] = new MiscStatsBlock(bytes, ref i); } } public override byte[] ToBytes() { - int length = 8; - length += DownloadTotals.Length; length += FailStats.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += DownloadTotals.Length; length += FailStats.Length;; + for (int j = 0; j < 2; j++) { length += NetStats[j].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); + AgentData.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); + bytes[i++] = (byte)MiscStats.Length; + for (int j = 0; j < MiscStats.Length; j++) { MiscStats[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -21670,17 +19603,17 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ViewerStats ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; output += DownloadTotals.ToString() + Environment.NewLine; - for (int j = 0; j < MiscStats.Length; j++) - { - output += MiscStats[j].ToString() + Environment.NewLine; - } for (int j = 0; j < 2; j++) { output += NetStats[j].ToString() + Environment.NewLine; } output += FailStats.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < MiscStats.Length; j++) + { + output += MiscStats[j].ToString() + Environment.NewLine; + } return output; } @@ -21689,6 +19622,52 @@ namespace libsecondlife.Packets /// public class ScriptAnswerYesPacket : Packet { + /// + [XmlType("scriptansweryes_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("scriptansweryes_data")] public class DataBlock @@ -21742,92 +19721,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("scriptansweryes_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 DataBlock Data; public ScriptAnswerYesPacket() { Header = new LowHeader(); - Header.ID = 160; + Header.ID = 132; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -21835,8 +19768,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ScriptAnswerYes ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -21845,159 +19778,6 @@ namespace libsecondlife.Packets /// public class UserReportPacket : Packet { - /// - [XmlType("userreport_reportdata")] - public class ReportDataBlock - { - public LLUUID ObjectID; - private byte[] _details; - public byte[] Details - { - get { return _details; } - set - { - if (value == null) { _details = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _details = new byte[value.Length]; Buffer.BlockCopy(value, 0, _details, 0, 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]; Buffer.BlockCopy(value, 0, _versionstring, 0, value.Length); } - } - } - public LLUUID AbuseRegionID; - public byte CheckFlags; - public byte Category; - private byte[] _summary; - public byte[] Summary - { - get { return _summary; } - set - { - if (value == null) { _summary = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _summary = new byte[value.Length]; Buffer.BlockCopy(value, 0, _summary, 0, value.Length); } - } - } - public byte ReportType; - public LLUUID AbuserID; - private byte[] _abuseregionname; - public byte[] AbuseRegionName - { - get { return _abuseregionname; } - set - { - if (value == null) { _abuseregionname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _abuseregionname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _abuseregionname, 0, value.Length); } - } - } - public LLUUID ScreenshotID; - public LLVector3 Position; - - [XmlIgnore] - public int Length - { - get - { - int length = 79; - if (Details != null) { length += 2 + Details.Length; } - if (VersionString != null) { length += 1 + VersionString.Length; } - if (Summary != null) { length += 1 + Summary.Length; } - if (AbuseRegionName != null) { length += 1 + AbuseRegionName.Length; } - return length; - } - } - - public ReportDataBlock() { } - public ReportDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _details = new byte[length]; - Buffer.BlockCopy(bytes, i, _details, 0, length); i += length; - length = (ushort)bytes[i++]; - _versionstring = new byte[length]; - Buffer.BlockCopy(bytes, i, _versionstring, 0, length); i += length; - AbuseRegionID = new LLUUID(bytes, i); i += 16; - CheckFlags = (byte)bytes[i++]; - Category = (byte)bytes[i++]; - length = (ushort)bytes[i++]; - _summary = new byte[length]; - Buffer.BlockCopy(bytes, i, _summary, 0, length); i += length; - ReportType = (byte)bytes[i++]; - AbuserID = new LLUUID(bytes, i); i += 16; - length = (ushort)bytes[i++]; - _abuseregionname = new byte[length]; - Buffer.BlockCopy(bytes, i, _abuseregionname, 0, length); i += length; - ScreenshotID = new LLUUID(bytes, i); i += 16; - Position = new LLVector3(bytes, i); i += 12; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(VersionString, 0, bytes, i, VersionString.Length); i += VersionString.Length; - Buffer.BlockCopy(AbuseRegionID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = CheckFlags; - bytes[i++] = Category; - if(Summary == null) { Console.WriteLine("Warning: Summary is null, in " + this.GetType()); } - bytes[i++] = (byte)Summary.Length; - Buffer.BlockCopy(Summary, 0, bytes, i, Summary.Length); i += Summary.Length; - bytes[i++] = ReportType; - Buffer.BlockCopy(AbuserID.GetBytes(), 0, bytes, i, 16); i += 16; - if(AbuseRegionName == null) { Console.WriteLine("Warning: AbuseRegionName is null, in " + this.GetType()); } - bytes[i++] = (byte)AbuseRegionName.Length; - Buffer.BlockCopy(AbuseRegionName, 0, bytes, i, AbuseRegionName.Length); i += AbuseRegionName.Length; - Buffer.BlockCopy(ScreenshotID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ReportData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - Helpers.FieldToString(output, Details, "Details"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, VersionString, "VersionString"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("AbuseRegionID: {0}", AbuseRegionID)); - output.AppendLine(String.Format("CheckFlags: {0}", CheckFlags)); - output.AppendLine(String.Format("Category: {0}", Category)); - Helpers.FieldToString(output, Summary, "Summary"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ReportType: {0}", ReportType)); - output.AppendLine(String.Format("AbuserID: {0}", AbuserID)); - Helpers.FieldToString(output, AbuseRegionName, "AbuseRegionName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ScreenshotID: {0}", ScreenshotID)); - output.Append(String.Format("Position: {0}", Position)); - return output.ToString(); - } - } - /// [XmlType("userreport_agentdata")] public class AgentDataBlock @@ -22044,47 +19824,198 @@ namespace libsecondlife.Packets } } + /// + [XmlType("userreport_reportdata")] + public class ReportDataBlock + { + public byte ReportType; + public byte Category; + public LLVector3 Position; + public byte CheckFlags; + public LLUUID ScreenshotID; + public LLUUID ObjectID; + public LLUUID AbuserID; + private byte[] _abuseregionname; + public byte[] AbuseRegionName + { + get { return _abuseregionname; } + set + { + if (value == null) { _abuseregionname = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _abuseregionname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _abuseregionname, 0, value.Length); } + } + } + public LLUUID AbuseRegionID; + 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]; Buffer.BlockCopy(value, 0, _summary, 0, value.Length); } + } + } + private byte[] _details; + public byte[] Details + { + get { return _details; } + set + { + if (value == null) { _details = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _details = new byte[value.Length]; Buffer.BlockCopy(value, 0, _details, 0, 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]; Buffer.BlockCopy(value, 0, _versionstring, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 79; + if (AbuseRegionName != null) { length += 1 + AbuseRegionName.Length; } + if (Summary != null) { length += 1 + Summary.Length; } + if (Details != null) { length += 2 + Details.Length; } + if (VersionString != null) { length += 1 + VersionString.Length; } + return length; + } + } + + public ReportDataBlock() { } + public ReportDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ReportType = (byte)bytes[i++]; + Category = (byte)bytes[i++]; + Position = new LLVector3(bytes, i); i += 12; + CheckFlags = (byte)bytes[i++]; + ScreenshotID = new LLUUID(bytes, i); i += 16; + ObjectID = new LLUUID(bytes, i); i += 16; + AbuserID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _abuseregionname = new byte[length]; + Buffer.BlockCopy(bytes, i, _abuseregionname, 0, length); i += length; + AbuseRegionID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _summary = new byte[length]; + Buffer.BlockCopy(bytes, i, _summary, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _details = new byte[length]; + Buffer.BlockCopy(bytes, i, _details, 0, length); i += length; + length = (ushort)bytes[i++]; + _versionstring = new byte[length]; + Buffer.BlockCopy(bytes, i, _versionstring, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = ReportType; + bytes[i++] = Category; + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = CheckFlags; + Buffer.BlockCopy(ScreenshotID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AbuserID.GetBytes(), 0, bytes, i, 16); i += 16; + if(AbuseRegionName == null) { Console.WriteLine("Warning: AbuseRegionName is null, in " + this.GetType()); } + bytes[i++] = (byte)AbuseRegionName.Length; + Buffer.BlockCopy(AbuseRegionName, 0, bytes, i, AbuseRegionName.Length); i += AbuseRegionName.Length; + Buffer.BlockCopy(AbuseRegionID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Summary == null) { Console.WriteLine("Warning: Summary is null, in " + this.GetType()); } + bytes[i++] = (byte)Summary.Length; + Buffer.BlockCopy(Summary, 0, bytes, i, Summary.Length); i += Summary.Length; + 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); + Buffer.BlockCopy(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; + Buffer.BlockCopy(VersionString, 0, bytes, i, VersionString.Length); i += VersionString.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ReportData --"); + output.AppendLine(String.Format("ReportType: {0}", ReportType)); + output.AppendLine(String.Format("Category: {0}", Category)); + output.AppendLine(String.Format("Position: {0}", Position)); + output.AppendLine(String.Format("CheckFlags: {0}", CheckFlags)); + output.AppendLine(String.Format("ScreenshotID: {0}", ScreenshotID)); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.AppendLine(String.Format("AbuserID: {0}", AbuserID)); + Helpers.FieldToString(output, AbuseRegionName, "AbuseRegionName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("AbuseRegionID: {0}", AbuseRegionID)); + Helpers.FieldToString(output, Summary, "Summary"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Details, "Details"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, VersionString, "VersionString"); + return output.ToString(); + } + } + private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.UserReport; } } - public ReportDataBlock ReportData; public AgentDataBlock AgentData; + public ReportDataBlock ReportData; public UserReportPacket() { Header = new LowHeader(); - Header.ID = 161; + Header.ID = 133; Header.Reliable = true; - Header.Zerocoded = true; - ReportData = new ReportDataBlock(); AgentData = new AgentDataBlock(); + ReportData = new ReportDataBlock(); } public UserReportPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); - ReportData = new ReportDataBlock(bytes, ref i); AgentData = new AgentDataBlock(bytes, ref i); + ReportData = new ReportDataBlock(bytes, ref i); } public UserReportPacket(Header head, byte[] bytes, ref int i) { Header = head; - ReportData = new ReportDataBlock(bytes, ref i); AgentData = new AgentDataBlock(bytes, ref i); + ReportData = new ReportDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ReportData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += ReportData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); - ReportData.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + ReportData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -22092,8 +20023,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- UserReport ---" + Environment.NewLine; - output += ReportData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ReportData.ToString() + Environment.NewLine; return output; } @@ -22169,7 +20100,7 @@ namespace libsecondlife.Packets public AlertMessagePacket() { Header = new LowHeader(); - Header.ID = 162; + Header.ID = 134; Header.Reliable = true; AlertData = new AlertDataBlock(); } @@ -22189,7 +20120,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AlertData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -22212,70 +20143,6 @@ namespace libsecondlife.Packets /// public class AgentAlertMessagePacket : Packet { - /// - [XmlType("agentalertmessage_alertdata")] - public class AlertDataBlock - { - private byte[] _message; - public byte[] Message - { - get { return _message; } - set - { - if (value == null) { _message = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } - } - } - public bool Modal; - - [XmlIgnore] - public int Length - { - get - { - int length = 1; - if (Message != null) { length += 1 + Message.Length; } - return length; - } - } - - public AlertDataBlock() { } - public AlertDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _message = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; - bytes[i++] = (byte)((Modal) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AlertData --"); - Helpers.FieldToString(output, Message, "Message"); - output.Append(Environment.NewLine); - output.Append(String.Format("Modal: {0}", Modal)); - return output.ToString(); - } - } - /// [XmlType("agentalertmessage_agentdata")] public class AgentDataBlock @@ -22318,46 +20185,109 @@ namespace libsecondlife.Packets } } + /// + [XmlType("agentalertmessage_alertdata")] + public class AlertDataBlock + { + public bool Modal; + 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]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 1; + if (Message != null) { length += 1 + Message.Length; } + return length; + } + } + + public AlertDataBlock() { } + public AlertDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + Modal = (bytes[i++] != 0) ? (bool)true : (bool)false; + length = (ushort)bytes[i++]; + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)((Modal) ? 1 : 0); + if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); } + bytes[i++] = (byte)Message.Length; + Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AlertData --"); + output.AppendLine(String.Format("Modal: {0}", Modal)); + Helpers.FieldToString(output, Message, "Message"); + return output.ToString(); + } + } + 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 AlertDataBlock AlertData; public AgentAlertMessagePacket() { Header = new LowHeader(); - Header.ID = 163; + Header.ID = 135; Header.Reliable = true; - AlertData = new AlertDataBlock(); AgentData = new AgentDataBlock(); + AlertData = new AlertDataBlock(); } 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); + AlertData = new AlertDataBlock(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); + AlertData = new AlertDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += AlertData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + AlertData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -22365,8 +20295,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentAlertMessage ---" + Environment.NewLine; - output += AlertData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += AlertData.ToString() + Environment.NewLine; return output; } @@ -22379,11 +20309,11 @@ namespace libsecondlife.Packets [XmlType("meancollisionalert_meancollision")] public class MeanCollisionBlock { - public float Mag; - public uint Time; - public LLUUID Perp; - public byte Type; public LLUUID Victim; + public LLUUID Perp; + public uint Time; + public float Mag; + public byte Type; [XmlIgnore] public int Length @@ -22399,12 +20329,12 @@ namespace libsecondlife.Packets { try { + Victim = new LLUUID(bytes, i); i += 16; + Perp = new LLUUID(bytes, i); i += 16; + Time = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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) { @@ -22415,27 +20345,27 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - ba = BitConverter.GetBytes(Mag); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + Buffer.BlockCopy(Victim.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Perp.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); - Buffer.BlockCopy(Perp.GetBytes(), 0, bytes, i, 16); i += 16; + ba = BitConverter.GetBytes(Mag); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; bytes[i++] = Type; - Buffer.BlockCopy(Victim.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- MeanCollision --"); - output.AppendLine(String.Format("Mag: {0}", Mag)); - output.AppendLine(String.Format("Time: {0}", Time)); + output.AppendLine(String.Format("Victim: {0}", Victim)); output.AppendLine(String.Format("Perp: {0}", Perp)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("Victim: {0}", Victim)); + output.AppendLine(String.Format("Time: {0}", Time)); + output.AppendLine(String.Format("Mag: {0}", Mag)); + output.Append(String.Format("Type: {0}", Type)); return output.ToString(); } } @@ -22448,9 +20378,8 @@ namespace libsecondlife.Packets public MeanCollisionAlertPacket() { Header = new LowHeader(); - Header.ID = 164; + Header.ID = 136; Header.Reliable = true; - Header.Zerocoded = true; MeanCollision = new MeanCollisionBlock[0]; } @@ -22475,7 +20404,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < MeanCollision.Length; j++) { length += MeanCollision[j].Length; } @@ -22554,7 +20483,7 @@ namespace libsecondlife.Packets public ViewerFrozenMessagePacket() { Header = new LowHeader(); - Header.ID = 165; + Header.ID = 137; Header.Reliable = true; FrozenData = new FrozenDataBlock(); } @@ -22574,7 +20503,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += FrozenData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -22651,9 +20580,8 @@ namespace libsecondlife.Packets public HealthMessagePacket() { Header = new LowHeader(); - Header.ID = 166; + Header.ID = 138; Header.Reliable = true; - Header.Zerocoded = true; HealthData = new HealthDataBlock(); } @@ -22672,7 +20600,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += HealthData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -22699,20 +20627,6 @@ namespace libsecondlife.Packets [XmlType("chatfromsimulator_chatdata")] public class ChatDataBlock { - private byte[] _message; - public byte[] Message - { - get { return _message; } - set - { - if (value == null) { _message = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } - } - } - public byte Audible; - public byte ChatType; - public LLUUID OwnerID; private byte[] _fromname; public byte[] FromName { @@ -22724,9 +20638,23 @@ namespace libsecondlife.Packets else { _fromname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _fromname, 0, value.Length); } } } - public byte SourceType; public LLUUID SourceID; + public LLUUID OwnerID; + public byte SourceType; + public byte ChatType; + public byte Audible; public LLVector3 Position; + private byte[] _message; + public byte[] Message + { + get { return _message; } + set + { + if (value == null) { _message = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } [XmlIgnore] public int Length @@ -22734,8 +20662,8 @@ namespace libsecondlife.Packets get { int length = 47; - if (Message != null) { length += 2 + Message.Length; } if (FromName != null) { length += 1 + FromName.Length; } + if (Message != null) { length += 2 + Message.Length; } return length; } } @@ -22746,18 +20674,18 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _message = new byte[length]; - Buffer.BlockCopy(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]; Buffer.BlockCopy(bytes, i, _fromname, 0, length); i += length; - SourceType = (byte)bytes[i++]; SourceID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + SourceType = (byte)bytes[i++]; + ChatType = (byte)bytes[i++]; + Audible = (byte)bytes[i++]; Position = new LLVector3(bytes, i); i += 12; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; } catch (Exception) { @@ -22767,35 +20695,34 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + if(FromName == null) { Console.WriteLine("Warning: FromName is null, in " + this.GetType()); } + bytes[i++] = (byte)FromName.Length; + Buffer.BlockCopy(FromName, 0, bytes, i, FromName.Length); i += FromName.Length; + Buffer.BlockCopy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = SourceType; + bytes[i++] = ChatType; + bytes[i++] = Audible; + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; 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); Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; - bytes[i++] = Audible; - bytes[i++] = ChatType; - Buffer.BlockCopy(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; - Buffer.BlockCopy(FromName, 0, bytes, i, FromName.Length); i += FromName.Length; - bytes[i++] = SourceType; - Buffer.BlockCopy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ChatData --"); - Helpers.FieldToString(output, Message, "Message"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Audible: {0}", Audible)); - output.AppendLine(String.Format("ChatType: {0}", ChatType)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); Helpers.FieldToString(output, FromName, "FromName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("SourceType: {0}", SourceType)); output.AppendLine(String.Format("SourceID: {0}", SourceID)); - output.Append(String.Format("Position: {0}", Position)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("SourceType: {0}", SourceType)); + output.AppendLine(String.Format("ChatType: {0}", ChatType)); + output.AppendLine(String.Format("Audible: {0}", Audible)); + output.AppendLine(String.Format("Position: {0}", Position)); + Helpers.FieldToString(output, Message, "Message"); return output.ToString(); } } @@ -22808,7 +20735,7 @@ namespace libsecondlife.Packets public ChatFromSimulatorPacket() { Header = new LowHeader(); - Header.ID = 167; + Header.ID = 139; Header.Reliable = true; ChatData = new ChatDataBlock(); } @@ -22828,7 +20755,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ChatData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -22851,59 +20778,6 @@ namespace libsecondlife.Packets /// public class SimStatsPacket : Packet { - /// - [XmlType("simstats_stat")] - public class StatBlock - { - public float StatValue; - public uint StatID; - - [XmlIgnore] - public int Length - { - get - { - return 8; - } - } - - public StatBlock() { } - public StatBlock(byte[] bytes, ref int i) - { - try - { - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - StatValue = BitConverter.ToSingle(bytes, i); i += 4; - StatID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - ba = BitConverter.GetBytes(StatValue); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Stat --"); - output.AppendLine(String.Format("StatValue: {0}", StatValue)); - output.Append(String.Format("StatID: {0}", StatID)); - return output.ToString(); - } - } - /// [XmlType("simstats_region")] public class RegionBlock @@ -22970,45 +20844,98 @@ namespace libsecondlife.Packets } } + /// + [XmlType("simstats_stat")] + public class StatBlock + { + public uint StatID; + public float StatValue; + + [XmlIgnore] + public int Length + { + get + { + return 8; + } + } + + public StatBlock() { } + public StatBlock(byte[] bytes, ref int i) + { + try + { + StatID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + StatValue = BitConverter.ToSingle(bytes, i); i += 4; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + bytes[i++] = (byte)(StatID % 256); + bytes[i++] = (byte)((StatID >> 8) % 256); + bytes[i++] = (byte)((StatID >> 16) % 256); + bytes[i++] = (byte)((StatID >> 24) % 256); + ba = BitConverter.GetBytes(StatValue); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Stat --"); + output.AppendLine(String.Format("StatID: {0}", StatID)); + output.Append(String.Format("StatValue: {0}", StatValue)); + return output.ToString(); + } + } + 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 StatBlock[] Stat; public SimStatsPacket() { Header = new LowHeader(); - Header.ID = 168; + Header.ID = 140; Header.Reliable = true; - Stat = new StatBlock[0]; Region = new RegionBlock(); + Stat = new StatBlock[0]; } public SimStatsPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + Region = new RegionBlock(bytes, ref i); 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; + Region = new RegionBlock(bytes, ref i); 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; + int length = 10; length += Region.Length;; length++; for (int j = 0; j < Stat.Length; j++) { length += Stat[j].Length; } @@ -23016,9 +20943,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + Region.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; } @@ -23026,11 +20953,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- SimStats ---" + Environment.NewLine; + output += Region.ToString() + Environment.NewLine; for (int j = 0; j < Stat.Length; j++) { output += Stat[j].ToString() + Environment.NewLine; } - output += Region.ToString() + Environment.NewLine; return output; } @@ -23093,7 +21020,7 @@ namespace libsecondlife.Packets public RequestRegionInfoPacket() { Header = new LowHeader(); - Header.ID = 169; + Header.ID = 141; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -23113,7 +21040,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -23136,163 +21063,6 @@ namespace libsecondlife.Packets /// public class RegionInfoPacket : Packet { - /// - [XmlType("regioninfo_regioninfo")] - public class RegionInfoBlock - { - public float BillableFactor; - public float ObjectBonusFactor; - public int RedirectGridX; - public int RedirectGridY; - private byte[] _simname; - public byte[] SimName - { - get { return _simname; } - set - { - if (value == null) { _simname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } - } - } - public int PricePerMeter; - public uint RegionFlags; - public float WaterHeight; - public bool UseEstateSun; - public float SunHour; - public byte MaxAgents; - public byte SimAccess; - public float TerrainLowerLimit; - public uint ParentEstateID; - public float TerrainRaiseLimit; - public uint EstateID; - - [XmlIgnore] - public int Length - { - get - { - int length = 51; - if (SimName != null) { length += 1 + SimName.Length; } - return length; - } - } - - public RegionInfoBlock() { } - public RegionInfoBlock(byte[] bytes, ref int i) - { - int length; - try - { - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - BillableFactor = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - ObjectBonusFactor = BitConverter.ToSingle(bytes, i); i += 4; - RedirectGridX = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - RedirectGridY = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _simname = new byte[length]; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(ObjectBonusFactor); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RegionInfo --"); - output.AppendLine(String.Format("BillableFactor: {0}", BillableFactor)); - output.AppendLine(String.Format("ObjectBonusFactor: {0}", ObjectBonusFactor)); - output.AppendLine(String.Format("RedirectGridX: {0}", RedirectGridX)); - output.AppendLine(String.Format("RedirectGridY: {0}", RedirectGridY)); - Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("PricePerMeter: {0}", PricePerMeter)); - output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); - output.AppendLine(String.Format("WaterHeight: {0}", WaterHeight)); - output.AppendLine(String.Format("UseEstateSun: {0}", UseEstateSun)); - output.AppendLine(String.Format("SunHour: {0}", SunHour)); - output.AppendLine(String.Format("MaxAgents: {0}", MaxAgents)); - output.AppendLine(String.Format("SimAccess: {0}", SimAccess)); - output.AppendLine(String.Format("TerrainLowerLimit: {0}", TerrainLowerLimit)); - output.AppendLine(String.Format("ParentEstateID: {0}", ParentEstateID)); - output.AppendLine(String.Format("TerrainRaiseLimit: {0}", TerrainRaiseLimit)); - output.Append(String.Format("EstateID: {0}", EstateID)); - return output.ToString(); - } - } - /// [XmlType("regioninfo_agentdata")] public class AgentDataBlock @@ -23339,71 +21109,10 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.RegionInfo; } } - public RegionInfoBlock RegionInfo; - public AgentDataBlock AgentData; - - public RegionInfoPacket() - { - Header = new LowHeader(); - Header.ID = 170; - Header.Reliable = true; - Header.Zerocoded = true; - RegionInfo = new RegionInfoBlock(); - AgentData = new AgentDataBlock(); - } - - public RegionInfoPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - RegionInfo = new RegionInfoBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RegionInfoPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - RegionInfo = new RegionInfoBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += RegionInfo.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - RegionInfo.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RegionInfo ---" + Environment.NewLine; - output += RegionInfo.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GodUpdateRegionInfoPacket : Packet - { /// - [XmlType("godupdateregioninfo_regioninfo")] + [XmlType("regioninfo_regioninfo")] public class RegionInfoBlock { - public float BillableFactor; - public int RedirectGridX; - public int RedirectGridY; private byte[] _simname; public byte[] SimName { @@ -23415,17 +21124,28 @@ namespace libsecondlife.Packets else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } } } - public int PricePerMeter; - public uint RegionFlags; - public uint ParentEstateID; public uint EstateID; + public uint ParentEstateID; + public uint RegionFlags; + public byte SimAccess; + public byte MaxAgents; + public float BillableFactor; + public float ObjectBonusFactor; + public float WaterHeight; + public float TerrainRaiseLimit; + public float TerrainLowerLimit; + public int PricePerMeter; + public int RedirectGridX; + public int RedirectGridY; + public bool UseEstateSun; + public float SunHour; [XmlIgnore] public int Length { get { - int length = 28; + int length = 51; if (SimName != null) { length += 1 + SimName.Length; } return length; } @@ -23437,17 +21157,30 @@ namespace libsecondlife.Packets 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]; Buffer.BlockCopy(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)); + ParentEstateID = (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)); + SimAccess = (byte)bytes[i++]; + MaxAgents = (byte)bytes[i++]; + 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; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + WaterHeight = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + TerrainRaiseLimit = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + TerrainLowerLimit = BitConverter.ToSingle(bytes, i); i += 4; + PricePerMeter = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + UseEstateSun = (bytes[i++] != 0) ? (bool)true : (bool)false; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + SunHour = BitConverter.ToSingle(bytes, i); i += 4; } catch (Exception) { @@ -23458,9 +21191,42 @@ namespace libsecondlife.Packets 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; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.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)(ParentEstateID % 256); + bytes[i++] = (byte)((ParentEstateID >> 8) % 256); + bytes[i++] = (byte)((ParentEstateID >> 16) % 256); + bytes[i++] = (byte)((ParentEstateID >> 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++] = SimAccess; + bytes[i++] = MaxAgents; ba = BitConverter.GetBytes(BillableFactor); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(ObjectBonusFactor); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(WaterHeight); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(TerrainRaiseLimit); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(TerrainLowerLimit); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + 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)(RedirectGridX % 256); bytes[i++] = (byte)((RedirectGridX >> 8) % 256); bytes[i++] = (byte)((RedirectGridX >> 16) % 256); @@ -23469,44 +21235,94 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); + bytes[i++] = (byte)((UseEstateSun) ? 1 : 0); + ba = BitConverter.GetBytes(SunHour); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- RegionInfo --"); - output.AppendLine(String.Format("BillableFactor: {0}", BillableFactor)); - output.AppendLine(String.Format("RedirectGridX: {0}", RedirectGridX)); - output.AppendLine(String.Format("RedirectGridY: {0}", RedirectGridY)); Helpers.FieldToString(output, SimName, "SimName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("PricePerMeter: {0}", PricePerMeter)); - output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); + output.AppendLine(String.Format("EstateID: {0}", EstateID)); output.AppendLine(String.Format("ParentEstateID: {0}", ParentEstateID)); - output.Append(String.Format("EstateID: {0}", EstateID)); + output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); + output.AppendLine(String.Format("SimAccess: {0}", SimAccess)); + output.AppendLine(String.Format("MaxAgents: {0}", MaxAgents)); + output.AppendLine(String.Format("BillableFactor: {0}", BillableFactor)); + output.AppendLine(String.Format("ObjectBonusFactor: {0}", ObjectBonusFactor)); + output.AppendLine(String.Format("WaterHeight: {0}", WaterHeight)); + output.AppendLine(String.Format("TerrainRaiseLimit: {0}", TerrainRaiseLimit)); + output.AppendLine(String.Format("TerrainLowerLimit: {0}", TerrainLowerLimit)); + output.AppendLine(String.Format("PricePerMeter: {0}", PricePerMeter)); + output.AppendLine(String.Format("RedirectGridX: {0}", RedirectGridX)); + output.AppendLine(String.Format("RedirectGridY: {0}", RedirectGridY)); + output.AppendLine(String.Format("UseEstateSun: {0}", UseEstateSun)); + output.Append(String.Format("SunHour: {0}", SunHour)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.RegionInfo; } } + public AgentDataBlock AgentData; + public RegionInfoBlock RegionInfo; + + public RegionInfoPacket() + { + Header = new LowHeader(); + Header.ID = 142; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + RegionInfo = new RegionInfoBlock(); + } + + public RegionInfoPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + RegionInfo = new RegionInfoBlock(bytes, ref i); + } + + public RegionInfoPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + RegionInfo = new RegionInfoBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- RegionInfo ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += RegionInfo.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class GodUpdateRegionInfoPacket : Packet + { /// [XmlType("godupdateregioninfo_agentdata")] public class AgentDataBlock @@ -23553,47 +21369,156 @@ namespace libsecondlife.Packets } } + /// + [XmlType("godupdateregioninfo_regioninfo")] + public class RegionInfoBlock + { + 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public uint EstateID; + public uint ParentEstateID; + public uint RegionFlags; + public float BillableFactor; + public int PricePerMeter; + public int RedirectGridX; + public int RedirectGridY; + + [XmlIgnore] + public int Length + { + get + { + int length = 28; + if (SimName != null) { length += 1 + SimName.Length; } + return length; + } + } + + public RegionInfoBlock() { } + public RegionInfoBlock(byte[] bytes, ref int i) + { + int length; + try + { + length = (ushort)bytes[i++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + EstateID = (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)); + RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + BillableFactor = BitConverter.ToSingle(bytes, i); i += 4; + PricePerMeter = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + } + 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; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.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)(ParentEstateID % 256); + bytes[i++] = (byte)((ParentEstateID >> 8) % 256); + bytes[i++] = (byte)((ParentEstateID >> 16) % 256); + bytes[i++] = (byte)((ParentEstateID >> 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(BillableFactor); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + 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)(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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RegionInfo --"); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("EstateID: {0}", EstateID)); + output.AppendLine(String.Format("ParentEstateID: {0}", ParentEstateID)); + output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); + output.AppendLine(String.Format("BillableFactor: {0}", BillableFactor)); + output.AppendLine(String.Format("PricePerMeter: {0}", PricePerMeter)); + output.AppendLine(String.Format("RedirectGridX: {0}", RedirectGridX)); + output.Append(String.Format("RedirectGridY: {0}", RedirectGridY)); + return output.ToString(); + } + } + 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 RegionInfoBlock RegionInfo; public GodUpdateRegionInfoPacket() { Header = new LowHeader(); - Header.ID = 171; + Header.ID = 143; Header.Reliable = true; - Header.Zerocoded = true; - RegionInfo = new RegionInfoBlock(); AgentData = new AgentDataBlock(); + RegionInfo = new RegionInfoBlock(); } 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); + RegionInfo = new RegionInfoBlock(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); + RegionInfo = new RegionInfoBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += RegionInfo.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.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); - RegionInfo.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + RegionInfo.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -23601,8 +21526,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GodUpdateRegionInfo ---" + Environment.NewLine; - output += RegionInfo.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += RegionInfo.ToString() + Environment.NewLine; return output; } @@ -23668,7 +21593,7 @@ namespace libsecondlife.Packets public NearestLandingRegionUpdatedPacket() { Header = new LowHeader(); - Header.ID = 174; + Header.ID = 146; Header.Reliable = true; RegionData = new RegionDataBlock(); } @@ -23688,7 +21613,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += RegionData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -23715,11 +21640,8 @@ namespace libsecondlife.Packets [XmlType("regionhandshake_regioninfo")] public class RegionInfoBlock { - public float BillableFactor; - public float TerrainHeightRange00; - public float TerrainHeightRange01; - public float TerrainHeightRange10; - public float TerrainHeightRange11; + public uint RegionFlags; + public byte SimAccess; private byte[] _simname; public byte[] SimName { @@ -23731,14 +21653,11 @@ namespace libsecondlife.Packets else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, 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 bool IsEstateManager; + public float WaterHeight; + public float BillableFactor; + public LLUUID CacheID; public LLUUID TerrainBase0; public LLUUID TerrainBase1; public LLUUID TerrainBase2; @@ -23747,8 +21666,14 @@ namespace libsecondlife.Packets public LLUUID TerrainDetail1; public LLUUID TerrainDetail2; public LLUUID TerrainDetail3; - public bool IsEstateManager; - public LLUUID CacheID; + public float TerrainStartHeight00; + public float TerrainStartHeight01; + public float TerrainStartHeight10; + public float TerrainStartHeight11; + public float TerrainHeightRange00; + public float TerrainHeightRange01; + public float TerrainHeightRange10; + public float TerrainHeightRange11; [XmlIgnore] public int Length @@ -23767,20 +21692,26 @@ namespace libsecondlife.Packets 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; + RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SimAccess = (byte)bytes[i++]; length = (ushort)bytes[i++]; _simname = new byte[length]; Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; - RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SimOwner = new LLUUID(bytes, i); i += 16; + IsEstateManager = (bytes[i++] != 0) ? (bool)true : (bool)false; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + WaterHeight = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + BillableFactor = BitConverter.ToSingle(bytes, i); i += 4; + CacheID = new LLUUID(bytes, i); i += 16; + 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; if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); TerrainStartHeight00 = BitConverter.ToSingle(bytes, i); i += 4; if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); @@ -23790,19 +21721,13 @@ namespace libsecondlife.Packets 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; + 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; } catch (Exception) { @@ -23813,9 +21738,43 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; + 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++] = SimAccess; + if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } + bytes[i++] = (byte)SimName.Length; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; + Buffer.BlockCopy(SimOwner.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((IsEstateManager) ? 1 : 0); + ba = BitConverter.GetBytes(WaterHeight); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; ba = BitConverter.GetBytes(BillableFactor); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + Buffer.BlockCopy(CacheID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainBase0.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainBase1.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainBase2.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainBase3.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainDetail0.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainDetail1.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainDetail2.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TerrainDetail3.GetBytes(), 0, bytes, i, 16); i += 16; + ba = BitConverter.GetBytes(TerrainStartHeight00); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(TerrainStartHeight01); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(TerrainStartHeight10); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(TerrainStartHeight11); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; ba = BitConverter.GetBytes(TerrainHeightRange00); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; @@ -23828,61 +21787,21 @@ namespace libsecondlife.Packets ba = BitConverter.GetBytes(TerrainHeightRange11); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } - bytes[i++] = (byte)SimName.Length; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(TerrainStartHeight01); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(TerrainStartHeight10); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(TerrainStartHeight11); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(WaterHeight); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(SimOwner.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = SimAccess; - Buffer.BlockCopy(TerrainBase0.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TerrainBase1.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TerrainBase2.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TerrainBase3.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TerrainDetail0.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TerrainDetail1.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TerrainDetail2.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TerrainDetail3.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((IsEstateManager) ? 1 : 0); - Buffer.BlockCopy(CacheID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- RegionInfo --"); - output.AppendLine(String.Format("BillableFactor: {0}", BillableFactor)); - output.AppendLine(String.Format("TerrainHeightRange00: {0}", TerrainHeightRange00)); - output.AppendLine(String.Format("TerrainHeightRange01: {0}", TerrainHeightRange01)); - output.AppendLine(String.Format("TerrainHeightRange10: {0}", TerrainHeightRange10)); - output.AppendLine(String.Format("TerrainHeightRange11: {0}", TerrainHeightRange11)); + output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); + output.AppendLine(String.Format("SimAccess: {0}", SimAccess)); Helpers.FieldToString(output, SimName, "SimName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); - output.AppendLine(String.Format("TerrainStartHeight00: {0}", TerrainStartHeight00)); - output.AppendLine(String.Format("TerrainStartHeight01: {0}", TerrainStartHeight01)); - output.AppendLine(String.Format("TerrainStartHeight10: {0}", TerrainStartHeight10)); - output.AppendLine(String.Format("TerrainStartHeight11: {0}", TerrainStartHeight11)); - output.AppendLine(String.Format("WaterHeight: {0}", WaterHeight)); output.AppendLine(String.Format("SimOwner: {0}", SimOwner)); - output.AppendLine(String.Format("SimAccess: {0}", SimAccess)); + output.AppendLine(String.Format("IsEstateManager: {0}", IsEstateManager)); + output.AppendLine(String.Format("WaterHeight: {0}", WaterHeight)); + output.AppendLine(String.Format("BillableFactor: {0}", BillableFactor)); + output.AppendLine(String.Format("CacheID: {0}", CacheID)); output.AppendLine(String.Format("TerrainBase0: {0}", TerrainBase0)); output.AppendLine(String.Format("TerrainBase1: {0}", TerrainBase1)); output.AppendLine(String.Format("TerrainBase2: {0}", TerrainBase2)); @@ -23891,85 +21810,39 @@ namespace libsecondlife.Packets output.AppendLine(String.Format("TerrainDetail1: {0}", TerrainDetail1)); output.AppendLine(String.Format("TerrainDetail2: {0}", TerrainDetail2)); output.AppendLine(String.Format("TerrainDetail3: {0}", TerrainDetail3)); - output.AppendLine(String.Format("IsEstateManager: {0}", IsEstateManager)); - output.Append(String.Format("CacheID: {0}", CacheID)); + output.AppendLine(String.Format("TerrainStartHeight00: {0}", TerrainStartHeight00)); + output.AppendLine(String.Format("TerrainStartHeight01: {0}", TerrainStartHeight01)); + output.AppendLine(String.Format("TerrainStartHeight10: {0}", TerrainStartHeight10)); + output.AppendLine(String.Format("TerrainStartHeight11: {0}", TerrainStartHeight11)); + output.AppendLine(String.Format("TerrainHeightRange00: {0}", TerrainHeightRange00)); + output.AppendLine(String.Format("TerrainHeightRange01: {0}", TerrainHeightRange01)); + output.AppendLine(String.Format("TerrainHeightRange10: {0}", TerrainHeightRange10)); + output.Append(String.Format("TerrainHeightRange11: {0}", TerrainHeightRange11)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.RegionHandshake; } } - public RegionInfoBlock RegionInfo; - - public RegionHandshakePacket() - { - Header = new LowHeader(); - Header.ID = 176; - Header.Reliable = true; - Header.Zerocoded = true; - RegionInfo = new RegionInfoBlock(); - } - - public RegionHandshakePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - RegionInfo = new RegionInfoBlock(bytes, ref i); - } - - public RegionHandshakePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - RegionInfo = new RegionInfoBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += RegionInfo.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - RegionInfo.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RegionHandshake ---" + Environment.NewLine; - output += RegionInfo.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RegionHandshakeReplyPacket : Packet - { /// - [XmlType("regionhandshakereply_regioninfo")] - public class RegionInfoBlock + [XmlType("regionhandshake_regioninfo2")] + public class RegionInfo2Block { - public uint Flags; + public LLUUID RegionID; [XmlIgnore] public int Length { get { - return 4; + return 16; } } - public RegionInfoBlock() { } - public RegionInfoBlock(byte[] bytes, ref int i) + public RegionInfo2Block() { } + public RegionInfo2Block(byte[] bytes, ref int i) { try { - Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + RegionID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -23979,21 +21852,75 @@ namespace libsecondlife.Packets 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); + Buffer.BlockCopy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- RegionInfo --"); - output.Append(String.Format("Flags: {0}", Flags)); + output.AppendLine("-- RegionInfo2 --"); + output.Append(String.Format("RegionID: {0}", RegionID)); return output.ToString(); } } + 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 RegionInfo2Block RegionInfo2; + + public RegionHandshakePacket() + { + Header = new LowHeader(); + Header.ID = 148; + Header.Reliable = true; + RegionInfo = new RegionInfoBlock(); + RegionInfo2 = new RegionInfo2Block(); + } + + 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); + RegionInfo2 = new RegionInfo2Block(bytes, ref i); + } + + public RegionHandshakePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + RegionInfo = new RegionInfoBlock(bytes, ref i); + RegionInfo2 = new RegionInfo2Block(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += RegionInfo.Length; length += RegionInfo2.Length;; + 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); + RegionInfo2.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- RegionHandshake ---" + Environment.NewLine; + output += RegionInfo.ToString() + Environment.NewLine; + output += RegionInfo2.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class RegionHandshakeReplyPacket : Packet + { /// [XmlType("regionhandshakereply_agentdata")] public class AgentDataBlock @@ -24040,47 +21967,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("regionhandshakereply_regioninfo")] + public class RegionInfoBlock + { + public uint Flags; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public RegionInfoBlock() { } + public RegionInfoBlock(byte[] bytes, ref int i) + { + try + { + Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(Flags % 256); + bytes[i++] = (byte)((Flags >> 8) % 256); + bytes[i++] = (byte)((Flags >> 16) % 256); + bytes[i++] = (byte)((Flags >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RegionInfo --"); + output.Append(String.Format("Flags: {0}", Flags)); + return output.ToString(); + } + } + 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 RegionInfoBlock RegionInfo; public RegionHandshakeReplyPacket() { Header = new LowHeader(); - Header.ID = 177; + Header.ID = 149; Header.Reliable = true; - Header.Zerocoded = true; - RegionInfo = new RegionInfoBlock(); AgentData = new AgentDataBlock(); + RegionInfo = new RegionInfoBlock(); } 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); + RegionInfo = new RegionInfoBlock(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); + RegionInfo = new RegionInfoBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += RegionInfo.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.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); - RegionInfo.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + RegionInfo.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -24088,8 +22059,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RegionHandshakeReply ---" + Environment.NewLine; - output += RegionInfo.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += RegionInfo.ToString() + Environment.NewLine; return output; } @@ -24102,12 +22073,12 @@ namespace libsecondlife.Packets [XmlType("simulatorviewertimemessage_timeinfo")] public class TimeInfoBlock { - public uint SecPerDay; public ulong UsecSinceStart; + public uint SecPerDay; public uint SecPerYear; - public LLVector3 SunAngVelocity; - public float SunPhase; public LLVector3 SunDirection; + public float SunPhase; + public LLVector3 SunAngVelocity; [XmlIgnore] public int Length @@ -24123,13 +22094,13 @@ namespace libsecondlife.Packets { 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)); + SecPerDay = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); SecPerYear = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SunAngVelocity = new LLVector3(bytes, i); i += 12; + SunDirection = 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; + SunAngVelocity = new LLVector3(bytes, i); i += 12; } catch (Exception) { @@ -24140,10 +22111,6 @@ namespace libsecondlife.Packets 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); @@ -24152,27 +22119,31 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((UsecSinceStart >> 40) % 256); bytes[i++] = (byte)((UsecSinceStart >> 48) % 256); bytes[i++] = (byte)((UsecSinceStart >> 56) % 256); + 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)(SecPerYear % 256); bytes[i++] = (byte)((SecPerYear >> 8) % 256); bytes[i++] = (byte)((SecPerYear >> 16) % 256); bytes[i++] = (byte)((SecPerYear >> 24) % 256); - Buffer.BlockCopy(SunAngVelocity.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12; ba = BitConverter.GetBytes(SunPhase); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(SunDirection.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(SunAngVelocity.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- TimeInfo --"); - output.AppendLine(String.Format("SecPerDay: {0}", SecPerDay)); output.AppendLine(String.Format("UsecSinceStart: {0}", UsecSinceStart)); + output.AppendLine(String.Format("SecPerDay: {0}", SecPerDay)); output.AppendLine(String.Format("SecPerYear: {0}", SecPerYear)); - output.AppendLine(String.Format("SunAngVelocity: {0}", SunAngVelocity)); + output.AppendLine(String.Format("SunDirection: {0}", SunDirection)); output.AppendLine(String.Format("SunPhase: {0}", SunPhase)); - output.Append(String.Format("SunDirection: {0}", SunDirection)); + output.Append(String.Format("SunAngVelocity: {0}", SunAngVelocity)); return output.ToString(); } } @@ -24185,7 +22156,7 @@ namespace libsecondlife.Packets public SimulatorViewerTimeMessagePacket() { Header = new LowHeader(); - Header.ID = 178; + Header.ID = 150; Header.Reliable = true; TimeInfo = new TimeInfoBlock(); } @@ -24205,7 +22176,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TimeInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -24232,9 +22203,9 @@ namespace libsecondlife.Packets [XmlType("enablesimulator_simulatorinfo")] public class SimulatorInfoBlock { + public ulong Handle; public uint IP; public ushort Port; - public ulong Handle; [XmlIgnore] public int Length @@ -24250,9 +22221,9 @@ namespace libsecondlife.Packets { try { + 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)); 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) { @@ -24262,12 +22233,6 @@ namespace libsecondlife.Packets 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); @@ -24276,15 +22241,21 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((Handle >> 40) % 256); bytes[i++] = (byte)((Handle >> 48) % 256); bytes[i++] = (byte)((Handle >> 56) % 256); + 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() { StringBuilder output = new StringBuilder(); output.AppendLine("-- SimulatorInfo --"); + output.AppendLine(String.Format("Handle: {0}", Handle)); output.AppendLine(String.Format("IP: {0}", IP)); - output.AppendLine(String.Format("Port: {0}", Port)); - output.Append(String.Format("Handle: {0}", Handle)); + output.Append(String.Format("Port: {0}", Port)); return output.ToString(); } } @@ -24297,7 +22268,7 @@ namespace libsecondlife.Packets public EnableSimulatorPacket() { Header = new LowHeader(); - Header.ID = 179; + Header.ID = 151; Header.Reliable = true; SimulatorInfo = new SimulatorInfoBlock(); } @@ -24317,7 +22288,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += SimulatorInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -24347,7 +22318,7 @@ namespace libsecondlife.Packets public DisableSimulatorPacket() { Header = new LowHeader(); - Header.ID = 180; + Header.ID = 152; Header.Reliable = true; } @@ -24364,7 +22335,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -24390,6 +22361,9 @@ namespace libsecondlife.Packets public class TransferInfoBlock { public LLUUID TransferID; + public int ChannelType; + public int SourceType; + public float Priority; private byte[] _params; public byte[] Params { @@ -24401,9 +22375,6 @@ namespace libsecondlife.Packets else { _params = new byte[value.Length]; Buffer.BlockCopy(value, 0, _params, 0, value.Length); } } } - public int ChannelType; - public int SourceType; - public float Priority; [XmlIgnore] public int Length @@ -24423,13 +22394,13 @@ namespace libsecondlife.Packets try { TransferID = new LLUUID(bytes, i); i += 16; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _params = new byte[length]; - Buffer.BlockCopy(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; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _params = new byte[length]; + Buffer.BlockCopy(bytes, i, _params, 0, length); i += length; } catch (Exception) { @@ -24441,10 +22412,6 @@ namespace libsecondlife.Packets { byte[] ba; Buffer.BlockCopy(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); - Buffer.BlockCopy(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); @@ -24456,6 +22423,10 @@ namespace libsecondlife.Packets ba = BitConverter.GetBytes(Priority); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + 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); + Buffer.BlockCopy(Params, 0, bytes, i, Params.Length); i += Params.Length; } public override string ToString() @@ -24463,11 +22434,10 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- TransferInfo --"); output.AppendLine(String.Format("TransferID: {0}", TransferID)); - Helpers.FieldToString(output, Params, "Params"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("ChannelType: {0}", ChannelType)); output.AppendLine(String.Format("SourceType: {0}", SourceType)); - output.Append(String.Format("Priority: {0}", Priority)); + output.AppendLine(String.Format("Priority: {0}", Priority)); + Helpers.FieldToString(output, Params, "Params"); return output.ToString(); } } @@ -24480,9 +22450,8 @@ namespace libsecondlife.Packets public TransferRequestPacket() { Header = new LowHeader(); - Header.ID = 181; + Header.ID = 153; Header.Reliable = true; - Header.Zerocoded = true; TransferInfo = new TransferInfoBlock(); } @@ -24501,7 +22470,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TransferInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -24529,6 +22498,9 @@ namespace libsecondlife.Packets public class TransferInfoBlock { public LLUUID TransferID; + public int ChannelType; + public int TargetType; + public int Status; public int Size; private byte[] _params; public byte[] Params @@ -24541,9 +22513,6 @@ namespace libsecondlife.Packets else { _params = new byte[value.Length]; Buffer.BlockCopy(value, 0, _params, 0, value.Length); } } } - public int ChannelType; - public int TargetType; - public int Status; [XmlIgnore] public int Length @@ -24563,13 +22532,13 @@ namespace libsecondlife.Packets try { TransferID = new LLUUID(bytes, i); i += 16; + 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)); Size = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _params = new byte[length]; Buffer.BlockCopy(bytes, i, _params, 0, length); i += length; - ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - TargetType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Status = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -24580,14 +22549,6 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(TransferID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)(Size % 256); - bytes[i++] = (byte)((Size >> 8) % 256); - bytes[i++] = (byte)((Size >> 16) % 256); - bytes[i++] = (byte)((Size >> 24) % 256); - if(Params == null) { Console.WriteLine("Warning: Params is null, in " + this.GetType()); } - bytes[i++] = (byte)(Params.Length % 256); - bytes[i++] = (byte)((Params.Length >> 8) % 256); - Buffer.BlockCopy(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); @@ -24600,6 +22561,14 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((Status >> 8) % 256); bytes[i++] = (byte)((Status >> 16) % 256); bytes[i++] = (byte)((Status >> 24) % 256); + bytes[i++] = (byte)(Size % 256); + bytes[i++] = (byte)((Size >> 8) % 256); + bytes[i++] = (byte)((Size >> 16) % 256); + bytes[i++] = (byte)((Size >> 24) % 256); + if(Params == null) { Console.WriteLine("Warning: Params is null, in " + this.GetType()); } + bytes[i++] = (byte)(Params.Length % 256); + bytes[i++] = (byte)((Params.Length >> 8) % 256); + Buffer.BlockCopy(Params, 0, bytes, i, Params.Length); i += Params.Length; } public override string ToString() @@ -24607,12 +22576,11 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- TransferInfo --"); output.AppendLine(String.Format("TransferID: {0}", TransferID)); - output.AppendLine(String.Format("Size: {0}", Size)); - Helpers.FieldToString(output, Params, "Params"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("ChannelType: {0}", ChannelType)); output.AppendLine(String.Format("TargetType: {0}", TargetType)); - output.Append(String.Format("Status: {0}", Status)); + output.AppendLine(String.Format("Status: {0}", Status)); + output.AppendLine(String.Format("Size: {0}", Size)); + Helpers.FieldToString(output, Params, "Params"); return output.ToString(); } } @@ -24625,9 +22593,8 @@ namespace libsecondlife.Packets public TransferInfoPacket() { Header = new LowHeader(); - Header.ID = 182; + Header.ID = 154; Header.Reliable = true; - Header.Zerocoded = true; TransferInfo = new TransferInfoBlock(); } @@ -24646,7 +22613,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TransferInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -24726,9 +22693,8 @@ namespace libsecondlife.Packets public TransferAbortPacket() { Header = new LowHeader(); - Header.ID = 183; + Header.ID = 155; Header.Reliable = true; - Header.Zerocoded = true; TransferInfo = new TransferInfoBlock(); } @@ -24747,7 +22713,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TransferInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -24767,115 +22733,6 @@ namespace libsecondlife.Packets } - /// - public class TransferPriorityPacket : Packet - { - /// - [XmlType("transferpriority_transferinfo")] - public class TransferInfoBlock - { - public LLUUID TransferID; - public int ChannelType; - public float Priority; - - [XmlIgnore] - public int Length - { - get - { - return 24; - } - } - - public TransferInfoBlock() { } - public TransferInfoBlock(byte[] bytes, ref int i) - { - try - { - TransferID = new LLUUID(bytes, i); i += 16; - ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Priority = BitConverter.ToSingle(bytes, i); i += 4; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransferInfo --"); - output.AppendLine(String.Format("TransferID: {0}", TransferID)); - output.AppendLine(String.Format("ChannelType: {0}", ChannelType)); - output.Append(String.Format("Priority: {0}", Priority)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.TransferPriority; } } - public TransferInfoBlock TransferInfo; - - public TransferPriorityPacket() - { - Header = new LowHeader(); - Header.ID = 184; - Header.Reliable = true; - Header.Zerocoded = true; - TransferInfo = new TransferInfoBlock(); - } - - public TransferPriorityPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - TransferInfo = new TransferInfoBlock(bytes, ref i); - } - - public TransferPriorityPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - TransferInfo = new TransferInfoBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += TransferInfo.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - TransferInfo.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- TransferPriority ---" + Environment.NewLine; - output += TransferInfo.ToString() + Environment.NewLine; - return output; - } - - } - /// public class RequestXferPacket : Packet { @@ -24884,9 +22741,6 @@ namespace libsecondlife.Packets public class XferIDBlock { public ulong ID; - public bool UseBigPackets; - public bool DeleteOnCompletion; - public byte FilePath; private byte[] _filename; public byte[] Filename { @@ -24898,6 +22752,9 @@ namespace libsecondlife.Packets else { _filename = new byte[value.Length]; Buffer.BlockCopy(value, 0, _filename, 0, value.Length); } } } + public byte FilePath; + public bool DeleteOnCompletion; + public bool UseBigPackets; public LLUUID VFileID; public short VFileType; @@ -24919,12 +22776,12 @@ namespace libsecondlife.Packets 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]; Buffer.BlockCopy(bytes, i, _filename, 0, length); i += length; + FilePath = (byte)bytes[i++]; + DeleteOnCompletion = (bytes[i++] != 0) ? (bool)true : (bool)false; + UseBigPackets = (bytes[i++] != 0) ? (bool)true : (bool)false; VFileID = new LLUUID(bytes, i); i += 16; VFileType = (short)(bytes[i++] + (bytes[i++] << 8)); } @@ -24944,12 +22801,12 @@ namespace libsecondlife.Packets 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; Buffer.BlockCopy(Filename, 0, bytes, i, Filename.Length); i += Filename.Length; + bytes[i++] = FilePath; + bytes[i++] = (byte)((DeleteOnCompletion) ? 1 : 0); + bytes[i++] = (byte)((UseBigPackets) ? 1 : 0); Buffer.BlockCopy(VFileID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(VFileType % 256); bytes[i++] = (byte)((VFileType >> 8) % 256); @@ -24960,11 +22817,11 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- XferID --"); output.AppendLine(String.Format("ID: {0}", ID)); - output.AppendLine(String.Format("UseBigPackets: {0}", UseBigPackets)); - output.AppendLine(String.Format("DeleteOnCompletion: {0}", DeleteOnCompletion)); - output.AppendLine(String.Format("FilePath: {0}", FilePath)); Helpers.FieldToString(output, Filename, "Filename"); output.Append(Environment.NewLine); + output.AppendLine(String.Format("FilePath: {0}", FilePath)); + output.AppendLine(String.Format("DeleteOnCompletion: {0}", DeleteOnCompletion)); + output.AppendLine(String.Format("UseBigPackets: {0}", UseBigPackets)); output.AppendLine(String.Format("VFileID: {0}", VFileID)); output.Append(String.Format("VFileType: {0}", VFileType)); return output.ToString(); @@ -24979,9 +22836,8 @@ namespace libsecondlife.Packets public RequestXferPacket() { Header = new LowHeader(); - Header.ID = 185; + Header.ID = 156; Header.Reliable = true; - Header.Zerocoded = true; XferID = new XferIDBlock(); } @@ -25000,7 +22856,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += XferID.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -25087,7 +22943,7 @@ namespace libsecondlife.Packets public AbortXferPacket() { Header = new LowHeader(); - Header.ID = 186; + Header.ID = 157; Header.Reliable = true; XferID = new XferIDBlock(); } @@ -25107,7 +22963,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += XferID.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -25127,123 +22983,32 @@ namespace libsecondlife.Packets } - /// - public class RequestAvatarInfoPacket : Packet - { - /// - [XmlType("requestavatarinfo_datablock")] - public class DataBlockBlock - { - public LLUUID FullID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public DataBlockBlock() { } - public DataBlockBlock(byte[] bytes, ref int i) - { - try - { - FullID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- DataBlock --"); - output.Append(String.Format("FullID: {0}", FullID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.RequestAvatarInfo; } } - public DataBlockBlock DataBlock; - - public RequestAvatarInfoPacket() - { - Header = new LowHeader(); - Header.ID = 187; - Header.Reliable = true; - DataBlock = new DataBlockBlock(); - } - - public RequestAvatarInfoPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - DataBlock = new DataBlockBlock(bytes, ref i); - } - - public RequestAvatarInfoPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - DataBlock = new DataBlockBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += DataBlock.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - DataBlock.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RequestAvatarInfo ---" + Environment.NewLine; - output += DataBlock.ToString() + Environment.NewLine; - return output; - } - - } - /// public class AvatarAppearancePacket : Packet { /// - [XmlType("avatarappearance_visualparam")] - public class VisualParamBlock + [XmlType("avatarappearance_sender")] + public class SenderBlock { - public byte ParamValue; + public LLUUID ID; + public bool IsTrial; [XmlIgnore] public int Length { get { - return 1; + return 17; } } - public VisualParamBlock() { } - public VisualParamBlock(byte[] bytes, ref int i) + public SenderBlock() { } + public SenderBlock(byte[] bytes, ref int i) { try { - ParamValue = (byte)bytes[i++]; + ID = new LLUUID(bytes, i); i += 16; + IsTrial = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -25253,14 +23018,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = ParamValue; + Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((IsTrial) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- VisualParam --"); - output.Append(String.Format("ParamValue: {0}", ParamValue)); + output.AppendLine("-- Sender --"); + output.AppendLine(String.Format("ID: {0}", ID)); + output.Append(String.Format("IsTrial: {0}", IsTrial)); return output.ToString(); } } @@ -25326,28 +23093,26 @@ namespace libsecondlife.Packets } /// - [XmlType("avatarappearance_sender")] - public class SenderBlock + [XmlType("avatarappearance_visualparam")] + public class VisualParamBlock { - public LLUUID ID; - public bool IsTrial; + public byte ParamValue; [XmlIgnore] public int Length { get { - return 17; + return 1; } } - public SenderBlock() { } - public SenderBlock(byte[] bytes, ref int i) + public VisualParamBlock() { } + public VisualParamBlock(byte[] bytes, ref int i) { try { - ID = new LLUUID(bytes, i); i += 16; - IsTrial = (bytes[i++] != 0) ? (bool)true : (bool)false; + ParamValue = (byte)bytes[i++]; } catch (Exception) { @@ -25357,16 +23122,14 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((IsTrial) ? 1 : 0); + bytes[i++] = ParamValue; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- Sender --"); - output.AppendLine(String.Format("ID: {0}", ID)); - output.Append(String.Format("IsTrial: {0}", IsTrial)); + output.AppendLine("-- VisualParam --"); + output.Append(String.Format("ParamValue: {0}", ParamValue)); return output.ToString(); } } @@ -25374,58 +23137,57 @@ namespace libsecondlife.Packets 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 ObjectDataBlock ObjectData; + public VisualParamBlock[] VisualParam; public AvatarAppearancePacket() { Header = new LowHeader(); - Header.ID = 188; + Header.ID = 158; Header.Reliable = true; - Header.Zerocoded = true; - VisualParam = new VisualParamBlock[0]; - ObjectData = new ObjectDataBlock(); Sender = new SenderBlock(); + ObjectData = new ObjectDataBlock(); + VisualParam = new VisualParamBlock[0]; } public AvatarAppearancePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + Sender = new SenderBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); 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; + Sender = new SenderBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); 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;; + int length = 10; + length += Sender.Length; length += ObjectData.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); + Sender.ToBytes(bytes, ref i); + ObjectData.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; } @@ -25433,12 +23195,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarAppearance ---" + Environment.NewLine; + output += Sender.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; for (int j = 0; j < VisualParam.Length; j++) { output += VisualParam[j].ToString() + Environment.NewLine; } - output += ObjectData.ToString() + Environment.NewLine; - output += Sender.ToString() + Environment.NewLine; return output; } @@ -25447,6 +23209,48 @@ namespace libsecondlife.Packets /// public class SetFollowCamPropertiesPacket : Packet { + /// + [XmlType("setfollowcamproperties_objectdata")] + public class ObjectDataBlock + { + public LLUUID ObjectID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.Append(String.Format("ObjectID: {0}", ObjectID)); + return output.ToString(); + } + } + /// [XmlType("setfollowcamproperties_cameraproperty")] public class CameraPropertyBlock @@ -25500,87 +23304,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("setfollowcamproperties_objectdata")] - public class ObjectDataBlock - { - public LLUUID ObjectID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectID: {0}", ObjectID)); - return output.ToString(); - } - } - 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 CameraPropertyBlock[] CameraProperty; public SetFollowCamPropertiesPacket() { Header = new LowHeader(); - Header.ID = 189; + Header.ID = 159; Header.Reliable = true; - CameraProperty = new CameraPropertyBlock[0]; ObjectData = new ObjectDataBlock(); + CameraProperty = new CameraPropertyBlock[0]; } public SetFollowCamPropertiesPacket(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++]; 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; + ObjectData = new ObjectDataBlock(bytes, ref i); 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; + int length = 10; length += ObjectData.Length;; length++; for (int j = 0; j < CameraProperty.Length; j++) { length += CameraProperty[j].Length; } @@ -25588,9 +23350,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + ObjectData.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; } @@ -25598,11 +23360,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- SetFollowCamProperties ---" + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; for (int j = 0; j < CameraProperty.Length; j++) { output += CameraProperty[j].ToString() + Environment.NewLine; } - output += ObjectData.ToString() + Environment.NewLine; return output; } @@ -25661,7 +23423,7 @@ namespace libsecondlife.Packets public ClearFollowCamPropertiesPacket() { Header = new LowHeader(); - Header.ID = 190; + Header.ID = 160; Header.Reliable = true; ObjectData = new ObjectDataBlock(); } @@ -25681,7 +23443,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ObjectData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -25754,7 +23516,7 @@ namespace libsecondlife.Packets public RequestPayPricePacket() { Header = new LowHeader(); - Header.ID = 191; + Header.ID = 161; Header.Reliable = true; ObjectData = new ObjectDataBlock(); } @@ -25774,7 +23536,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ObjectData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -25900,7 +23662,7 @@ namespace libsecondlife.Packets public PayPriceReplyPacket() { Header = new LowHeader(); - Header.ID = 192; + Header.ID = 162; Header.Reliable = true; ObjectData = new ObjectDataBlock(); ButtonData = new ButtonDataBlock[0]; @@ -25929,7 +23691,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ObjectData.Length;; length++; for (int j = 0; j < ButtonData.Length; j++) { length += ButtonData[j].Length; } @@ -26087,7 +23849,7 @@ namespace libsecondlife.Packets public KickUserPacket() { Header = new LowHeader(); - Header.ID = 193; + Header.ID = 163; Header.Reliable = true; TargetBlock = new TargetBlockBlock(); UserInfo = new UserInfoBlock(); @@ -26110,7 +23872,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TargetBlock.Length; length += UserInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -26192,7 +23954,7 @@ namespace libsecondlife.Packets public KickUserAckPacket() { Header = new LowHeader(); - Header.ID = 194; + Header.ID = 164; Header.Reliable = true; UserInfo = new UserInfoBlock(); } @@ -26212,7 +23974,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += UserInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -26239,8 +24001,10 @@ namespace libsecondlife.Packets [XmlType("godkickuser_userinfo")] public class UserInfoBlock { + public LLUUID GodID; public LLUUID GodSessionID; public LLUUID AgentID; + public uint KickFlags; private byte[] _reason; public byte[] Reason { @@ -26252,8 +24016,6 @@ namespace libsecondlife.Packets else { _reason = new byte[value.Length]; Buffer.BlockCopy(value, 0, _reason, 0, value.Length); } } } - public uint KickFlags; - public LLUUID GodID; [XmlIgnore] public int Length @@ -26272,13 +24034,13 @@ namespace libsecondlife.Packets int length; try { + GodID = new LLUUID(bytes, i); i += 16; GodSessionID = new LLUUID(bytes, i); i += 16; AgentID = new LLUUID(bytes, i); i += 16; + KickFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _reason = new byte[length]; Buffer.BlockCopy(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) { @@ -26288,29 +24050,28 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(GodID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(GodSessionID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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); - Buffer.BlockCopy(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); - Buffer.BlockCopy(GodID.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); + Buffer.BlockCopy(Reason, 0, bytes, i, Reason.Length); i += Reason.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- UserInfo --"); + output.AppendLine(String.Format("GodID: {0}", GodID)); output.AppendLine(String.Format("GodSessionID: {0}", GodSessionID)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - Helpers.FieldToString(output, Reason, "Reason"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("KickFlags: {0}", KickFlags)); - output.Append(String.Format("GodID: {0}", GodID)); + Helpers.FieldToString(output, Reason, "Reason"); return output.ToString(); } } @@ -26323,7 +24084,7 @@ namespace libsecondlife.Packets public GodKickUserPacket() { Header = new LowHeader(); - Header.ID = 195; + Header.ID = 165; Header.Reliable = true; UserInfo = new UserInfoBlock(); } @@ -26343,7 +24104,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += UserInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -26366,6 +24127,52 @@ namespace libsecondlife.Packets /// public class EjectUserPacket : Packet { + /// + [XmlType("ejectuser_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("ejectuser_data")] public class DataBlock @@ -26415,8 +24222,65 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.EjectUser; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public EjectUserPacket() + { + Header = new LowHeader(); + Header.ID = 167; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public EjectUserPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public EjectUserPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- EjectUser ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class FreezeUserPacket : Packet + { /// - [XmlType("ejectuser_agentdata")] + [XmlType("freezeuser_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -26461,63 +24325,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.EjectUser; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public EjectUserPacket() - { - Header = new LowHeader(); - Header.ID = 197; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public EjectUserPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public EjectUserPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- EjectUser ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class FreezeUserPacket : Packet - { /// [XmlType("freezeuser_data")] public class DataBlock @@ -26567,92 +24374,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("freezeuser_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 DataBlock Data; public FreezeUserPacket() { Header = new LowHeader(); - Header.ID = 198; + Header.ID = 168; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -26660,8 +24421,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- FreezeUser ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -26728,7 +24489,7 @@ namespace libsecondlife.Packets public AvatarPropertiesRequestPacket() { Header = new LowHeader(); - Header.ID = 199; + Header.ID = 169; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -26748,7 +24509,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -26771,166 +24532,6 @@ namespace libsecondlife.Packets /// public class AvatarPropertiesReplyPacket : Packet { - /// - [XmlType("avatarpropertiesreply_propertiesdata")] - public class PropertiesDataBlock - { - public LLUUID PartnerID; - private byte[] _abouttext; - public byte[] AboutText - { - get { return _abouttext; } - set - { - if (value == null) { _abouttext = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _abouttext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _abouttext, 0, value.Length); } - } - } - 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]; Buffer.BlockCopy(value, 0, _chartermember, 0, 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]; Buffer.BlockCopy(value, 0, _flabouttext, 0, value.Length); } - } - } - public LLUUID ImageID; - public LLUUID FLImageID; - 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]; Buffer.BlockCopy(value, 0, _profileurl, 0, value.Length); } - } - } - 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]; Buffer.BlockCopy(value, 0, _bornon, 0, value.Length); } - } - } - public uint Flags; - - [XmlIgnore] - public int Length - { - get - { - int length = 52; - if (AboutText != null) { length += 2 + AboutText.Length; } - if (CharterMember != null) { length += 1 + CharterMember.Length; } - if (FLAboutText != null) { length += 1 + FLAboutText.Length; } - if (ProfileURL != null) { length += 1 + ProfileURL.Length; } - if (BornOn != null) { length += 1 + BornOn.Length; } - return length; - } - } - - public PropertiesDataBlock() { } - public PropertiesDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - PartnerID = new LLUUID(bytes, i); i += 16; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _abouttext = new byte[length]; - Buffer.BlockCopy(bytes, i, _abouttext, 0, length); i += length; - length = (ushort)bytes[i++]; - _chartermember = new byte[length]; - Buffer.BlockCopy(bytes, i, _chartermember, 0, length); i += length; - length = (ushort)bytes[i++]; - _flabouttext = new byte[length]; - Buffer.BlockCopy(bytes, i, _flabouttext, 0, length); i += length; - ImageID = new LLUUID(bytes, i); i += 16; - FLImageID = new LLUUID(bytes, i); i += 16; - length = (ushort)bytes[i++]; - _profileurl = new byte[length]; - Buffer.BlockCopy(bytes, i, _profileurl, 0, length); i += length; - length = (ushort)bytes[i++]; - _bornon = new byte[length]; - Buffer.BlockCopy(bytes, i, _bornon, 0, length); i += length; - 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) - { - Buffer.BlockCopy(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); - Buffer.BlockCopy(AboutText, 0, bytes, i, AboutText.Length); i += AboutText.Length; - if(CharterMember == null) { Console.WriteLine("Warning: CharterMember is null, in " + this.GetType()); } - bytes[i++] = (byte)CharterMember.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(FLAboutText, 0, bytes, i, FLAboutText.Length); i += FLAboutText.Length; - Buffer.BlockCopy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(FLImageID.GetBytes(), 0, bytes, i, 16); i += 16; - if(ProfileURL == null) { Console.WriteLine("Warning: ProfileURL is null, in " + this.GetType()); } - bytes[i++] = (byte)ProfileURL.Length; - Buffer.BlockCopy(ProfileURL, 0, bytes, i, ProfileURL.Length); i += ProfileURL.Length; - if(BornOn == null) { Console.WriteLine("Warning: BornOn is null, in " + this.GetType()); } - bytes[i++] = (byte)BornOn.Length; - Buffer.BlockCopy(BornOn, 0, bytes, i, BornOn.Length); i += BornOn.Length; - 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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- PropertiesData --"); - output.AppendLine(String.Format("PartnerID: {0}", PartnerID)); - Helpers.FieldToString(output, AboutText, "AboutText"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, CharterMember, "CharterMember"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, FLAboutText, "FLAboutText"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ImageID: {0}", ImageID)); - output.AppendLine(String.Format("FLImageID: {0}", FLImageID)); - Helpers.FieldToString(output, ProfileURL, "ProfileURL"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, BornOn, "BornOn"); - output.Append(Environment.NewLine); - output.Append(String.Format("Flags: {0}", Flags)); - return output.ToString(); - } - } - /// [XmlType("avatarpropertiesreply_agentdata")] public class AgentDataBlock @@ -26977,47 +24578,206 @@ namespace libsecondlife.Packets } } + /// + [XmlType("avatarpropertiesreply_propertiesdata")] + public class PropertiesDataBlock + { + public LLUUID ImageID; + public LLUUID FLImageID; + public LLUUID PartnerID; + private byte[] _abouttext; + public byte[] AboutText + { + get { return _abouttext; } + set + { + if (value == null) { _abouttext = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _abouttext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _abouttext, 0, 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]; Buffer.BlockCopy(value, 0, _flabouttext, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _bornon, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _profileurl, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _chartermember, 0, value.Length); } + } + } + public uint Flags; + + [XmlIgnore] + public int Length + { + get + { + int length = 52; + if (AboutText != null) { length += 2 + AboutText.Length; } + if (FLAboutText != null) { length += 1 + FLAboutText.Length; } + if (BornOn != null) { length += 1 + BornOn.Length; } + if (ProfileURL != null) { length += 1 + ProfileURL.Length; } + if (CharterMember != null) { length += 1 + CharterMember.Length; } + return length; + } + } + + public PropertiesDataBlock() { } + public PropertiesDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ImageID = new LLUUID(bytes, i); i += 16; + FLImageID = new LLUUID(bytes, i); i += 16; + PartnerID = new LLUUID(bytes, i); i += 16; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _abouttext = new byte[length]; + Buffer.BlockCopy(bytes, i, _abouttext, 0, length); i += length; + length = (ushort)bytes[i++]; + _flabouttext = new byte[length]; + Buffer.BlockCopy(bytes, i, _flabouttext, 0, length); i += length; + length = (ushort)bytes[i++]; + _bornon = new byte[length]; + Buffer.BlockCopy(bytes, i, _bornon, 0, length); i += length; + length = (ushort)bytes[i++]; + _profileurl = new byte[length]; + Buffer.BlockCopy(bytes, i, _profileurl, 0, length); i += length; + length = (ushort)bytes[i++]; + _chartermember = new byte[length]; + Buffer.BlockCopy(bytes, i, _chartermember, 0, length); i += length; + 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) + { + Buffer.BlockCopy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FLImageID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(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); + Buffer.BlockCopy(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; + Buffer.BlockCopy(FLAboutText, 0, bytes, i, FLAboutText.Length); i += FLAboutText.Length; + if(BornOn == null) { Console.WriteLine("Warning: BornOn is null, in " + this.GetType()); } + bytes[i++] = (byte)BornOn.Length; + Buffer.BlockCopy(BornOn, 0, bytes, i, BornOn.Length); i += BornOn.Length; + if(ProfileURL == null) { Console.WriteLine("Warning: ProfileURL is null, in " + this.GetType()); } + bytes[i++] = (byte)ProfileURL.Length; + Buffer.BlockCopy(ProfileURL, 0, bytes, i, ProfileURL.Length); i += ProfileURL.Length; + if(CharterMember == null) { Console.WriteLine("Warning: CharterMember is null, in " + this.GetType()); } + bytes[i++] = (byte)CharterMember.Length; + Buffer.BlockCopy(CharterMember, 0, bytes, i, CharterMember.Length); i += CharterMember.Length; + 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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- PropertiesData --"); + output.AppendLine(String.Format("ImageID: {0}", ImageID)); + output.AppendLine(String.Format("FLImageID: {0}", FLImageID)); + output.AppendLine(String.Format("PartnerID: {0}", PartnerID)); + Helpers.FieldToString(output, AboutText, "AboutText"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, FLAboutText, "FLAboutText"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, BornOn, "BornOn"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, ProfileURL, "ProfileURL"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, CharterMember, "CharterMember"); + output.Append(Environment.NewLine); + output.Append(String.Format("Flags: {0}", Flags)); + return output.ToString(); + } + } + 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 PropertiesDataBlock PropertiesData; public AvatarPropertiesReplyPacket() { Header = new LowHeader(); - Header.ID = 201; + Header.ID = 171; Header.Reliable = true; - Header.Zerocoded = true; - PropertiesData = new PropertiesDataBlock(); AgentData = new AgentDataBlock(); + PropertiesData = new PropertiesDataBlock(); } 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); + PropertiesData = new PropertiesDataBlock(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); + PropertiesData = new PropertiesDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += PropertiesData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += PropertiesData.Length;; 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); + PropertiesData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -27025,8 +24785,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarPropertiesReply ---" + Environment.NewLine; - output += PropertiesData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += PropertiesData.ToString() + Environment.NewLine; return output; } @@ -27035,6 +24795,52 @@ namespace libsecondlife.Packets /// public class AvatarInterestsReplyPacket : Packet { + /// + [XmlType("avatarinterestsreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID AvatarID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + AvatarID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("AvatarID: {0}", AvatarID)); + return output.ToString(); + } + } + /// [XmlType("avatarinterestsreply_propertiesdata")] public class PropertiesDataBlock @@ -27148,93 +24954,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("avatarinterestsreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID AvatarID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - AvatarID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("AvatarID: {0}", AvatarID)); - return output.ToString(); - } - } - 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 PropertiesDataBlock PropertiesData; public AvatarInterestsReplyPacket() { Header = new LowHeader(); - Header.ID = 202; + Header.ID = 172; Header.Reliable = true; - Header.Zerocoded = true; - PropertiesData = new PropertiesDataBlock(); AgentData = new AgentDataBlock(); + PropertiesData = new PropertiesDataBlock(); } 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); + PropertiesData = new PropertiesDataBlock(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); + PropertiesData = new PropertiesDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += PropertiesData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += PropertiesData.Length;; 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); + PropertiesData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -27242,8 +25001,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarInterestsReply ---" + Environment.NewLine; - output += PropertiesData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += PropertiesData.ToString() + Environment.NewLine; return output; } @@ -27302,6 +25061,8 @@ namespace libsecondlife.Packets [XmlType("avatargroupsreply_groupdata")] public class GroupDataBlock { + public ulong GroupPowers; + public bool AcceptNotices; private byte[] _grouptitle; public byte[] GroupTitle { @@ -27313,10 +25074,7 @@ namespace libsecondlife.Packets else { _grouptitle = new byte[value.Length]; Buffer.BlockCopy(value, 0, _grouptitle, 0, value.Length); } } } - public ulong GroupPowers; public LLUUID GroupID; - public LLUUID GroupInsigniaID; - public bool AcceptNotices; private byte[] _groupname; public byte[] GroupName { @@ -27328,6 +25086,7 @@ namespace libsecondlife.Packets else { _groupname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _groupname, 0, value.Length); } } } + public LLUUID GroupInsigniaID; [XmlIgnore] public int Length @@ -27347,16 +25106,16 @@ namespace libsecondlife.Packets 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)); + AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false; length = (ushort)bytes[i++]; _grouptitle = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(bytes, i, _groupname, 0, length); i += length; + GroupInsigniaID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -27366,9 +25125,6 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); @@ -27377,25 +25133,29 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((GroupPowers >> 40) % 256); bytes[i++] = (byte)((GroupPowers >> 48) % 256); bytes[i++] = (byte)((GroupPowers >> 56) % 256); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupInsigniaID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)((AcceptNotices) ? 1 : 0); + if(GroupTitle == null) { Console.WriteLine("Warning: GroupTitle is null, in " + this.GetType()); } + bytes[i++] = (byte)GroupTitle.Length; + Buffer.BlockCopy(GroupTitle, 0, bytes, i, GroupTitle.Length); i += GroupTitle.Length; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; if(GroupName == null) { Console.WriteLine("Warning: GroupName is null, in " + this.GetType()); } bytes[i++] = (byte)GroupName.Length; Buffer.BlockCopy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length; + Buffer.BlockCopy(GroupInsigniaID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); + output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); + output.AppendLine(String.Format("AcceptNotices: {0}", AcceptNotices)); Helpers.FieldToString(output, GroupTitle, "GroupTitle"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("GroupInsigniaID: {0}", GroupInsigniaID)); - output.AppendLine(String.Format("AcceptNotices: {0}", AcceptNotices)); Helpers.FieldToString(output, GroupName, "GroupName"); + output.Append(Environment.NewLine); + output.Append(String.Format("GroupInsigniaID: {0}", GroupInsigniaID)); return output.ToString(); } } @@ -27409,9 +25169,8 @@ namespace libsecondlife.Packets public AvatarGroupsReplyPacket() { Header = new LowHeader(); - Header.ID = 203; + Header.ID = 173; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock[0]; } @@ -27439,7 +25198,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < GroupData.Length; j++) { length += GroupData[j].Length; } @@ -27470,123 +25229,6 @@ namespace libsecondlife.Packets /// public class AvatarPropertiesUpdatePacket : Packet { - /// - [XmlType("avatarpropertiesupdate_propertiesdata")] - public class PropertiesDataBlock - { - private byte[] _abouttext; - public byte[] AboutText - { - get { return _abouttext; } - set - { - if (value == null) { _abouttext = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _abouttext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _abouttext, 0, 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]; Buffer.BlockCopy(value, 0, _flabouttext, 0, 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]; Buffer.BlockCopy(value, 0, _profileurl, 0, value.Length); } - } - } - public bool MaturePublish; - - [XmlIgnore] - public int Length - { - get - { - int length = 34; - if (AboutText != null) { length += 2 + AboutText.Length; } - if (FLAboutText != null) { length += 1 + FLAboutText.Length; } - if (ProfileURL != null) { length += 1 + ProfileURL.Length; } - return length; - } - } - - public PropertiesDataBlock() { } - public PropertiesDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _abouttext = new byte[length]; - Buffer.BlockCopy(bytes, i, _abouttext, 0, length); i += length; - length = (ushort)bytes[i++]; - _flabouttext = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(FLAboutText, 0, bytes, i, FLAboutText.Length); i += FLAboutText.Length; - Buffer.BlockCopy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(ProfileURL, 0, bytes, i, ProfileURL.Length); i += ProfileURL.Length; - bytes[i++] = (byte)((MaturePublish) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- PropertiesData --"); - Helpers.FieldToString(output, AboutText, "AboutText"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, FLAboutText, "FLAboutText"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ImageID: {0}", ImageID)); - output.AppendLine(String.Format("FLImageID: {0}", FLImageID)); - output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); - Helpers.FieldToString(output, ProfileURL, "ProfileURL"); - output.Append(Environment.NewLine); - output.Append(String.Format("MaturePublish: {0}", MaturePublish)); - return output.ToString(); - } - } - /// [XmlType("avatarpropertiesupdate_agentdata")] public class AgentDataBlock @@ -27633,47 +25275,162 @@ namespace libsecondlife.Packets } } + /// + [XmlType("avatarpropertiesupdate_propertiesdata")] + public class PropertiesDataBlock + { + public LLUUID ImageID; + public LLUUID FLImageID; + private byte[] _abouttext; + public byte[] AboutText + { + get { return _abouttext; } + set + { + if (value == null) { _abouttext = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _abouttext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _abouttext, 0, 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]; Buffer.BlockCopy(value, 0, _flabouttext, 0, value.Length); } + } + } + public bool AllowPublish; + public bool MaturePublish; + 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]; Buffer.BlockCopy(value, 0, _profileurl, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 34; + if (AboutText != null) { length += 2 + AboutText.Length; } + if (FLAboutText != null) { length += 1 + FLAboutText.Length; } + if (ProfileURL != null) { length += 1 + ProfileURL.Length; } + return length; + } + } + + public PropertiesDataBlock() { } + public PropertiesDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ImageID = new LLUUID(bytes, i); i += 16; + FLImageID = new LLUUID(bytes, i); i += 16; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _abouttext = new byte[length]; + Buffer.BlockCopy(bytes, i, _abouttext, 0, length); i += length; + length = (ushort)bytes[i++]; + _flabouttext = new byte[length]; + Buffer.BlockCopy(bytes, i, _flabouttext, 0, length); i += length; + AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + length = (ushort)bytes[i++]; + _profileurl = new byte[length]; + Buffer.BlockCopy(bytes, i, _profileurl, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FLImageID.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); + Buffer.BlockCopy(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; + Buffer.BlockCopy(FLAboutText, 0, bytes, i, FLAboutText.Length); i += FLAboutText.Length; + bytes[i++] = (byte)((AllowPublish) ? 1 : 0); + bytes[i++] = (byte)((MaturePublish) ? 1 : 0); + if(ProfileURL == null) { Console.WriteLine("Warning: ProfileURL is null, in " + this.GetType()); } + bytes[i++] = (byte)ProfileURL.Length; + Buffer.BlockCopy(ProfileURL, 0, bytes, i, ProfileURL.Length); i += ProfileURL.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- PropertiesData --"); + output.AppendLine(String.Format("ImageID: {0}", ImageID)); + output.AppendLine(String.Format("FLImageID: {0}", FLImageID)); + Helpers.FieldToString(output, AboutText, "AboutText"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, FLAboutText, "FLAboutText"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); + output.AppendLine(String.Format("MaturePublish: {0}", MaturePublish)); + Helpers.FieldToString(output, ProfileURL, "ProfileURL"); + return output.ToString(); + } + } + 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 PropertiesDataBlock PropertiesData; public AvatarPropertiesUpdatePacket() { Header = new LowHeader(); - Header.ID = 204; + Header.ID = 174; Header.Reliable = true; - Header.Zerocoded = true; - PropertiesData = new PropertiesDataBlock(); AgentData = new AgentDataBlock(); + PropertiesData = new PropertiesDataBlock(); } 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); + PropertiesData = new PropertiesDataBlock(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); + PropertiesData = new PropertiesDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += PropertiesData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += PropertiesData.Length;; 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); + PropertiesData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -27681,8 +25438,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarPropertiesUpdate ---" + Environment.NewLine; - output += PropertiesData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += PropertiesData.ToString() + Environment.NewLine; return output; } @@ -27691,6 +25448,52 @@ namespace libsecondlife.Packets /// public class AvatarInterestsUpdatePacket : Packet { + /// + [XmlType("avatarinterestsupdate_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("avatarinterestsupdate_propertiesdata")] public class PropertiesDataBlock @@ -27804,93 +25607,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("avatarinterestsupdate_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 PropertiesDataBlock PropertiesData; public AvatarInterestsUpdatePacket() { Header = new LowHeader(); - Header.ID = 205; + Header.ID = 175; Header.Reliable = true; - Header.Zerocoded = true; - PropertiesData = new PropertiesDataBlock(); AgentData = new AgentDataBlock(); + PropertiesData = new PropertiesDataBlock(); } 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); + PropertiesData = new PropertiesDataBlock(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); + PropertiesData = new PropertiesDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += PropertiesData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += PropertiesData.Length;; 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); + PropertiesData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -27898,134 +25654,18 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarInterestsUpdate ---" + Environment.NewLine; - output += PropertiesData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += PropertiesData.ToString() + Environment.NewLine; return output; } } /// - public class AvatarStatisticsReplyPacket : Packet + public class AvatarNotesReplyPacket : Packet { /// - [XmlType("avatarstatisticsreply_statisticsdata")] - public class StatisticsDataBlock - { - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - public int Negative; - public int Positive; - - [XmlIgnore] - public int Length - { - get - { - int length = 8; - if (Name != null) { length += 1 + Name.Length; } - return length; - } - } - - public StatisticsDataBlock() { } - public StatisticsDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- StatisticsData --"); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Negative: {0}", Negative)); - output.Append(String.Format("Positive: {0}", Positive)); - return output.ToString(); - } - } - - /// - [XmlType("avatarstatisticsreply_avatardata")] - public class AvatarDataBlock - { - public LLUUID AvatarID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AvatarDataBlock() { } - public AvatarDataBlock(byte[] bytes, ref int i) - { - try - { - AvatarID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AvatarID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AvatarData --"); - output.Append(String.Format("AvatarID: {0}", AvatarID)); - return output.ToString(); - } - } - - /// - [XmlType("avatarstatisticsreply_agentdata")] + [XmlType("avatarnotesreply_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -28066,82 +25706,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AvatarStatisticsReply; } } - public StatisticsDataBlock[] StatisticsData; - public AvatarDataBlock AvatarData; - public AgentDataBlock AgentData; - - public AvatarStatisticsReplyPacket() - { - Header = new LowHeader(); - Header.ID = 206; - Header.Reliable = true; - Header.Zerocoded = true; - StatisticsData = new StatisticsDataBlock[0]; - AvatarData = new AvatarDataBlock(); - AgentData = new AgentDataBlock(); - } - - public AvatarStatisticsReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - StatisticsData = new StatisticsDataBlock[count]; - for (int j = 0; j < count; j++) - { StatisticsData[j] = new StatisticsDataBlock(bytes, ref i); } - AvatarData = new AvatarDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AvatarStatisticsReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - StatisticsData = new StatisticsDataBlock[count]; - for (int j = 0; j < count; j++) - { StatisticsData[j] = new StatisticsDataBlock(bytes, ref i); } - AvatarData = new AvatarDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AvatarData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < StatisticsData.Length; j++) { length += StatisticsData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)StatisticsData.Length; - for (int j = 0; j < StatisticsData.Length; j++) { StatisticsData[j].ToBytes(bytes, ref i); } - AvatarData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AvatarStatisticsReply ---" + Environment.NewLine; - for (int j = 0; j < StatisticsData.Length; j++) - { - output += StatisticsData[j].ToString() + Environment.NewLine; - } - output += AvatarData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AvatarNotesReplyPacket : Packet - { /// [XmlType("avatarnotesreply_data")] public class DataBlock @@ -28206,18 +25770,76 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.AvatarNotesReply; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public AvatarNotesReplyPacket() + { + Header = new LowHeader(); + Header.ID = 176; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public AvatarNotesReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public AvatarNotesReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- AvatarNotesReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class AvatarNotesUpdatePacket : Packet + { /// - [XmlType("avatarnotesreply_agentdata")] + [XmlType("avatarnotesupdate_agentdata")] public class AgentDataBlock { public LLUUID AgentID; + public LLUUID SessionID; [XmlIgnore] public int Length { get { - return 16; + return 32; } } @@ -28227,6 +25849,7 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -28237,74 +25860,19 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AvatarNotesReply; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public AvatarNotesReplyPacket() - { - Header = new LowHeader(); - Header.ID = 207; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public AvatarNotesReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AvatarNotesReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AvatarNotesReply ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AvatarNotesUpdatePacket : Packet - { /// [XmlType("avatarnotesupdate_data")] public class DataBlock @@ -28369,92 +25937,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("avatarnotesupdate_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 DataBlock Data; public AvatarNotesUpdatePacket() { Header = new LowHeader(); - Header.ID = 208; + Header.ID = 177; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -28462,8 +25984,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarNotesUpdate ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -28472,70 +25994,6 @@ namespace libsecondlife.Packets /// public class AvatarPicksReplyPacket : Packet { - /// - [XmlType("avatarpicksreply_data")] - public class DataBlock - { - private byte[] _pickname; - public byte[] PickName - { - get { return _pickname; } - set - { - if (value == null) { _pickname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _pickname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _pickname, 0, value.Length); } - } - } - public LLUUID PickID; - - [XmlIgnore] - public int Length - { - get - { - int length = 16; - if (PickName != null) { length += 1 + PickName.Length; } - return length; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _pickname = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(PickName, 0, bytes, i, PickName.Length); i += PickName.Length; - Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - Helpers.FieldToString(output, PickName, "PickName"); - output.Append(Environment.NewLine); - output.Append(String.Format("PickID: {0}", PickID)); - return output.ToString(); - } - } - /// [XmlType("avatarpicksreply_agentdata")] public class AgentDataBlock @@ -28582,96 +26040,44 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AvatarPicksReply; } } - public DataBlock[] Data; - public AgentDataBlock AgentData; - - public AvatarPicksReplyPacket() - { - Header = new LowHeader(); - Header.ID = 209; - Header.Reliable = true; - Data = new DataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public AvatarPicksReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AvatarPicksReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)Data.Length; - for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AvatarPicksReply ---" + Environment.NewLine; - for (int j = 0; j < Data.Length; j++) - { - output += Data[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class EventInfoRequestPacket : Packet - { /// - [XmlType("eventinforequest_eventdata")] - public class EventDataBlock + [XmlType("avatarpicksreply_data")] + public class DataBlock { - public uint EventID; + public LLUUID PickID; + 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]; Buffer.BlockCopy(value, 0, _pickname, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 4; + int length = 16; + if (PickName != null) { length += 1 + PickName.Length; } + return length; } } - public EventDataBlock() { } - public EventDataBlock(byte[] bytes, ref int i) + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) { + int length; try { - EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PickID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _pickname = new byte[length]; + Buffer.BlockCopy(bytes, i, _pickname, 0, length); i += length; } catch (Exception) { @@ -28681,21 +26087,91 @@ namespace libsecondlife.Packets 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); + Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; + if(PickName == null) { Console.WriteLine("Warning: PickName is null, in " + this.GetType()); } + bytes[i++] = (byte)PickName.Length; + Buffer.BlockCopy(PickName, 0, bytes, i, PickName.Length); i += PickName.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- EventData --"); - output.Append(String.Format("EventID: {0}", EventID)); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("PickID: {0}", PickID)); + Helpers.FieldToString(output, PickName, "PickName"); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.AvatarPicksReply; } } + public AgentDataBlock AgentData; + public DataBlock[] Data; + + public AvatarPicksReplyPacket() + { + Header = new LowHeader(); + Header.ID = 178; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock[0]; + } + + public AvatarPicksReplyPacket(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++]; + Data = new DataBlock[count]; + for (int j = 0; j < count; j++) + { Data[j] = new DataBlock(bytes, ref i); } + } + + public AvatarPicksReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(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); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.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 = "--- AvatarPicksReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < Data.Length; j++) + { + output += Data[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class EventInfoRequestPacket : Packet + { /// [XmlType("eventinforequest_agentdata")] public class AgentDataBlock @@ -28742,371 +26218,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.EventInfoRequest; } } - public EventDataBlock EventData; - public AgentDataBlock AgentData; - - public EventInfoRequestPacket() - { - Header = new LowHeader(); - Header.ID = 210; - Header.Reliable = true; - EventData = new EventDataBlock(); - AgentData = new AgentDataBlock(); - } - - public EventInfoRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - EventData = new EventDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public EventInfoRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - EventData = new EventDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += EventData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - EventData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- EventInfoRequest ---" + Environment.NewLine; - output += EventData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class EventInfoReplyPacket : Packet - { /// - [XmlType("eventinforeply_eventdata")] - public class EventDataBlock - { - public uint Duration; - public uint DateUTC; - private byte[] _simname; - public byte[] SimName - { - get { return _simname; } - set - { - if (value == null) { _simname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, 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]; Buffer.BlockCopy(value, 0, _creator, 0, 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _date, 0, value.Length); } - } - } - private byte[] _desc; - public byte[] Desc - { - get { return _desc; } - set - { - if (value == null) { _desc = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, 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]; Buffer.BlockCopy(value, 0, _category, 0, value.Length); } - } - } - public uint EventFlags; - public uint Amount; - public uint Cover; - - [XmlIgnore] - public int Length - { - get - { - int length = 48; - if (SimName != null) { length += 1 + SimName.Length; } - if (Creator != null) { length += 1 + Creator.Length; } - if (Name != null) { length += 1 + Name.Length; } - if (Date != null) { length += 1 + Date.Length; } - if (Desc != null) { length += 2 + Desc.Length; } - if (Category != null) { length += 1 + Category.Length; } - return length; - } - } - - public EventDataBlock() { } - public EventDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Duration = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - DateUTC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _simname = new byte[length]; - Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; - GlobalPos = new LLVector3d(bytes, i); i += 24; - length = (ushort)bytes[i++]; - _creator = new byte[length]; - Buffer.BlockCopy(bytes, i, _creator, 0, length); i += length; - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - length = (ushort)bytes[i++]; - _date = new byte[length]; - Buffer.BlockCopy(bytes, i, _date, 0, length); i += length; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _desc = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- EventData --"); - output.AppendLine(String.Format("Duration: {0}", Duration)); - output.AppendLine(String.Format("DateUTC: {0}", DateUTC)); - Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("GlobalPos: {0}", GlobalPos)); - Helpers.FieldToString(output, Creator, "Creator"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Date, "Date"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Desc, "Desc"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("EventID: {0}", EventID)); - Helpers.FieldToString(output, Category, "Category"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("EventFlags: {0}", EventFlags)); - output.AppendLine(String.Format("Amount: {0}", Amount)); - output.Append(String.Format("Cover: {0}", Cover)); - return output.ToString(); - } - } - - /// - [XmlType("eventinforeply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.EventInfoReply; } } - public EventDataBlock EventData; - public AgentDataBlock AgentData; - - public EventInfoReplyPacket() - { - Header = new LowHeader(); - Header.ID = 211; - Header.Reliable = true; - EventData = new EventDataBlock(); - AgentData = new AgentDataBlock(); - } - - public EventInfoReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - EventData = new EventDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public EventInfoReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - EventData = new EventDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += EventData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - EventData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- EventInfoReply ---" + Environment.NewLine; - output += EventData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class EventNotificationAddRequestPacket : Packet - { - /// - [XmlType("eventnotificationaddrequest_eventdata")] + [XmlType("eventinforequest_eventdata")] public class EventDataBlock { public uint EventID; @@ -29150,6 +26263,369 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.EventInfoRequest; } } + public AgentDataBlock AgentData; + public EventDataBlock EventData; + + public EventInfoRequestPacket() + { + Header = new LowHeader(); + Header.ID = 179; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + EventData = new EventDataBlock(); + } + + public EventInfoRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + EventData = new EventDataBlock(bytes, ref i); + } + + public EventInfoRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + EventData = new EventDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += EventData.Length;; + 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); + EventData.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- EventInfoRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += EventData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class EventInfoReplyPacket : Packet + { + /// + [XmlType("eventinforeply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.Append(String.Format("AgentID: {0}", AgentID)); + return output.ToString(); + } + } + + /// + [XmlType("eventinforeply_eventdata")] + public class EventDataBlock + { + public uint EventID; + 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]; Buffer.BlockCopy(value, 0, _creator, 0, 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _category, 0, value.Length); } + } + } + private byte[] _desc; + public byte[] Desc + { + get { return _desc; } + set + { + if (value == null) { _desc = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, 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]; Buffer.BlockCopy(value, 0, _date, 0, value.Length); } + } + } + public uint DateUTC; + public uint Duration; + public uint Cover; + public uint Amount; + 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public LLVector3d GlobalPos; + public uint EventFlags; + + [XmlIgnore] + public int Length + { + get + { + int length = 48; + if (Creator != null) { length += 1 + Creator.Length; } + if (Name != null) { length += 1 + Name.Length; } + if (Category != null) { length += 1 + Category.Length; } + if (Desc != null) { length += 2 + Desc.Length; } + if (Date != null) { length += 1 + Date.Length; } + if (SimName != null) { length += 1 + SimName.Length; } + return length; + } + } + + public EventDataBlock() { } + public EventDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _creator = new byte[length]; + Buffer.BlockCopy(bytes, i, _creator, 0, length); i += length; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _category = new byte[length]; + Buffer.BlockCopy(bytes, i, _category, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _desc = new byte[length]; + Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; + length = (ushort)bytes[i++]; + _date = new byte[length]; + Buffer.BlockCopy(bytes, i, _date, 0, length); i += length; + DateUTC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Duration = (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)); + Amount = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + GlobalPos = new LLVector3d(bytes, i); i += 24; + EventFlags = (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); + if(Creator == null) { Console.WriteLine("Warning: Creator is null, in " + this.GetType()); } + bytes[i++] = (byte)Creator.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Category == null) { Console.WriteLine("Warning: Category is null, in " + this.GetType()); } + bytes[i++] = (byte)Category.Length; + Buffer.BlockCopy(Category, 0, bytes, i, Category.Length); i += Category.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); + Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; + if(Date == null) { Console.WriteLine("Warning: Date is null, in " + this.GetType()); } + bytes[i++] = (byte)Date.Length; + Buffer.BlockCopy(Date, 0, bytes, i, Date.Length); i += Date.Length; + bytes[i++] = (byte)(DateUTC % 256); + bytes[i++] = (byte)((DateUTC >> 8) % 256); + bytes[i++] = (byte)((DateUTC >> 16) % 256); + bytes[i++] = (byte)((DateUTC >> 24) % 256); + 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)(Cover % 256); + bytes[i++] = (byte)((Cover >> 8) % 256); + bytes[i++] = (byte)((Cover >> 16) % 256); + bytes[i++] = (byte)((Cover >> 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); + if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } + bytes[i++] = (byte)SimName.Length; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; + Buffer.BlockCopy(GlobalPos.GetBytes(), 0, bytes, i, 24); i += 24; + bytes[i++] = (byte)(EventFlags % 256); + bytes[i++] = (byte)((EventFlags >> 8) % 256); + bytes[i++] = (byte)((EventFlags >> 16) % 256); + bytes[i++] = (byte)((EventFlags >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- EventData --"); + output.AppendLine(String.Format("EventID: {0}", EventID)); + Helpers.FieldToString(output, Creator, "Creator"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Category, "Category"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Desc, "Desc"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Date, "Date"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("DateUTC: {0}", DateUTC)); + output.AppendLine(String.Format("Duration: {0}", Duration)); + output.AppendLine(String.Format("Cover: {0}", Cover)); + output.AppendLine(String.Format("Amount: {0}", Amount)); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("GlobalPos: {0}", GlobalPos)); + output.Append(String.Format("EventFlags: {0}", EventFlags)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.EventInfoReply; } } + public AgentDataBlock AgentData; + public EventDataBlock EventData; + + public EventInfoReplyPacket() + { + Header = new LowHeader(); + Header.ID = 180; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + EventData = new EventDataBlock(); + } + + public EventInfoReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + EventData = new EventDataBlock(bytes, ref i); + } + + public EventInfoReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + EventData = new EventDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += EventData.Length;; + 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); + EventData.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- EventInfoReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += EventData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class EventNotificationAddRequestPacket : Packet + { /// [XmlType("eventnotificationaddrequest_agentdata")] public class AgentDataBlock @@ -29196,65 +26672,8 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.EventNotificationAddRequest; } } - public EventDataBlock EventData; - public AgentDataBlock AgentData; - - public EventNotificationAddRequestPacket() - { - Header = new LowHeader(); - Header.ID = 212; - Header.Reliable = true; - EventData = new EventDataBlock(); - AgentData = new AgentDataBlock(); - } - - public EventNotificationAddRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - EventData = new EventDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public EventNotificationAddRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - EventData = new EventDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += EventData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - EventData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- EventNotificationAddRequest ---" + Environment.NewLine; - output += EventData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class EventNotificationRemoveRequestPacket : Packet - { /// - [XmlType("eventnotificationremoverequest_eventdata")] + [XmlType("eventnotificationaddrequest_eventdata")] public class EventDataBlock { public uint EventID; @@ -29298,6 +26717,63 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.EventNotificationAddRequest; } } + public AgentDataBlock AgentData; + public EventDataBlock EventData; + + public EventNotificationAddRequestPacket() + { + Header = new LowHeader(); + Header.ID = 181; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + EventData = new EventDataBlock(); + } + + public EventNotificationAddRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + EventData = new EventDataBlock(bytes, ref i); + } + + public EventNotificationAddRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + EventData = new EventDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += EventData.Length;; + 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); + EventData.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- EventNotificationAddRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += EventData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class EventNotificationRemoveRequestPacket : Packet + { /// [XmlType("eventnotificationremoverequest_agentdata")] public class AgentDataBlock @@ -29344,46 +26820,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("eventnotificationremoverequest_eventdata")] + public class EventDataBlock + { + public uint EventID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public EventDataBlock() { } + public EventDataBlock(byte[] bytes, ref int i) + { + try + { + EventID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(EventID % 256); + bytes[i++] = (byte)((EventID >> 8) % 256); + bytes[i++] = (byte)((EventID >> 16) % 256); + bytes[i++] = (byte)((EventID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- EventData --"); + output.Append(String.Format("EventID: {0}", EventID)); + return output.ToString(); + } + } + 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 EventDataBlock EventData; public EventNotificationRemoveRequestPacket() { Header = new LowHeader(); - Header.ID = 213; + Header.ID = 182; Header.Reliable = true; - EventData = new EventDataBlock(); AgentData = new AgentDataBlock(); + EventData = new EventDataBlock(); } 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); + EventData = new EventDataBlock(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); + EventData = new EventDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += EventData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += EventData.Length;; 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); + EventData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -29391,8 +26912,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- EventNotificationRemoveRequest ---" + Environment.NewLine; - output += EventData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += EventData.ToString() + Environment.NewLine; return output; } @@ -29401,6 +26922,52 @@ namespace libsecondlife.Packets /// public class EventGodDeletePacket : Packet { + /// + [XmlType("eventgoddelete_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("eventgoddelete_eventdata")] public class EventDataBlock @@ -29451,8 +27018,6 @@ namespace libsecondlife.Packets public class QueryDataBlock { public LLUUID QueryID; - public uint QueryFlags; - public int QueryStart; private byte[] _querytext; public byte[] QueryText { @@ -29464,6 +27029,8 @@ namespace libsecondlife.Packets else { _querytext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _querytext, 0, value.Length); } } } + public uint QueryFlags; + public int QueryStart; [XmlIgnore] public int Length @@ -29483,11 +27050,11 @@ namespace libsecondlife.Packets 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]; Buffer.BlockCopy(bytes, i, _querytext, 0, length); i += length; + 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)); } catch (Exception) { @@ -29498,6 +27065,9 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(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; + Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; bytes[i++] = (byte)(QueryFlags % 256); bytes[i++] = (byte)((QueryFlags >> 8) % 256); bytes[i++] = (byte)((QueryFlags >> 16) % 256); @@ -29506,9 +27076,6 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(QueryText, 0, bytes, i, QueryText.Length); i += QueryText.Length; } public override string ToString() @@ -29516,55 +27083,10 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- QueryData --"); output.AppendLine(String.Format("QueryID: {0}", QueryID)); - output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); - output.AppendLine(String.Format("QueryStart: {0}", QueryStart)); Helpers.FieldToString(output, QueryText, "QueryText"); - return output.ToString(); - } - } - - /// - [XmlType("eventgoddelete_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("QueryFlags: {0}", QueryFlags)); + output.Append(String.Format("QueryStart: {0}", QueryStart)); return output.ToString(); } } @@ -29572,48 +27094,48 @@ namespace libsecondlife.Packets private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.EventGodDelete; } } + public AgentDataBlock AgentData; public EventDataBlock EventData; public QueryDataBlock QueryData; - public AgentDataBlock AgentData; public EventGodDeletePacket() { Header = new LowHeader(); - Header.ID = 214; + Header.ID = 183; Header.Reliable = true; + AgentData = new AgentDataBlock(); 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); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; 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); + AgentData.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; } @@ -29621,155 +27143,9 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- EventGodDelete ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; output += EventData.ToString() + Environment.NewLine; output += QueryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class PickInfoRequestPacket : Packet - { - /// - [XmlType("pickinforequest_data")] - public class DataBlock - { - public LLUUID PickID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - PickID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.Append(String.Format("PickID: {0}", PickID)); - return output.ToString(); - } - } - - /// - [XmlType("pickinforequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.PickInfoRequest; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public PickInfoRequestPacket() - { - Header = new LowHeader(); - Header.ID = 215; - Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public PickInfoRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public PickInfoRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- PickInfoRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -29778,182 +27154,6 @@ namespace libsecondlife.Packets /// public class PickInfoReplyPacket : Packet { - /// - [XmlType("pickinforeply_data")] - public class DataBlock - { - private byte[] _originalname; - public byte[] OriginalName - { - get { return _originalname; } - set - { - if (value == null) { _originalname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _originalname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _originalname, 0, 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]; Buffer.BlockCopy(value, 0, _simname, 0, 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - private byte[] _desc; - public byte[] Desc - { - get { return _desc; } - set - { - if (value == null) { _desc = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, 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]; Buffer.BlockCopy(value, 0, _user, 0, value.Length); } - } - } - public LLUUID CreatorID; - public LLUUID PickID; - public LLUUID SnapshotID; - public int SortOrder; - - [XmlIgnore] - public int Length - { - get - { - int length = 94; - if (OriginalName != null) { length += 1 + OriginalName.Length; } - if (SimName != null) { length += 1 + SimName.Length; } - if (Name != null) { length += 1 + Name.Length; } - if (Desc != null) { length += 2 + Desc.Length; } - if (User != null) { length += 1 + User.Length; } - return length; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _originalname = new byte[length]; - Buffer.BlockCopy(bytes, i, _originalname, 0, length); i += length; - length = (ushort)bytes[i++]; - _simname = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _desc = new byte[length]; - Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; - length = (ushort)bytes[i++]; - _user = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; - bytes[i++] = (byte)((Enabled) ? 1 : 0); - Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; - bytes[i++] = (byte)((TopPick) ? 1 : 0); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(User, 0, bytes, i, User.Length); i += User.Length; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - Helpers.FieldToString(output, OriginalName, "OriginalName"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Enabled: {0}", Enabled)); - output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); - output.AppendLine(String.Format("TopPick: {0}", TopPick)); - output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Desc, "Desc"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, User, "User"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - output.AppendLine(String.Format("PickID: {0}", PickID)); - output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.Append(String.Format("SortOrder: {0}", SortOrder)); - return output.ToString(); - } - } - /// [XmlType("pickinforeply_agentdata")] public class AgentDataBlock @@ -29996,69 +27196,12 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.PickInfoReply; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public PickInfoReplyPacket() - { - Header = new LowHeader(); - Header.ID = 216; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public PickInfoReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public PickInfoReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- PickInfoReply ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class PickInfoUpdatePacket : Packet - { /// - [XmlType("pickinfoupdate_data")] + [XmlType("pickinforeply_data")] public class DataBlock { - public bool Enabled; - public LLVector3d PosGlobal; + public LLUUID PickID; + public LLUUID CreatorID; public bool TopPick; public LLUUID ParcelID; private byte[] _name; @@ -30083,10 +27226,43 @@ namespace libsecondlife.Packets else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } } } - public LLUUID CreatorID; - public LLUUID PickID; public LLUUID SnapshotID; + 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]; Buffer.BlockCopy(value, 0, _user, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _originalname, 0, 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public LLVector3d PosGlobal; public int SortOrder; + public bool Enabled; [XmlIgnore] public int Length @@ -30096,6 +27272,9 @@ namespace libsecondlife.Packets int length = 94; if (Name != null) { length += 1 + Name.Length; } if (Desc != null) { length += 2 + Desc.Length; } + if (User != null) { length += 1 + User.Length; } + if (OriginalName != null) { length += 1 + OriginalName.Length; } + if (SimName != null) { length += 1 + SimName.Length; } return length; } } @@ -30106,8 +27285,8 @@ namespace libsecondlife.Packets int length; try { - Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false; - PosGlobal = new LLVector3d(bytes, i); i += 24; + PickID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; TopPick = (bytes[i++] != 0) ? (bool)true : (bool)false; ParcelID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; @@ -30116,10 +27295,19 @@ namespace libsecondlife.Packets length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _desc = new byte[length]; Buffer.BlockCopy(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; + length = (ushort)bytes[i++]; + _user = new byte[length]; + Buffer.BlockCopy(bytes, i, _user, 0, length); i += length; + length = (ushort)bytes[i++]; + _originalname = new byte[length]; + Buffer.BlockCopy(bytes, i, _originalname, 0, length); i += length; + length = (ushort)bytes[i++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + PosGlobal = new LLVector3d(bytes, i); i += 24; SortOrder = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -30129,8 +27317,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((Enabled) ? 1 : 0); - Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; + Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)((TopPick) ? 1 : 0); Buffer.BlockCopy(ParcelID.GetBytes(), 0, bytes, i, 16); i += 16; if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } @@ -30140,35 +27328,107 @@ namespace libsecondlife.Packets bytes[i++] = (byte)(Desc.Length % 256); bytes[i++] = (byte)((Desc.Length >> 8) % 256); Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + if(User == null) { Console.WriteLine("Warning: User is null, in " + this.GetType()); } + bytes[i++] = (byte)User.Length; + Buffer.BlockCopy(User, 0, bytes, i, User.Length); i += User.Length; + if(OriginalName == null) { Console.WriteLine("Warning: OriginalName is null, in " + this.GetType()); } + bytes[i++] = (byte)OriginalName.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; + Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; 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)((Enabled) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("Enabled: {0}", Enabled)); - output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); + output.AppendLine(String.Format("PickID: {0}", PickID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); output.AppendLine(String.Format("TopPick: {0}", TopPick)); output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); Helpers.FieldToString(output, Desc, "Desc"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - output.AppendLine(String.Format("PickID: {0}", PickID)); output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.Append(String.Format("SortOrder: {0}", SortOrder)); + Helpers.FieldToString(output, User, "User"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, OriginalName, "OriginalName"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); + output.AppendLine(String.Format("SortOrder: {0}", SortOrder)); + output.Append(String.Format("Enabled: {0}", Enabled)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.PickInfoReply; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public PickInfoReplyPacket() + { + Header = new LowHeader(); + Header.ID = 184; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public PickInfoReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public PickInfoReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- PickInfoReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class PickInfoUpdatePacket : Packet + { /// [XmlType("pickinfoupdate_agentdata")] public class AgentDataBlock @@ -30215,84 +27475,73 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.PickInfoUpdate; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public PickInfoUpdatePacket() - { - Header = new LowHeader(); - Header.ID = 217; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public PickInfoUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public PickInfoUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- PickInfoUpdate ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class PickDeletePacket : Packet - { /// - [XmlType("pickdelete_data")] + [XmlType("pickinfoupdate_data")] public class DataBlock { public LLUUID PickID; + public LLUUID CreatorID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + private byte[] _desc; + public byte[] Desc + { + get { return _desc; } + set + { + if (value == null) { _desc = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _desc = new byte[value.Length]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } + } + } + public LLUUID SnapshotID; + public LLVector3d PosGlobal; + public int SortOrder; + public bool Enabled; [XmlIgnore] public int Length { get { - return 16; + 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 { PickID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; + TopPick = (bytes[i++] != 0) ? (bool)true : (bool)false; + ParcelID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _desc = new byte[length]; + Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; + SnapshotID = new LLUUID(bytes, i); i += 16; + PosGlobal = new LLVector3d(bytes, i); i += 24; + SortOrder = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -30303,17 +27552,102 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((TopPick) ? 1 : 0); + Buffer.BlockCopy(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; + Buffer.BlockCopy(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); + Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; + Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; + 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)((Enabled) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.Append(String.Format("PickID: {0}", PickID)); + output.AppendLine(String.Format("PickID: {0}", PickID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("TopPick: {0}", TopPick)); + output.AppendLine(String.Format("ParcelID: {0}", ParcelID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Desc, "Desc"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); + output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); + output.AppendLine(String.Format("SortOrder: {0}", SortOrder)); + output.Append(String.Format("Enabled: {0}", Enabled)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.PickInfoUpdate; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public PickInfoUpdatePacket() + { + Header = new LowHeader(); + Header.ID = 185; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public PickInfoUpdatePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public PickInfoUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- PickInfoUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class PickDeletePacket : Packet + { /// [XmlType("pickdelete_agentdata")] public class AgentDataBlock @@ -30360,68 +27694,10 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.PickDelete; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public PickDeletePacket() - { - Header = new LowHeader(); - Header.ID = 218; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public PickDeletePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public PickDeletePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- PickDelete ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class PickGodDeletePacket : Packet - { /// - [XmlType("pickgoddelete_data")] + [XmlType("pickdelete_data")] public class DataBlock { - public LLUUID QueryID; public LLUUID PickID; [XmlIgnore] @@ -30429,7 +27705,7 @@ namespace libsecondlife.Packets { get { - return 32; + return 16; } } @@ -30438,7 +27714,6 @@ namespace libsecondlife.Packets { try { - QueryID = new LLUUID(bytes, i); i += 16; PickID = new LLUUID(bytes, i); i += 16; } catch (Exception) @@ -30449,7 +27724,6 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; } @@ -30457,12 +27731,68 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("QueryID: {0}", QueryID)); output.Append(String.Format("PickID: {0}", PickID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.PickDelete; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public PickDeletePacket() + { + Header = new LowHeader(); + Header.ID = 186; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public PickDeletePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public PickDeletePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- PickDelete ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class PickGodDeletePacket : Packet + { /// [XmlType("pickgoddelete_agentdata")] public class AgentDataBlock @@ -30509,46 +27839,92 @@ namespace libsecondlife.Packets } } + /// + [XmlType("pickgoddelete_data")] + public class DataBlock + { + public LLUUID PickID; + public LLUUID QueryID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + try + { + PickID = 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) + { + Buffer.BlockCopy(PickID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("PickID: {0}", PickID)); + output.Append(String.Format("QueryID: {0}", QueryID)); + return output.ToString(); + } + } + 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 DataBlock Data; public PickGodDeletePacket() { Header = new LowHeader(); - Header.ID = 219; + Header.ID = 187; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -30556,8 +27932,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- PickGodDelete ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -30570,6 +27946,8 @@ namespace libsecondlife.Packets [XmlType("scriptquestion_data")] public class DataBlock { + public LLUUID TaskID; + public LLUUID ItemID; private byte[] _objectname; public byte[] ObjectName { @@ -30592,8 +27970,6 @@ namespace libsecondlife.Packets else { _objectowner = new byte[value.Length]; Buffer.BlockCopy(value, 0, _objectowner, 0, value.Length); } } } - public LLUUID TaskID; - public LLUUID ItemID; public int Questions; [XmlIgnore] @@ -30614,14 +27990,14 @@ namespace libsecondlife.Packets int length; try { + TaskID = new LLUUID(bytes, i); i += 16; + ItemID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _objectname = new byte[length]; Buffer.BlockCopy(bytes, i, _objectname, 0, length); i += length; length = (ushort)bytes[i++]; _objectowner = new byte[length]; Buffer.BlockCopy(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) @@ -30632,14 +28008,14 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); } bytes[i++] = (byte)ObjectName.Length; Buffer.BlockCopy(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; Buffer.BlockCopy(ObjectOwner, 0, bytes, i, ObjectOwner.Length); i += ObjectOwner.Length; - Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); @@ -30650,12 +28026,12 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); + output.AppendLine(String.Format("TaskID: {0}", TaskID)); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); Helpers.FieldToString(output, ObjectName, "ObjectName"); output.Append(Environment.NewLine); Helpers.FieldToString(output, ObjectOwner, "ObjectOwner"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("TaskID: {0}", TaskID)); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); output.Append(String.Format("Questions: {0}", Questions)); return output.ToString(); } @@ -30669,7 +28045,7 @@ namespace libsecondlife.Packets public ScriptQuestionPacket() { Header = new LowHeader(); - Header.ID = 220; + Header.ID = 188; Header.Reliable = true; Data = new DataBlock(); } @@ -30689,7 +28065,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Data.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -30716,9 +28092,9 @@ namespace libsecondlife.Packets [XmlType("scriptcontrolchange_data")] public class DataBlock { - public bool PassToAgent; - public uint Controls; public bool TakeControls; + public uint Controls; + public bool PassToAgent; [XmlIgnore] public int Length @@ -30734,9 +28110,9 @@ namespace libsecondlife.Packets { 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; + Controls = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PassToAgent = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -30746,21 +28122,21 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((PassToAgent) ? 1 : 0); + bytes[i++] = (byte)((TakeControls) ? 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); + bytes[i++] = (byte)((PassToAgent) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("PassToAgent: {0}", PassToAgent)); + output.AppendLine(String.Format("TakeControls: {0}", TakeControls)); output.AppendLine(String.Format("Controls: {0}", Controls)); - output.Append(String.Format("TakeControls: {0}", TakeControls)); + output.Append(String.Format("PassToAgent: {0}", PassToAgent)); return output.ToString(); } } @@ -30773,7 +28149,7 @@ namespace libsecondlife.Packets public ScriptControlChangePacket() { Header = new LowHeader(); - Header.ID = 221; + Header.ID = 189; Header.Reliable = true; Data = new DataBlock[0]; } @@ -30799,7 +28175,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } @@ -30832,28 +28208,16 @@ namespace libsecondlife.Packets [XmlType("scriptdialog_data")] public class DataBlock { - private byte[] _objectname; - public byte[] ObjectName - { - get { return _objectname; } - set - { - if (value == null) { _objectname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _objectname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _objectname, 0, value.Length); } - } - } - public LLUUID ImageID; public LLUUID ObjectID; - private byte[] _message; - public byte[] Message + private byte[] _firstname; + public byte[] FirstName { - get { return _message; } + get { return _firstname; } set { - if (value == null) { _message = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + if (value == null) { _firstname = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _firstname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _firstname, 0, value.Length); } } } private byte[] _lastname; @@ -30867,18 +28231,30 @@ namespace libsecondlife.Packets else { _lastname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _lastname, 0, value.Length); } } } - private byte[] _firstname; - public byte[] FirstName + private byte[] _objectname; + public byte[] ObjectName { - get { return _firstname; } + get { return _objectname; } set { - if (value == null) { _firstname = null; return; } + if (value == null) { _objectname = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _firstname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _firstname, 0, value.Length); } + else { _objectname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _objectname, 0, value.Length); } + } + } + private byte[] _message; + public byte[] Message + { + get { return _message; } + set + { + if (value == null) { _message = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } } } public int ChatChannel; + public LLUUID ImageID; [XmlIgnore] public int Length @@ -30886,10 +28262,10 @@ namespace libsecondlife.Packets get { int length = 36; + if (FirstName != null) { length += 1 + FirstName.Length; } + if (LastName != null) { length += 1 + LastName.Length; } 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; } } @@ -30900,21 +28276,21 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)bytes[i++]; - _objectname = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + length = (ushort)bytes[i++]; + _firstname = new byte[length]; + Buffer.BlockCopy(bytes, i, _firstname, 0, length); i += length; length = (ushort)bytes[i++]; _lastname = new byte[length]; Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; length = (ushort)bytes[i++]; - _firstname = new byte[length]; - Buffer.BlockCopy(bytes, i, _firstname, 0, length); i += length; + _objectname = new byte[length]; + Buffer.BlockCopy(bytes, i, _objectname, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; ChatChannel = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ImageID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -30924,42 +28300,42 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); } + bytes[i++] = (byte)FirstName.Length; + Buffer.BlockCopy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length; + if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); } + bytes[i++] = (byte)LastName.Length; + Buffer.BlockCopy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length; if(ObjectName == null) { Console.WriteLine("Warning: ObjectName is null, in " + this.GetType()); } bytes[i++] = (byte)ObjectName.Length; Buffer.BlockCopy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length; - Buffer.BlockCopy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + Buffer.BlockCopy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - Helpers.FieldToString(output, ObjectName, "ObjectName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ImageID: {0}", ImageID)); output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - Helpers.FieldToString(output, Message, "Message"); + Helpers.FieldToString(output, FirstName, "FirstName"); output.Append(Environment.NewLine); Helpers.FieldToString(output, LastName, "LastName"); output.Append(Environment.NewLine); - Helpers.FieldToString(output, FirstName, "FirstName"); + Helpers.FieldToString(output, ObjectName, "ObjectName"); output.Append(Environment.NewLine); - output.Append(String.Format("ChatChannel: {0}", ChatChannel)); + Helpers.FieldToString(output, Message, "Message"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ChatChannel: {0}", ChatChannel)); + output.Append(String.Format("ImageID: {0}", ImageID)); return output.ToString(); } } @@ -31032,9 +28408,8 @@ namespace libsecondlife.Packets public ScriptDialogPacket() { Header = new LowHeader(); - Header.ID = 222; + Header.ID = 190; Header.Reliable = true; - Header.Zerocoded = true; Data = new DataBlock(); Buttons = new ButtonsBlock[0]; } @@ -31062,7 +28437,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Data.Length;; length++; for (int j = 0; j < Buttons.Length; j++) { length += Buttons[j].Length; } @@ -31093,84 +28468,6 @@ namespace libsecondlife.Packets /// public class ScriptDialogReplyPacket : Packet { - /// - [XmlType("scriptdialogreply_data")] - public class DataBlock - { - public LLUUID ObjectID; - private byte[] _buttonlabel; - public byte[] ButtonLabel - { - get { return _buttonlabel; } - set - { - if (value == null) { _buttonlabel = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _buttonlabel = new byte[value.Length]; Buffer.BlockCopy(value, 0, _buttonlabel, 0, value.Length); } - } - } - public int ButtonIndex; - public int ChatChannel; - - [XmlIgnore] - public int Length - { - get - { - int length = 24; - if (ButtonLabel != null) { length += 1 + ButtonLabel.Length; } - return length; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - int length; - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - length = (ushort)bytes[i++]; - _buttonlabel = new byte[length]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - Helpers.FieldToString(output, ButtonLabel, "ButtonLabel"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ButtonIndex: {0}", ButtonIndex)); - output.Append(String.Format("ChatChannel: {0}", ChatChannel)); - return output.ToString(); - } - } - /// [XmlType("scriptdialogreply_agentdata")] public class AgentDataBlock @@ -31217,47 +28514,123 @@ namespace libsecondlife.Packets } } + /// + [XmlType("scriptdialogreply_data")] + public class DataBlock + { + public LLUUID ObjectID; + public int ChatChannel; + public int ButtonIndex; + 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]; Buffer.BlockCopy(value, 0, _buttonlabel, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 24; + if (ButtonLabel != null) { length += 1 + ButtonLabel.Length; } + return length; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ObjectID = new LLUUID(bytes, i); i += 16; + ChatChannel = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ButtonIndex = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _buttonlabel = new byte[length]; + Buffer.BlockCopy(bytes, i, _buttonlabel, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(ChatChannel % 256); + bytes[i++] = (byte)((ChatChannel >> 8) % 256); + bytes[i++] = (byte)((ChatChannel >> 16) % 256); + bytes[i++] = (byte)((ChatChannel >> 24) % 256); + bytes[i++] = (byte)(ButtonIndex % 256); + bytes[i++] = (byte)((ButtonIndex >> 8) % 256); + bytes[i++] = (byte)((ButtonIndex >> 16) % 256); + bytes[i++] = (byte)((ButtonIndex >> 24) % 256); + if(ButtonLabel == null) { Console.WriteLine("Warning: ButtonLabel is null, in " + this.GetType()); } + bytes[i++] = (byte)ButtonLabel.Length; + Buffer.BlockCopy(ButtonLabel, 0, bytes, i, ButtonLabel.Length); i += ButtonLabel.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.AppendLine(String.Format("ChatChannel: {0}", ChatChannel)); + output.AppendLine(String.Format("ButtonIndex: {0}", ButtonIndex)); + Helpers.FieldToString(output, ButtonLabel, "ButtonLabel"); + return output.ToString(); + } + } + 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 DataBlock Data; public ScriptDialogReplyPacket() { Header = new LowHeader(); - Header.ID = 223; + Header.ID = 191; Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -31265,8 +28638,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ScriptDialogReply ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -31329,7 +28702,7 @@ namespace libsecondlife.Packets public ForceScriptControlReleasePacket() { Header = new LowHeader(); - Header.ID = 224; + Header.ID = 192; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -31349,7 +28722,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -31372,55 +28745,6 @@ namespace libsecondlife.Packets /// public class RevokePermissionsPacket : Packet { - /// - [XmlType("revokepermissions_data")] - public class DataBlock - { - public uint ObjectPermissions; - public LLUUID ObjectID; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - ObjectPermissions = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - ObjectID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ObjectPermissions % 256); - bytes[i++] = (byte)((ObjectPermissions >> 8) % 256); - bytes[i++] = (byte)((ObjectPermissions >> 16) % 256); - bytes[i++] = (byte)((ObjectPermissions >> 24) % 256); - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.AppendLine(String.Format("ObjectPermissions: {0}", ObjectPermissions)); - output.Append(String.Format("ObjectID: {0}", ObjectID)); - return output.ToString(); - } - } - /// [XmlType("revokepermissions_agentdata")] public class AgentDataBlock @@ -31467,46 +28791,95 @@ namespace libsecondlife.Packets } } + /// + [XmlType("revokepermissions_data")] + public class DataBlock + { + public LLUUID ObjectID; + public uint ObjectPermissions; + + [XmlIgnore] + public int Length + { + get + { + return 20; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + try + { + ObjectID = new LLUUID(bytes, i); i += 16; + ObjectPermissions = (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) + { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(ObjectPermissions % 256); + bytes[i++] = (byte)((ObjectPermissions >> 8) % 256); + bytes[i++] = (byte)((ObjectPermissions >> 16) % 256); + bytes[i++] = (byte)((ObjectPermissions >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.Append(String.Format("ObjectPermissions: {0}", ObjectPermissions)); + return output.ToString(); + } + } + 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 DataBlock Data; public RevokePermissionsPacket() { Header = new LowHeader(); - Header.ID = 225; + Header.ID = 193; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -31514,8 +28887,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RevokePermissions ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -31528,17 +28901,6 @@ namespace libsecondlife.Packets [XmlType("loadurl_data")] public class DataBlock { - private byte[] _url; - public byte[] URL - { - get { return _url; } - set - { - if (value == null) { _url = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _url = new byte[value.Length]; Buffer.BlockCopy(value, 0, _url, 0, value.Length); } - } - } private byte[] _objectname; public byte[] ObjectName { @@ -31550,8 +28912,9 @@ namespace libsecondlife.Packets else { _objectname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _objectname, 0, value.Length); } } } - public bool OwnerIsGroup; public LLUUID ObjectID; + public LLUUID OwnerID; + public bool OwnerIsGroup; private byte[] _message; public byte[] Message { @@ -31563,7 +28926,17 @@ namespace libsecondlife.Packets else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } } } - public LLUUID OwnerID; + 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]; Buffer.BlockCopy(value, 0, _url, 0, value.Length); } + } + } [XmlIgnore] public int Length @@ -31571,9 +28944,9 @@ namespace libsecondlife.Packets 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; } + if (URL != null) { length += 1 + URL.Length; } return length; } } @@ -31584,18 +28957,18 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)bytes[i++]; - _url = new byte[length]; - Buffer.BlockCopy(bytes, i, _url, 0, length); i += length; length = (ushort)bytes[i++]; _objectname = new byte[length]; Buffer.BlockCopy(bytes, i, _objectname, 0, length); i += length; - OwnerIsGroup = (bytes[i++] != 0) ? (bool)true : (bool)false; ObjectID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + OwnerIsGroup = (bytes[i++] != 0) ? (bool)true : (bool)false; length = (ushort)bytes[i++]; _message = new byte[length]; Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; - OwnerID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _url = new byte[length]; + Buffer.BlockCopy(bytes, i, _url, 0, length); i += length; } catch (Exception) { @@ -31605,33 +28978,32 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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; Buffer.BlockCopy(ObjectName, 0, bytes, i, ObjectName.Length); i += ObjectName.Length; - bytes[i++] = (byte)((OwnerIsGroup) ? 1 : 0); Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((OwnerIsGroup) ? 1 : 0); if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); } bytes[i++] = (byte)Message.Length; Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + if(URL == null) { Console.WriteLine("Warning: URL is null, in " + this.GetType()); } + bytes[i++] = (byte)URL.Length; + Buffer.BlockCopy(URL, 0, bytes, i, URL.Length); i += URL.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - Helpers.FieldToString(output, URL, "URL"); - output.Append(Environment.NewLine); Helpers.FieldToString(output, ObjectName, "ObjectName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("OwnerIsGroup: {0}", OwnerIsGroup)); output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("OwnerIsGroup: {0}", OwnerIsGroup)); Helpers.FieldToString(output, Message, "Message"); output.Append(Environment.NewLine); - output.Append(String.Format("OwnerID: {0}", OwnerID)); + Helpers.FieldToString(output, URL, "URL"); return output.ToString(); } } @@ -31644,7 +29016,7 @@ namespace libsecondlife.Packets public LoadURLPacket() { Header = new LowHeader(); - Header.ID = 226; + Header.ID = 194; Header.Reliable = true; Data = new DataBlock(); } @@ -31664,7 +29036,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Data.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -31713,8 +29085,8 @@ namespace libsecondlife.Packets else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } } } - public LLVector3 LookAt; public LLVector3 SimPosition; + public LLVector3 LookAt; [XmlIgnore] public int Length @@ -31740,8 +29112,8 @@ namespace libsecondlife.Packets length = (ushort)bytes[i++]; _simname = new byte[length]; Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; - LookAt = new LLVector3(bytes, i); i += 12; SimPosition = new LLVector3(bytes, i); i += 12; + LookAt = new LLVector3(bytes, i); i += 12; } catch (Exception) { @@ -31757,8 +29129,8 @@ namespace libsecondlife.Packets if(SimName == null) { Console.WriteLine("Warning: SimName is null, in " + this.GetType()); } bytes[i++] = (byte)SimName.Length; Buffer.BlockCopy(SimName, 0, bytes, i, SimName.Length); i += SimName.Length; - Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; Buffer.BlockCopy(SimPosition.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; } public override string ToString() @@ -31769,8 +29141,8 @@ namespace libsecondlife.Packets output.Append(Environment.NewLine); Helpers.FieldToString(output, SimName, "SimName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("LookAt: {0}", LookAt)); - output.Append(String.Format("SimPosition: {0}", SimPosition)); + output.AppendLine(String.Format("SimPosition: {0}", SimPosition)); + output.Append(String.Format("LookAt: {0}", LookAt)); return output.ToString(); } } @@ -31783,7 +29155,7 @@ namespace libsecondlife.Packets public ScriptTeleportRequestPacket() { Header = new LowHeader(); - Header.ID = 227; + Header.ID = 195; Header.Reliable = true; Data = new DataBlock(); } @@ -31803,7 +29175,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Data.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -31830,6 +29202,7 @@ namespace libsecondlife.Packets [XmlType("parceloverlay_parceldata")] public class ParcelDataBlock { + public int SequenceID; private byte[] _data; public byte[] Data { @@ -31841,7 +29214,6 @@ namespace libsecondlife.Packets else { _data = new byte[value.Length]; Buffer.BlockCopy(value, 0, _data, 0, value.Length); } } } - public int SequenceID; [XmlIgnore] public int Length @@ -31860,10 +29232,10 @@ namespace libsecondlife.Packets int length; try { + SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _data = new byte[length]; Buffer.BlockCopy(bytes, i, _data, 0, length); i += length; - SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -31873,23 +29245,22 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(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); + 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); + Buffer.BlockCopy(Data, 0, bytes, i, Data.Length); i += Data.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ParcelData --"); + output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); Helpers.FieldToString(output, Data, "Data"); - output.Append(Environment.NewLine); - output.Append(String.Format("SequenceID: {0}", SequenceID)); return output.ToString(); } } @@ -31902,9 +29273,8 @@ namespace libsecondlife.Packets public ParcelOverlayPacket() { Header = new LowHeader(); - Header.ID = 228; + Header.ID = 196; Header.Reliable = true; - Header.Zerocoded = true; ParcelData = new ParcelDataBlock(); } @@ -31923,7 +29293,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ParcelData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -31946,58 +29316,6 @@ namespace libsecondlife.Packets /// public class ParcelPropertiesRequestByIDPacket : Packet { - /// - [XmlType("parcelpropertiesrequestbyid_parceldata")] - public class ParcelDataBlock - { - public int LocalID; - public int SequenceID; - - [XmlIgnore] - public int Length - { - get - { - return 8; - } - } - - public ParcelDataBlock() { } - public ParcelDataBlock(byte[] bytes, ref int i) - { - try - { - LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(LocalID % 256); - bytes[i++] = (byte)((LocalID >> 8) % 256); - bytes[i++] = (byte)((LocalID >> 16) % 256); - bytes[i++] = (byte)((LocalID >> 24) % 256); - bytes[i++] = (byte)(SequenceID % 256); - bytes[i++] = (byte)((SequenceID >> 8) % 256); - bytes[i++] = (byte)((SequenceID >> 16) % 256); - bytes[i++] = (byte)((SequenceID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.Append(String.Format("SequenceID: {0}", SequenceID)); - return output.ToString(); - } - } - /// [XmlType("parcelpropertiesrequestbyid_agentdata")] public class AgentDataBlock @@ -32044,176 +29362,29 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelPropertiesRequestByID; } } - public ParcelDataBlock ParcelData; - public AgentDataBlock AgentData; - - public ParcelPropertiesRequestByIDPacket() - { - Header = new LowHeader(); - Header.ID = 229; - Header.Reliable = true; - Header.Zerocoded = true; - ParcelData = new ParcelDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelPropertiesRequestByIDPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelPropertiesRequestByIDPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ParcelData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelPropertiesRequestByID ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelPropertiesUpdatePacket : Packet - { /// - [XmlType("parcelpropertiesupdate_parceldata")] + [XmlType("parcelpropertiesrequestbyid_parceldata")] public class ParcelDataBlock { - public LLUUID MediaID; - public LLVector3 UserLookAt; - private byte[] _mediaurl; - public byte[] MediaURL - { - get { return _mediaurl; } - set - { - if (value == null) { _mediaurl = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _mediaurl = new byte[value.Length]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } - } - } + public int SequenceID; 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, 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]; Buffer.BlockCopy(value, 0, _musicurl, 0, value.Length); } - } - } [XmlIgnore] public int Length { get { - int length = 115; - if (MediaURL != null) { length += 1 + MediaURL.Length; } - if (Name != null) { length += 1 + Name.Length; } - if (Desc != null) { length += 1 + Desc.Length; } - if (MusicURL != null) { length += 1 + MusicURL.Length; } - return length; + return 8; } } 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]; - Buffer.BlockCopy(bytes, i, _mediaurl, 0, length); i += length; + SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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]; - Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - length = (ushort)bytes[i++]; - _desc = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _musicurl, 0, length); i += length; } catch (Exception) { @@ -32223,83 +29394,83 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - byte[] ba; - Buffer.BlockCopy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length; + 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)(LocalID % 256); bytes[i++] = (byte)((LocalID >> 8) % 256); bytes[i++] = (byte)((LocalID >> 16) % 256); bytes[i++] = (byte)((LocalID >> 24) % 256); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; - bytes[i++] = Category; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(AuthBuyerID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(PassHours); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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; - Buffer.BlockCopy(MusicURL, 0, bytes, i, MusicURL.Length); i += MusicURL.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("MediaID: {0}", MediaID)); - output.AppendLine(String.Format("UserLookAt: {0}", UserLookAt)); - Helpers.FieldToString(output, MediaURL, "MediaURL"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.AppendLine(String.Format("UserLocation: {0}", UserLocation)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Desc, "Desc"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("LandingType: {0}", LandingType)); - output.AppendLine(String.Format("AuthBuyerID: {0}", AuthBuyerID)); - output.AppendLine(String.Format("PassHours: {0}", PassHours)); - output.AppendLine(String.Format("ParcelFlags: {0}", ParcelFlags)); - output.AppendLine(String.Format("PassPrice: {0}", PassPrice)); - output.AppendLine(String.Format("MediaAutoScale: {0}", MediaAutoScale)); - Helpers.FieldToString(output, MusicURL, "MusicURL"); + output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); + output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelPropertiesRequestByID; } } + public AgentDataBlock AgentData; + public ParcelDataBlock ParcelData; + + public ParcelPropertiesRequestByIDPacket() + { + Header = new LowHeader(); + Header.ID = 197; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + } + + public ParcelPropertiesRequestByIDPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public ParcelPropertiesRequestByIDPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelPropertiesRequestByID ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelPropertiesUpdatePacket : Packet + { /// [XmlType("parcelpropertiesupdate_agentdata")] public class AgentDataBlock @@ -32346,85 +29517,118 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelPropertiesUpdate; } } - public ParcelDataBlock ParcelData; - public AgentDataBlock AgentData; - - public ParcelPropertiesUpdatePacket() - { - Header = new LowHeader(); - Header.ID = 230; - Header.Reliable = true; - Header.Zerocoded = true; - ParcelData = new ParcelDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelPropertiesUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelPropertiesUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ParcelData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelPropertiesUpdate ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelReturnObjectsPacket : Packet - { /// - [XmlType("parcelreturnobjects_taskids")] - public class TaskIDsBlock + [XmlType("parcelpropertiesupdate_parceldata")] + public class ParcelDataBlock { - public LLUUID TaskID; + public int LocalID; + public uint Flags; + public uint ParcelFlags; + public int SalePrice; + 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, 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]; Buffer.BlockCopy(value, 0, _musicurl, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } + } + } + public LLUUID MediaID; + public byte MediaAutoScale; + public LLUUID GroupID; + public int PassPrice; + public float PassHours; + public byte Category; + public LLUUID AuthBuyerID; + public LLUUID SnapshotID; + public LLVector3 UserLocation; + public LLVector3 UserLookAt; + public byte LandingType; [XmlIgnore] public int Length { get { - return 16; + int length = 115; + if (Name != null) { length += 1 + Name.Length; } + if (Desc != null) { length += 1 + Desc.Length; } + if (MusicURL != null) { length += 1 + MusicURL.Length; } + if (MediaURL != null) { length += 1 + MediaURL.Length; } + return length; } } - public TaskIDsBlock() { } - public TaskIDsBlock(byte[] bytes, ref int i) + public ParcelDataBlock() { } + public ParcelDataBlock(byte[] bytes, ref int i) { + int length; try { - TaskID = new LLUUID(bytes, i); i += 16; + LocalID = (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)); + ParcelFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _desc = new byte[length]; + Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; + length = (ushort)bytes[i++]; + _musicurl = new byte[length]; + Buffer.BlockCopy(bytes, i, _musicurl, 0, length); i += length; + length = (ushort)bytes[i++]; + _mediaurl = new byte[length]; + Buffer.BlockCopy(bytes, i, _mediaurl, 0, length); i += length; + MediaID = new LLUUID(bytes, i); i += 16; + MediaAutoScale = (byte)bytes[i++]; + GroupID = new LLUUID(bytes, i); i += 16; + PassPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + PassHours = BitConverter.ToSingle(bytes, i); i += 4; + Category = (byte)bytes[i++]; + AuthBuyerID = new LLUUID(bytes, i); i += 16; + SnapshotID = new LLUUID(bytes, i); i += 16; + UserLocation = new LLVector3(bytes, i); i += 12; + UserLookAt = new LLVector3(bytes, i); i += 12; + LandingType = (byte)bytes[i++]; } catch (Exception) { @@ -32434,14 +29638,183 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; + 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); + 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)(ParcelFlags % 256); + bytes[i++] = (byte)((ParcelFlags >> 8) % 256); + bytes[i++] = (byte)((ParcelFlags >> 16) % 256); + bytes[i++] = (byte)((ParcelFlags >> 24) % 256); + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; + if(MusicURL == null) { Console.WriteLine("Warning: MusicURL is null, in " + this.GetType()); } + bytes[i++] = (byte)MusicURL.Length; + Buffer.BlockCopy(MusicURL, 0, bytes, i, MusicURL.Length); i += MusicURL.Length; + if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); } + bytes[i++] = (byte)MediaURL.Length; + Buffer.BlockCopy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length; + Buffer.BlockCopy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = MediaAutoScale; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(PassPrice % 256); + bytes[i++] = (byte)((PassPrice >> 8) % 256); + bytes[i++] = (byte)((PassPrice >> 16) % 256); + bytes[i++] = (byte)((PassPrice >> 24) % 256); + ba = BitConverter.GetBytes(PassHours); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = Category; + Buffer.BlockCopy(AuthBuyerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(UserLocation.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(UserLookAt.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = LandingType; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- TaskIDs --"); - output.Append(String.Format("TaskID: {0}", TaskID)); + output.AppendLine("-- ParcelData --"); + output.AppendLine(String.Format("LocalID: {0}", LocalID)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("ParcelFlags: {0}", ParcelFlags)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Desc, "Desc"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, MusicURL, "MusicURL"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, MediaURL, "MediaURL"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("MediaID: {0}", MediaID)); + output.AppendLine(String.Format("MediaAutoScale: {0}", MediaAutoScale)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("PassPrice: {0}", PassPrice)); + output.AppendLine(String.Format("PassHours: {0}", PassHours)); + output.AppendLine(String.Format("Category: {0}", Category)); + output.AppendLine(String.Format("AuthBuyerID: {0}", AuthBuyerID)); + output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); + output.AppendLine(String.Format("UserLocation: {0}", UserLocation)); + output.AppendLine(String.Format("UserLookAt: {0}", UserLookAt)); + output.Append(String.Format("LandingType: {0}", LandingType)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelPropertiesUpdate; } } + public AgentDataBlock AgentData; + public ParcelDataBlock ParcelData; + + public ParcelPropertiesUpdatePacket() + { + Header = new LowHeader(); + Header.ID = 198; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + } + + public ParcelPropertiesUpdatePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public ParcelPropertiesUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelPropertiesUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelReturnObjectsPacket : Packet + { + /// + [XmlType("parcelreturnobjects_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); return output.ToString(); } } @@ -32499,28 +29872,26 @@ namespace libsecondlife.Packets } /// - [XmlType("parcelreturnobjects_agentdata")] - public class AgentDataBlock + [XmlType("parcelreturnobjects_taskids")] + public class TaskIDsBlock { - public LLUUID AgentID; - public LLUUID SessionID; + public LLUUID TaskID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public TaskIDsBlock() { } + public TaskIDsBlock(byte[] bytes, ref int i) { try { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; + TaskID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -32530,16 +29901,14 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine("-- TaskIDs --"); + output.Append(String.Format("TaskID: {0}", TaskID)); return output.ToString(); } } @@ -32589,20 +29958,19 @@ namespace libsecondlife.Packets 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 ParcelDataBlock ParcelData; + public TaskIDsBlock[] TaskIDs; public OwnerIDsBlock[] OwnerIDs; public ParcelReturnObjectsPacket() { Header = new LowHeader(); - Header.ID = 231; + Header.ID = 199; Header.Reliable = true; - Header.Zerocoded = true; - TaskIDs = new TaskIDsBlock[0]; - ParcelData = new ParcelDataBlock(); AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + TaskIDs = new TaskIDsBlock[0]; OwnerIDs = new OwnerIDsBlock[0]; } @@ -32610,12 +29978,12 @@ namespace libsecondlife.Packets { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); 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++) @@ -32625,12 +29993,12 @@ namespace libsecondlife.Packets public ParcelReturnObjectsPacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); 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++) @@ -32639,8 +30007,8 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += ParcelData.Length;; length++; for (int j = 0; j < TaskIDs.Length; j++) { length += TaskIDs[j].Length; } length++; @@ -32649,10 +30017,10 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.ToBytes(bytes, ref i); + ParcelData.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); } @@ -32662,12 +30030,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelReturnObjects ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; for (int j = 0; j < TaskIDs.Length; j++) { output += TaskIDs[j].ToString() + Environment.NewLine; } - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < OwnerIDs.Length; j++) { output += OwnerIDs[j].ToString() + Environment.NewLine; @@ -32680,6 +30048,52 @@ namespace libsecondlife.Packets /// public class ParcelSetOtherCleanTimePacket : Packet { + /// + [XmlType("parcelsetothercleantime_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("parcelsetothercleantime_parceldata")] public class ParcelDataBlock @@ -32732,8 +30146,65 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelSetOtherCleanTime; } } + public AgentDataBlock AgentData; + public ParcelDataBlock ParcelData; + + public ParcelSetOtherCleanTimePacket() + { + Header = new LowHeader(); + Header.ID = 200; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + } + + public ParcelSetOtherCleanTimePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public ParcelSetOtherCleanTimePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelSetOtherCleanTime ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelDisableObjectsPacket : Packet + { /// - [XmlType("parcelsetothercleantime_agentdata")] + [XmlType("parceldisableobjects_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -32778,106 +30249,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelSetOtherCleanTime; } } - public ParcelDataBlock ParcelData; - public AgentDataBlock AgentData; - - public ParcelSetOtherCleanTimePacket() - { - Header = new LowHeader(); - Header.ID = 232; - Header.Reliable = true; - Header.Zerocoded = true; - ParcelData = new ParcelDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelSetOtherCleanTimePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelSetOtherCleanTimePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ParcelData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelSetOtherCleanTime ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelDisableObjectsPacket : Packet - { - /// - [XmlType("parceldisableobjects_taskids")] - public class TaskIDsBlock - { - public LLUUID TaskID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TaskIDsBlock() { } - public TaskIDsBlock(byte[] bytes, ref int i) - { - try - { - TaskID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TaskIDs --"); - output.Append(String.Format("TaskID: {0}", TaskID)); - return output.ToString(); - } - } - /// [XmlType("parceldisableobjects_parceldata")] public class ParcelDataBlock @@ -32931,28 +30302,26 @@ namespace libsecondlife.Packets } /// - [XmlType("parceldisableobjects_agentdata")] - public class AgentDataBlock + [XmlType("parceldisableobjects_taskids")] + public class TaskIDsBlock { - public LLUUID AgentID; - public LLUUID SessionID; + public LLUUID TaskID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public TaskIDsBlock() { } + public TaskIDsBlock(byte[] bytes, ref int i) { try { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; + TaskID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -32962,16 +30331,14 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine("-- TaskIDs --"); + output.Append(String.Format("TaskID: {0}", TaskID)); return output.ToString(); } } @@ -33021,20 +30388,19 @@ namespace libsecondlife.Packets 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 ParcelDataBlock ParcelData; + public TaskIDsBlock[] TaskIDs; public OwnerIDsBlock[] OwnerIDs; public ParcelDisableObjectsPacket() { Header = new LowHeader(); - Header.ID = 233; + Header.ID = 201; Header.Reliable = true; - Header.Zerocoded = true; - TaskIDs = new TaskIDsBlock[0]; - ParcelData = new ParcelDataBlock(); AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + TaskIDs = new TaskIDsBlock[0]; OwnerIDs = new OwnerIDsBlock[0]; } @@ -33042,12 +30408,12 @@ namespace libsecondlife.Packets { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); 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++) @@ -33057,12 +30423,12 @@ namespace libsecondlife.Packets public ParcelDisableObjectsPacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); 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++) @@ -33071,8 +30437,8 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += ParcelData.Length;; length++; for (int j = 0; j < TaskIDs.Length; j++) { length += TaskIDs[j].Length; } length++; @@ -33081,10 +30447,10 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.ToBytes(bytes, ref i); + ParcelData.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); } @@ -33094,12 +30460,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelDisableObjects ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; for (int j = 0; j < TaskIDs.Length; j++) { output += TaskIDs[j].ToString() + Environment.NewLine; } - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < OwnerIDs.Length; j++) { output += OwnerIDs[j].ToString() + Environment.NewLine; @@ -33113,26 +30479,28 @@ namespace libsecondlife.Packets public class ParcelSelectObjectsPacket : Packet { /// - [XmlType("parcelselectobjects_returnids")] - public class ReturnIDsBlock + [XmlType("parcelselectobjects_agentdata")] + public class AgentDataBlock { - public LLUUID ReturnID; + public LLUUID AgentID; + public LLUUID SessionID; [XmlIgnore] public int Length { get { - return 16; + return 32; } } - public ReturnIDsBlock() { } - public ReturnIDsBlock(byte[] bytes, ref int i) + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) { try { - ReturnID = new LLUUID(bytes, i); i += 16; + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -33142,14 +30510,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(ReturnID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- ReturnIDs --"); - output.Append(String.Format("ReturnID: {0}", ReturnID)); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); return output.ToString(); } } @@ -33207,28 +30577,26 @@ namespace libsecondlife.Packets } /// - [XmlType("parcelselectobjects_agentdata")] - public class AgentDataBlock + [XmlType("parcelselectobjects_returnids")] + public class ReturnIDsBlock { - public LLUUID AgentID; - public LLUUID SessionID; + public LLUUID ReturnID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public ReturnIDsBlock() { } + public ReturnIDsBlock(byte[] bytes, ref int i) { try { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; + ReturnID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -33238,16 +30606,14 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ReturnID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine("-- ReturnIDs --"); + output.Append(String.Format("ReturnID: {0}", ReturnID)); return output.ToString(); } } @@ -33255,58 +30621,57 @@ namespace libsecondlife.Packets 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 ParcelDataBlock ParcelData; + public ReturnIDsBlock[] ReturnIDs; public ParcelSelectObjectsPacket() { Header = new LowHeader(); - Header.ID = 234; + Header.ID = 202; Header.Reliable = true; - Header.Zerocoded = true; - ReturnIDs = new ReturnIDsBlock[0]; - ParcelData = new ParcelDataBlock(); AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + ReturnIDs = new ReturnIDsBlock[0]; } public ParcelSelectObjectsPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += ParcelData.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); + AgentData.ToBytes(bytes, ref i); + ParcelData.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; } @@ -33314,12 +30679,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelSelectObjects ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; for (int j = 0; j < ReturnIDs.Length; j++) { output += ReturnIDs[j].ToString() + Environment.NewLine; } - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -33382,7 +30747,7 @@ namespace libsecondlife.Packets public EstateCovenantRequestPacket() { Header = new LowHeader(); - Header.ID = 235; + Header.ID = 203; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -33402,7 +30767,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -33508,7 +30873,7 @@ namespace libsecondlife.Packets public EstateCovenantReplyPacket() { Header = new LowHeader(); - Header.ID = 236; + Header.ID = 204; Header.Reliable = true; Data = new DataBlock(); } @@ -33528,7 +30893,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Data.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -33551,6 +30916,48 @@ namespace libsecondlife.Packets /// public class ForceObjectSelectPacket : Packet { + /// + [XmlType("forceobjectselect_header")] + public class HeaderBlock + { + public bool ResetList; + + [XmlIgnore] + public int Length + { + get + { + return 1; + } + } + + public HeaderBlock() { } + public HeaderBlock(byte[] bytes, ref int i) + { + try + { + ResetList = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)((ResetList) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Header --"); + output.Append(String.Format("ResetList: {0}", ResetList)); + return output.ToString(); + } + } + /// [XmlType("forceobjectselect_data")] public class DataBlock @@ -33596,87 +31003,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("forceobjectselect_header")] - public class HeaderBlock - { - public bool ResetList; - - [XmlIgnore] - public int Length - { - get - { - return 1; - } - } - - public HeaderBlock() { } - public HeaderBlock(byte[] bytes, ref int i) - { - try - { - ResetList = (bytes[i++] != 0) ? (bool)true : (bool)false; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)((ResetList) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Header --"); - output.Append(String.Format("ResetList: {0}", ResetList)); - return output.ToString(); - } - } - 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 DataBlock[] Data; public ForceObjectSelectPacket() { Header = new LowHeader(); - Header.ID = 237; + Header.ID = 205; Header.Reliable = true; - Data = new DataBlock[0]; _Header = new HeaderBlock(); + Data = new DataBlock[0]; } public ForceObjectSelectPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + _Header = new HeaderBlock(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); } - _Header = new HeaderBlock(bytes, ref i); } public ForceObjectSelectPacket(Header head, byte[] bytes, ref int i) { Header = head; + _Header = new HeaderBlock(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); } - _Header = new HeaderBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; + int length = 10; length += _Header.Length;; length++; for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } @@ -33684,9 +31049,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + _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; } @@ -33694,11 +31059,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ForceObjectSelect ---" + Environment.NewLine; + output += _Header.ToString() + Environment.NewLine; for (int j = 0; j < Data.Length; j++) { output += Data[j].ToString() + Environment.NewLine; } - output += _Header.ToString() + Environment.NewLine; return output; } @@ -33707,51 +31072,6 @@ namespace libsecondlife.Packets /// public class ParcelBuyPassPacket : Packet { - /// - [XmlType("parcelbuypass_parceldata")] - public class ParcelDataBlock - { - public int LocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ParcelDataBlock() { } - public ParcelDataBlock(byte[] bytes, ref int i) - { - try - { - LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(LocalID % 256); - bytes[i++] = (byte)((LocalID >> 8) % 256); - bytes[i++] = (byte)((LocalID >> 16) % 256); - bytes[i++] = (byte)((LocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ParcelData --"); - output.Append(String.Format("LocalID: {0}", LocalID)); - return output.ToString(); - } - } - /// [XmlType("parcelbuypass_agentdata")] public class AgentDataBlock @@ -33798,86 +31118,27 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelBuyPass; } } - public ParcelDataBlock ParcelData; - public AgentDataBlock AgentData; - - public ParcelBuyPassPacket() - { - Header = new LowHeader(); - Header.ID = 238; - Header.Reliable = true; - ParcelData = new ParcelDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelBuyPassPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelBuyPassPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ParcelData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelBuyPass ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelDeedToGroupPacket : Packet - { /// - [XmlType("parceldeedtogroup_data")] - public class DataBlock + [XmlType("parcelbuypass_parceldata")] + public class ParcelDataBlock { public int LocalID; - public LLUUID GroupID; [XmlIgnore] public int Length { get { - return 20; + return 4; } } - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) + public ParcelDataBlock() { } + public ParcelDataBlock(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) { @@ -33891,19 +31152,74 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((LocalID >> 8) % 256); bytes[i++] = (byte)((LocalID >> 16) % 256); bytes[i++] = (byte)((LocalID >> 24) % 256); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine("-- ParcelData --"); + output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelBuyPass; } } + public AgentDataBlock AgentData; + public ParcelDataBlock ParcelData; + + public ParcelBuyPassPacket() + { + Header = new LowHeader(); + Header.ID = 206; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + } + + public ParcelBuyPassPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public ParcelBuyPassPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelBuyPass ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelDeedToGroupPacket : Packet + { /// [XmlType("parceldeedtogroup_agentdata")] public class AgentDataBlock @@ -33950,67 +31266,11 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelDeedToGroup; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelDeedToGroupPacket() - { - Header = new LowHeader(); - Header.ID = 239; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelDeedToGroupPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelDeedToGroupPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelDeedToGroup ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelReclaimPacket : Packet - { /// - [XmlType("parcelreclaim_data")] + [XmlType("parceldeedtogroup_data")] public class DataBlock { + public LLUUID GroupID; public int LocalID; [XmlIgnore] @@ -34018,7 +31278,7 @@ namespace libsecondlife.Packets { get { - return 4; + return 20; } } @@ -34027,6 +31287,7 @@ namespace libsecondlife.Packets { try { + GroupID = new LLUUID(bytes, i); i += 16; LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) @@ -34037,6 +31298,7 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(LocalID % 256); bytes[i++] = (byte)((LocalID >> 8) % 256); bytes[i++] = (byte)((LocalID >> 16) % 256); @@ -34047,11 +31309,69 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelDeedToGroup; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ParcelDeedToGroupPacket() + { + Header = new LowHeader(); + Header.ID = 207; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ParcelDeedToGroupPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ParcelDeedToGroupPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelDeedToGroup ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelReclaimPacket : Packet + { /// [XmlType("parcelreclaim_agentdata")] public class AgentDataBlock @@ -34098,77 +31418,18 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelReclaim; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelReclaimPacket() - { - Header = new LowHeader(); - Header.ID = 240; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelReclaimPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelReclaimPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelReclaim ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelClaimPacket : Packet - { /// - [XmlType("parcelclaim_data")] + [XmlType("parcelreclaim_data")] public class DataBlock { - public bool IsGroupOwned; - public LLUUID GroupID; - public bool Final; + public int LocalID; [XmlIgnore] public int Length { get { - return 18; + return 4; } } @@ -34177,9 +31438,7 @@ namespace libsecondlife.Packets { try { - IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; - GroupID = new LLUUID(bytes, i); i += 16; - Final = (bytes[i++] != 0) ? (bool)true : (bool)false; + LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -34189,89 +31448,78 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((Final) ? 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); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.Append(String.Format("Final: {0}", Final)); + output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } - /// - [XmlType("parcelclaim_parceldata")] - public class ParcelDataBlock + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelReclaim; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ParcelReclaimPacket() { - public float East; - public float West; - public float North; - public float South; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public ParcelDataBlock() { } - public ParcelDataBlock(byte[] bytes, ref int i) - { - try - { - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - East = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - West = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - North = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - South = BitConverter.ToSingle(bytes, i); i += 4; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - ba = BitConverter.GetBytes(East); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(West); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(North); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(South); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("East: {0}", East)); - output.AppendLine(String.Format("West: {0}", West)); - output.AppendLine(String.Format("North: {0}", North)); - output.Append(String.Format("South: {0}", South)); - return output.ToString(); - } + Header = new LowHeader(); + Header.ID = 208; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); } + public ParcelReclaimPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ParcelReclaimPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelReclaim ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelClaimPacket : Packet + { /// [XmlType("parcelclaim_agentdata")] public class AgentDataBlock @@ -34318,90 +31566,64 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelClaim; } } - public DataBlock Data; - public ParcelDataBlock[] ParcelData; - public AgentDataBlock AgentData; - - public ParcelClaimPacket() - { - Header = new LowHeader(); - Header.ID = 241; - Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); - ParcelData = new ParcelDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ParcelClaimPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - int count = (int)bytes[i++]; - ParcelData = new ParcelDataBlock[count]; - for (int j = 0; j < count; j++) - { ParcelData[j] = new ParcelDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelClaimPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - int count = (int)bytes[i++]; - ParcelData = new ParcelDataBlock[count]; - for (int j = 0; j < count; j++) - { ParcelData[j] = new ParcelDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < ParcelData.Length; j++) { length += ParcelData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - bytes[i++] = (byte)ParcelData.Length; - for (int j = 0; j < ParcelData.Length; j++) { ParcelData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelClaim ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - for (int j = 0; j < ParcelData.Length; j++) - { - output += ParcelData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelJoinPacket : Packet - { /// - [XmlType("parceljoin_parceldata")] + [XmlType("parcelclaim_data")] + public class DataBlock + { + public LLUUID GroupID; + public bool IsGroupOwned; + public bool Final; + + [XmlIgnore] + public int Length + { + get + { + return 18; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + try + { + GroupID = new LLUUID(bytes, i); i += 16; + IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + Final = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0); + bytes[i++] = (byte)((Final) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); + output.Append(String.Format("Final: {0}", Final)); + return output.ToString(); + } + } + + /// + [XmlType("parcelclaim_parceldata")] public class ParcelDataBlock { - public float East; public float West; - public float North; public float South; + public float East; + public float North; [XmlIgnore] public int Length @@ -34417,14 +31639,14 @@ namespace libsecondlife.Packets { 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; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + East = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + North = BitConverter.ToSingle(bytes, i); i += 4; } catch (Exception) { @@ -34435,16 +31657,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - ba = BitConverter.GetBytes(East); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; ba = BitConverter.GetBytes(West); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(North); + ba = BitConverter.GetBytes(South); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(South); + ba = BitConverter.GetBytes(East); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(North); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } @@ -34453,14 +31675,89 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("East: {0}", East)); output.AppendLine(String.Format("West: {0}", West)); - output.AppendLine(String.Format("North: {0}", North)); - output.Append(String.Format("South: {0}", South)); + output.AppendLine(String.Format("South: {0}", South)); + output.AppendLine(String.Format("East: {0}", East)); + output.Append(String.Format("North: {0}", North)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelClaim; } } + public AgentDataBlock AgentData; + public DataBlock Data; + public ParcelDataBlock[] ParcelData; + + public ParcelClaimPacket() + { + Header = new LowHeader(); + Header.ID = 209; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + ParcelData = new ParcelDataBlock[0]; + } + + public ParcelClaimPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + 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); } + } + + public ParcelClaimPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += Data.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); + AgentData.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); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- ParcelClaim ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + for (int j = 0; j < ParcelData.Length; j++) + { + output += ParcelData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ParcelJoinPacket : Packet + { /// [XmlType("parceljoin_agentdata")] public class AgentDataBlock @@ -34507,71 +31804,14 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelJoin; } } - public ParcelDataBlock ParcelData; - public AgentDataBlock AgentData; - - public ParcelJoinPacket() - { - Header = new LowHeader(); - Header.ID = 242; - Header.Reliable = true; - ParcelData = new ParcelDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelJoinPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelJoinPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ParcelData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelJoin ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelDividePacket : Packet - { /// - [XmlType("parceldivide_parceldata")] + [XmlType("parceljoin_parceldata")] public class ParcelDataBlock { - public float East; public float West; - public float North; public float South; + public float East; + public float North; [XmlIgnore] public int Length @@ -34587,14 +31827,14 @@ namespace libsecondlife.Packets { 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; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + East = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + North = BitConverter.ToSingle(bytes, i); i += 4; } catch (Exception) { @@ -34605,16 +31845,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - ba = BitConverter.GetBytes(East); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; ba = BitConverter.GetBytes(West); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(North); + ba = BitConverter.GetBytes(South); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(South); + ba = BitConverter.GetBytes(East); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(North); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } @@ -34623,14 +31863,71 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("East: {0}", East)); output.AppendLine(String.Format("West: {0}", West)); - output.AppendLine(String.Format("North: {0}", North)); - output.Append(String.Format("South: {0}", South)); + output.AppendLine(String.Format("South: {0}", South)); + output.AppendLine(String.Format("East: {0}", East)); + output.Append(String.Format("North: {0}", North)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelJoin; } } + public AgentDataBlock AgentData; + public ParcelDataBlock ParcelData; + + public ParcelJoinPacket() + { + Header = new LowHeader(); + Header.ID = 210; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + } + + public ParcelJoinPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public ParcelJoinPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelJoin ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelDividePacket : Packet + { /// [XmlType("parceldivide_agentdata")] public class AgentDataBlock @@ -34677,84 +31974,37 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelDivide; } } - public ParcelDataBlock ParcelData; - public AgentDataBlock AgentData; - - public ParcelDividePacket() - { - Header = new LowHeader(); - Header.ID = 243; - Header.Reliable = true; - ParcelData = new ParcelDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelDividePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelDividePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ParcelData = new ParcelDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ParcelData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelDivide ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelReleasePacket : Packet - { /// - [XmlType("parcelrelease_data")] - public class DataBlock + [XmlType("parceldivide_parceldata")] + public class ParcelDataBlock { - public int LocalID; + public float West; + public float South; + public float East; + public float North; [XmlIgnore] public int Length { get { - return 4; + return 16; } } - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) + 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); + West = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + South = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + East = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + North = BitConverter.ToSingle(bytes, i); i += 4; } catch (Exception) { @@ -34764,21 +32014,90 @@ namespace libsecondlife.Packets 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); + byte[] ba; + ba = BitConverter.GetBytes(West); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(South); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(East); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(North); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.Append(String.Format("LocalID: {0}", LocalID)); + output.AppendLine("-- ParcelData --"); + output.AppendLine(String.Format("West: {0}", West)); + output.AppendLine(String.Format("South: {0}", South)); + output.AppendLine(String.Format("East: {0}", East)); + output.Append(String.Format("North: {0}", North)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelDivide; } } + public AgentDataBlock AgentData; + public ParcelDataBlock ParcelData; + + public ParcelDividePacket() + { + Header = new LowHeader(); + Header.ID = 211; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); + } + + public ParcelDividePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public ParcelDividePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelDivide ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelReleasePacket : Packet + { /// [XmlType("parcelrelease_agentdata")] public class AgentDataBlock @@ -34825,79 +32144,18 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelRelease; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelReleasePacket() - { - Header = new LowHeader(); - Header.ID = 244; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelReleasePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelReleasePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelRelease ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelBuyPacket : Packet - { /// - [XmlType("parcelbuy_data")] + [XmlType("parcelrelease_data")] public class DataBlock { - public bool RemoveContribution; public int LocalID; - public bool IsGroupOwned; - public LLUUID GroupID; - public bool Final; [XmlIgnore] public int Length { get { - return 23; + return 4; } } @@ -34906,11 +32164,7 @@ namespace libsecondlife.Packets { 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) { @@ -34920,29 +32174,78 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((Final) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("RemoveContribution: {0}", RemoveContribution)); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.Append(String.Format("Final: {0}", Final)); + output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelRelease; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ParcelReleasePacket() + { + Header = new LowHeader(); + Header.ID = 212; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ParcelReleasePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ParcelReleasePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelRelease ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelBuyPacket : Packet + { /// [XmlType("parcelbuy_agentdata")] public class AgentDataBlock @@ -34989,77 +32292,22 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelBuy; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelBuyPacket() - { - Header = new LowHeader(); - Header.ID = 245; - Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelBuyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelBuyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelBuy ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelGodForceOwnerPacket : Packet - { /// - [XmlType("parcelgodforceowner_data")] + [XmlType("parcelbuy_data")] public class DataBlock { + public LLUUID GroupID; + public bool IsGroupOwned; + public bool RemoveContribution; public int LocalID; - public LLUUID OwnerID; + public bool Final; [XmlIgnore] public int Length { get { - return 20; + return 23; } } @@ -35068,8 +32316,11 @@ namespace libsecondlife.Packets { try { + GroupID = new LLUUID(bytes, i); i += 16; + IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + RemoveContribution = (bytes[i++] != 0) ? (bool)true : (bool)false; LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - OwnerID = new LLUUID(bytes, i); i += 16; + Final = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -35079,23 +32330,144 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0); + 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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Final) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); + output.AppendLine(String.Format("RemoveContribution: {0}", RemoveContribution)); output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.Append(String.Format("OwnerID: {0}", OwnerID)); + output.Append(String.Format("Final: {0}", Final)); return output.ToString(); } } + /// + [XmlType("parcelbuy_parceldata")] + public class ParcelDataBlock + { + public int Price; + public int Area; + + [XmlIgnore] + public int Length + { + get + { + return 8; + } + } + + public ParcelDataBlock() { } + public ParcelDataBlock(byte[] bytes, ref int i) + { + try + { + Price = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Area = (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)(Price % 256); + bytes[i++] = (byte)((Price >> 8) % 256); + bytes[i++] = (byte)((Price >> 16) % 256); + bytes[i++] = (byte)((Price >> 24) % 256); + bytes[i++] = (byte)(Area % 256); + bytes[i++] = (byte)((Area >> 8) % 256); + bytes[i++] = (byte)((Area >> 16) % 256); + bytes[i++] = (byte)((Area >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ParcelData --"); + output.AppendLine(String.Format("Price: {0}", Price)); + output.Append(String.Format("Area: {0}", Area)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelBuy; } } + public AgentDataBlock AgentData; + public DataBlock Data; + public ParcelDataBlock ParcelData; + + public ParcelBuyPacket() + { + Header = new LowHeader(); + Header.ID = 213; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + ParcelData = new ParcelDataBlock(); + } + + public ParcelBuyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public ParcelBuyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + ParcelData = new ParcelDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += Data.Length; 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); + AgentData.ToBytes(bytes, ref i); + Data.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 = "--- ParcelBuy ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelGodForceOwnerPacket : Packet + { /// [XmlType("parcelgodforceowner_agentdata")] public class AgentDataBlock @@ -35142,78 +32514,19 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelGodForceOwner; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelGodForceOwnerPacket() - { - Header = new LowHeader(); - Header.ID = 246; - Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelGodForceOwnerPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelGodForceOwnerPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelGodForceOwner ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelAccessListRequestPacket : Packet - { /// - [XmlType("parcelaccesslistrequest_data")] + [XmlType("parcelgodforceowner_data")] public class DataBlock { + public LLUUID OwnerID; public int LocalID; - public int SequenceID; - public uint Flags; [XmlIgnore] public int Length { get { - return 12; + return 20; } } @@ -35222,9 +32535,8 @@ namespace libsecondlife.Packets { try { + OwnerID = 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) { @@ -35234,31 +32546,80 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(OwnerID.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() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); - output.Append(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelGodForceOwner; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ParcelGodForceOwnerPacket() + { + Header = new LowHeader(); + Header.ID = 214; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ParcelGodForceOwnerPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ParcelGodForceOwnerPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelGodForceOwner ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelAccessListRequestPacket : Packet + { /// [XmlType("parcelaccesslistrequest_agentdata")] public class AgentDataBlock @@ -35305,47 +32666,105 @@ namespace libsecondlife.Packets } } + /// + [XmlType("parcelaccesslistrequest_data")] + public class DataBlock + { + public int SequenceID; + public uint Flags; + public int LocalID; + + [XmlIgnore] + public int Length + { + get + { + return 12; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + try + { + 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)); + 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)(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); + 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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.Append(String.Format("LocalID: {0}", LocalID)); + return output.ToString(); + } + } + 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 DataBlock Data; public ParcelAccessListRequestPacket() { Header = new LowHeader(); - Header.ID = 247; + Header.ID = 215; Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -35353,8 +32772,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelAccessListRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -35368,9 +32787,9 @@ namespace libsecondlife.Packets public class DataBlock { public LLUUID AgentID; - public int LocalID; public int SequenceID; public uint Flags; + public int LocalID; [XmlIgnore] public int Length @@ -35387,9 +32806,9 @@ namespace libsecondlife.Packets 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)); + LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -35400,10 +32819,6 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(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); @@ -35412,6 +32827,10 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((Flags >> 8) % 256); bytes[i++] = (byte)((Flags >> 16) % 256); bytes[i++] = (byte)((Flags >> 24) % 256); + 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() @@ -35419,9 +32838,9 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); - output.Append(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.Append(String.Format("LocalID: {0}", LocalID)); return output.ToString(); } } @@ -35491,9 +32910,8 @@ namespace libsecondlife.Packets public ParcelAccessListReplyPacket() { Header = new LowHeader(); - Header.ID = 248; + Header.ID = 216; Header.Reliable = true; - Header.Zerocoded = true; Data = new DataBlock(); List = new ListBlock[0]; } @@ -35521,7 +32939,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Data.Length;; length++; for (int j = 0; j < List.Length; j++) { length += List[j].Length; } @@ -35552,15 +32970,61 @@ namespace libsecondlife.Packets /// public class ParcelAccessListUpdatePacket : Packet { + /// + [XmlType("parcelaccesslistupdate_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("parcelaccesslistupdate_data")] public class DataBlock { - public int LocalID; - public int Sections; - public int SequenceID; public uint Flags; + public int LocalID; public LLUUID TransactionID; + public int SequenceID; + public int Sections; [XmlIgnore] public int Length @@ -35576,11 +33040,11 @@ namespace libsecondlife.Packets { 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)); + LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); TransactionID = new LLUUID(bytes, i); i += 16; + SequenceID = (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)); } catch (Exception) { @@ -35590,34 +33054,34 @@ namespace libsecondlife.Packets 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); + bytes[i++] = (byte)(LocalID % 256); + bytes[i++] = (byte)((LocalID >> 8) % 256); + bytes[i++] = (byte)((LocalID >> 16) % 256); + bytes[i++] = (byte)((LocalID >> 24) % 256); Buffer.BlockCopy(TransactionID.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)(Sections % 256); + bytes[i++] = (byte)((Sections >> 8) % 256); + bytes[i++] = (byte)((Sections >> 16) % 256); + bytes[i++] = (byte)((Sections >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.AppendLine(String.Format("Sections: {0}", Sections)); - output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); output.AppendLine(String.Format("Flags: {0}", Flags)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("LocalID: {0}", LocalID)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); + output.Append(String.Format("Sections: {0}", Sections)); return output.ToString(); } } @@ -35678,8 +33142,83 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelAccessListUpdate; } } + public AgentDataBlock AgentData; + public DataBlock Data; + public ListBlock[] List; + + public ParcelAccessListUpdatePacket() + { + Header = new LowHeader(); + Header.ID = 217; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + List = new ListBlock[0]; + } + + public ParcelAccessListUpdatePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + 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 ParcelAccessListUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelAccessListUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + for (int j = 0; j < List.Length; j++) + { + output += List[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ParcelDwellRequestPacket : Packet + { /// - [XmlType("parcelaccesslistupdate_agentdata")] + [XmlType("parceldwellrequest_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -35724,82 +33263,6 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelAccessListUpdate; } } - public DataBlock Data; - public ListBlock[] List; - public AgentDataBlock AgentData; - - public ParcelAccessListUpdatePacket() - { - Header = new LowHeader(); - Header.ID = 249; - Header.Reliable = true; - Header.Zerocoded = true; - Data = new DataBlock(); - List = new ListBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ParcelAccessListUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - int count = (int)bytes[i++]; - List = new ListBlock[count]; - for (int j = 0; j < count; j++) - { List[j] = new ListBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelAccessListUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - int count = (int)bytes[i++]; - List = new ListBlock[count]; - for (int j = 0; j < count; j++) - { List[j] = new ListBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < List.Length; j++) { length += List[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - bytes[i++] = (byte)List.Length; - for (int j = 0; j < List.Length; j++) { List[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelAccessListUpdate ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - for (int j = 0; j < List.Length; j++) - { - output += List[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelDwellRequestPacket : Packet - { /// [XmlType("parceldwellrequest_data")] public class DataBlock @@ -35849,19 +33312,75 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ParcelDwellRequest; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public ParcelDwellRequestPacket() + { + Header = new LowHeader(); + Header.ID = 218; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public ParcelDwellRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public ParcelDwellRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- ParcelDwellRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ParcelDwellReplyPacket : Packet + { /// - [XmlType("parceldwellrequest_agentdata")] + [XmlType("parceldwellreply_agentdata")] public class AgentDataBlock { public LLUUID AgentID; - public LLUUID SessionID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } @@ -35871,7 +33390,6 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -35882,76 +33400,17 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("AgentID: {0}", AgentID)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ParcelDwellRequest; } } - public DataBlock Data; - public AgentDataBlock AgentData; - - public ParcelDwellRequestPacket() - { - Header = new LowHeader(); - Header.ID = 250; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public ParcelDwellRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ParcelDwellRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ParcelDwellRequest ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ParcelDwellReplyPacket : Packet - { /// [XmlType("parceldwellreply_data")] public class DataBlock @@ -36009,88 +33468,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("parceldwellreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - 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 DataBlock Data; public ParcelDwellReplyPacket() { Header = new LowHeader(); - Header.ID = 251; + Header.ID = 219; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -36098,8 +33515,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelDwellReply ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -36108,51 +33525,6 @@ namespace libsecondlife.Packets /// public class ParcelGodMarkAsContentPacket : Packet { - /// - [XmlType("parcelgodmarkascontent_parceldata")] - public class ParcelDataBlock - { - public int LocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ParcelDataBlock() { } - public ParcelDataBlock(byte[] bytes, ref int i) - { - try - { - LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(LocalID % 256); - bytes[i++] = (byte)((LocalID >> 8) % 256); - bytes[i++] = (byte)((LocalID >> 16) % 256); - bytes[i++] = (byte)((LocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ParcelData --"); - output.Append(String.Format("LocalID: {0}", LocalID)); - return output.ToString(); - } - } - /// [XmlType("parcelgodmarkascontent_agentdata")] public class AgentDataBlock @@ -36199,46 +33571,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("parcelgodmarkascontent_parceldata")] + public class ParcelDataBlock + { + public int LocalID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public ParcelDataBlock() { } + public ParcelDataBlock(byte[] bytes, ref int i) + { + try + { + LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(LocalID % 256); + bytes[i++] = (byte)((LocalID >> 8) % 256); + bytes[i++] = (byte)((LocalID >> 16) % 256); + bytes[i++] = (byte)((LocalID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ParcelData --"); + output.Append(String.Format("LocalID: {0}", LocalID)); + return output.ToString(); + } + } + 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 ParcelDataBlock ParcelData; public ParcelGodMarkAsContentPacket() { Header = new LowHeader(); - Header.ID = 259; + Header.ID = 227; Header.Reliable = true; - ParcelData = new ParcelDataBlock(); AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); } 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); + ParcelData = new ParcelDataBlock(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); + ParcelData = new ParcelDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + ParcelData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -36246,8 +33663,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelGodMarkAsContent ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; return output; } @@ -36256,6 +33673,52 @@ namespace libsecondlife.Packets /// public class ViewerStartAuctionPacket : Packet { + /// + [XmlType("viewerstartauction_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("viewerstartauction_parceldata")] public class ParcelDataBlock @@ -36305,92 +33768,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("viewerstartauction_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 ParcelDataBlock ParcelData; public ViewerStartAuctionPacket() { Header = new LowHeader(); - Header.ID = 260; + Header.ID = 228; Header.Reliable = true; - ParcelData = new ParcelDataBlock(); AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); } 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); + ParcelData = new ParcelDataBlock(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); + ParcelData = new ParcelDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ParcelData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + ParcelData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -36398,8 +33815,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ViewerStartAuction ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; return output; } @@ -36458,7 +33875,7 @@ namespace libsecondlife.Packets public UUIDNameRequestPacket() { Header = new LowHeader(); - Header.ID = 267; + Header.ID = 235; Header.Reliable = true; UUIDNameBlock = new UUIDNameBlockBlock[0]; } @@ -36484,7 +33901,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; } @@ -36518,17 +33935,6 @@ namespace libsecondlife.Packets 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]; Buffer.BlockCopy(value, 0, _lastname, 0, value.Length); } - } - } private byte[] _firstname; public byte[] FirstName { @@ -36540,6 +33946,17 @@ namespace libsecondlife.Packets else { _firstname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _firstname, 0, 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]; Buffer.BlockCopy(value, 0, _lastname, 0, value.Length); } + } + } [XmlIgnore] public int Length @@ -36547,8 +33964,8 @@ namespace libsecondlife.Packets get { int length = 16; - if (LastName != null) { length += 1 + LastName.Length; } if (FirstName != null) { length += 1 + FirstName.Length; } + if (LastName != null) { length += 1 + LastName.Length; } return length; } } @@ -36561,11 +33978,11 @@ namespace libsecondlife.Packets { ID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; - _lastname = new byte[length]; - Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; - length = (ushort)bytes[i++]; _firstname = new byte[length]; Buffer.BlockCopy(bytes, i, _firstname, 0, length); i += length; + length = (ushort)bytes[i++]; + _lastname = new byte[length]; + Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; } catch (Exception) { @@ -36576,12 +33993,12 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(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; - Buffer.BlockCopy(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; Buffer.BlockCopy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length; + if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); } + bytes[i++] = (byte)LastName.Length; + Buffer.BlockCopy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length; } public override string ToString() @@ -36589,9 +34006,9 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- UUIDNameBlock --"); output.AppendLine(String.Format("ID: {0}", ID)); - Helpers.FieldToString(output, LastName, "LastName"); - output.Append(Environment.NewLine); Helpers.FieldToString(output, FirstName, "FirstName"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, LastName, "LastName"); return output.ToString(); } } @@ -36604,7 +34021,7 @@ namespace libsecondlife.Packets public UUIDNameReplyPacket() { Header = new LowHeader(); - Header.ID = 268; + Header.ID = 236; Header.Reliable = true; UUIDNameBlock = new UUIDNameBlockBlock[0]; } @@ -36630,7 +34047,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; } @@ -36709,7 +34126,7 @@ namespace libsecondlife.Packets public UUIDGroupNameRequestPacket() { Header = new LowHeader(); - Header.ID = 269; + Header.ID = 237; Header.Reliable = true; UUIDNameBlock = new UUIDNameBlockBlock[0]; } @@ -36735,7 +34152,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; } @@ -36835,7 +34252,7 @@ namespace libsecondlife.Packets public UUIDGroupNameReplyPacket() { Header = new LowHeader(); - Header.ID = 270; + Header.ID = 238; Header.Reliable = true; UUIDNameBlock = new UUIDNameBlockBlock[0]; } @@ -36861,7 +34278,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < UUIDNameBlock.Length; j++) { length += UUIDNameBlock[j].Length; } @@ -36944,9 +34361,8 @@ namespace libsecondlife.Packets public ChildAgentDyingPacket() { Header = new LowHeader(); - Header.ID = 272; + Header.ID = 240; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); } @@ -36965,7 +34381,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -37042,7 +34458,7 @@ namespace libsecondlife.Packets public ChildAgentUnknownPacket() { Header = new LowHeader(); - Header.ID = 273; + Header.ID = 241; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -37062,7 +34478,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -37139,7 +34555,7 @@ namespace libsecondlife.Packets public GetScriptRunningPacket() { Header = new LowHeader(); - Header.ID = 275; + Header.ID = 243; Header.Reliable = true; Script = new ScriptBlock(); } @@ -37159,7 +34575,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Script.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -37187,8 +34603,8 @@ namespace libsecondlife.Packets public class ScriptBlock { public LLUUID ObjectID; - public bool Running; public LLUUID ItemID; + public bool Running; [XmlIgnore] public int Length @@ -37205,8 +34621,8 @@ namespace libsecondlife.Packets try { ObjectID = new LLUUID(bytes, i); i += 16; - Running = (bytes[i++] != 0) ? (bool)true : (bool)false; ItemID = new LLUUID(bytes, i); i += 16; + Running = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -37217,8 +34633,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((Running) ? 1 : 0); Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Running) ? 1 : 0); } public override string ToString() @@ -37226,8 +34642,8 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- Script --"); output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("Running: {0}", Running)); - output.Append(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.Append(String.Format("Running: {0}", Running)); return output.ToString(); } } @@ -37240,7 +34656,7 @@ namespace libsecondlife.Packets public ScriptRunningReplyPacket() { Header = new LowHeader(); - Header.ID = 276; + Header.ID = 244; Header.Reliable = true; Script = new ScriptBlock(); } @@ -37260,7 +34676,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Script.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -37283,56 +34699,6 @@ namespace libsecondlife.Packets /// public class SetScriptRunningPacket : Packet { - /// - [XmlType("setscriptrunning_script")] - public class ScriptBlock - { - public LLUUID ObjectID; - public bool Running; - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 33; - } - } - - public ScriptBlock() { } - public ScriptBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - Running = (bytes[i++] != 0) ? (bool)true : (bool)false; - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((Running) ? 1 : 0); - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Script --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("Running: {0}", Running)); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("setscriptrunning_agentdata")] public class AgentDataBlock @@ -37379,76 +34745,20 @@ namespace libsecondlife.Packets } } - 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 = 277; - Header.Reliable = true; - Script = new ScriptBlock(); - AgentData = new AgentDataBlock(); - } - - public SetScriptRunningPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Script = new ScriptBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public SetScriptRunningPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Script = new ScriptBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Script.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Script.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- SetScriptRunning ---" + Environment.NewLine; - output += Script.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ScriptResetPacket : Packet - { /// - [XmlType("scriptreset_script")] + [XmlType("setscriptrunning_script")] public class ScriptBlock { public LLUUID ObjectID; public LLUUID ItemID; + public bool Running; [XmlIgnore] public int Length { get { - return 32; + return 33; } } @@ -37459,6 +34769,7 @@ namespace libsecondlife.Packets { ObjectID = new LLUUID(bytes, i); i += 16; ItemID = new LLUUID(bytes, i); i += 16; + Running = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -37470,6 +34781,7 @@ namespace libsecondlife.Packets { Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Running) ? 1 : 0); } public override string ToString() @@ -37477,11 +34789,69 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- Script --"); output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.Append(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.Append(String.Format("Running: {0}", Running)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.SetScriptRunning; } } + public AgentDataBlock AgentData; + public ScriptBlock Script; + + public SetScriptRunningPacket() + { + Header = new LowHeader(); + Header.ID = 245; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Script = new ScriptBlock(); + } + + public SetScriptRunningPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Script = new ScriptBlock(bytes, ref i); + } + + public SetScriptRunningPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Script = new ScriptBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- SetScriptRunning ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Script.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class ScriptResetPacket : Packet + { /// [XmlType("scriptreset_agentdata")] public class AgentDataBlock @@ -37528,46 +34898,92 @@ namespace libsecondlife.Packets } } + /// + [XmlType("scriptreset_script")] + public class ScriptBlock + { + public LLUUID ObjectID; + public LLUUID ItemID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public ScriptBlock() { } + public ScriptBlock(byte[] bytes, ref int i) + { + try + { + ObjectID = new LLUUID(bytes, i); i += 16; + ItemID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Script --"); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.Append(String.Format("ItemID: {0}", ItemID)); + return output.ToString(); + } + } + 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 ScriptBlock Script; public ScriptResetPacket() { Header = new LowHeader(); - Header.ID = 278; + Header.ID = 246; Header.Reliable = true; - Script = new ScriptBlock(); AgentData = new AgentDataBlock(); + Script = new ScriptBlock(); } 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); + Script = new ScriptBlock(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); + Script = new ScriptBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Script.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Script.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -37575,8 +34991,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ScriptReset ---" + Environment.NewLine; - output += Script.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Script.ToString() + Environment.NewLine; return output; } @@ -37589,9 +35005,11 @@ namespace libsecondlife.Packets [XmlType("scriptsensorrequest_requester")] public class RequesterBlock { - public float Arc; + public LLUUID SourceID; public LLUUID RequestID; public LLUUID SearchID; + public LLVector3 SearchPos; + public LLQuaternion SearchDir; private byte[] _searchname; public byte[] SearchName { @@ -37604,12 +35022,10 @@ namespace libsecondlife.Packets } } public int Type; - public ulong RegionHandle; - public LLQuaternion SearchDir; - public byte SearchRegions; - public LLVector3 SearchPos; public float Range; - public LLUUID SourceID; + public float Arc; + public ulong RegionHandle; + public byte SearchRegions; [XmlIgnore] public int Length @@ -37628,21 +35044,21 @@ namespace libsecondlife.Packets int length; try { - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Arc = BitConverter.ToSingle(bytes, i); i += 4; + SourceID = new LLUUID(bytes, i); i += 16; RequestID = new LLUUID(bytes, i); i += 16; SearchID = new LLUUID(bytes, i); i += 16; + SearchPos = new LLVector3(bytes, i); i += 12; + SearchDir = new LLQuaternion(bytes, i, true); i += 12; length = (ushort)bytes[i++]; _searchname = new byte[length]; Buffer.BlockCopy(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; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Arc = BitConverter.ToSingle(bytes, i); i += 4; + 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)); + SearchRegions = (byte)bytes[i++]; } catch (Exception) { @@ -37653,11 +35069,11 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - ba = BitConverter.GetBytes(Arc); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + Buffer.BlockCopy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(SearchID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SearchPos.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(SearchDir.GetBytes(), 0, bytes, i, 12); i += 12; if(SearchName == null) { Console.WriteLine("Warning: SearchName is null, in " + this.GetType()); } bytes[i++] = (byte)SearchName.Length; Buffer.BlockCopy(SearchName, 0, bytes, i, SearchName.Length); i += SearchName.Length; @@ -37665,6 +35081,12 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((Type >> 8) % 256); bytes[i++] = (byte)((Type >> 16) % 256); bytes[i++] = (byte)((Type >> 24) % 256); + ba = BitConverter.GetBytes(Range); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(Arc); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; bytes[i++] = (byte)(RegionHandle % 256); bytes[i++] = (byte)((RegionHandle >> 8) % 256); bytes[i++] = (byte)((RegionHandle >> 16) % 256); @@ -37673,31 +35095,25 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((RegionHandle >> 40) % 256); bytes[i++] = (byte)((RegionHandle >> 48) % 256); bytes[i++] = (byte)((RegionHandle >> 56) % 256); - Buffer.BlockCopy(SearchDir.GetBytes(), 0, bytes, i, 12); i += 12; bytes[i++] = SearchRegions; - Buffer.BlockCopy(SearchPos.GetBytes(), 0, bytes, i, 12); i += 12; - ba = BitConverter.GetBytes(Range); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Requester --"); - output.AppendLine(String.Format("Arc: {0}", Arc)); + output.AppendLine(String.Format("SourceID: {0}", SourceID)); output.AppendLine(String.Format("RequestID: {0}", RequestID)); output.AppendLine(String.Format("SearchID: {0}", SearchID)); + output.AppendLine(String.Format("SearchPos: {0}", SearchPos)); + output.AppendLine(String.Format("SearchDir: {0}", SearchDir)); Helpers.FieldToString(output, SearchName, "SearchName"); output.Append(Environment.NewLine); output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.AppendLine(String.Format("SearchDir: {0}", SearchDir)); - output.AppendLine(String.Format("SearchRegions: {0}", SearchRegions)); - output.AppendLine(String.Format("SearchPos: {0}", SearchPos)); output.AppendLine(String.Format("Range: {0}", Range)); - output.Append(String.Format("SourceID: {0}", SourceID)); + output.AppendLine(String.Format("Arc: {0}", Arc)); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.Append(String.Format("SearchRegions: {0}", SearchRegions)); return output.ToString(); } } @@ -37710,9 +35126,8 @@ namespace libsecondlife.Packets public ScriptSensorRequestPacket() { Header = new LowHeader(); - Header.ID = 279; + Header.ID = 247; Header.Reliable = true; - Header.Zerocoded = true; Requester = new RequesterBlock(); } @@ -37731,7 +35146,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += Requester.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -37754,105 +35169,6 @@ namespace libsecondlife.Packets /// public class ScriptSensorReplyPacket : Packet { - /// - [XmlType("scriptsensorreply_senseddata")] - 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - public int Type; - public LLUUID GroupID; - public LLUUID OwnerID; - public LLVector3 Velocity; - public float Range; - public LLQuaternion Rotation; - public LLVector3 Position; - - [XmlIgnore] - 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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Velocity.GetBytes(), 0, bytes, i, 12); i += 12; - ba = BitConverter.GetBytes(Range); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- SensedData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("Velocity: {0}", Velocity)); - output.AppendLine(String.Format("Range: {0}", Range)); - output.AppendLine(String.Format("Rotation: {0}", Rotation)); - output.Append(String.Format("Position: {0}", Position)); - return output.ToString(); - } - } - /// [XmlType("scriptsensorreply_requester")] public class RequesterBlock @@ -37895,46 +35211,144 @@ namespace libsecondlife.Packets } } + /// + [XmlType("scriptsensorreply_senseddata")] + public class SensedDataBlock + { + public LLUUID ObjectID; + public LLUUID OwnerID; + public LLUUID GroupID; + public LLVector3 Position; + public LLVector3 Velocity; + public LLQuaternion Rotation; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + public int Type; + public float Range; + + [XmlIgnore] + 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; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + Position = new LLVector3(bytes, i); i += 12; + Velocity = new LLVector3(bytes, i); i += 12; + Rotation = new LLQuaternion(bytes, i, true); i += 12; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Range = BitConverter.ToSingle(bytes, i); i += 4; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(Velocity.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(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); + ba = BitConverter.GetBytes(Range); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- SensedData --"); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("Position: {0}", Position)); + output.AppendLine(String.Format("Velocity: {0}", Velocity)); + output.AppendLine(String.Format("Rotation: {0}", Rotation)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Type: {0}", Type)); + output.Append(String.Format("Range: {0}", Range)); + return output.ToString(); + } + } + 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 SensedDataBlock[] SensedData; public ScriptSensorReplyPacket() { Header = new LowHeader(); - Header.ID = 280; + Header.ID = 248; Header.Reliable = true; - Header.Zerocoded = true; - SensedData = new SensedDataBlock[0]; Requester = new RequesterBlock(); + SensedData = new SensedDataBlock[0]; } public ScriptSensorReplyPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + Requester = new RequesterBlock(bytes, ref i); 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; + Requester = new RequesterBlock(bytes, ref i); 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; + int length = 10; length += Requester.Length;; length++; for (int j = 0; j < SensedData.Length; j++) { length += SensedData[j].Length; } @@ -37942,9 +35356,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + Requester.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; } @@ -37952,11 +35366,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ScriptSensorReply ---" + Environment.NewLine; + output += Requester.ToString() + Environment.NewLine; for (int j = 0; j < SensedData.Length; j++) { output += SensedData[j].ToString() + Environment.NewLine; } - output += Requester.ToString() + Environment.NewLine; return output; } @@ -38026,7 +35440,7 @@ namespace libsecondlife.Packets public CompleteAgentMovementPacket() { Header = new LowHeader(); - Header.ID = 281; + Header.ID = 249; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -38046,7 +35460,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -38069,70 +35483,6 @@ namespace libsecondlife.Packets /// public class AgentMovementCompletePacket : Packet { - /// - [XmlType("agentmovementcomplete_data")] - public class DataBlock - { - public uint Timestamp; - public ulong RegionHandle; - public LLVector3 LookAt; - public LLVector3 Position; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); - LookAt = new LLVector3(bytes, i); i += 12; - Position = new LLVector3(bytes, i); i += 12; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(Timestamp % 256); - bytes[i++] = (byte)((Timestamp >> 8) % 256); - bytes[i++] = (byte)((Timestamp >> 16) % 256); - bytes[i++] = (byte)((Timestamp >> 24) % 256); - bytes[i++] = (byte)(RegionHandle % 256); - bytes[i++] = (byte)((RegionHandle >> 8) % 256); - bytes[i++] = (byte)((RegionHandle >> 16) % 256); - bytes[i++] = (byte)((RegionHandle >> 24) % 256); - bytes[i++] = (byte)((RegionHandle >> 32) % 256); - bytes[i++] = (byte)((RegionHandle >> 40) % 256); - bytes[i++] = (byte)((RegionHandle >> 48) % 256); - bytes[i++] = (byte)((RegionHandle >> 56) % 256); - Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.AppendLine(String.Format("Timestamp: {0}", Timestamp)); - output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.AppendLine(String.Format("LookAt: {0}", LookAt)); - output.Append(String.Format("Position: {0}", Position)); - return output.ToString(); - } - } - /// [XmlType("agentmovementcomplete_agentdata")] public class AgentDataBlock @@ -38179,86 +35529,33 @@ namespace libsecondlife.Packets } } - 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 = 282; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public AgentMovementCompletePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AgentMovementCompletePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AgentMovementComplete ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ConnectAgentToUserserverPacket : Packet - { /// - [XmlType("connectagenttouserserver_agentdata")] - public class AgentDataBlock + [XmlType("agentmovementcomplete_data")] + public class DataBlock { - public LLUUID AgentID; - public LLUUID SessionID; + public LLVector3 Position; + public LLVector3 LookAt; + public ulong RegionHandle; + public uint Timestamp; [XmlIgnore] public int Length { get { - return 32; + return 36; } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) { try { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; + Position = new LLVector3(bytes, i); i += 12; + LookAt = 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)); + Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -38268,108 +35565,83 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LookAt.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); + bytes[i++] = (byte)(Timestamp % 256); + bytes[i++] = (byte)((Timestamp >> 8) % 256); + bytes[i++] = (byte)((Timestamp >> 16) % 256); + bytes[i++] = (byte)((Timestamp >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("Position: {0}", Position)); + output.AppendLine(String.Format("LookAt: {0}", LookAt)); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.Append(String.Format("Timestamp: {0}", Timestamp)); return output.ToString(); } } private Header header; public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ConnectAgentToUserserver; } } + public override PacketType Type { get { return PacketType.AgentMovementComplete; } } public AgentDataBlock AgentData; + public DataBlock Data; - public ConnectAgentToUserserverPacket() + public AgentMovementCompletePacket() { Header = new LowHeader(); - Header.ID = 284; + Header.ID = 250; Header.Reliable = true; AgentData = new AgentDataBlock(); + Data = new DataBlock(); } - public ConnectAgentToUserserverPacket(byte[] bytes, ref int i) + public AgentMovementCompletePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); } - public ConnectAgentToUserserverPacket(Header head, byte[] bytes, ref int i) + public AgentMovementCompletePacket(Header head, byte[] bytes, ref int i) { Header = head; AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.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 = "--- ConnectAgentToUserserver ---" + Environment.NewLine; + string output = "--- AgentMovementComplete ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - 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 = 285; - Header.Reliable = true; - } - - public ConnectToUserserverPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - } - - public ConnectToUserserverPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - } - - public override byte[] ToBytes() - { - int length = 8; -; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ConnectToUserserver ---" + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -38432,7 +35704,7 @@ namespace libsecondlife.Packets public LogoutRequestPacket() { Header = new LowHeader(); - Header.ID = 287; + Header.ID = 252; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -38452,7 +35724,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -38472,148 +35744,9 @@ namespace libsecondlife.Packets } - /// - public class FinalizeLogoutPacket : Packet - { - /// - [XmlType("finalizelogout_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - 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 = 288; - Header.Reliable = true; - AgentData = new AgentDataBlock(); - } - - public FinalizeLogoutPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public FinalizeLogoutPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- FinalizeLogout ---" + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - /// public class LogoutReplyPacket : Packet { - /// - [XmlType("logoutreply_inventorydata")] - public class InventoryDataBlock - { - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("logoutreply_agentdata")] public class AgentDataBlock @@ -38660,81 +35793,11 @@ namespace libsecondlife.Packets } } - 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 = 289; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public LogoutReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public LogoutReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- LogoutReply ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class LogoutDemandPacket : Packet - { /// - [XmlType("logoutdemand_logoutblock")] - public class LogoutBlockBlock + [XmlType("logoutreply_inventorydata")] + public class InventoryDataBlock { - public LLUUID SessionID; + public LLUUID ItemID; [XmlIgnore] public int Length @@ -38745,12 +35808,12 @@ namespace libsecondlife.Packets } } - public LogoutBlockBlock() { } - public LogoutBlockBlock(byte[] bytes, ref int i) + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) { try { - SessionID = new LLUUID(bytes, i); i += 16; + ItemID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -38760,61 +35823,79 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- LogoutBlock --"); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine("-- InventoryData --"); + output.Append(String.Format("ItemID: {0}", ItemID)); return output.ToString(); } } 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 override PacketType Type { get { return PacketType.LogoutReply; } } + public AgentDataBlock AgentData; + public InventoryDataBlock[] InventoryData; - public LogoutDemandPacket() + public LogoutReplyPacket() { Header = new LowHeader(); - Header.ID = 290; + Header.ID = 253; Header.Reliable = true; - LogoutBlock = new LogoutBlockBlock(); + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; } - public LogoutDemandPacket(byte[] bytes, ref int i) + public LogoutReplyPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); - LogoutBlock = new LogoutBlockBlock(bytes, ref i); + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } } - public LogoutDemandPacket(Header head, byte[] bytes, ref int i) + public LogoutReplyPacket(Header head, byte[] bytes, ref int i) { Header = head; - LogoutBlock = new LogoutBlockBlock(bytes, ref i); + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } } public override byte[] ToBytes() { - int length = 8; - length += LogoutBlock.Length;; + int length = 10; + 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); - LogoutBlock.ToBytes(bytes, ref i); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } public override string ToString() { - string output = "--- LogoutDemand ---" + Environment.NewLine; - output += LogoutBlock.ToString() + Environment.NewLine; + string output = "--- LogoutReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } return output; } @@ -38823,150 +35904,6 @@ namespace libsecondlife.Packets /// public class ImprovedInstantMessagePacket : Packet { - /// - [XmlType("improvedinstantmessage_messageblock")] - public class MessageBlockBlock - { - public LLUUID ID; - public LLUUID ToAgentID; - public byte Offline; - public uint Timestamp; - private byte[] _message; - public byte[] Message - { - get { return _message; } - set - { - if (value == null) { _message = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, 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 > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _binarybucket = new byte[value.Length]; Buffer.BlockCopy(value, 0, _binarybucket, 0, 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]; Buffer.BlockCopy(value, 0, _fromagentname, 0, value.Length); } - } - } - public LLVector3 Position; - - [XmlIgnore] - public int Length - { - get - { - int length = 71; - if (Message != null) { length += 2 + Message.Length; } - if (BinaryBucket != null) { length += 2 + BinaryBucket.Length; } - if (FromAgentName != null) { length += 1 + FromAgentName.Length; } - return length; - } - } - - public MessageBlockBlock() { } - public MessageBlockBlock(byte[] bytes, ref int i) - { - int length; - try - { - ID = new LLUUID(bytes, i); i += 16; - ToAgentID = new LLUUID(bytes, i); i += 16; - Offline = (byte)bytes[i++]; - Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _message = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); - Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(FromAgentName, 0, bytes, i, FromAgentName.Length); i += FromAgentName.Length; - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MessageBlock --"); - output.AppendLine(String.Format("ID: {0}", ID)); - output.AppendLine(String.Format("ToAgentID: {0}", ToAgentID)); - output.AppendLine(String.Format("Offline: {0}", Offline)); - output.AppendLine(String.Format("Timestamp: {0}", Timestamp)); - Helpers.FieldToString(output, Message, "Message"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("RegionID: {0}", RegionID)); - output.AppendLine(String.Format("Dialog: {0}", Dialog)); - output.AppendLine(String.Format("FromGroup: {0}", FromGroup)); - Helpers.FieldToString(output, BinaryBucket, "BinaryBucket"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ParentEstateID: {0}", ParentEstateID)); - Helpers.FieldToString(output, FromAgentName, "FromAgentName"); - output.Append(Environment.NewLine); - output.Append(String.Format("Position: {0}", Position)); - return output.ToString(); - } - } - /// [XmlType("improvedinstantmessage_agentdata")] public class AgentDataBlock @@ -39013,47 +35950,189 @@ namespace libsecondlife.Packets } } + /// + [XmlType("improvedinstantmessage_messageblock")] + public class MessageBlockBlock + { + public bool FromGroup; + public LLUUID ToAgentID; + public uint ParentEstateID; + public LLUUID RegionID; + public LLVector3 Position; + public byte Offline; + public byte Dialog; + public LLUUID ID; + public uint Timestamp; + 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]; Buffer.BlockCopy(value, 0, _fromagentname, 0, value.Length); } + } + } + private byte[] _message; + public byte[] Message + { + get { return _message; } + set + { + if (value == null) { _message = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } + private byte[] _binarybucket; + public byte[] BinaryBucket + { + get { return _binarybucket; } + set + { + if (value == null) { _binarybucket = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _binarybucket = new byte[value.Length]; Buffer.BlockCopy(value, 0, _binarybucket, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 71; + if (FromAgentName != null) { length += 1 + FromAgentName.Length; } + if (Message != null) { length += 2 + Message.Length; } + if (BinaryBucket != null) { length += 2 + BinaryBucket.Length; } + return length; + } + } + + public MessageBlockBlock() { } + public MessageBlockBlock(byte[] bytes, ref int i) + { + int length; + try + { + FromGroup = (bytes[i++] != 0) ? (bool)true : (bool)false; + ToAgentID = new LLUUID(bytes, i); i += 16; + ParentEstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + RegionID = new LLUUID(bytes, i); i += 16; + Position = new LLVector3(bytes, i); i += 12; + Offline = (byte)bytes[i++]; + Dialog = (byte)bytes[i++]; + ID = new LLUUID(bytes, i); i += 16; + Timestamp = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _fromagentname = new byte[length]; + Buffer.BlockCopy(bytes, i, _fromagentname, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _binarybucket = new byte[length]; + Buffer.BlockCopy(bytes, i, _binarybucket, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)((FromGroup) ? 1 : 0); + Buffer.BlockCopy(ToAgentID.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); + Buffer.BlockCopy(RegionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = Offline; + bytes[i++] = Dialog; + Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(Timestamp % 256); + bytes[i++] = (byte)((Timestamp >> 8) % 256); + bytes[i++] = (byte)((Timestamp >> 16) % 256); + bytes[i++] = (byte)((Timestamp >> 24) % 256); + if(FromAgentName == null) { Console.WriteLine("Warning: FromAgentName is null, in " + this.GetType()); } + bytes[i++] = (byte)FromAgentName.Length; + Buffer.BlockCopy(FromAgentName, 0, bytes, i, FromAgentName.Length); i += FromAgentName.Length; + 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); + Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; + 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); + Buffer.BlockCopy(BinaryBucket, 0, bytes, i, BinaryBucket.Length); i += BinaryBucket.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- MessageBlock --"); + output.AppendLine(String.Format("FromGroup: {0}", FromGroup)); + output.AppendLine(String.Format("ToAgentID: {0}", ToAgentID)); + output.AppendLine(String.Format("ParentEstateID: {0}", ParentEstateID)); + output.AppendLine(String.Format("RegionID: {0}", RegionID)); + output.AppendLine(String.Format("Position: {0}", Position)); + output.AppendLine(String.Format("Offline: {0}", Offline)); + output.AppendLine(String.Format("Dialog: {0}", Dialog)); + output.AppendLine(String.Format("ID: {0}", ID)); + output.AppendLine(String.Format("Timestamp: {0}", Timestamp)); + Helpers.FieldToString(output, FromAgentName, "FromAgentName"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Message, "Message"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, BinaryBucket, "BinaryBucket"); + return output.ToString(); + } + } + 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 MessageBlockBlock MessageBlock; public ImprovedInstantMessagePacket() { Header = new LowHeader(); - Header.ID = 291; + Header.ID = 254; Header.Reliable = true; - Header.Zerocoded = true; - MessageBlock = new MessageBlockBlock(); AgentData = new AgentDataBlock(); + MessageBlock = new MessageBlockBlock(); } 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); + MessageBlock = new MessageBlockBlock(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); + MessageBlock = new MessageBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += MessageBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += MessageBlock.Length;; 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); + MessageBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -39061,8 +36140,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ImprovedInstantMessage ---" + Environment.NewLine; - output += MessageBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += MessageBlock.ToString() + Environment.NewLine; return output; } @@ -39125,7 +36204,7 @@ namespace libsecondlife.Packets public RetrieveInstantMessagesPacket() { Header = new LowHeader(); - Header.ID = 292; + Header.ID = 255; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -39145,7 +36224,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -39168,6 +36247,59 @@ namespace libsecondlife.Packets /// public class FindAgentPacket : Packet { + /// + [XmlType("findagent_agentblock")] + public class AgentBlockBlock + { + public LLUUID Hunter; + public LLUUID Prey; + public uint SpaceIP; + + [XmlIgnore] + public int Length + { + get + { + return 36; + } + } + + public AgentBlockBlock() { } + public AgentBlockBlock(byte[] bytes, ref int i) + { + try + { + Hunter = new LLUUID(bytes, i); i += 16; + Prey = new LLUUID(bytes, i); i += 16; + 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) + { + Buffer.BlockCopy(Hunter.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Prey.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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentBlock --"); + output.AppendLine(String.Format("Hunter: {0}", Hunter)); + output.AppendLine(String.Format("Prey: {0}", Prey)); + output.Append(String.Format("SpaceIP: {0}", SpaceIP)); + return output.ToString(); + } + } + /// [XmlType("findagent_locationblock")] public class LocationBlockBlock @@ -39221,98 +36353,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("findagent_agentblock")] - public class AgentBlockBlock - { - public uint SpaceIP; - public LLUUID Prey; - public LLUUID Hunter; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public AgentBlockBlock() { } - public AgentBlockBlock(byte[] bytes, ref int i) - { - try - { - SpaceIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Prey = new LLUUID(bytes, i); i += 16; - Hunter = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(SpaceIP % 256); - bytes[i++] = (byte)((SpaceIP >> 8) % 256); - bytes[i++] = (byte)((SpaceIP >> 16) % 256); - bytes[i++] = (byte)((SpaceIP >> 24) % 256); - Buffer.BlockCopy(Prey.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Hunter.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentBlock --"); - output.AppendLine(String.Format("SpaceIP: {0}", SpaceIP)); - output.AppendLine(String.Format("Prey: {0}", Prey)); - output.Append(String.Format("Hunter: {0}", Hunter)); - return output.ToString(); - } - } - 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 LocationBlockBlock[] LocationBlock; public FindAgentPacket() { Header = new LowHeader(); - Header.ID = 293; + Header.ID = 256; Header.Reliable = true; - LocationBlock = new LocationBlockBlock[0]; AgentBlock = new AgentBlockBlock(); + LocationBlock = new LocationBlockBlock[0]; } public FindAgentPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentBlock = new AgentBlockBlock(bytes, ref i); 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; + AgentBlock = new AgentBlockBlock(bytes, ref i); 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; + int length = 10; length += AgentBlock.Length;; length++; for (int j = 0; j < LocationBlock.Length; j++) { length += LocationBlock[j].Length; } @@ -39320,9 +36399,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentBlock.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; } @@ -39330,11 +36409,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- FindAgent ---" + Environment.NewLine; + output += AgentBlock.ToString() + Environment.NewLine; for (int j = 0; j < LocationBlock.Length; j++) { output += LocationBlock[j].ToString() + Environment.NewLine; } - output += AgentBlock.ToString() + Environment.NewLine; return output; } @@ -39343,52 +36422,6 @@ namespace libsecondlife.Packets /// public class RequestGodlikePowersPacket : Packet { - /// - [XmlType("requestgodlikepowers_requestblock")] - public class RequestBlockBlock - { - public bool Godlike; - public LLUUID Token; - - [XmlIgnore] - public int Length - { - get - { - return 17; - } - } - - public RequestBlockBlock() { } - public RequestBlockBlock(byte[] bytes, ref int i) - { - try - { - Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false; - Token = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)((Godlike) ? 1 : 0); - Buffer.BlockCopy(Token.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RequestBlock --"); - output.AppendLine(String.Format("Godlike: {0}", Godlike)); - output.Append(String.Format("Token: {0}", Token)); - return output.ToString(); - } - } - /// [XmlType("requestgodlikepowers_agentdata")] public class AgentDataBlock @@ -39435,68 +36468,11 @@ namespace libsecondlife.Packets } } - 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 = 294; - Header.Reliable = true; - RequestBlock = new RequestBlockBlock(); - AgentData = new AgentDataBlock(); - } - - public RequestGodlikePowersPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - RequestBlock = new RequestBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RequestGodlikePowersPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - RequestBlock = new RequestBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += RequestBlock.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - RequestBlock.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RequestGodlikePowers ---" + Environment.NewLine; - output += RequestBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GrantGodlikePowersPacket : Packet - { /// - [XmlType("grantgodlikepowers_grantdata")] - public class GrantDataBlock + [XmlType("requestgodlikepowers_requestblock")] + public class RequestBlockBlock { - public byte GodLevel; + public bool Godlike; public LLUUID Token; [XmlIgnore] @@ -39508,12 +36484,12 @@ namespace libsecondlife.Packets } } - public GrantDataBlock() { } - public GrantDataBlock(byte[] bytes, ref int i) + public RequestBlockBlock() { } + public RequestBlockBlock(byte[] bytes, ref int i) { try { - GodLevel = (byte)bytes[i++]; + Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false; Token = new LLUUID(bytes, i); i += 16; } catch (Exception) @@ -39524,20 +36500,77 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = GodLevel; + bytes[i++] = (byte)((Godlike) ? 1 : 0); Buffer.BlockCopy(Token.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- GrantData --"); - output.AppendLine(String.Format("GodLevel: {0}", GodLevel)); + output.AppendLine("-- RequestBlock --"); + output.AppendLine(String.Format("Godlike: {0}", Godlike)); output.Append(String.Format("Token: {0}", Token)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.RequestGodlikePowers; } } + public AgentDataBlock AgentData; + public RequestBlockBlock RequestBlock; + + public RequestGodlikePowersPacket() + { + Header = new LowHeader(); + Header.ID = 257; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + RequestBlock = new RequestBlockBlock(); + } + + public RequestGodlikePowersPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + RequestBlock = new RequestBlockBlock(bytes, ref i); + } + + public RequestGodlikePowersPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + RequestBlock = new RequestBlockBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- RequestGodlikePowers ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += RequestBlock.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class GrantGodlikePowersPacket : Packet + { /// [XmlType("grantgodlikepowers_agentdata")] public class AgentDataBlock @@ -39584,46 +36617,92 @@ namespace libsecondlife.Packets } } + /// + [XmlType("grantgodlikepowers_grantdata")] + public class GrantDataBlock + { + public byte GodLevel; + public LLUUID Token; + + [XmlIgnore] + public int Length + { + get + { + return 17; + } + } + + public GrantDataBlock() { } + public GrantDataBlock(byte[] bytes, ref int i) + { + try + { + GodLevel = (byte)bytes[i++]; + Token = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = GodLevel; + Buffer.BlockCopy(Token.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- GrantData --"); + output.AppendLine(String.Format("GodLevel: {0}", GodLevel)); + output.Append(String.Format("Token: {0}", Token)); + return output.ToString(); + } + } + 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 GrantDataBlock GrantData; public GrantGodlikePowersPacket() { Header = new LowHeader(); - Header.ID = 295; + Header.ID = 258; Header.Reliable = true; - GrantData = new GrantDataBlock(); AgentData = new AgentDataBlock(); + GrantData = new GrantDataBlock(); } 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); + GrantData = new GrantDataBlock(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); + GrantData = new GrantDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += GrantData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += GrantData.Length;; 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); + GrantData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -39631,8 +36710,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GrantGodlikePowers ---" + Environment.NewLine; - output += GrantData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += GrantData.ToString() + Environment.NewLine; return output; } @@ -39641,11 +36720,60 @@ namespace libsecondlife.Packets /// public class GodlikeMessagePacket : Packet { + /// + [XmlType("godlikemessage_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public LLUUID TransactionID; + + [XmlIgnore] + public int Length + { + get + { + return 48; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + TransactionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("TransactionID: {0}", TransactionID)); + return output.ToString(); + } + } + /// [XmlType("godlikemessage_methoddata")] public class MethodDataBlock { - public LLUUID Invoice; private byte[] _method; public byte[] Method { @@ -39657,6 +36785,7 @@ namespace libsecondlife.Packets else { _method = new byte[value.Length]; Buffer.BlockCopy(value, 0, _method, 0, value.Length); } } } + public LLUUID Invoice; [XmlIgnore] public int Length @@ -39675,10 +36804,10 @@ namespace libsecondlife.Packets int length; try { - Invoice = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _method = new byte[length]; Buffer.BlockCopy(bytes, i, _method, 0, length); i += length; + Invoice = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -39688,18 +36817,19 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(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; Buffer.BlockCopy(Method, 0, bytes, i, Method.Length); i += Method.Length; + Buffer.BlockCopy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- MethodData --"); - output.AppendLine(String.Format("Invoice: {0}", Invoice)); Helpers.FieldToString(output, Method, "Method"); + output.Append(Environment.NewLine); + output.Append(String.Format("Invoice: {0}", Invoice)); return output.ToString(); } } @@ -39763,8 +36893,83 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GodlikeMessage; } } + public AgentDataBlock AgentData; + public MethodDataBlock MethodData; + public ParamListBlock[] ParamList; + + public GodlikeMessagePacket() + { + Header = new LowHeader(); + Header.ID = 259; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + MethodData = new MethodDataBlock(); + ParamList = new ParamListBlock[0]; + } + + public GodlikeMessagePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + 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 GodlikeMessagePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- GodlikeMessage ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += MethodData.ToString() + Environment.NewLine; + for (int j = 0; j < ParamList.Length; j++) + { + output += ParamList[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class EstateOwnerMessagePacket : Packet + { /// - [XmlType("godlikemessage_agentdata")] + [XmlType("estateownermessage_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -39813,87 +37018,10 @@ namespace libsecondlife.Packets } } - 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 = 296; - Header.Reliable = true; - Header.Zerocoded = true; - MethodData = new MethodDataBlock(); - ParamList = new ParamListBlock[0]; - AgentData = new AgentDataBlock(); - } - - public GodlikeMessagePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MethodData = new MethodDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - ParamList = new ParamListBlock[count]; - for (int j = 0; j < count; j++) - { ParamList[j] = new ParamListBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GodlikeMessagePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MethodData = new MethodDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - ParamList = new ParamListBlock[count]; - for (int j = 0; j < count; j++) - { ParamList[j] = new ParamListBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MethodData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < ParamList.Length; j++) { length += ParamList[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MethodData.ToBytes(bytes, ref i); - bytes[i++] = (byte)ParamList.Length; - for (int j = 0; j < ParamList.Length; j++) { ParamList[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GodlikeMessage ---" + Environment.NewLine; - output += MethodData.ToString() + Environment.NewLine; - for (int j = 0; j < ParamList.Length; j++) - { - output += ParamList[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class EstateOwnerMessagePacket : Packet - { /// [XmlType("estateownermessage_methoddata")] public class MethodDataBlock { - public LLUUID Invoice; private byte[] _method; public byte[] Method { @@ -39905,6 +37033,7 @@ namespace libsecondlife.Packets else { _method = new byte[value.Length]; Buffer.BlockCopy(value, 0, _method, 0, value.Length); } } } + public LLUUID Invoice; [XmlIgnore] public int Length @@ -39923,10 +37052,10 @@ namespace libsecondlife.Packets int length; try { - Invoice = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _method = new byte[length]; Buffer.BlockCopy(bytes, i, _method, 0, length); i += length; + Invoice = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -39936,18 +37065,19 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(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; Buffer.BlockCopy(Method, 0, bytes, i, Method.Length); i += Method.Length; + Buffer.BlockCopy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- MethodData --"); - output.AppendLine(String.Format("Invoice: {0}", Invoice)); Helpers.FieldToString(output, Method, "Method"); + output.Append(Environment.NewLine); + output.Append(String.Format("Invoice: {0}", Invoice)); return output.ToString(); } } @@ -40011,8 +37141,83 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.EstateOwnerMessage; } } + public AgentDataBlock AgentData; + public MethodDataBlock MethodData; + public ParamListBlock[] ParamList; + + public EstateOwnerMessagePacket() + { + Header = new LowHeader(); + Header.ID = 260; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + MethodData = new MethodDataBlock(); + ParamList = new ParamListBlock[0]; + } + + public EstateOwnerMessagePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + 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 EstateOwnerMessagePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- EstateOwnerMessage ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += MethodData.ToString() + Environment.NewLine; + for (int j = 0; j < ParamList.Length; j++) + { + output += ParamList[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class GenericMessagePacket : Packet + { /// - [XmlType("estateownermessage_agentdata")] + [XmlType("genericmessage_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -40061,87 +37266,10 @@ namespace libsecondlife.Packets } } - 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 = 297; - Header.Reliable = true; - Header.Zerocoded = true; - MethodData = new MethodDataBlock(); - ParamList = new ParamListBlock[0]; - AgentData = new AgentDataBlock(); - } - - public EstateOwnerMessagePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MethodData = new MethodDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - ParamList = new ParamListBlock[count]; - for (int j = 0; j < count; j++) - { ParamList[j] = new ParamListBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public EstateOwnerMessagePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MethodData = new MethodDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - ParamList = new ParamListBlock[count]; - for (int j = 0; j < count; j++) - { ParamList[j] = new ParamListBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MethodData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < ParamList.Length; j++) { length += ParamList[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MethodData.ToBytes(bytes, ref i); - bytes[i++] = (byte)ParamList.Length; - for (int j = 0; j < ParamList.Length; j++) { ParamList[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- EstateOwnerMessage ---" + Environment.NewLine; - output += MethodData.ToString() + Environment.NewLine; - for (int j = 0; j < ParamList.Length; j++) - { - output += ParamList[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GenericMessagePacket : Packet - { /// [XmlType("genericmessage_methoddata")] public class MethodDataBlock { - public LLUUID Invoice; private byte[] _method; public byte[] Method { @@ -40153,6 +37281,7 @@ namespace libsecondlife.Packets else { _method = new byte[value.Length]; Buffer.BlockCopy(value, 0, _method, 0, value.Length); } } } + public LLUUID Invoice; [XmlIgnore] public int Length @@ -40171,10 +37300,10 @@ namespace libsecondlife.Packets int length; try { - Invoice = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _method = new byte[length]; Buffer.BlockCopy(bytes, i, _method, 0, length); i += length; + Invoice = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -40184,18 +37313,19 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(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; Buffer.BlockCopy(Method, 0, bytes, i, Method.Length); i += Method.Length; + Buffer.BlockCopy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- MethodData --"); - output.AppendLine(String.Format("Invoice: {0}", Invoice)); Helpers.FieldToString(output, Method, "Method"); + output.Append(Environment.NewLine); + output.Append(String.Format("Invoice: {0}", Invoice)); return output.ToString(); } } @@ -40259,111 +37389,60 @@ namespace libsecondlife.Packets } } - /// - [XmlType("genericmessage_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 48; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.GenericMessage; } } + public AgentDataBlock AgentData; public MethodDataBlock MethodData; public ParamListBlock[] ParamList; - public AgentDataBlock AgentData; public GenericMessagePacket() { Header = new LowHeader(); - Header.ID = 298; + Header.ID = 261; Header.Reliable = true; - Header.Zerocoded = true; + AgentData = new AgentDataBlock(); 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); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; 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); + AgentData.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; } @@ -40371,12 +37450,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GenericMessage ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; output += MethodData.ToString() + Environment.NewLine; for (int j = 0; j < ParamList.Length; j++) { output += ParamList[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -40485,7 +37564,7 @@ namespace libsecondlife.Packets public MuteListRequestPacket() { Header = new LowHeader(); - Header.ID = 299; + Header.ID = 262; Header.Reliable = true; AgentData = new AgentDataBlock(); MuteData = new MuteDataBlock(); @@ -40508,7 +37587,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += MuteData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -40584,7 +37663,6 @@ namespace libsecondlife.Packets public class MuteDataBlock { public LLUUID MuteID; - public uint MuteFlags; private byte[] _mutename; public byte[] MuteName { @@ -40597,6 +37675,7 @@ namespace libsecondlife.Packets } } public int MuteType; + public uint MuteFlags; [XmlIgnore] public int Length @@ -40616,11 +37695,11 @@ namespace libsecondlife.Packets 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]; Buffer.BlockCopy(bytes, i, _mutename, 0, length); i += length; MuteType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + MuteFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -40631,10 +37710,6 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(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; Buffer.BlockCopy(MuteName, 0, bytes, i, MuteName.Length); i += MuteName.Length; @@ -40642,6 +37717,10 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((MuteType >> 8) % 256); bytes[i++] = (byte)((MuteType >> 16) % 256); bytes[i++] = (byte)((MuteType >> 24) % 256); + bytes[i++] = (byte)(MuteFlags % 256); + bytes[i++] = (byte)((MuteFlags >> 8) % 256); + bytes[i++] = (byte)((MuteFlags >> 16) % 256); + bytes[i++] = (byte)((MuteFlags >> 24) % 256); } public override string ToString() @@ -40649,10 +37728,10 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- MuteData --"); output.AppendLine(String.Format("MuteID: {0}", MuteID)); - output.AppendLine(String.Format("MuteFlags: {0}", MuteFlags)); Helpers.FieldToString(output, MuteName, "MuteName"); output.Append(Environment.NewLine); - output.Append(String.Format("MuteType: {0}", MuteType)); + output.AppendLine(String.Format("MuteType: {0}", MuteType)); + output.Append(String.Format("MuteFlags: {0}", MuteFlags)); return output.ToString(); } } @@ -40666,7 +37745,7 @@ namespace libsecondlife.Packets public UpdateMuteListEntryPacket() { Header = new LowHeader(); - Header.ID = 300; + Header.ID = 263; Header.Reliable = true; AgentData = new AgentDataBlock(); MuteData = new MuteDataBlock(); @@ -40689,7 +37768,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += MuteData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -40832,7 +37911,7 @@ namespace libsecondlife.Packets public RemoveMuteListEntryPacket() { Header = new LowHeader(); - Header.ID = 301; + Header.ID = 264; Header.Reliable = true; AgentData = new AgentDataBlock(); MuteData = new MuteDataBlock(); @@ -40855,7 +37934,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += MuteData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -40880,98 +37959,6 @@ namespace libsecondlife.Packets /// public class CopyInventoryFromNotecardPacket : Packet { - /// - [XmlType("copyinventoryfromnotecard_inventorydata")] - public class InventoryDataBlock - { - public LLUUID ItemID; - public LLUUID FolderID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - ItemID = new LLUUID(bytes, i); i += 16; - FolderID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.Append(String.Format("FolderID: {0}", FolderID)); - return output.ToString(); - } - } - - /// - [XmlType("copyinventoryfromnotecard_notecarddata")] - public class NotecardDataBlock - { - public LLUUID ObjectID; - public LLUUID NotecardItemID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public NotecardDataBlock() { } - public NotecardDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - NotecardItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(NotecardItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- NotecardData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.Append(String.Format("NotecardItemID: {0}", NotecardItemID)); - return output.ToString(); - } - } - /// [XmlType("copyinventoryfromnotecard_agentdata")] public class AgentDataBlock @@ -41018,173 +38005,75 @@ namespace libsecondlife.Packets } } - 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 = 302; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - NotecardData = new NotecardDataBlock(); - AgentData = new AgentDataBlock(); - } - - public CopyInventoryFromNotecardPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - NotecardData = new NotecardDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public CopyInventoryFromNotecardPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - NotecardData = new NotecardDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += NotecardData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - NotecardData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- CopyInventoryFromNotecard ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += NotecardData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class UpdateInventoryItemPacket : Packet - { /// - [XmlType("updateinventoryitem_inventorydata")] - public class InventoryDataBlock + [XmlType("copyinventoryfromnotecard_notecarddata")] + public class NotecardDataBlock { - 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - public uint Flags; - public uint NextOwnerMask; - public LLUUID TransactionID; - public uint GroupMask; - public uint OwnerMask; + public LLUUID NotecardItemID; + public LLUUID ObjectID; [XmlIgnore] public int Length { get { - int length = 140; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - return length; + return 32; } } - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) + public NotecardDataBlock() { } + public NotecardDataBlock(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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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)); + NotecardItemID = new LLUUID(bytes, i); i += 16; + ObjectID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(NotecardItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- NotecardData --"); + output.AppendLine(String.Format("NotecardItemID: {0}", NotecardItemID)); + output.Append(String.Format("ObjectID: {0}", ObjectID)); + return output.ToString(); + } + } + + /// + [XmlType("copyinventoryfromnotecard_inventorydata")] + public class InventoryDataBlock + { + public LLUUID ItemID; + public LLUUID FolderID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + try + { + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -41194,96 +38083,95 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); + output.Append(String.Format("FolderID: {0}", FolderID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.CopyInventoryFromNotecard; } } + public AgentDataBlock AgentData; + public NotecardDataBlock NotecardData; + public InventoryDataBlock[] InventoryData; + + public CopyInventoryFromNotecardPacket() + { + Header = new LowHeader(); + Header.ID = 265; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + NotecardData = new NotecardDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public CopyInventoryFromNotecardPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + NotecardData = new NotecardDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public CopyInventoryFromNotecardPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + NotecardData = new NotecardDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += NotecardData.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); + AgentData.ToBytes(bytes, ref i); + NotecardData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- CopyInventoryFromNotecard ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += NotecardData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class UpdateInventoryItemPacket : Packet + { /// [XmlType("updateinventoryitem_agentdata")] public class AgentDataBlock @@ -41334,86 +38222,28 @@ namespace libsecondlife.Packets } } - 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 = 303; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public UpdateInventoryItemPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public UpdateInventoryItemPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- UpdateInventoryItem ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class UpdateCreateInventoryItemPacket : Packet - { /// - [XmlType("updatecreateinventoryitem_inventorydata")] + [XmlType("updateinventoryitem_inventorydata")] public class InventoryDataBlock { - public bool GroupOwned; - public uint CRC; - public int CreationDate; - public byte SaleType; + public LLUUID ItemID; + public LLUUID FolderID; public uint CallbackID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID TransactionID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; private byte[] _name; public byte[] Name { @@ -41425,16 +38255,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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 { @@ -41446,10 +38266,8 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public uint Flags; - public uint NextOwnerMask; - public uint GroupMask; - public uint OwnerMask; + public int CreationDate; + public uint CRC; [XmlIgnore] public int Length @@ -41469,32 +38287,32 @@ namespace libsecondlife.Packets 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++]; + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + TransactionID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(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)); + CreationDate = (int)(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) { @@ -41504,96 +38322,165 @@ namespace libsecondlife.Packets 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; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.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); + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; 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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + 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)(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)((GroupOwned) ? 1 : 0); + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("AssetID: {0}", AssetID)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); output.AppendLine(String.Format("ItemID: {0}", ItemID)); output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); Helpers.FieldToString(output, Description, "Description"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.UpdateInventoryItem; } } + public AgentDataBlock AgentData; + public InventoryDataBlock[] InventoryData; + + public UpdateInventoryItemPacket() + { + Header = new LowHeader(); + Header.ID = 266; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public UpdateInventoryItemPacket(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++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public UpdateInventoryItemPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- UpdateInventoryItem ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class UpdateCreateInventoryItemPacket : Packet + { /// [XmlType("updatecreateinventoryitem_agentdata")] public class AgentDataBlock @@ -41644,101 +38531,61 @@ namespace libsecondlife.Packets } } - 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 = 304; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public UpdateCreateInventoryItemPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public UpdateCreateInventoryItemPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- UpdateCreateInventoryItem ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoveInventoryItemPacket : Packet - { /// - [XmlType("moveinventoryitem_inventorydata")] + [XmlType("updatecreateinventoryitem_inventorydata")] public class InventoryDataBlock { - private byte[] _newname; - public byte[] NewName - { - get { return _newname; } - set - { - if (value == null) { _newname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _newname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _newname, 0, value.Length); } - } - } public LLUUID ItemID; public LLUUID FolderID; + public uint CallbackID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; + public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID AssetID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } + public int CreationDate; + public uint CRC; [XmlIgnore] public int Length { get { - int length = 32; - if (NewName != null) { length += 1 + NewName.Length; } + int length = 140; + if (Name != null) { length += 1 + Name.Length; } + if (Description != null) { length += 1 + Description.Length; } return length; } } @@ -41749,11 +38596,32 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)bytes[i++]; - _newname = new byte[length]; - Buffer.BlockCopy(bytes, i, _newname, 0, length); i += length; ItemID = new LLUUID(bytes, i); i += 16; FolderID = new LLUUID(bytes, i); i += 16; + CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + AssetID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + CreationDate = (int)(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) { @@ -41763,25 +38631,165 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(NewName, 0, bytes, i, NewName.Length); i += NewName.Length; Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(FolderID.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); + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + 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++] = (byte)(OwnerMask % 256); + bytes[i++] = (byte)((OwnerMask >> 8) % 256); + bytes[i++] = (byte)((OwnerMask >> 16) % 256); + bytes[i++] = (byte)((OwnerMask >> 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)(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)((GroupOwned) ? 1 : 0); + Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); - Helpers.FieldToString(output, NewName, "NewName"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.Append(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.UpdateCreateInventoryItem; } } + public AgentDataBlock AgentData; + public InventoryDataBlock[] InventoryData; + + public UpdateCreateInventoryItemPacket() + { + Header = new LowHeader(); + Header.ID = 267; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public UpdateCreateInventoryItemPacket(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++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public UpdateCreateInventoryItemPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- UpdateCreateInventoryItem ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class MoveInventoryItemPacket : Packet + { /// [XmlType("moveinventoryitem_agentdata")] public class AgentDataBlock @@ -41832,80 +38840,12 @@ namespace libsecondlife.Packets } } - 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 = 305; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public MoveInventoryItemPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoveInventoryItemPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoveInventoryItem ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class CopyInventoryItemPacket : Packet - { /// - [XmlType("copyinventoryitem_inventorydata")] + [XmlType("moveinventoryitem_inventorydata")] public class InventoryDataBlock { + public LLUUID ItemID; + public LLUUID FolderID; private byte[] _newname; public byte[] NewName { @@ -41917,17 +38857,13 @@ namespace libsecondlife.Packets else { _newname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _newname, 0, value.Length); } } } - public LLUUID NewFolderID; - public uint CallbackID; - public LLUUID OldItemID; - public LLUUID OldAgentID; [XmlIgnore] public int Length { get { - int length = 52; + int length = 32; if (NewName != null) { length += 1 + NewName.Length; } return length; } @@ -41939,13 +38875,11 @@ namespace libsecondlife.Packets int length; try { + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _newname = new byte[length]; Buffer.BlockCopy(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) { @@ -41955,32 +38889,93 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; if(NewName == null) { Console.WriteLine("Warning: NewName is null, in " + this.GetType()); } bytes[i++] = (byte)NewName.Length; Buffer.BlockCopy(NewName, 0, bytes, i, NewName.Length); i += NewName.Length; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OldItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(OldAgentID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); Helpers.FieldToString(output, NewName, "NewName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("NewFolderID: {0}", NewFolderID)); - output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); - output.AppendLine(String.Format("OldItemID: {0}", OldItemID)); - output.Append(String.Format("OldAgentID: {0}", OldAgentID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.MoveInventoryItem; } } + public AgentDataBlock AgentData; + public InventoryDataBlock[] InventoryData; + + public MoveInventoryItemPacket() + { + Header = new LowHeader(); + Header.ID = 268; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public MoveInventoryItemPacket(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++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public MoveInventoryItemPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- MoveInventoryItem ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class CopyInventoryItemPacket : Packet + { /// [XmlType("copyinventoryitem_agentdata")] public class AgentDataBlock @@ -42027,97 +39022,50 @@ namespace libsecondlife.Packets } } - 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 = 306; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public CopyInventoryItemPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public CopyInventoryItemPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- CopyInventoryItem ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RemoveInventoryItemPacket : Packet - { /// - [XmlType("removeinventoryitem_inventorydata")] + [XmlType("copyinventoryitem_inventorydata")] public class InventoryDataBlock { - public LLUUID ItemID; + public uint CallbackID; + public LLUUID OldAgentID; + public LLUUID OldItemID; + public LLUUID NewFolderID; + 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]; Buffer.BlockCopy(value, 0, _newname, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 16; + int length = 52; + if (NewName != null) { length += 1 + NewName.Length; } + return length; } } public InventoryDataBlock() { } public InventoryDataBlock(byte[] bytes, ref int i) { + int length; try { - ItemID = new LLUUID(bytes, i); i += 16; + CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + OldAgentID = new LLUUID(bytes, i); i += 16; + OldItemID = new LLUUID(bytes, i); i += 16; + NewFolderID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _newname = new byte[length]; + Buffer.BlockCopy(bytes, i, _newname, 0, length); i += length; } catch (Exception) { @@ -42127,18 +39075,100 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(ItemID.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); + Buffer.BlockCopy(OldAgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OldItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(NewFolderID.GetBytes(), 0, bytes, i, 16); i += 16; + if(NewName == null) { Console.WriteLine("Warning: NewName is null, in " + this.GetType()); } + bytes[i++] = (byte)NewName.Length; + Buffer.BlockCopy(NewName, 0, bytes, i, NewName.Length); i += NewName.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); - output.Append(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); + output.AppendLine(String.Format("OldAgentID: {0}", OldAgentID)); + output.AppendLine(String.Format("OldItemID: {0}", OldItemID)); + output.AppendLine(String.Format("NewFolderID: {0}", NewFolderID)); + Helpers.FieldToString(output, NewName, "NewName"); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.CopyInventoryItem; } } + public AgentDataBlock AgentData; + public InventoryDataBlock[] InventoryData; + + public CopyInventoryItemPacket() + { + Header = new LowHeader(); + Header.ID = 269; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public CopyInventoryItemPacket(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++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public CopyInventoryItemPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- CopyInventoryItem ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class RemoveInventoryItemPacket : Packet + { /// [XmlType("removeinventoryitem_agentdata")] public class AgentDataBlock @@ -42185,45 +39215,87 @@ namespace libsecondlife.Packets } } + /// + [XmlType("removeinventoryitem_inventorydata")] + public class InventoryDataBlock + { + public LLUUID ItemID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + try + { + ItemID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InventoryData --"); + output.Append(String.Format("ItemID: {0}", ItemID)); + return output.ToString(); + } + } + 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 InventoryDataBlock[] InventoryData; public RemoveInventoryItemPacket() { Header = new LowHeader(); - Header.ID = 307; + Header.ID = 270; Header.Reliable = true; - InventoryData = new InventoryDataBlock[0]; AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; } public RemoveInventoryItemPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } @@ -42231,9 +39303,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -42241,11 +39313,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RemoveInventoryItem ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < InventoryData.Length; j++) { output += InventoryData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -42254,6 +39326,52 @@ namespace libsecondlife.Packets /// public class ChangeInventoryItemFlagsPacket : Packet { + /// + [XmlType("changeinventoryitemflags_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("changeinventoryitemflags_inventorydata")] public class InventoryDataBlock @@ -42303,91 +39421,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("changeinventoryitemflags_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 InventoryDataBlock[] InventoryData; public ChangeInventoryItemFlagsPacket() { Header = new LowHeader(); - Header.ID = 308; + Header.ID = 271; Header.Reliable = true; - InventoryData = new InventoryDataBlock[0]; AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; } public ChangeInventoryItemFlagsPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } @@ -42395,9 +39467,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -42405,11 +39477,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ChangeInventoryItemFlags ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < InventoryData.Length; j++) { output += InventoryData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -42418,52 +39490,6 @@ namespace libsecondlife.Packets /// public class SaveAssetIntoInventoryPacket : Packet { - /// - [XmlType("saveassetintoinventory_inventorydata")] - public class InventoryDataBlock - { - public LLUUID NewAssetID; - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - NewAssetID = new LLUUID(bytes, i); i += 16; - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(NewAssetID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("NewAssetID: {0}", NewAssetID)); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("saveassetintoinventory_agentdata")] public class AgentDataBlock @@ -42506,46 +39532,92 @@ namespace libsecondlife.Packets } } + /// + [XmlType("saveassetintoinventory_inventorydata")] + public class InventoryDataBlock + { + public LLUUID ItemID; + public LLUUID NewAssetID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + try + { + ItemID = new LLUUID(bytes, i); i += 16; + NewAssetID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(NewAssetID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InventoryData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.Append(String.Format("NewAssetID: {0}", NewAssetID)); + return output.ToString(); + } + } + 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 InventoryDataBlock InventoryData; public SaveAssetIntoInventoryPacket() { Header = new LowHeader(); - Header.ID = 309; + Header.ID = 272; Header.Reliable = true; - InventoryData = new InventoryDataBlock(); AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock(); } 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); + InventoryData = new InventoryDataBlock(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); + InventoryData = new InventoryDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += InventoryData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + InventoryData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -42553,8 +39625,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- SaveAssetIntoInventory ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; return output; } @@ -42613,6 +39685,9 @@ namespace libsecondlife.Packets [XmlType("createinventoryfolder_folderdata")] public class FolderDataBlock { + public LLUUID FolderID; + public LLUUID ParentID; + public sbyte Type; private byte[] _name; public byte[] Name { @@ -42624,9 +39699,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - public LLUUID ParentID; - public sbyte Type; - public LLUUID FolderID; [XmlIgnore] public int Length @@ -42645,12 +39717,12 @@ namespace libsecondlife.Packets int length; try { + FolderID = new LLUUID(bytes, i); i += 16; + ParentID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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) { @@ -42660,23 +39732,22 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } bytes[i++] = (byte)Name.Length; Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- FolderData --"); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); output.AppendLine(String.Format("ParentID: {0}", ParentID)); output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("FolderID: {0}", FolderID)); + Helpers.FieldToString(output, Name, "Name"); return output.ToString(); } } @@ -42690,7 +39761,7 @@ namespace libsecondlife.Packets public CreateInventoryFolderPacket() { Header = new LowHeader(); - Header.ID = 310; + Header.ID = 273; Header.Reliable = true; AgentData = new AgentDataBlock(); FolderData = new FolderDataBlock(); @@ -42713,7 +39784,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += FolderData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -42788,6 +39859,9 @@ namespace libsecondlife.Packets [XmlType("updateinventoryfolder_folderdata")] public class FolderDataBlock { + public LLUUID FolderID; + public LLUUID ParentID; + public sbyte Type; private byte[] _name; public byte[] Name { @@ -42799,9 +39873,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - public LLUUID ParentID; - public sbyte Type; - public LLUUID FolderID; [XmlIgnore] public int Length @@ -42820,12 +39891,12 @@ namespace libsecondlife.Packets int length; try { + FolderID = new LLUUID(bytes, i); i += 16; + ParentID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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) { @@ -42835,23 +39906,22 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } bytes[i++] = (byte)Name.Length; Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- FolderData --"); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); output.AppendLine(String.Format("ParentID: {0}", ParentID)); output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("FolderID: {0}", FolderID)); + Helpers.FieldToString(output, Name, "Name"); return output.ToString(); } } @@ -42865,7 +39935,7 @@ namespace libsecondlife.Packets public UpdateInventoryFolderPacket() { Header = new LowHeader(); - Header.ID = 311; + Header.ID = 274; Header.Reliable = true; AgentData = new AgentDataBlock(); FolderData = new FolderDataBlock[0]; @@ -42894,7 +39964,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; } @@ -42925,52 +39995,6 @@ namespace libsecondlife.Packets /// public class MoveInventoryFolderPacket : Packet { - /// - [XmlType("moveinventoryfolder_inventorydata")] - public class InventoryDataBlock - { - public LLUUID ParentID; - public LLUUID FolderID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - ParentID = new LLUUID(bytes, i); i += 16; - FolderID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("ParentID: {0}", ParentID)); - output.Append(String.Format("FolderID: {0}", FolderID)); - return output.ToString(); - } - } - /// [XmlType("moveinventoryfolder_agentdata")] public class AgentDataBlock @@ -43021,46 +40045,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("moveinventoryfolder_inventorydata")] + public class InventoryDataBlock + { + public LLUUID FolderID; + public LLUUID ParentID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + try + { + FolderID = new LLUUID(bytes, i); i += 16; + ParentID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InventoryData --"); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.Append(String.Format("ParentID: {0}", ParentID)); + return output.ToString(); + } + } + 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 InventoryDataBlock[] InventoryData; public MoveInventoryFolderPacket() { Header = new LowHeader(); - Header.ID = 312; + Header.ID = 275; Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; } public MoveInventoryFolderPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } @@ -43068,9 +40137,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -43078,11 +40147,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- MoveInventoryFolder ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < InventoryData.Length; j++) { output += InventoryData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -43188,7 +40257,7 @@ namespace libsecondlife.Packets public RemoveInventoryFolderPacket() { Header = new LowHeader(); - Header.ID = 313; + Header.ID = 276; Header.Reliable = true; AgentData = new AgentDataBlock(); FolderData = new FolderDataBlock[0]; @@ -43217,7 +40286,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; } @@ -43248,67 +40317,6 @@ namespace libsecondlife.Packets /// public class FetchInventoryDescendentsPacket : Packet { - /// - [XmlType("fetchinventorydescendents_inventorydata")] - public class InventoryDataBlock - { - public LLUUID OwnerID; - public LLUUID FolderID; - public int SortOrder; - public bool FetchFolders; - public bool FetchItems; - - [XmlIgnore] - public int Length - { - get - { - return 38; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - OwnerID = new LLUUID(bytes, i); i += 16; - FolderID = new LLUUID(bytes, i); i += 16; - SortOrder = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - FetchFolders = (bytes[i++] != 0) ? (bool)true : (bool)false; - FetchItems = (bytes[i++] != 0) ? (bool)true : (bool)false; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("SortOrder: {0}", SortOrder)); - output.AppendLine(String.Format("FetchFolders: {0}", FetchFolders)); - output.Append(String.Format("FetchItems: {0}", FetchItems)); - return output.ToString(); - } - } - /// [XmlType("fetchinventorydescendents_agentdata")] public class AgentDataBlock @@ -43355,47 +40363,107 @@ namespace libsecondlife.Packets } } + /// + [XmlType("fetchinventorydescendents_inventorydata")] + public class InventoryDataBlock + { + public LLUUID FolderID; + public LLUUID OwnerID; + public int SortOrder; + public bool FetchFolders; + public bool FetchItems; + + [XmlIgnore] + public int Length + { + get + { + return 38; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + try + { + FolderID = new LLUUID(bytes, i); i += 16; + OwnerID = 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) + { + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InventoryData --"); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("SortOrder: {0}", SortOrder)); + output.AppendLine(String.Format("FetchFolders: {0}", FetchFolders)); + output.Append(String.Format("FetchItems: {0}", FetchItems)); + return output.ToString(); + } + } + 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 InventoryDataBlock InventoryData; public FetchInventoryDescendentsPacket() { Header = new LowHeader(); - Header.ID = 314; + Header.ID = 277; Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock(); AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock(); } 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); + InventoryData = new InventoryDataBlock(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); + InventoryData = new InventoryDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += InventoryData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + InventoryData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -43403,8 +40471,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- FetchInventoryDescendents ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; return output; } @@ -43414,14 +40482,76 @@ namespace libsecondlife.Packets public class InventoryDescendentsPacket : Packet { /// - [XmlType("inventorydescendents_itemdata")] - public class ItemDataBlock + [XmlType("inventorydescendents_agentdata")] + public class AgentDataBlock { - public bool GroupOwned; - public uint CRC; - public int CreationDate; - public byte SaleType; - public uint BaseMask; + public LLUUID AgentID; + public LLUUID FolderID; + public LLUUID OwnerID; + public int Version; + public int Descendents; + + [XmlIgnore] + public int Length + { + get + { + return 56; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + Version = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Descendents = (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) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(Version % 256); + bytes[i++] = (byte)((Version >> 8) % 256); + bytes[i++] = (byte)((Version >> 16) % 256); + bytes[i++] = (byte)((Version >> 24) % 256); + bytes[i++] = (byte)(Descendents % 256); + bytes[i++] = (byte)((Descendents >> 8) % 256); + bytes[i++] = (byte)((Descendents >> 16) % 256); + bytes[i++] = (byte)((Descendents >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("Version: {0}", Version)); + output.Append(String.Format("Descendents: {0}", Descendents)); + return output.ToString(); + } + } + + /// + [XmlType("inventorydescendents_folderdata")] + public class FolderDataBlock + { + public LLUUID FolderID; + public LLUUID ParentID; + public sbyte Type; private byte[] _name; public byte[] Name { @@ -43433,16 +40563,91 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - public sbyte InvType; - public sbyte Type; - public LLUUID AssetID; - public LLUUID GroupID; - public int SalePrice; - public LLUUID OwnerID; - public LLUUID CreatorID; + + [XmlIgnore] + public int Length + { + get + { + int length = 33; + if (Name != null) { length += 1 + Name.Length; } + return length; + } + } + + public FolderDataBlock() { } + public FolderDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + FolderID = new LLUUID(bytes, i); i += 16; + ParentID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- FolderData --"); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("ParentID: {0}", ParentID)); + output.AppendLine(String.Format("Type: {0}", Type)); + Helpers.FieldToString(output, Name, "Name"); + return output.ToString(); + } + } + + /// + [XmlType("inventorydescendents_itemdata")] + public class ItemDataBlock + { public LLUUID ItemID; public LLUUID FolderID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; + public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID AssetID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } private byte[] _description; public byte[] Description { @@ -43454,10 +40659,8 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public uint Flags; - public uint NextOwnerMask; - public uint GroupMask; - public uint OwnerMask; + public int CreationDate; + public uint CRC; [XmlIgnore] public int Length @@ -43477,31 +40680,31 @@ namespace libsecondlife.Packets 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++]; + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + AssetID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(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)); + CreationDate = (int)(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) { @@ -43511,223 +40714,87 @@ namespace libsecondlife.Packets 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; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; 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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + 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)(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)((GroupOwned) ? 1 : 0); + Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ItemData --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("AssetID: {0}", AssetID)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); output.AppendLine(String.Format("ItemID: {0}", ItemID)); output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); - return output.ToString(); - } - } - - /// - [XmlType("inventorydescendents_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public int Descendents; - public int Version; - public LLUUID OwnerID; - public LLUUID FolderID; - - [XmlIgnore] - public int Length - { - get - { - return 56; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - Descendents = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Version = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - OwnerID = new LLUUID(bytes, i); i += 16; - FolderID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("Descendents: {0}", Descendents)); - output.AppendLine(String.Format("Version: {0}", Version)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.Append(String.Format("FolderID: {0}", FolderID)); - return output.ToString(); - } - } - - /// - [XmlType("inventorydescendents_folderdata")] - public class FolderDataBlock - { - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - public LLUUID ParentID; - public sbyte Type; - public LLUUID FolderID; - - [XmlIgnore] - public int Length - { - get - { - int length = 33; - if (Name != null) { length += 1 + Name.Length; } - return length; - } - } - - public FolderDataBlock() { } - public FolderDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- FolderData --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("ParentID: {0}", ParentID)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("FolderID: {0}", FolderID)); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); return output.ToString(); } } @@ -43735,67 +40802,66 @@ namespace libsecondlife.Packets 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 ItemDataBlock[] ItemData; public InventoryDescendentsPacket() { Header = new LowHeader(); - Header.ID = 315; + Header.ID = 278; Header.Reliable = true; - Header.Zerocoded = true; - ItemData = new ItemDataBlock[0]; AgentData = new AgentDataBlock(); FolderData = new FolderDataBlock[0]; + ItemData = new ItemDataBlock[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++]; + int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) { FolderData[j] = new FolderDataBlock(bytes, ref i); } + count = (int)bytes[i++]; + ItemData = new ItemDataBlock[count]; + for (int j = 0; j < count; j++) + { ItemData[j] = new ItemDataBlock(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++]; + int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) { FolderData[j] = new FolderDataBlock(bytes, ref i); } + count = (int)bytes[i++]; + ItemData = new ItemDataBlock[count]; + for (int j = 0; j < count; j++) + { ItemData[j] = new ItemDataBlock(bytes, ref i); } } public override byte[] ToBytes() { - int length = 8; + int length = 10; 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; } + length++; + for (int j = 0; j < ItemData.Length; j++) { length += ItemData[j].Length; } if (header.AckList.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); } + bytes[i++] = (byte)ItemData.Length; + for (int j = 0; j < ItemData.Length; j++) { ItemData[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -43803,15 +40869,15 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- InventoryDescendents ---" + Environment.NewLine; - for (int j = 0; j < ItemData.Length; j++) - { - output += ItemData[j].ToString() + Environment.NewLine; - } output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < FolderData.Length; j++) { output += FolderData[j].ToString() + Environment.NewLine; } + for (int j = 0; j < ItemData.Length; j++) + { + output += ItemData[j].ToString() + Environment.NewLine; + } return output; } @@ -43820,52 +40886,6 @@ namespace libsecondlife.Packets /// public class FetchInventoryPacket : Packet { - /// - [XmlType("fetchinventory_inventorydata")] - public class InventoryDataBlock - { - public LLUUID OwnerID; - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - OwnerID = new LLUUID(bytes, i); i += 16; - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("fetchinventory_agentdata")] public class AgentDataBlock @@ -43912,165 +40932,29 @@ namespace libsecondlife.Packets } } - 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 = 316; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public FetchInventoryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public FetchInventoryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- FetchInventory ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class FetchInventoryReplyPacket : Packet - { /// - [XmlType("fetchinventoryreply_inventorydata")] + [XmlType("fetchinventory_inventorydata")] public class InventoryDataBlock { - public bool GroupOwned; - public uint CRC; - public int CreationDate; - public byte SaleType; - public uint BaseMask; - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - public uint Flags; - public uint NextOwnerMask; - public uint GroupMask; - public uint OwnerMask; [XmlIgnore] public int Length { get { - int length = 136; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - return length; + return 32; } } 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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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) { @@ -44080,91 +40964,89 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("AssetID: {0}", AssetID)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); + output.Append(String.Format("ItemID: {0}", ItemID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.FetchInventory; } } + public AgentDataBlock AgentData; + public InventoryDataBlock[] InventoryData; + + public FetchInventoryPacket() + { + Header = new LowHeader(); + Header.ID = 279; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public FetchInventoryPacket(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++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public FetchInventoryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- FetchInventory ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class FetchInventoryReplyPacket : Packet + { /// [XmlType("fetchinventoryreply_agentdata")] public class AgentDataBlock @@ -44207,86 +41089,27 @@ namespace libsecondlife.Packets } } - 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 = 317; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public FetchInventoryReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public FetchInventoryReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- FetchInventoryReply ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class BulkUpdateInventoryPacket : Packet - { /// - [XmlType("bulkupdateinventory_itemdata")] - public class ItemDataBlock + [XmlType("fetchinventoryreply_inventorydata")] + public class InventoryDataBlock { - public bool GroupOwned; - public uint CRC; - public int CreationDate; - public byte SaleType; - public uint CallbackID; + public LLUUID ItemID; + public LLUUID FolderID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID AssetID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; private byte[] _name; public byte[] Name { @@ -44298,16 +41121,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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 { @@ -44319,55 +41132,52 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public uint Flags; - public uint NextOwnerMask; - public uint GroupMask; - public uint OwnerMask; + public int CreationDate; + public uint CRC; [XmlIgnore] public int Length { get { - int length = 140; + 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) + 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)); + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + AssetID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(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)); + CreationDate = (int)(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) { @@ -44377,96 +41187,160 @@ namespace libsecondlife.Packets 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); + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; 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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + 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)(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)((GroupOwned) ? 1 : 0); + Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- ItemData --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("AssetID: {0}", AssetID)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine("-- InventoryData --"); output.AppendLine(String.Format("ItemID: {0}", ItemID)); output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); Helpers.FieldToString(output, Description, "Description"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.FetchInventoryReply; } } + public AgentDataBlock AgentData; + public InventoryDataBlock[] InventoryData; + + public FetchInventoryReplyPacket() + { + Header = new LowHeader(); + Header.ID = 280; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public FetchInventoryReplyPacket(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++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public FetchInventoryReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- FetchInventoryReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class BulkUpdateInventoryPacket : Packet + { /// [XmlType("bulkupdateinventory_agentdata")] public class AgentDataBlock @@ -44517,6 +41391,9 @@ namespace libsecondlife.Packets [XmlType("bulkupdateinventory_folderdata")] public class FolderDataBlock { + public LLUUID FolderID; + public LLUUID ParentID; + public sbyte Type; private byte[] _name; public byte[] Name { @@ -44528,9 +41405,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - public LLUUID ParentID; - public sbyte Type; - public LLUUID FolderID; [XmlIgnore] public int Length @@ -44549,12 +41423,12 @@ namespace libsecondlife.Packets int length; try { + FolderID = new LLUUID(bytes, i); i += 16; + ParentID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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) { @@ -44564,23 +41438,212 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } bytes[i++] = (byte)Name.Length; Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- FolderData --"); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); output.AppendLine(String.Format("ParentID: {0}", ParentID)); output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("FolderID: {0}", FolderID)); + Helpers.FieldToString(output, Name, "Name"); + return output.ToString(); + } + } + + /// + [XmlType("bulkupdateinventory_itemdata")] + public class ItemDataBlock + { + public LLUUID ItemID; + public uint CallbackID; + public LLUUID FolderID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; + public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID AssetID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } + public int CreationDate; + public uint CRC; + + [XmlIgnore] + public int Length + { + get + { + int length = 140; + if (Name != null) { length += 1 + Name.Length; } + if (Description != null) { length += 1 + Description.Length; } + return length; + } + } + + public ItemDataBlock() { } + public ItemDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ItemID = new LLUUID(bytes, i); i += 16; + CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + FolderID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + AssetID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + CreationDate = (int)(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) + { + Buffer.BlockCopy(ItemID.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); + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + 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++] = (byte)(OwnerMask % 256); + bytes[i++] = (byte)((OwnerMask >> 8) % 256); + bytes[i++] = (byte)((OwnerMask >> 16) % 256); + bytes[i++] = (byte)((OwnerMask >> 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)(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)((GroupOwned) ? 1 : 0); + Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ItemData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); return output.ToString(); } } @@ -44588,67 +41651,66 @@ namespace libsecondlife.Packets 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 ItemDataBlock[] ItemData; public BulkUpdateInventoryPacket() { Header = new LowHeader(); - Header.ID = 318; + Header.ID = 281; Header.Reliable = true; - Header.Zerocoded = true; - ItemData = new ItemDataBlock[0]; AgentData = new AgentDataBlock(); FolderData = new FolderDataBlock[0]; + ItemData = new ItemDataBlock[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++]; + int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) { FolderData[j] = new FolderDataBlock(bytes, ref i); } + count = (int)bytes[i++]; + ItemData = new ItemDataBlock[count]; + for (int j = 0; j < count; j++) + { ItemData[j] = new ItemDataBlock(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++]; + int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) { FolderData[j] = new FolderDataBlock(bytes, ref i); } + count = (int)bytes[i++]; + ItemData = new ItemDataBlock[count]; + for (int j = 0; j < count; j++) + { ItemData[j] = new ItemDataBlock(bytes, ref i); } } public override byte[] ToBytes() { - int length = 8; + int length = 10; 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; } + length++; + for (int j = 0; j < ItemData.Length; j++) { length += ItemData[j].Length; } if (header.AckList.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); } + bytes[i++] = (byte)ItemData.Length; + for (int j = 0; j < ItemData.Length; j++) { ItemData[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -44656,15 +41718,15 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- BulkUpdateInventory ---" + Environment.NewLine; - for (int j = 0; j < ItemData.Length; j++) - { - output += ItemData[j].ToString() + Environment.NewLine; - } output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < FolderData.Length; j++) { output += FolderData[j].ToString() + Environment.NewLine; } + for (int j = 0; j < ItemData.Length; j++) + { + output += ItemData[j].ToString() + Environment.NewLine; + } return output; } @@ -44677,8 +41739,8 @@ namespace libsecondlife.Packets [XmlType("requestinventoryasset_querydata")] public class QueryDataBlock { - public LLUUID AgentID; public LLUUID QueryID; + public LLUUID AgentID; public LLUUID OwnerID; public LLUUID ItemID; @@ -44696,8 +41758,8 @@ namespace libsecondlife.Packets { try { - AgentID = new LLUUID(bytes, i); i += 16; QueryID = new LLUUID(bytes, i); i += 16; + AgentID = new LLUUID(bytes, i); i += 16; OwnerID = new LLUUID(bytes, i); i += 16; ItemID = new LLUUID(bytes, i); i += 16; } @@ -44709,8 +41771,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(QueryID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; } @@ -44719,8 +41781,8 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- QueryData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("QueryID: {0}", QueryID)); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); output.Append(String.Format("ItemID: {0}", ItemID)); return output.ToString(); @@ -44735,7 +41797,7 @@ namespace libsecondlife.Packets public RequestInventoryAssetPacket() { Header = new LowHeader(); - Header.ID = 319; + Header.ID = 282; Header.Reliable = true; QueryData = new QueryDataBlock(); } @@ -44755,7 +41817,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += QueryData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -44836,7 +41898,7 @@ namespace libsecondlife.Packets public InventoryAssetResponsePacket() { Header = new LowHeader(); - Header.ID = 320; + Header.ID = 283; Header.Reliable = true; QueryData = new QueryDataBlock(); } @@ -44856,7 +41918,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += QueryData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -44879,48 +41941,6 @@ namespace libsecondlife.Packets /// public class RemoveInventoryObjectsPacket : Packet { - /// - [XmlType("removeinventoryobjects_itemdata")] - public class ItemDataBlock - { - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public ItemDataBlock() { } - public ItemDataBlock(byte[] bytes, ref int i) - { - try - { - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ItemData --"); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("removeinventoryobjects_agentdata")] public class AgentDataBlock @@ -45009,98 +42029,11 @@ namespace libsecondlife.Packets } } - 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 = 321; - Header.Reliable = true; - ItemData = new ItemDataBlock[0]; - AgentData = new AgentDataBlock(); - FolderData = new FolderDataBlock[0]; - } - - public RemoveInventoryObjectsPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ItemData = new ItemDataBlock[count]; - for (int j = 0; j < count; j++) - { ItemData[j] = new ItemDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - count = (int)bytes[i++]; - FolderData = new FolderDataBlock[count]; - for (int j = 0; j < count; j++) - { FolderData[j] = new FolderDataBlock(bytes, ref i); } - } - - public RemoveInventoryObjectsPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ItemData = new ItemDataBlock[count]; - for (int j = 0; j < count; j++) - { ItemData[j] = new ItemDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - count = (int)bytes[i++]; - FolderData = new FolderDataBlock[count]; - for (int j = 0; j < count; j++) - { FolderData[j] = new FolderDataBlock(bytes, ref i); } - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < ItemData.Length; j++) { length += ItemData[j].Length; } - length++; - for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ItemData.Length; - for (int j = 0; j < ItemData.Length; j++) { ItemData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - bytes[i++] = (byte)FolderData.Length; - for (int j = 0; j < FolderData.Length; j++) { FolderData[j].ToBytes(bytes, ref i); } - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RemoveInventoryObjects ---" + Environment.NewLine; - for (int j = 0; j < ItemData.Length; j++) - { - output += ItemData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - for (int j = 0; j < FolderData.Length; j++) - { - output += FolderData[j].ToString() + Environment.NewLine; - } - return output; - } - - } - - /// - public class PurgeInventoryDescendentsPacket : Packet - { /// - [XmlType("purgeinventorydescendents_inventorydata")] - public class InventoryDataBlock + [XmlType("removeinventoryobjects_itemdata")] + public class ItemDataBlock { - public LLUUID FolderID; + public LLUUID ItemID; [XmlIgnore] public int Length @@ -45111,12 +42044,12 @@ namespace libsecondlife.Packets } } - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) + public ItemDataBlock() { } + public ItemDataBlock(byte[] bytes, ref int i) { try { - FolderID = new LLUUID(bytes, i); i += 16; + ItemID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -45126,18 +42059,105 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.Append(String.Format("FolderID: {0}", FolderID)); + output.AppendLine("-- ItemData --"); + output.Append(String.Format("ItemID: {0}", ItemID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.RemoveInventoryObjects; } } + public AgentDataBlock AgentData; + public FolderDataBlock[] FolderData; + public ItemDataBlock[] ItemData; + + public RemoveInventoryObjectsPacket() + { + Header = new LowHeader(); + Header.ID = 284; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + FolderData = new FolderDataBlock[0]; + ItemData = new ItemDataBlock[0]; + } + + public RemoveInventoryObjectsPacket(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); } + count = (int)bytes[i++]; + ItemData = new ItemDataBlock[count]; + for (int j = 0; j < count; j++) + { ItemData[j] = new ItemDataBlock(bytes, ref i); } + } + + public RemoveInventoryObjectsPacket(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); } + count = (int)bytes[i++]; + ItemData = new ItemDataBlock[count]; + for (int j = 0; j < count; j++) + { ItemData[j] = new ItemDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length;; + length++; + for (int j = 0; j < FolderData.Length; j++) { length += FolderData[j].Length; } + length++; + for (int j = 0; j < ItemData.Length; j++) { length += ItemData[j].Length; } + 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); } + bytes[i++] = (byte)ItemData.Length; + for (int j = 0; j < ItemData.Length; j++) { ItemData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- RemoveInventoryObjects ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < FolderData.Length; j++) + { + output += FolderData[j].ToString() + Environment.NewLine; + } + for (int j = 0; j < ItemData.Length; j++) + { + output += ItemData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class PurgeInventoryDescendentsPacket : Packet + { /// [XmlType("purgeinventorydescendents_agentdata")] public class AgentDataBlock @@ -45184,47 +42204,88 @@ namespace libsecondlife.Packets } } + /// + [XmlType("purgeinventorydescendents_inventorydata")] + public class InventoryDataBlock + { + public LLUUID FolderID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + try + { + FolderID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InventoryData --"); + output.Append(String.Format("FolderID: {0}", FolderID)); + return output.ToString(); + } + } + 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 InventoryDataBlock InventoryData; public PurgeInventoryDescendentsPacket() { Header = new LowHeader(); - Header.ID = 322; + Header.ID = 285; Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock(); AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock(); } 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); + InventoryData = new InventoryDataBlock(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); + InventoryData = new InventoryDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += InventoryData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + InventoryData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -45232,8 +42293,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- PurgeInventoryDescendents ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; return output; } @@ -45242,238 +42303,6 @@ namespace libsecondlife.Packets /// public class UpdateTaskInventoryPacket : Packet { - /// - [XmlType("updatetaskinventory_inventorydata")] - public class InventoryDataBlock - { - public bool GroupOwned; - public uint CRC; - public int CreationDate; - public byte SaleType; - public uint BaseMask; - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - public uint Flags; - public uint NextOwnerMask; - public LLUUID TransactionID; - public uint GroupMask; - public uint OwnerMask; - - [XmlIgnore] - public int Length - { - get - { - int length = 136; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; - CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SaleType = (byte)bytes[i++]; - BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); - return output.ToString(); - } - } - - /// - [XmlType("updatetaskinventory_updatedata")] - public class UpdateDataBlock - { - public byte Key; - public uint LocalID; - - [XmlIgnore] - public int Length - { - get - { - return 5; - } - } - - public UpdateDataBlock() { } - public UpdateDataBlock(byte[] bytes, ref int i) - { - try - { - Key = (byte)bytes[i++]; - LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = Key; - bytes[i++] = (byte)(LocalID % 256); - bytes[i++] = (byte)((LocalID >> 8) % 256); - bytes[i++] = (byte)((LocalID >> 16) % 256); - bytes[i++] = (byte)((LocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- UpdateData --"); - output.AppendLine(String.Format("Key: {0}", Key)); - output.Append(String.Format("LocalID: {0}", LocalID)); - return output.ToString(); - } - } - /// [XmlType("updatetaskinventory_agentdata")] public class AgentDataBlock @@ -45520,52 +42349,283 @@ namespace libsecondlife.Packets } } + /// + [XmlType("updatetaskinventory_updatedata")] + public class UpdateDataBlock + { + public uint LocalID; + public byte Key; + + [XmlIgnore] + public int Length + { + get + { + return 5; + } + } + + public UpdateDataBlock() { } + public UpdateDataBlock(byte[] bytes, ref int i) + { + try + { + LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Key = (byte)bytes[i++]; + } + 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++] = Key; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- UpdateData --"); + output.AppendLine(String.Format("LocalID: {0}", LocalID)); + output.Append(String.Format("Key: {0}", Key)); + return output.ToString(); + } + } + + /// + [XmlType("updatetaskinventory_inventorydata")] + public class InventoryDataBlock + { + public LLUUID ItemID; + public LLUUID FolderID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; + public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID TransactionID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } + public int CreationDate; + public uint CRC; + + [XmlIgnore] + public int Length + { + get + { + int length = 136; + if (Name != null) { length += 1 + Name.Length; } + if (Description != null) { length += 1 + Description.Length; } + return length; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + TransactionID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + CreationDate = (int)(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) + { + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + 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++] = (byte)(OwnerMask % 256); + bytes[i++] = (byte)((OwnerMask >> 8) % 256); + bytes[i++] = (byte)((OwnerMask >> 16) % 256); + bytes[i++] = (byte)((OwnerMask >> 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)(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)((GroupOwned) ? 1 : 0); + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InventoryData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); + return output.ToString(); + } + } + 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 UpdateDataBlock UpdateData; + public InventoryDataBlock InventoryData; public UpdateTaskInventoryPacket() { Header = new LowHeader(); - Header.ID = 323; + Header.ID = 286; Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock(); - UpdateData = new UpdateDataBlock(); AgentData = new AgentDataBlock(); + UpdateData = new UpdateDataBlock(); + InventoryData = new InventoryDataBlock(); } 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); + UpdateData = new UpdateDataBlock(bytes, ref i); + InventoryData = new InventoryDataBlock(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); + UpdateData = new UpdateDataBlock(bytes, ref i); + InventoryData = new InventoryDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += InventoryData.Length; length += UpdateData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += UpdateData.Length; 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); - UpdateData.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + UpdateData.ToBytes(bytes, ref i); + InventoryData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -45573,9 +42633,9 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- UpdateTaskInventory ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; - output += UpdateData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += UpdateData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; return output; } @@ -45584,6 +42644,52 @@ namespace libsecondlife.Packets /// public class RemoveTaskInventoryPacket : Packet { + /// + [XmlType("removetaskinventory_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("removetaskinventory_inventorydata")] public class InventoryDataBlock @@ -45633,93 +42739,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("removetaskinventory_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 InventoryDataBlock InventoryData; public RemoveTaskInventoryPacket() { Header = new LowHeader(); - Header.ID = 324; + Header.ID = 287; Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock(); AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock(); } 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); + InventoryData = new InventoryDataBlock(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); + InventoryData = new InventoryDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += InventoryData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + InventoryData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -45727,8 +42786,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RemoveTaskInventory ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; return output; } @@ -45737,55 +42796,6 @@ namespace libsecondlife.Packets /// public class MoveTaskInventoryPacket : Packet { - /// - [XmlType("movetaskinventory_inventorydata")] - public class InventoryDataBlock - { - public uint LocalID; - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(LocalID % 256); - bytes[i++] = (byte)((LocalID >> 8) % 256); - bytes[i++] = (byte)((LocalID >> 16) % 256); - bytes[i++] = (byte)((LocalID >> 24) % 256); - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("movetaskinventory_agentdata")] public class AgentDataBlock @@ -45836,75 +42846,19 @@ namespace libsecondlife.Packets } } - 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 = 325; - Header.Reliable = true; - InventoryData = new InventoryDataBlock(); - AgentData = new AgentDataBlock(); - } - - public MoveTaskInventoryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - InventoryData = new InventoryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoveTaskInventoryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - InventoryData = new InventoryDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += InventoryData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - InventoryData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoveTaskInventory ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RequestTaskInventoryPacket : Packet - { /// - [XmlType("requesttaskinventory_inventorydata")] + [XmlType("movetaskinventory_inventorydata")] public class InventoryDataBlock { public uint LocalID; + public LLUUID ItemID; [XmlIgnore] public int Length { get { - return 4; + return 20; } } @@ -45914,6 +42868,7 @@ namespace libsecondlife.Packets try { LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ItemID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -45927,17 +42882,76 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((LocalID >> 8) % 256); bytes[i++] = (byte)((LocalID >> 16) % 256); bytes[i++] = (byte)((LocalID >> 24) % 256); + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); - output.Append(String.Format("LocalID: {0}", LocalID)); + output.AppendLine(String.Format("LocalID: {0}", LocalID)); + output.Append(String.Format("ItemID: {0}", ItemID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.MoveTaskInventory; } } + public AgentDataBlock AgentData; + public InventoryDataBlock InventoryData; + + public MoveTaskInventoryPacket() + { + Header = new LowHeader(); + Header.ID = 288; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock(); + } + + public MoveTaskInventoryPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + InventoryData = new InventoryDataBlock(bytes, ref i); + } + + public MoveTaskInventoryPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + InventoryData = new InventoryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- MoveTaskInventory ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class RequestTaskInventoryPacket : Packet + { /// [XmlType("requesttaskinventory_agentdata")] public class AgentDataBlock @@ -45984,46 +42998,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("requesttaskinventory_inventorydata")] + public class InventoryDataBlock + { + public uint LocalID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) + { + try + { + LocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(LocalID % 256); + bytes[i++] = (byte)((LocalID >> 8) % 256); + bytes[i++] = (byte)((LocalID >> 16) % 256); + bytes[i++] = (byte)((LocalID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InventoryData --"); + output.Append(String.Format("LocalID: {0}", LocalID)); + return output.ToString(); + } + } + 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 InventoryDataBlock InventoryData; public RequestTaskInventoryPacket() { Header = new LowHeader(); - Header.ID = 326; + Header.ID = 289; Header.Reliable = true; - InventoryData = new InventoryDataBlock(); AgentData = new AgentDataBlock(); + InventoryData = new InventoryDataBlock(); } 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); + InventoryData = new InventoryDataBlock(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); + InventoryData = new InventoryDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += InventoryData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + InventoryData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -46031,8 +43090,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RequestTaskInventory ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; return output; } @@ -46046,6 +43105,7 @@ namespace libsecondlife.Packets public class InventoryDataBlock { public LLUUID TaskID; + public short Serial; private byte[] _filename; public byte[] Filename { @@ -46057,7 +43117,6 @@ namespace libsecondlife.Packets else { _filename = new byte[value.Length]; Buffer.BlockCopy(value, 0, _filename, 0, value.Length); } } } - public short Serial; [XmlIgnore] public int Length @@ -46077,10 +43136,10 @@ namespace libsecondlife.Packets try { TaskID = new LLUUID(bytes, i); i += 16; + Serial = (short)(bytes[i++] + (bytes[i++] << 8)); length = (ushort)bytes[i++]; _filename = new byte[length]; Buffer.BlockCopy(bytes, i, _filename, 0, length); i += length; - Serial = (short)(bytes[i++] + (bytes[i++] << 8)); } catch (Exception) { @@ -46091,11 +43150,11 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(Serial % 256); + bytes[i++] = (byte)((Serial >> 8) % 256); if(Filename == null) { Console.WriteLine("Warning: Filename is null, in " + this.GetType()); } bytes[i++] = (byte)Filename.Length; Buffer.BlockCopy(Filename, 0, bytes, i, Filename.Length); i += Filename.Length; - bytes[i++] = (byte)(Serial % 256); - bytes[i++] = (byte)((Serial >> 8) % 256); } public override string ToString() @@ -46103,9 +43162,8 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryData --"); output.AppendLine(String.Format("TaskID: {0}", TaskID)); + output.AppendLine(String.Format("Serial: {0}", Serial)); Helpers.FieldToString(output, Filename, "Filename"); - output.Append(Environment.NewLine); - output.Append(String.Format("Serial: {0}", Serial)); return output.ToString(); } } @@ -46118,9 +43176,8 @@ namespace libsecondlife.Packets public ReplyTaskInventoryPacket() { Header = new LowHeader(); - Header.ID = 327; + Header.ID = 290; Header.Reliable = true; - Header.Zerocoded = true; InventoryData = new InventoryDataBlock(); } @@ -46139,7 +43196,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += InventoryData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -46162,113 +43219,6 @@ namespace libsecondlife.Packets /// public class DeRezObjectPacket : Packet { - /// - [XmlType("derezobject_objectdata")] - public class ObjectDataBlock - { - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 4; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - - /// - [XmlType("derezobject_agentblock")] - public class AgentBlockBlock - { - public LLUUID GroupID; - public byte Destination; - public byte PacketNumber; - public byte PacketCount; - public LLUUID TransactionID; - public LLUUID DestinationID; - - [XmlIgnore] - public int Length - { - get - { - return 51; - } - } - - public AgentBlockBlock() { } - public AgentBlockBlock(byte[] bytes, ref int i) - { - try - { - GroupID = new LLUUID(bytes, i); i += 16; - Destination = (byte)bytes[i++]; - PacketNumber = (byte)bytes[i++]; - PacketCount = (byte)bytes[i++]; - TransactionID = new LLUUID(bytes, i); i += 16; - DestinationID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = Destination; - bytes[i++] = PacketNumber; - bytes[i++] = PacketCount; - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(DestinationID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentBlock --"); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("Destination: {0}", Destination)); - output.AppendLine(String.Format("PacketNumber: {0}", PacketNumber)); - output.AppendLine(String.Format("PacketCount: {0}", PacketCount)); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.Append(String.Format("DestinationID: {0}", DestinationID)); - return output.ToString(); - } - } - /// [XmlType("derezobject_agentdata")] public class AgentDataBlock @@ -46315,61 +43265,167 @@ namespace libsecondlife.Packets } } + /// + [XmlType("derezobject_agentblock")] + public class AgentBlockBlock + { + public LLUUID GroupID; + public byte Destination; + public LLUUID DestinationID; + public LLUUID TransactionID; + public byte PacketCount; + public byte PacketNumber; + + [XmlIgnore] + public int Length + { + get + { + return 51; + } + } + + public AgentBlockBlock() { } + public AgentBlockBlock(byte[] bytes, ref int i) + { + try + { + GroupID = new LLUUID(bytes, i); i += 16; + Destination = (byte)bytes[i++]; + DestinationID = new LLUUID(bytes, i); i += 16; + TransactionID = new LLUUID(bytes, i); i += 16; + PacketCount = (byte)bytes[i++]; + PacketNumber = (byte)bytes[i++]; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = Destination; + Buffer.BlockCopy(DestinationID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = PacketCount; + bytes[i++] = PacketNumber; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentBlock --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("Destination: {0}", Destination)); + output.AppendLine(String.Format("DestinationID: {0}", DestinationID)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("PacketCount: {0}", PacketCount)); + output.Append(String.Format("PacketNumber: {0}", PacketNumber)); + return output.ToString(); + } + } + + /// + [XmlType("derezobject_objectdata")] + public class ObjectDataBlock + { + public uint ObjectLocalID; + + [XmlIgnore] + public int Length + { + get + { + return 4; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(ObjectLocalID % 256); + bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); + bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + return output.ToString(); + } + } + 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 AgentBlockBlock AgentBlock; + public ObjectDataBlock[] ObjectData; public DeRezObjectPacket() { Header = new LowHeader(); - Header.ID = 328; + Header.ID = 291; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentBlock = new AgentBlockBlock(); AgentData = new AgentDataBlock(); + AgentBlock = new AgentBlockBlock(); + ObjectData = new ObjectDataBlock[0]; } public DeRezObjectPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + AgentBlock = new AgentBlockBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + AgentBlock = new AgentBlockBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += AgentBlock.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); + AgentData.ToBytes(bytes, ref i); + AgentBlock.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; } @@ -46377,12 +43433,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- DeRezObject ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += AgentBlock.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -46395,8 +43451,8 @@ namespace libsecondlife.Packets [XmlType("derezack_transactiondata")] public class TransactionDataBlock { - public bool Success; public LLUUID TransactionID; + public bool Success; [XmlIgnore] public int Length @@ -46412,8 +43468,8 @@ namespace libsecondlife.Packets { try { - Success = (bytes[i++] != 0) ? (bool)true : (bool)false; TransactionID = new LLUUID(bytes, i); i += 16; + Success = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -46423,16 +43479,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((Success) ? 1 : 0); Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Success) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- TransactionData --"); - output.AppendLine(String.Format("Success: {0}", Success)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.Append(String.Format("Success: {0}", Success)); return output.ToString(); } } @@ -46445,7 +43501,7 @@ namespace libsecondlife.Packets public DeRezAckPacket() { Header = new LowHeader(); - Header.ID = 329; + Header.ID = 292; Header.Reliable = true; TransactionData = new TransactionDataBlock(); } @@ -46465,7 +43521,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TransactionData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -46488,287 +43544,6 @@ namespace libsecondlife.Packets /// public class RezObjectPacket : Packet { - /// - [XmlType("rezobject_inventorydata")] - public class InventoryDataBlock - { - public bool GroupOwned; - public uint CRC; - public int CreationDate; - public byte SaleType; - public uint BaseMask; - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - public uint Flags; - public uint NextOwnerMask; - public LLUUID TransactionID; - public uint GroupMask; - public uint OwnerMask; - - [XmlIgnore] - public int Length - { - get - { - int length = 136; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; - CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SaleType = (byte)bytes[i++]; - BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); - return output.ToString(); - } - } - - /// - [XmlType("rezobject_rezdata")] - public class RezDataBlock - { - public bool RezSelected; - public bool RemoveItem; - public LLVector3 RayStart; - public uint ItemFlags; - public LLUUID FromTaskID; - public bool RayEndIsIntersection; - public LLVector3 RayEnd; - public byte BypassRaycast; - public uint EveryoneMask; - public uint NextOwnerMask; - public uint GroupMask; - public LLUUID RayTargetID; - - [XmlIgnore] - public int Length - { - get - { - return 76; - } - } - - public RezDataBlock() { } - public RezDataBlock(byte[] bytes, ref int i) - { - try - { - RezSelected = (bytes[i++] != 0) ? (bool)true : (bool)false; - RemoveItem = (bytes[i++] != 0) ? (bool)true : (bool)false; - RayStart = new LLVector3(bytes, i); i += 12; - ItemFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - FromTaskID = new LLUUID(bytes, i); i += 16; - RayEndIsIntersection = (bytes[i++] != 0) ? (bool)true : (bool)false; - RayEnd = new LLVector3(bytes, i); i += 12; - BypassRaycast = (byte)bytes[i++]; - EveryoneMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - RayTargetID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)((RezSelected) ? 1 : 0); - bytes[i++] = (byte)((RemoveItem) ? 1 : 0); - Buffer.BlockCopy(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); - Buffer.BlockCopy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0); - Buffer.BlockCopy(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); - Buffer.BlockCopy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RezData --"); - output.AppendLine(String.Format("RezSelected: {0}", RezSelected)); - output.AppendLine(String.Format("RemoveItem: {0}", RemoveItem)); - output.AppendLine(String.Format("RayStart: {0}", RayStart)); - output.AppendLine(String.Format("ItemFlags: {0}", ItemFlags)); - output.AppendLine(String.Format("FromTaskID: {0}", FromTaskID)); - output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); - output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); - output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("RayTargetID: {0}", RayTargetID)); - return output.ToString(); - } - } - /// [XmlType("rezobject_agentdata")] public class AgentDataBlock @@ -46819,128 +43594,22 @@ namespace libsecondlife.Packets } } - 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 = 330; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock(); - RezData = new RezDataBlock(); - AgentData = new AgentDataBlock(); - } - - public RezObjectPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - InventoryData = new InventoryDataBlock(bytes, ref i); - RezData = new RezDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RezObjectPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - InventoryData = new InventoryDataBlock(bytes, ref i); - RezData = new RezDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += InventoryData.Length; length += RezData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - InventoryData.ToBytes(bytes, ref i); - RezData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RezObject ---" + Environment.NewLine; - output += InventoryData.ToString() + Environment.NewLine; - output += RezData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RezObjectFromNotecardPacket : Packet - { /// - [XmlType("rezobjectfromnotecard_inventorydata")] - public class InventoryDataBlock - { - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public InventoryDataBlock() { } - public InventoryDataBlock(byte[] bytes, ref int i) - { - try - { - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryData --"); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - - /// - [XmlType("rezobjectfromnotecard_rezdata")] + [XmlType("rezobject_rezdata")] public class RezDataBlock { + public LLUUID FromTaskID; + public byte BypassRaycast; + public LLVector3 RayStart; + public LLVector3 RayEnd; + public LLUUID RayTargetID; + public bool RayEndIsIntersection; 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 GroupMask; public uint EveryoneMask; public uint NextOwnerMask; - public uint GroupMask; - public LLUUID RayTargetID; [XmlIgnore] public int Length @@ -46956,18 +43625,18 @@ namespace libsecondlife.Packets { try { + FromTaskID = new LLUUID(bytes, i); i += 16; + BypassRaycast = (byte)bytes[i++]; + RayStart = new LLVector3(bytes, i); i += 12; + RayEnd = new LLVector3(bytes, i); i += 12; + RayTargetID = new LLUUID(bytes, i); i += 16; + RayEndIsIntersection = (bytes[i++] != 0) ? (bool)true : (bool)false; 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++]; + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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) { @@ -46977,17 +43646,22 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = BypassRaycast; + Buffer.BlockCopy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0); bytes[i++] = (byte)((RezSelected) ? 1 : 0); bytes[i++] = (byte)((RemoveItem) ? 1 : 0); - Buffer.BlockCopy(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); - Buffer.BlockCopy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0); - Buffer.BlockCopy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = BypassRaycast; + 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)(EveryoneMask % 256); bytes[i++] = (byte)((EveryoneMask >> 8) % 256); bytes[i++] = (byte)((EveryoneMask >> 16) % 256); @@ -46996,56 +43670,117 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- RezData --"); + output.AppendLine(String.Format("FromTaskID: {0}", FromTaskID)); + output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); + output.AppendLine(String.Format("RayStart: {0}", RayStart)); + output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); + output.AppendLine(String.Format("RayTargetID: {0}", RayTargetID)); + output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); output.AppendLine(String.Format("RezSelected: {0}", RezSelected)); output.AppendLine(String.Format("RemoveItem: {0}", RemoveItem)); - output.AppendLine(String.Format("RayStart: {0}", RayStart)); output.AppendLine(String.Format("ItemFlags: {0}", ItemFlags)); - output.AppendLine(String.Format("FromTaskID: {0}", FromTaskID)); - output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); - output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); - output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("RayTargetID: {0}", RayTargetID)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.Append(String.Format("NextOwnerMask: {0}", NextOwnerMask)); return output.ToString(); } } /// - [XmlType("rezobjectfromnotecard_notecarddata")] - public class NotecardDataBlock + [XmlType("rezobject_inventorydata")] + public class InventoryDataBlock { - public LLUUID ObjectID; - public LLUUID NotecardItemID; + public LLUUID ItemID; + public LLUUID FolderID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; + public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID TransactionID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } + public int CreationDate; + public uint CRC; [XmlIgnore] public int Length { get { - return 32; + int length = 136; + if (Name != null) { length += 1 + Name.Length; } + if (Description != null) { length += 1 + Description.Length; } + return length; } } - public NotecardDataBlock() { } - public NotecardDataBlock(byte[] bytes, ref int i) + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) { + int length; try { - ObjectID = new LLUUID(bytes, i); i += 16; - NotecardItemID = new LLUUID(bytes, i); i += 16; + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + TransactionID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + CreationDate = (int)(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) { @@ -47055,20 +43790,154 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(NotecardItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + 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++] = (byte)(OwnerMask % 256); + bytes[i++] = (byte)((OwnerMask >> 8) % 256); + bytes[i++] = (byte)((OwnerMask >> 16) % 256); + bytes[i++] = (byte)((OwnerMask >> 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)(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)((GroupOwned) ? 1 : 0); + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- NotecardData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.Append(String.Format("NotecardItemID: {0}", NotecardItemID)); + output.AppendLine("-- InventoryData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.RezObject; } } + public AgentDataBlock AgentData; + public RezDataBlock RezData; + public InventoryDataBlock InventoryData; + + public RezObjectPacket() + { + Header = new LowHeader(); + Header.ID = 293; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + RezData = new RezDataBlock(); + InventoryData = new InventoryDataBlock(); + } + + public RezObjectPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + RezData = new RezDataBlock(bytes, ref i); + InventoryData = new InventoryDataBlock(bytes, ref i); + } + + public RezObjectPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + RezData = new RezDataBlock(bytes, ref i); + InventoryData = new InventoryDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += RezData.Length; 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); + AgentData.ToBytes(bytes, ref i); + RezData.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 = "--- RezObject ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += RezData.ToString() + Environment.NewLine; + output += InventoryData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class RezObjectFromNotecardPacket : Packet + { /// [XmlType("rezobjectfromnotecard_agentdata")] public class AgentDataBlock @@ -47119,109 +43988,49 @@ namespace libsecondlife.Packets } } - 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 = 331; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryData = new InventoryDataBlock[0]; - RezData = new RezDataBlock(); - NotecardData = new NotecardDataBlock(); - AgentData = new AgentDataBlock(); - } - - public RezObjectFromNotecardPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - RezData = new RezDataBlock(bytes, ref i); - NotecardData = new NotecardDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RezObjectFromNotecardPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - InventoryData = new InventoryDataBlock[count]; - for (int j = 0; j < count; j++) - { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } - RezData = new RezDataBlock(bytes, ref i); - NotecardData = new NotecardDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += RezData.Length; length += NotecardData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < InventoryData.Length; j++) { length += InventoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)InventoryData.Length; - for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } - RezData.ToBytes(bytes, ref i); - NotecardData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RezObjectFromNotecard ---" + Environment.NewLine; - for (int j = 0; j < InventoryData.Length; j++) - { - output += InventoryData[j].ToString() + Environment.NewLine; - } - output += RezData.ToString() + Environment.NewLine; - output += NotecardData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DeclineInventoryPacket : Packet - { /// - [XmlType("declineinventory_infoblock")] - public class InfoBlockBlock + [XmlType("rezobjectfromnotecard_rezdata")] + public class RezDataBlock { - public LLUUID TransactionID; + public LLUUID FromTaskID; + public byte BypassRaycast; + public LLVector3 RayStart; + public LLVector3 RayEnd; + public LLUUID RayTargetID; + public bool RayEndIsIntersection; + public bool RezSelected; + public bool RemoveItem; + public uint ItemFlags; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; [XmlIgnore] public int Length { get { - return 16; + return 76; } } - public InfoBlockBlock() { } - public InfoBlockBlock(byte[] bytes, ref int i) + public RezDataBlock() { } + public RezDataBlock(byte[] bytes, ref int i) { try { - TransactionID = new LLUUID(bytes, i); i += 16; + FromTaskID = new LLUUID(bytes, i); i += 16; + BypassRaycast = (byte)bytes[i++]; + RayStart = new LLVector3(bytes, i); i += 12; + RayEnd = new LLVector3(bytes, i); i += 12; + RayTargetID = new LLUUID(bytes, i); i += 16; + RayEndIsIntersection = (bytes[i++] != 0) ? (bool)true : (bool)false; + RezSelected = (bytes[i++] != 0) ? (bool)true : (bool)false; + RemoveItem = (bytes[i++] != 0) ? (bool)true : (bool)false; + ItemFlags = (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)); + 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)); } catch (Exception) { @@ -47231,125 +44040,58 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = BypassRaycast; + Buffer.BlockCopy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((RayEndIsIntersection) ? 1 : 0); + bytes[i++] = (byte)((RezSelected) ? 1 : 0); + bytes[i++] = (byte)((RemoveItem) ? 1 : 0); + bytes[i++] = (byte)(ItemFlags % 256); + bytes[i++] = (byte)((ItemFlags >> 8) % 256); + bytes[i++] = (byte)((ItemFlags >> 16) % 256); + bytes[i++] = (byte)((ItemFlags >> 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)(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); } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- InfoBlock --"); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - - 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 = 332; - Header.Reliable = true; - InfoBlock = new InfoBlockBlock(); - } - - public DeclineInventoryPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - InfoBlock = new InfoBlockBlock(bytes, ref i); - } - - public DeclineInventoryPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - InfoBlock = new InfoBlockBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += InfoBlock.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - InfoBlock.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- DeclineInventory ---" + Environment.NewLine; - output += InfoBlock.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RequestFriendshipPacket : Packet - { - /// - [XmlType("requestfriendship_agentblock")] - public class AgentBlockBlock - { - public LLUUID DestID; - public LLUUID FolderID; - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 48; - } - } - - public AgentBlockBlock() { } - public AgentBlockBlock(byte[] bytes, ref int i) - { - try - { - DestID = new LLUUID(bytes, i); i += 16; - FolderID = new LLUUID(bytes, i); i += 16; - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(DestID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentBlock --"); - output.AppendLine(String.Format("DestID: {0}", DestID)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine("-- RezData --"); + output.AppendLine(String.Format("FromTaskID: {0}", FromTaskID)); + output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); + output.AppendLine(String.Format("RayStart: {0}", RayStart)); + output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); + output.AppendLine(String.Format("RayTargetID: {0}", RayTargetID)); + output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); + output.AppendLine(String.Format("RezSelected: {0}", RezSelected)); + output.AppendLine(String.Format("RemoveItem: {0}", RemoveItem)); + output.AppendLine(String.Format("ItemFlags: {0}", ItemFlags)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.Append(String.Format("NextOwnerMask: {0}", NextOwnerMask)); return output.ToString(); } } /// - [XmlType("requestfriendship_agentdata")] - public class AgentDataBlock + [XmlType("rezobjectfromnotecard_notecarddata")] + public class NotecardDataBlock { - public LLUUID AgentID; - public LLUUID SessionID; + public LLUUID NotecardItemID; + public LLUUID ObjectID; [XmlIgnore] public int Length @@ -47360,13 +44102,13 @@ namespace libsecondlife.Packets } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public NotecardDataBlock() { } + public NotecardDataBlock(byte[] bytes, ref int i) { try { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; + NotecardItemID = new LLUUID(bytes, i); i += 16; + ObjectID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -47376,82 +44118,25 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(NotecardItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine("-- NotecardData --"); + output.AppendLine(String.Format("NotecardItemID: {0}", NotecardItemID)); + output.Append(String.Format("ObjectID: {0}", ObjectID)); return output.ToString(); } } - 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 = 335; - Header.Reliable = true; - AgentBlock = new AgentBlockBlock(); - AgentData = new AgentDataBlock(); - } - - public RequestFriendshipPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentBlock = new AgentBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RequestFriendshipPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentBlock = new AgentBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentBlock.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentBlock.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RequestFriendship ---" + Environment.NewLine; - output += AgentBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AcceptFriendshipPacket : Packet - { /// - [XmlType("acceptfriendship_transactionblock")] - public class TransactionBlockBlock + [XmlType("rezobjectfromnotecard_inventorydata")] + public class InventoryDataBlock { - public LLUUID TransactionID; + public LLUUID ItemID; [XmlIgnore] public int Length @@ -47462,12 +44147,12 @@ namespace libsecondlife.Packets } } - public TransactionBlockBlock() { } - public TransactionBlockBlock(byte[] bytes, ref int i) + public InventoryDataBlock() { } + public InventoryDataBlock(byte[] bytes, ref int i) { try { - TransactionID = new LLUUID(bytes, i); i += 16; + ItemID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -47477,18 +44162,99 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransactionBlock --"); - output.Append(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine("-- InventoryData --"); + output.Append(String.Format("ItemID: {0}", ItemID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.RezObjectFromNotecard; } } + public AgentDataBlock AgentData; + public RezDataBlock RezData; + public NotecardDataBlock NotecardData; + public InventoryDataBlock[] InventoryData; + + public RezObjectFromNotecardPacket() + { + Header = new LowHeader(); + Header.ID = 294; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + RezData = new RezDataBlock(); + NotecardData = new NotecardDataBlock(); + InventoryData = new InventoryDataBlock[0]; + } + + public RezObjectFromNotecardPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + RezData = new RezDataBlock(bytes, ref i); + NotecardData = new NotecardDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public RezObjectFromNotecardPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + RezData = new RezDataBlock(bytes, ref i); + NotecardData = new NotecardDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + InventoryData = new InventoryDataBlock[count]; + for (int j = 0; j < count; j++) + { InventoryData[j] = new InventoryDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += RezData.Length; length += NotecardData.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); + AgentData.ToBytes(bytes, ref i); + RezData.ToBytes(bytes, ref i); + NotecardData.ToBytes(bytes, ref i); + bytes[i++] = (byte)InventoryData.Length; + for (int j = 0; j < InventoryData.Length; j++) { InventoryData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- RezObjectFromNotecard ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += RezData.ToString() + Environment.NewLine; + output += NotecardData.ToString() + Environment.NewLine; + for (int j = 0; j < InventoryData.Length; j++) + { + output += InventoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class AcceptFriendshipPacket : Packet + { /// [XmlType("acceptfriendship_agentdata")] public class AgentDataBlock @@ -47535,6 +44301,48 @@ namespace libsecondlife.Packets } } + /// + [XmlType("acceptfriendship_transactionblock")] + public class TransactionBlockBlock + { + public LLUUID TransactionID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public TransactionBlockBlock() { } + public TransactionBlockBlock(byte[] bytes, ref int i) + { + try + { + TransactionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TransactionBlock --"); + output.Append(String.Format("TransactionID: {0}", TransactionID)); + return output.ToString(); + } + } + /// [XmlType("acceptfriendship_folderdata")] public class FolderDataBlock @@ -47580,17 +44388,17 @@ namespace libsecondlife.Packets 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 TransactionBlockBlock TransactionBlock; public FolderDataBlock[] FolderData; public AcceptFriendshipPacket() { Header = new LowHeader(); - Header.ID = 336; + Header.ID = 297; Header.Reliable = true; - TransactionBlock = new TransactionBlockBlock(); AgentData = new AgentDataBlock(); + TransactionBlock = new TransactionBlockBlock(); FolderData = new FolderDataBlock[0]; } @@ -47598,8 +44406,8 @@ namespace libsecondlife.Packets { 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); + TransactionBlock = new TransactionBlockBlock(bytes, ref i); int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) @@ -47609,8 +44417,8 @@ namespace libsecondlife.Packets public AcceptFriendshipPacket(Header head, byte[] bytes, ref int i) { Header = head; - TransactionBlock = new TransactionBlockBlock(bytes, ref i); AgentData = new AgentDataBlock(bytes, ref i); + TransactionBlock = new TransactionBlockBlock(bytes, ref i); int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) @@ -47619,16 +44427,16 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; - length += TransactionBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += TransactionBlock.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); + TransactionBlock.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); } @@ -47638,8 +44446,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AcceptFriendship ---" + Environment.NewLine; - output += TransactionBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += TransactionBlock.ToString() + Environment.NewLine; for (int j = 0; j < FolderData.Length; j++) { output += FolderData[j].ToString() + Environment.NewLine; @@ -47652,48 +44460,6 @@ namespace libsecondlife.Packets /// public class DeclineFriendshipPacket : Packet { - /// - [XmlType("declinefriendship_transactionblock")] - public class TransactionBlockBlock - { - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TransactionBlockBlock() { } - public TransactionBlockBlock(byte[] bytes, ref int i) - { - try - { - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransactionBlock --"); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - /// [XmlType("declinefriendship_agentdata")] public class AgentDataBlock @@ -47740,46 +44506,88 @@ namespace libsecondlife.Packets } } + /// + [XmlType("declinefriendship_transactionblock")] + public class TransactionBlockBlock + { + public LLUUID TransactionID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public TransactionBlockBlock() { } + public TransactionBlockBlock(byte[] bytes, ref int i) + { + try + { + TransactionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TransactionBlock --"); + output.Append(String.Format("TransactionID: {0}", TransactionID)); + return output.ToString(); + } + } + 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 TransactionBlockBlock TransactionBlock; public DeclineFriendshipPacket() { Header = new LowHeader(); - Header.ID = 337; + Header.ID = 298; Header.Reliable = true; - TransactionBlock = new TransactionBlockBlock(); AgentData = new AgentDataBlock(); + TransactionBlock = new TransactionBlockBlock(); } 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); + TransactionBlock = new TransactionBlockBlock(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); + TransactionBlock = new TransactionBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += TransactionBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += TransactionBlock.Length;; 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); + TransactionBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -47787,8 +44595,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- DeclineFriendship ---" + Environment.NewLine; - output += TransactionBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += TransactionBlock.ToString() + Environment.NewLine; return output; } @@ -47801,8 +44609,8 @@ namespace libsecondlife.Packets [XmlType("formfriendship_agentblock")] public class AgentBlockBlock { - public LLUUID DestID; public LLUUID SourceID; + public LLUUID DestID; [XmlIgnore] public int Length @@ -47818,8 +44626,8 @@ namespace libsecondlife.Packets { try { - DestID = new LLUUID(bytes, i); i += 16; SourceID = new LLUUID(bytes, i); i += 16; + DestID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -47829,16 +44637,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(DestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(DestID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentBlock --"); - output.AppendLine(String.Format("DestID: {0}", DestID)); - output.Append(String.Format("SourceID: {0}", SourceID)); + output.AppendLine(String.Format("SourceID: {0}", SourceID)); + output.Append(String.Format("DestID: {0}", DestID)); return output.ToString(); } } @@ -47851,7 +44659,7 @@ namespace libsecondlife.Packets public FormFriendshipPacket() { Header = new LowHeader(); - Header.ID = 338; + Header.ID = 299; Header.Reliable = true; AgentBlock = new AgentBlockBlock(); } @@ -47871,7 +44679,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -47894,48 +44702,6 @@ namespace libsecondlife.Packets /// public class TerminateFriendshipPacket : Packet { - /// - [XmlType("terminatefriendship_exblock")] - public class ExBlockBlock - { - public LLUUID OtherID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public ExBlockBlock() { } - public ExBlockBlock(byte[] bytes, ref int i) - { - try - { - OtherID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(OtherID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ExBlock --"); - output.Append(String.Format("OtherID: {0}", OtherID)); - return output.ToString(); - } - } - /// [XmlType("terminatefriendship_agentdata")] public class AgentDataBlock @@ -47982,86 +44748,27 @@ namespace libsecondlife.Packets } } - 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 = 339; - Header.Reliable = true; - ExBlock = new ExBlockBlock(); - AgentData = new AgentDataBlock(); - } - - public TerminateFriendshipPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ExBlock = new ExBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public TerminateFriendshipPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ExBlock = new ExBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ExBlock.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ExBlock.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- TerminateFriendship ---" + Environment.NewLine; - output += ExBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class OfferCallingCardPacket : Packet - { /// - [XmlType("offercallingcard_agentblock")] - public class AgentBlockBlock + [XmlType("terminatefriendship_exblock")] + public class ExBlockBlock { - public LLUUID DestID; - public LLUUID TransactionID; + public LLUUID OtherID; [XmlIgnore] public int Length { get { - return 32; + return 16; } } - public AgentBlockBlock() { } - public AgentBlockBlock(byte[] bytes, ref int i) + public ExBlockBlock() { } + public ExBlockBlock(byte[] bytes, ref int i) { try { - DestID = new LLUUID(bytes, i); i += 16; - TransactionID = new LLUUID(bytes, i); i += 16; + OtherID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -48071,20 +44778,75 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(DestID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OtherID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentBlock --"); - output.AppendLine(String.Format("DestID: {0}", DestID)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine("-- ExBlock --"); + output.Append(String.Format("OtherID: {0}", OtherID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.TerminateFriendship; } } + public AgentDataBlock AgentData; + public ExBlockBlock ExBlock; + + public TerminateFriendshipPacket() + { + Header = new LowHeader(); + Header.ID = 300; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ExBlock = new ExBlockBlock(); + } + + public TerminateFriendshipPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ExBlock = new ExBlockBlock(bytes, ref i); + } + + public TerminateFriendshipPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ExBlock = new ExBlockBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += ExBlock.Length;; + 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); + ExBlock.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- TerminateFriendship ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ExBlock.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class OfferCallingCardPacket : Packet + { /// [XmlType("offercallingcard_agentdata")] public class AgentDataBlock @@ -48131,67 +44893,11 @@ namespace libsecondlife.Packets } } - 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 = 340; - Header.Reliable = true; - AgentBlock = new AgentBlockBlock(); - AgentData = new AgentDataBlock(); - } - - public OfferCallingCardPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentBlock = new AgentBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public OfferCallingCardPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentBlock = new AgentBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentBlock.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentBlock.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- OfferCallingCard ---" + Environment.NewLine; - output += AgentBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AcceptCallingCardPacket : Packet - { /// - [XmlType("acceptcallingcard_transactionblock")] - public class TransactionBlockBlock + [XmlType("offercallingcard_agentblock")] + public class AgentBlockBlock { + public LLUUID DestID; public LLUUID TransactionID; [XmlIgnore] @@ -48199,15 +44905,16 @@ namespace libsecondlife.Packets { get { - return 16; + return 32; } } - public TransactionBlockBlock() { } - public TransactionBlockBlock(byte[] bytes, ref int i) + 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) @@ -48218,18 +44925,77 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(DestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransactionBlock --"); + output.AppendLine("-- AgentBlock --"); + output.AppendLine(String.Format("DestID: {0}", DestID)); output.Append(String.Format("TransactionID: {0}", TransactionID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.OfferCallingCard; } } + public AgentDataBlock AgentData; + public AgentBlockBlock AgentBlock; + + public OfferCallingCardPacket() + { + Header = new LowHeader(); + Header.ID = 301; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + AgentBlock = new AgentBlockBlock(); + } + + public OfferCallingCardPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + AgentBlock = new AgentBlockBlock(bytes, ref i); + } + + public OfferCallingCardPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + AgentBlock = new AgentBlockBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- OfferCallingCard ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += AgentBlock.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class AcceptCallingCardPacket : Packet + { /// [XmlType("acceptcallingcard_agentdata")] public class AgentDataBlock @@ -48276,6 +45042,48 @@ namespace libsecondlife.Packets } } + /// + [XmlType("acceptcallingcard_transactionblock")] + public class TransactionBlockBlock + { + public LLUUID TransactionID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public TransactionBlockBlock() { } + public TransactionBlockBlock(byte[] bytes, ref int i) + { + try + { + TransactionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TransactionBlock --"); + output.Append(String.Format("TransactionID: {0}", TransactionID)); + return output.ToString(); + } + } + /// [XmlType("acceptcallingcard_folderdata")] public class FolderDataBlock @@ -48321,17 +45129,17 @@ namespace libsecondlife.Packets 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 TransactionBlockBlock TransactionBlock; public FolderDataBlock[] FolderData; public AcceptCallingCardPacket() { Header = new LowHeader(); - Header.ID = 341; + Header.ID = 302; Header.Reliable = true; - TransactionBlock = new TransactionBlockBlock(); AgentData = new AgentDataBlock(); + TransactionBlock = new TransactionBlockBlock(); FolderData = new FolderDataBlock[0]; } @@ -48339,8 +45147,8 @@ namespace libsecondlife.Packets { 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); + TransactionBlock = new TransactionBlockBlock(bytes, ref i); int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) @@ -48350,8 +45158,8 @@ namespace libsecondlife.Packets public AcceptCallingCardPacket(Header head, byte[] bytes, ref int i) { Header = head; - TransactionBlock = new TransactionBlockBlock(bytes, ref i); AgentData = new AgentDataBlock(bytes, ref i); + TransactionBlock = new TransactionBlockBlock(bytes, ref i); int count = (int)bytes[i++]; FolderData = new FolderDataBlock[count]; for (int j = 0; j < count; j++) @@ -48360,16 +45168,16 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; - length += TransactionBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += TransactionBlock.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); + TransactionBlock.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); } @@ -48379,8 +45187,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AcceptCallingCard ---" + Environment.NewLine; - output += TransactionBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += TransactionBlock.ToString() + Environment.NewLine; for (int j = 0; j < FolderData.Length; j++) { output += FolderData[j].ToString() + Environment.NewLine; @@ -48393,48 +45201,6 @@ namespace libsecondlife.Packets /// public class DeclineCallingCardPacket : Packet { - /// - [XmlType("declinecallingcard_transactionblock")] - public class TransactionBlockBlock - { - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TransactionBlockBlock() { } - public TransactionBlockBlock(byte[] bytes, ref int i) - { - try - { - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransactionBlock --"); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - /// [XmlType("declinecallingcard_agentdata")] public class AgentDataBlock @@ -48481,46 +45247,88 @@ namespace libsecondlife.Packets } } + /// + [XmlType("declinecallingcard_transactionblock")] + public class TransactionBlockBlock + { + public LLUUID TransactionID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public TransactionBlockBlock() { } + public TransactionBlockBlock(byte[] bytes, ref int i) + { + try + { + TransactionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TransactionBlock --"); + output.Append(String.Format("TransactionID: {0}", TransactionID)); + return output.ToString(); + } + } + 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 TransactionBlockBlock TransactionBlock; public DeclineCallingCardPacket() { Header = new LowHeader(); - Header.ID = 342; + Header.ID = 303; Header.Reliable = true; - TransactionBlock = new TransactionBlockBlock(); AgentData = new AgentDataBlock(); + TransactionBlock = new TransactionBlockBlock(); } 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); + TransactionBlock = new TransactionBlockBlock(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); + TransactionBlock = new TransactionBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += TransactionBlock.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += TransactionBlock.Length;; 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); + TransactionBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -48528,8 +45336,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- DeclineCallingCard ---" + Environment.NewLine; - output += TransactionBlock.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += TransactionBlock.ToString() + Environment.NewLine; return output; } @@ -48538,238 +45346,6 @@ namespace libsecondlife.Packets /// public class RezScriptPacket : Packet { - /// - [XmlType("rezscript_updateblock")] - public class UpdateBlockBlock - { - public bool Enabled; - public uint ObjectLocalID; - - [XmlIgnore] - public int Length - { - get - { - return 5; - } - } - - public UpdateBlockBlock() { } - public UpdateBlockBlock(byte[] bytes, ref int i) - { - try - { - Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false; - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)((Enabled) ? 1 : 0); - bytes[i++] = (byte)(ObjectLocalID % 256); - bytes[i++] = (byte)((ObjectLocalID >> 8) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 16) % 256); - bytes[i++] = (byte)((ObjectLocalID >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- UpdateBlock --"); - output.AppendLine(String.Format("Enabled: {0}", Enabled)); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); - return output.ToString(); - } - } - - /// - [XmlType("rezscript_inventoryblock")] - public class InventoryBlockBlock - { - public bool GroupOwned; - public uint CRC; - public int CreationDate; - public byte SaleType; - public uint BaseMask; - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - public uint Flags; - public uint NextOwnerMask; - public LLUUID TransactionID; - public uint GroupMask; - public uint OwnerMask; - - [XmlIgnore] - public int Length - { - get - { - int length = 136; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public InventoryBlockBlock() { } - public InventoryBlockBlock(byte[] bytes, ref int i) - { - int length; - try - { - GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; - CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - CreationDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SaleType = (byte)bytes[i++]; - BaseMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InventoryBlock --"); - output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); - output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); - return output.ToString(); - } - } - /// [XmlType("rezscript_agentdata")] public class AgentDataBlock @@ -48820,76 +45396,76 @@ namespace libsecondlife.Packets } } - 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 = 343; - Header.Reliable = true; - Header.Zerocoded = true; - UpdateBlock = new UpdateBlockBlock(); - InventoryBlock = new InventoryBlockBlock(); - AgentData = new AgentDataBlock(); - } - - public RezScriptPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - UpdateBlock = new UpdateBlockBlock(bytes, ref i); - InventoryBlock = new InventoryBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RezScriptPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - UpdateBlock = new UpdateBlockBlock(bytes, ref i); - InventoryBlock = new InventoryBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += UpdateBlock.Length; length += InventoryBlock.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - UpdateBlock.ToBytes(bytes, ref i); - InventoryBlock.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RezScript ---" + Environment.NewLine; - output += UpdateBlock.ToString() + Environment.NewLine; - output += InventoryBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class CreateInventoryItemPacket : Packet - { /// - [XmlType("createinventoryitem_inventoryblock")] + [XmlType("rezscript_updateblock")] + public class UpdateBlockBlock + { + public uint ObjectLocalID; + public bool Enabled; + + [XmlIgnore] + public int Length + { + get + { + return 5; + } + } + + public UpdateBlockBlock() { } + public UpdateBlockBlock(byte[] bytes, ref int i) + { + try + { + ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Enabled = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + 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); + bytes[i++] = (byte)((Enabled) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- UpdateBlock --"); + output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.Append(String.Format("Enabled: {0}", Enabled)); + return output.ToString(); + } + } + + /// + [XmlType("rezscript_inventoryblock")] public class InventoryBlockBlock { - public uint CallbackID; - public byte WearableType; + public LLUUID ItemID; + public LLUUID FolderID; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; + public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public bool GroupOwned; + public LLUUID TransactionID; + public sbyte Type; + public sbyte InvType; + public uint Flags; + public byte SaleType; + public int SalePrice; private byte[] _name; public byte[] Name { @@ -48901,9 +45477,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - public sbyte InvType; - public sbyte Type; - public LLUUID FolderID; private byte[] _description; public byte[] Description { @@ -48915,15 +45488,15 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public uint NextOwnerMask; - public LLUUID TransactionID; + public int CreationDate; + public uint CRC; [XmlIgnore] public int Length { get { - int length = 43; + int length = 136; if (Name != null) { length += 1 + Name.Length; } if (Description != null) { length += 1 + Description.Length; } return length; @@ -48936,19 +45509,31 @@ namespace libsecondlife.Packets int length; try { - CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - WearableType = (byte)bytes[i++]; + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + GroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + TransactionID = new LLUUID(bytes, i); i += 16; + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + Flags = (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)); length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(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; + CreationDate = (int)(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) { @@ -48958,46 +45543,154 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = (byte)InvType; - bytes[i++] = (byte)Type; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + 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++] = (byte)(OwnerMask % 256); + bytes[i++] = (byte)((OwnerMask >> 8) % 256); + bytes[i++] = (byte)((OwnerMask >> 16) % 256); + bytes[i++] = (byte)((OwnerMask >> 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)(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)((GroupOwned) ? 1 : 0); Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)Type; + bytes[i++] = (byte)InvType; + 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++] = SaleType; + bytes[i++] = (byte)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + bytes[i++] = (byte)(CreationDate % 256); + bytes[i++] = (byte)((CreationDate >> 8) % 256); + bytes[i++] = (byte)((CreationDate >> 16) % 256); + bytes[i++] = (byte)((CreationDate >> 24) % 256); + bytes[i++] = (byte)(CRC % 256); + bytes[i++] = (byte)((CRC >> 8) % 256); + bytes[i++] = (byte)((CRC >> 16) % 256); + bytes[i++] = (byte)((CRC >> 24) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryBlock --"); - output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); - output.AppendLine(String.Format("WearableType: {0}", WearableType)); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("GroupOwned: {0}", GroupOwned)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("InvType: {0}", InvType)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); Helpers.FieldToString(output, Description, "Description"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); + output.Append(String.Format("CRC: {0}", CRC)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.RezScript; } } + public AgentDataBlock AgentData; + public UpdateBlockBlock UpdateBlock; + public InventoryBlockBlock InventoryBlock; + + public RezScriptPacket() + { + Header = new LowHeader(); + Header.ID = 304; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + UpdateBlock = new UpdateBlockBlock(); + InventoryBlock = new InventoryBlockBlock(); + } + + public RezScriptPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + UpdateBlock = new UpdateBlockBlock(bytes, ref i); + InventoryBlock = new InventoryBlockBlock(bytes, ref i); + } + + public RezScriptPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + UpdateBlock = new UpdateBlockBlock(bytes, ref i); + InventoryBlock = new InventoryBlockBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += UpdateBlock.Length; length += InventoryBlock.Length;; + 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); + UpdateBlock.ToBytes(bytes, ref i); + InventoryBlock.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- RezScript ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += UpdateBlock.ToString() + Environment.NewLine; + output += InventoryBlock.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class CreateInventoryItemPacket : Packet + { /// [XmlType("createinventoryitem_agentdata")] public class AgentDataBlock @@ -49044,68 +45737,17 @@ namespace libsecondlife.Packets } } - 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 = 344; - Header.Reliable = true; - Header.Zerocoded = true; - InventoryBlock = new InventoryBlockBlock(); - AgentData = new AgentDataBlock(); - } - - public CreateInventoryItemPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - InventoryBlock = new InventoryBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public CreateInventoryItemPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - InventoryBlock = new InventoryBlockBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += InventoryBlock.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - InventoryBlock.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- CreateInventoryItem ---" + Environment.NewLine; - output += InventoryBlock.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class CreateLandmarkForEventPacket : Packet - { /// - [XmlType("createlandmarkforevent_inventoryblock")] + [XmlType("createinventoryitem_inventoryblock")] public class InventoryBlockBlock { + public uint CallbackID; + public LLUUID FolderID; + public LLUUID TransactionID; + public uint NextOwnerMask; + public sbyte Type; + public sbyte InvType; + public byte WearableType; private byte[] _name; public byte[] Name { @@ -49117,15 +45759,26 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - int length = 16; + int length = 43; if (Name != null) { length += 1 + Name.Length; } + if (Description != null) { length += 1 + Description.Length; } return length; } } @@ -49136,10 +45789,19 @@ namespace libsecondlife.Packets int length; try { + CallbackID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + FolderID = new LLUUID(bytes, i); i += 16; + TransactionID = new LLUUID(bytes, i); i += 16; + NextOwnerMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Type = (sbyte)bytes[i++]; + InvType = (sbyte)bytes[i++]; + WearableType = (byte)bytes[i++]; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; - FolderID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; } catch (Exception) { @@ -49149,19 +45811,144 @@ namespace libsecondlife.Packets 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); + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TransactionID.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)Type; + bytes[i++] = (byte)InvType; + bytes[i++] = WearableType; if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } bytes[i++] = (byte)Name.Length; Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(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; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- InventoryBlock --"); + output.AppendLine(String.Format("CallbackID: {0}", CallbackID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("InvType: {0}", InvType)); + output.AppendLine(String.Format("WearableType: {0}", WearableType)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); - output.Append(String.Format("FolderID: {0}", FolderID)); + Helpers.FieldToString(output, Description, "Description"); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.CreateInventoryItem; } } + public AgentDataBlock AgentData; + public InventoryBlockBlock InventoryBlock; + + public CreateInventoryItemPacket() + { + Header = new LowHeader(); + Header.ID = 305; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + InventoryBlock = new InventoryBlockBlock(); + } + + public CreateInventoryItemPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + InventoryBlock = new InventoryBlockBlock(bytes, ref i); + } + + public CreateInventoryItemPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + InventoryBlock = new InventoryBlockBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += InventoryBlock.Length;; + 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); + InventoryBlock.ToBytes(bytes, ref i); + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- CreateInventoryItem ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += InventoryBlock.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class CreateLandmarkForEventPacket : Packet + { + /// + [XmlType("createlandmarkforevent_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); return output.ToString(); } } @@ -49212,28 +45999,43 @@ namespace libsecondlife.Packets } /// - [XmlType("createlandmarkforevent_agentdata")] - public class AgentDataBlock + [XmlType("createlandmarkforevent_inventoryblock")] + public class InventoryBlockBlock { - public LLUUID AgentID; - public LLUUID SessionID; + public LLUUID FolderID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 32; + int length = 16; + if (Name != null) { length += 1 + Name.Length; } + return length; } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public InventoryBlockBlock() { } + public InventoryBlockBlock(byte[] bytes, ref int i) { + int length; try { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; } catch (Exception) { @@ -49243,16 +46045,18 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine("-- InventoryBlock --"); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + Helpers.FieldToString(output, Name, "Name"); return output.ToString(); } } @@ -49260,49 +46064,48 @@ namespace libsecondlife.Packets 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 EventDataBlock EventData; + public InventoryBlockBlock InventoryBlock; public CreateLandmarkForEventPacket() { Header = new LowHeader(); - Header.ID = 345; + Header.ID = 306; Header.Reliable = true; - Header.Zerocoded = true; - InventoryBlock = new InventoryBlockBlock(); - EventData = new EventDataBlock(); AgentData = new AgentDataBlock(); + EventData = new EventDataBlock(); + InventoryBlock = new InventoryBlockBlock(); } 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); + EventData = new EventDataBlock(bytes, ref i); + InventoryBlock = new InventoryBlockBlock(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); + EventData = new EventDataBlock(bytes, ref i); + InventoryBlock = new InventoryBlockBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += InventoryBlock.Length; length += EventData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += EventData.Length; length += InventoryBlock.Length;; 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); + EventData.ToBytes(bytes, ref i); + InventoryBlock.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -49310,9 +46113,9 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- CreateLandmarkForEvent ---" + Environment.NewLine; - output += InventoryBlock.ToString() + Environment.NewLine; - output += EventData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += EventData.ToString() + Environment.NewLine; + output += InventoryBlock.ToString() + Environment.NewLine; return output; } @@ -49371,7 +46174,7 @@ namespace libsecondlife.Packets public RegionHandleRequestPacket() { Header = new LowHeader(); - Header.ID = 348; + Header.ID = 309; Header.Reliable = true; RequestBlock = new RequestBlockBlock(); } @@ -49391,7 +46194,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += RequestBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -49475,7 +46278,7 @@ namespace libsecondlife.Packets public RegionIDAndHandleReplyPacket() { Header = new LowHeader(); - Header.ID = 349; + Header.ID = 310; Header.Reliable = true; ReplyBlock = new ReplyBlockBlock(); } @@ -49495,7 +46298,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ReplyBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -49518,100 +46321,6 @@ namespace libsecondlife.Packets /// public class MoneyTransferRequestPacket : Packet { - /// - [XmlType("moneytransferrequest_moneydata")] - public class MoneyDataBlock - { - public byte AggregatePermInventory; - public byte AggregatePermNextOwner; - public LLUUID DestID; - public int Amount; - private byte[] _description; - public byte[] Description - { - get { return _description; } - set - { - if (value == null) { _description = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - public byte Flags; - public LLUUID SourceID; - public int TransactionType; - - [XmlIgnore] - public int Length - { - get - { - int length = 43; - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - AggregatePermInventory = (byte)bytes[i++]; - AggregatePermNextOwner = (byte)bytes[i++]; - DestID = new LLUUID(bytes, i); i += 16; - Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _description = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; - bytes[i++] = Flags; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("AggregatePermInventory: {0}", AggregatePermInventory)); - output.AppendLine(String.Format("AggregatePermNextOwner: {0}", AggregatePermNextOwner)); - output.AppendLine(String.Format("DestID: {0}", DestID)); - output.AppendLine(String.Format("Amount: {0}", Amount)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("SourceID: {0}", SourceID)); - output.Append(String.Format("TransactionType: {0}", TransactionType)); - return output.ToString(); - } - } - /// [XmlType("moneytransferrequest_agentdata")] public class AgentDataBlock @@ -49658,87 +46367,56 @@ namespace libsecondlife.Packets } } - 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 = 350; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public MoneyTransferRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneyTransferRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneyTransferRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AdjustBalancePacket : Packet - { /// - [XmlType("adjustbalance_agentdata")] - public class AgentDataBlock + [XmlType("moneytransferrequest_moneydata")] + public class MoneyDataBlock { - public LLUUID AgentID; - public int Delta; + public LLUUID SourceID; + public LLUUID DestID; + public byte Flags; + public int Amount; + public byte AggregatePermNextOwner; + public byte AggregatePermInventory; + public int TransactionType; + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 20; + int length = 43; + if (Description != null) { length += 1 + Description.Length; } + return length; } } - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) + public MoneyDataBlock() { } + public MoneyDataBlock(byte[] bytes, ref int i) { + int length; try { - AgentID = new LLUUID(bytes, i); i += 16; - Delta = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + SourceID = new LLUUID(bytes, i); i += 16; + DestID = new LLUUID(bytes, i); i += 16; + Flags = (byte)bytes[i++]; + Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + AggregatePermNextOwner = (byte)bytes[i++]; + AggregatePermInventory = (byte)bytes[i++]; + TransactionType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; } catch (Exception) { @@ -49748,67 +46426,89 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(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); + Buffer.BlockCopy(SourceID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(DestID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = Flags; + 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++] = AggregatePermNextOwner; + bytes[i++] = AggregatePermInventory; + bytes[i++] = (byte)(TransactionType % 256); + bytes[i++] = (byte)((TransactionType >> 8) % 256); + bytes[i++] = (byte)((TransactionType >> 16) % 256); + bytes[i++] = (byte)((TransactionType >> 24) % 256); + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("Delta: {0}", Delta)); + output.AppendLine("-- MoneyData --"); + output.AppendLine(String.Format("SourceID: {0}", SourceID)); + output.AppendLine(String.Format("DestID: {0}", DestID)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("Amount: {0}", Amount)); + output.AppendLine(String.Format("AggregatePermNextOwner: {0}", AggregatePermNextOwner)); + output.AppendLine(String.Format("AggregatePermInventory: {0}", AggregatePermInventory)); + output.AppendLine(String.Format("TransactionType: {0}", TransactionType)); + Helpers.FieldToString(output, Description, "Description"); return output.ToString(); } } private Header header; public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AdjustBalance; } } + public override PacketType Type { get { return PacketType.MoneyTransferRequest; } } public AgentDataBlock AgentData; + public MoneyDataBlock MoneyData; - public AdjustBalancePacket() + public MoneyTransferRequestPacket() { Header = new LowHeader(); - Header.ID = 353; + Header.ID = 311; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); + MoneyData = new MoneyDataBlock(); } - public AdjustBalancePacket(byte[] bytes, ref int i) + public MoneyTransferRequestPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); } - public AdjustBalancePacket(Header head, byte[] bytes, ref int i) + public MoneyTransferRequestPacket(Header head, byte[] bytes, ref int i) { Header = head; AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += AgentData.Length;; + int length = 10; + length += AgentData.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); AgentData.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 = "--- AdjustBalance ---" + Environment.NewLine; + string output = "--- MoneyTransferRequest ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += MoneyData.ToString() + Environment.NewLine; return output; } @@ -49817,48 +46517,6 @@ namespace libsecondlife.Packets /// public class MoneyBalanceRequestPacket : Packet { - /// - [XmlType("moneybalancerequest_moneydata")] - public class MoneyDataBlock - { - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - try - { - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - /// [XmlType("moneybalancerequest_agentdata")] public class AgentDataBlock @@ -49905,47 +46563,88 @@ namespace libsecondlife.Packets } } + /// + [XmlType("moneybalancerequest_moneydata")] + public class MoneyDataBlock + { + public LLUUID TransactionID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public MoneyDataBlock() { } + public MoneyDataBlock(byte[] bytes, ref int i) + { + try + { + TransactionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- MoneyData --"); + output.Append(String.Format("TransactionID: {0}", TransactionID)); + return output.ToString(); + } + } + 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 MoneyDataBlock MoneyData; public MoneyBalanceRequestPacket() { Header = new LowHeader(); - Header.ID = 354; + Header.ID = 313; Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); AgentData = new AgentDataBlock(); + MoneyData = new MoneyDataBlock(); } 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); + MoneyData = new MoneyDataBlock(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); + MoneyData = new MoneyDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.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); - MoneyData.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + MoneyData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -49953,8 +46652,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- MoneyBalanceRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += MoneyData.ToString() + Environment.NewLine; return output; } @@ -49968,8 +46667,11 @@ namespace libsecondlife.Packets public class MoneyDataBlock { public LLUUID AgentID; + public LLUUID TransactionID; + public bool TransactionSuccess; public int MoneyBalance; public int SquareMetersCredit; + public int SquareMetersCommitted; private byte[] _description; public byte[] Description { @@ -49981,9 +46683,6 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public int SquareMetersCommitted; - public LLUUID TransactionID; - public bool TransactionSuccess; [XmlIgnore] public int Length @@ -50003,14 +46702,14 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; + TransactionID = new LLUUID(bytes, i); i += 16; + TransactionSuccess = (bytes[i++] != 0) ? (bool)true : (bool)false; 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)); + SquareMetersCommitted = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); length = (ushort)bytes[i++]; _description = new byte[length]; Buffer.BlockCopy(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) { @@ -50021,6 +46720,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((TransactionSuccess) ? 1 : 0); bytes[i++] = (byte)(MoneyBalance % 256); bytes[i++] = (byte)((MoneyBalance >> 8) % 256); bytes[i++] = (byte)((MoneyBalance >> 16) % 256); @@ -50029,15 +46730,13 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((TransactionSuccess) ? 1 : 0); + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; } public override string ToString() @@ -50045,13 +46744,12 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- MoneyData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("TransactionSuccess: {0}", TransactionSuccess)); output.AppendLine(String.Format("MoneyBalance: {0}", MoneyBalance)); output.AppendLine(String.Format("SquareMetersCredit: {0}", SquareMetersCredit)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("SquareMetersCommitted: {0}", SquareMetersCommitted)); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.Append(String.Format("TransactionSuccess: {0}", TransactionSuccess)); + Helpers.FieldToString(output, Description, "Description"); return output.ToString(); } } @@ -50064,9 +46762,8 @@ namespace libsecondlife.Packets public MoneyBalanceReplyPacket() { Header = new LowHeader(); - Header.ID = 355; + Header.ID = 314; Header.Reliable = true; - Header.Zerocoded = true; MoneyData = new MoneyDataBlock(); } @@ -50085,7 +46782,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += MoneyData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -50163,8 +46860,11 @@ namespace libsecondlife.Packets public class MoneyDataBlock { public LLUUID AgentID; + public LLUUID TransactionID; + public bool TransactionSuccess; public int MoneyBalance; public int SquareMetersCredit; + public int SquareMetersCommitted; private byte[] _description; public byte[] Description { @@ -50176,9 +46876,6 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public int SquareMetersCommitted; - public LLUUID TransactionID; - public bool TransactionSuccess; [XmlIgnore] public int Length @@ -50198,14 +46895,14 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; + TransactionID = new LLUUID(bytes, i); i += 16; + TransactionSuccess = (bytes[i++] != 0) ? (bool)true : (bool)false; 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)); + SquareMetersCommitted = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); length = (ushort)bytes[i++]; _description = new byte[length]; Buffer.BlockCopy(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) { @@ -50216,6 +46913,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((TransactionSuccess) ? 1 : 0); bytes[i++] = (byte)(MoneyBalance % 256); bytes[i++] = (byte)((MoneyBalance >> 8) % 256); bytes[i++] = (byte)((MoneyBalance >> 16) % 256); @@ -50224,15 +46923,13 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((TransactionSuccess) ? 1 : 0); + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; } public override string ToString() @@ -50240,13 +46937,12 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- MoneyData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("TransactionSuccess: {0}", TransactionSuccess)); output.AppendLine(String.Format("MoneyBalance: {0}", MoneyBalance)); output.AppendLine(String.Format("SquareMetersCredit: {0}", SquareMetersCredit)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("SquareMetersCommitted: {0}", SquareMetersCommitted)); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.Append(String.Format("TransactionSuccess: {0}", TransactionSuccess)); + Helpers.FieldToString(output, Description, "Description"); return output.ToString(); } } @@ -50260,9 +46956,8 @@ namespace libsecondlife.Packets public RoutedMoneyBalanceReplyPacket() { Header = new LowHeader(); - Header.ID = 356; + Header.ID = 315; Header.Reliable = true; - Header.Zerocoded = true; TargetBlock = new TargetBlockBlock(); MoneyData = new MoneyDataBlock(); } @@ -50284,7 +46979,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += TargetBlock.Length; length += MoneyData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -50306,1827 +47001,9 @@ namespace libsecondlife.Packets } - /// - public class MoneyHistoryRequestPacket : Packet - { - /// - [XmlType("moneyhistoryrequest_moneydata")] - public class MoneyDataBlock - { - public LLUUID AgentID; - public int StartPeriod; - public int EndPeriod; - - [XmlIgnore] - public int Length - { - get - { - return 24; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - StartPeriod = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - EndPeriod = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("StartPeriod: {0}", StartPeriod)); - output.Append(String.Format("EndPeriod: {0}", EndPeriod)); - return output.ToString(); - } - } - - 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 = 357; - Header.Reliable = true; - MoneyData = new MoneyDataBlock(); - } - - public MoneyHistoryRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - } - - public MoneyHistoryRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneyHistoryRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoneyHistoryReplyPacket : Packet - { - /// - [XmlType("moneyhistoryreply_moneydata")] - public class MoneyDataBlock - { - public int Balance; - public int TaxEstimate; - private byte[] _startdate; - public byte[] StartDate - { - get { return _startdate; } - set - { - if (value == null) { _startdate = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _startdate = new byte[value.Length]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } - } - } - public int StartPeriod; - public int StipendEstimate; - public int EndPeriod; - public int BonusEstimate; - - [XmlIgnore] - public int Length - { - get - { - int length = 24; - if (StartDate != null) { length += 1 + StartDate.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Balance = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - TaxEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _startdate = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("Balance: {0}", Balance)); - output.AppendLine(String.Format("TaxEstimate: {0}", TaxEstimate)); - Helpers.FieldToString(output, StartDate, "StartDate"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("StartPeriod: {0}", StartPeriod)); - output.AppendLine(String.Format("StipendEstimate: {0}", StipendEstimate)); - output.AppendLine(String.Format("EndPeriod: {0}", EndPeriod)); - output.Append(String.Format("BonusEstimate: {0}", BonusEstimate)); - return output.ToString(); - } - } - - /// - [XmlType("moneyhistoryreply_historydata")] - public class HistoryDataBlock - { - public int Amount; - private byte[] _description; - public byte[] Description - { - get { return _description; } - set - { - if (value == null) { _description = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 4; - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public HistoryDataBlock() { } - public HistoryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _description = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- HistoryData --"); - output.AppendLine(String.Format("Amount: {0}", Amount)); - Helpers.FieldToString(output, Description, "Description"); - return output.ToString(); - } - } - - /// - [XmlType("moneyhistoryreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - - 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 = 358; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - HistoryData = new HistoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public MoneyHistoryReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneyHistoryReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - bytes[i++] = (byte)HistoryData.Length; - for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneyHistoryReply ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - for (int j = 0; j < HistoryData.Length; j++) - { - output += HistoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoneySummaryRequestPacket : Packet - { - /// - [XmlType("moneysummaryrequest_moneydata")] - public class MoneyDataBlock - { - public LLUUID RequestID; - public int IntervalDays; - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - return 24; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - try - { - RequestID = new LLUUID(bytes, i); i += 16; - IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("moneysummaryrequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - 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 = 359; - Header.Reliable = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public MoneySummaryRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneySummaryRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneySummaryRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoneySummaryReplyPacket : Packet - { - /// - [XmlType("moneysummaryreply_moneydata")] - public class MoneyDataBlock - { - public int ParcelDirFeeCurrent; - private byte[] _taxdate; - public byte[] TaxDate - { - get { return _taxdate; } - set - { - if (value == null) { _taxdate = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _taxdate = new byte[value.Length]; Buffer.BlockCopy(value, 0, _taxdate, 0, 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]; Buffer.BlockCopy(value, 0, _lasttaxdate, 0, 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]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } - } - } - public int TotalCredits; - public int StipendEstimate; - public int CurrentInterval; - public int BonusEstimate; - - [XmlIgnore] - public int Length - { - get - { - int length = 84; - if (TaxDate != null) { length += 1 + TaxDate.Length; } - if (LastTaxDate != null) { length += 1 + LastTaxDate.Length; } - if (StartDate != null) { length += 1 + StartDate.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - ParcelDirFeeCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _taxdate = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _lasttaxdate, 0, length); i += length; - length = (ushort)bytes[i++]; - _startdate = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("ParcelDirFeeCurrent: {0}", ParcelDirFeeCurrent)); - Helpers.FieldToString(output, TaxDate, "TaxDate"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Balance: {0}", Balance)); - output.AppendLine(String.Format("ParcelDirFeeEstimate: {0}", ParcelDirFeeEstimate)); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("ObjectTaxCurrent: {0}", ObjectTaxCurrent)); - output.AppendLine(String.Format("LightTaxCurrent: {0}", LightTaxCurrent)); - output.AppendLine(String.Format("LandTaxCurrent: {0}", LandTaxCurrent)); - output.AppendLine(String.Format("GroupTaxCurrent: {0}", GroupTaxCurrent)); - output.AppendLine(String.Format("TotalDebits: {0}", TotalDebits)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - output.AppendLine(String.Format("ObjectTaxEstimate: {0}", ObjectTaxEstimate)); - output.AppendLine(String.Format("LightTaxEstimate: {0}", LightTaxEstimate)); - output.AppendLine(String.Format("LandTaxEstimate: {0}", LandTaxEstimate)); - output.AppendLine(String.Format("GroupTaxEstimate: {0}", GroupTaxEstimate)); - Helpers.FieldToString(output, LastTaxDate, "LastTaxDate"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, StartDate, "StartDate"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("TotalCredits: {0}", TotalCredits)); - output.AppendLine(String.Format("StipendEstimate: {0}", StipendEstimate)); - output.AppendLine(String.Format("CurrentInterval: {0}", CurrentInterval)); - output.Append(String.Format("BonusEstimate: {0}", BonusEstimate)); - return output.ToString(); - } - } - - /// - [XmlType("moneysummaryreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - - 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 = 360; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public MoneySummaryReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneySummaryReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneySummaryReply ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoneyDetailsRequestPacket : Packet - { - /// - [XmlType("moneydetailsrequest_moneydata")] - public class MoneyDataBlock - { - public LLUUID RequestID; - public int IntervalDays; - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - return 24; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - try - { - RequestID = new LLUUID(bytes, i); i += 16; - IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("moneydetailsrequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - 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 = 361; - Header.Reliable = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public MoneyDetailsRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneyDetailsRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneyDetailsRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoneyDetailsReplyPacket : Packet - { - /// - [XmlType("moneydetailsreply_moneydata")] - public class MoneyDataBlock - { - public LLUUID RequestID; - public int IntervalDays; - private byte[] _startdate; - public byte[] StartDate - { - get { return _startdate; } - set - { - if (value == null) { _startdate = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _startdate = new byte[value.Length]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } - } - } - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - int length = 24; - if (StartDate != null) { length += 1 + StartDate.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - RequestID = new LLUUID(bytes, i); i += 16; - IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _startdate = new byte[length]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - Helpers.FieldToString(output, StartDate, "StartDate"); - output.Append(Environment.NewLine); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("moneydetailsreply_historydata")] - public class HistoryDataBlock - { - public int Amount; - private byte[] _description; - public byte[] Description - { - get { return _description; } - set - { - if (value == null) { _description = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 4; - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public HistoryDataBlock() { } - public HistoryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _description = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- HistoryData --"); - output.AppendLine(String.Format("Amount: {0}", Amount)); - Helpers.FieldToString(output, Description, "Description"); - return output.ToString(); - } - } - - /// - [XmlType("moneydetailsreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - - 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 = 362; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - HistoryData = new HistoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public MoneyDetailsReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneyDetailsReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - bytes[i++] = (byte)HistoryData.Length; - for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneyDetailsReply ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - for (int j = 0; j < HistoryData.Length; j++) - { - output += HistoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoneyTransactionsRequestPacket : Packet - { - /// - [XmlType("moneytransactionsrequest_moneydata")] - public class MoneyDataBlock - { - public LLUUID RequestID; - public int IntervalDays; - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - return 24; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - try - { - RequestID = new LLUUID(bytes, i); i += 16; - IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("moneytransactionsrequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - 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 = 363; - Header.Reliable = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public MoneyTransactionsRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneyTransactionsRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneyTransactionsRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MoneyTransactionsReplyPacket : Packet - { - /// - [XmlType("moneytransactionsreply_moneydata")] - public class MoneyDataBlock - { - public LLUUID RequestID; - public int IntervalDays; - private byte[] _startdate; - public byte[] StartDate - { - get { return _startdate; } - set - { - if (value == null) { _startdate = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _startdate = new byte[value.Length]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } - } - } - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - int length = 24; - if (StartDate != null) { length += 1 + StartDate.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - RequestID = new LLUUID(bytes, i); i += 16; - IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _startdate = new byte[length]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - Helpers.FieldToString(output, StartDate, "StartDate"); - output.Append(Environment.NewLine); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("moneytransactionsreply_historydata")] - public class HistoryDataBlock - { - private byte[] _time; - public byte[] Time - { - get { return _time; } - set - { - if (value == null) { _time = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _time = new byte[value.Length]; Buffer.BlockCopy(value, 0, _time, 0, 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]; Buffer.BlockCopy(value, 0, _item, 0, 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]; Buffer.BlockCopy(value, 0, _user, 0, value.Length); } - } - } - public int Type; - public int Amount; - - [XmlIgnore] - public int Length - { - get - { - int length = 8; - if (Time != null) { length += 1 + Time.Length; } - if (Item != null) { length += 1 + Item.Length; } - if (User != null) { length += 1 + User.Length; } - return length; - } - } - - public HistoryDataBlock() { } - public HistoryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _time = new byte[length]; - Buffer.BlockCopy(bytes, i, _time, 0, length); i += length; - length = (ushort)bytes[i++]; - _item = new byte[length]; - Buffer.BlockCopy(bytes, i, _item, 0, length); i += length; - length = (ushort)bytes[i++]; - _user = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- HistoryData --"); - Helpers.FieldToString(output, Time, "Time"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Item, "Item"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, User, "User"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("Amount: {0}", Amount)); - return output.ToString(); - } - } - - /// - [XmlType("moneytransactionsreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - - 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 = 364; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - HistoryData = new HistoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public MoneyTransactionsReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MoneyTransactionsReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - bytes[i++] = (byte)HistoryData.Length; - for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MoneyTransactionsReply ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - for (int j = 0; j < HistoryData.Length; j++) - { - output += HistoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - /// public class ActivateGesturesPacket : Packet { - /// - [XmlType("activategestures_data")] - public class DataBlock - { - public LLUUID AssetID; - public uint GestureFlags; - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - AssetID = new LLUUID(bytes, i); i += 16; - GestureFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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); - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.AppendLine(String.Format("AssetID: {0}", AssetID)); - output.AppendLine(String.Format("GestureFlags: {0}", GestureFlags)); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("activategestures_agentdata")] public class AgentDataBlock @@ -52180,88 +47057,20 @@ namespace libsecondlife.Packets } } - 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 = 365; - Header.Reliable = true; - Data = new DataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public ActivateGesturesPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ActivateGesturesPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)Data.Length; - for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ActivateGestures ---" + Environment.NewLine; - for (int j = 0; j < Data.Length; j++) - { - output += Data[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class DeactivateGesturesPacket : Packet - { /// - [XmlType("deactivategestures_data")] + [XmlType("activategestures_data")] public class DataBlock { - public uint GestureFlags; public LLUUID ItemID; + public LLUUID AssetID; + public uint GestureFlags; [XmlIgnore] public int Length { get { - return 20; + return 36; } } @@ -52270,8 +47079,9 @@ namespace libsecondlife.Packets { try { - GestureFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); ItemID = new LLUUID(bytes, i); i += 16; + AssetID = new LLUUID(bytes, i); i += 16; + GestureFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -52281,23 +47091,94 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(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); - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); - output.AppendLine(String.Format("GestureFlags: {0}", GestureFlags)); - output.Append(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.Append(String.Format("GestureFlags: {0}", GestureFlags)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ActivateGestures; } } + public AgentDataBlock AgentData; + public DataBlock[] Data; + + public ActivateGesturesPacket() + { + Header = new LowHeader(); + Header.ID = 316; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock[0]; + } + + public ActivateGesturesPacket(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++]; + Data = new DataBlock[count]; + for (int j = 0; j < count; j++) + { Data[j] = new DataBlock(bytes, ref i); } + } + + public ActivateGesturesPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(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); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.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 = "--- ActivateGestures ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < Data.Length; j++) + { + output += Data[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class DeactivateGesturesPacket : Packet + { /// [XmlType("deactivategestures_agentdata")] public class AgentDataBlock @@ -52351,45 +47232,94 @@ namespace libsecondlife.Packets } } + /// + [XmlType("deactivategestures_data")] + public class DataBlock + { + public LLUUID ItemID; + public uint GestureFlags; + + [XmlIgnore] + public int Length + { + get + { + return 20; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + try + { + ItemID = new LLUUID(bytes, i); i += 16; + GestureFlags = (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) + { + Buffer.BlockCopy(ItemID.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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.Append(String.Format("GestureFlags: {0}", GestureFlags)); + return output.ToString(); + } + } + 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 DataBlock[] Data; public DeactivateGesturesPacket() { Header = new LowHeader(); - Header.ID = 366; + Header.ID = 317; Header.Reliable = true; - Data = new DataBlock[0]; AgentData = new AgentDataBlock(); + Data = new DataBlock[0]; } public DeactivateGesturesPacket(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++]; 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; + AgentData = new AgentDataBlock(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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } @@ -52397,9 +47327,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -52407,11 +47337,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- DeactivateGestures ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < Data.Length; j++) { output += Data[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -52491,7 +47421,7 @@ namespace libsecondlife.Packets public MuteListUpdatePacket() { Header = new LowHeader(); - Header.ID = 367; + Header.ID = 318; Header.Reliable = true; MuteData = new MuteDataBlock(); } @@ -52511,7 +47441,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += MuteData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -52584,7 +47514,7 @@ namespace libsecondlife.Packets public UseCachedMuteListPacket() { Header = new LowHeader(); - Header.ID = 368; + Header.ID = 319; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -52604,7 +47534,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -52627,55 +47557,6 @@ namespace libsecondlife.Packets /// public class GrantUserRightsPacket : Packet { - /// - [XmlType("grantuserrights_rights")] - public class RightsBlock - { - public int RelatedRights; - public LLUUID AgentRelated; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public RightsBlock() { } - public RightsBlock(byte[] bytes, ref int i) - { - try - { - RelatedRights = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - AgentRelated = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(RelatedRights % 256); - bytes[i++] = (byte)((RelatedRights >> 8) % 256); - bytes[i++] = (byte)((RelatedRights >> 16) % 256); - bytes[i++] = (byte)((RelatedRights >> 24) % 256); - Buffer.BlockCopy(AgentRelated.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Rights --"); - output.AppendLine(String.Format("RelatedRights: {0}", RelatedRights)); - output.Append(String.Format("AgentRelated: {0}", AgentRelated)); - return output.ToString(); - } - } - /// [XmlType("grantuserrights_agentdata")] public class AgentDataBlock @@ -52722,81 +47603,12 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.GrantUserRights; } } - public RightsBlock[] Rights; - public AgentDataBlock AgentData; - - public GrantUserRightsPacket() - { - Header = new LowHeader(); - Header.ID = 369; - Header.Reliable = true; - Rights = new RightsBlock[0]; - AgentData = new AgentDataBlock(); - } - - public GrantUserRightsPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - Rights = new RightsBlock[count]; - for (int j = 0; j < count; j++) - { Rights[j] = new RightsBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GrantUserRightsPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - Rights = new RightsBlock[count]; - for (int j = 0; j < count; j++) - { Rights[j] = new RightsBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < Rights.Length; j++) { length += Rights[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)Rights.Length; - for (int j = 0; j < Rights.Length; j++) { Rights[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GrantUserRights ---" + Environment.NewLine; - for (int j = 0; j < Rights.Length; j++) - { - output += Rights[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ChangeUserRightsPacket : Packet - { /// - [XmlType("changeuserrights_rights")] + [XmlType("grantuserrights_rights")] public class RightsBlock { - public int RelatedRights; public LLUUID AgentRelated; + public int RelatedRights; [XmlIgnore] public int Length @@ -52812,8 +47624,8 @@ namespace libsecondlife.Packets { try { - RelatedRights = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); AgentRelated = new LLUUID(bytes, i); i += 16; + RelatedRights = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -52823,23 +47635,92 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(AgentRelated.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(RelatedRights % 256); bytes[i++] = (byte)((RelatedRights >> 8) % 256); bytes[i++] = (byte)((RelatedRights >> 16) % 256); bytes[i++] = (byte)((RelatedRights >> 24) % 256); - Buffer.BlockCopy(AgentRelated.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- Rights --"); - output.AppendLine(String.Format("RelatedRights: {0}", RelatedRights)); - output.Append(String.Format("AgentRelated: {0}", AgentRelated)); + output.AppendLine(String.Format("AgentRelated: {0}", AgentRelated)); + output.Append(String.Format("RelatedRights: {0}", RelatedRights)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GrantUserRights; } } + public AgentDataBlock AgentData; + public RightsBlock[] Rights; + + public GrantUserRightsPacket() + { + Header = new LowHeader(); + Header.ID = 320; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Rights = new RightsBlock[0]; + } + + public GrantUserRightsPacket(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++]; + Rights = new RightsBlock[count]; + for (int j = 0; j < count; j++) + { Rights[j] = new RightsBlock(bytes, ref i); } + } + + public GrantUserRightsPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + Rights = new RightsBlock[count]; + for (int j = 0; j < count; j++) + { Rights[j] = new RightsBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length;; + length++; + for (int j = 0; j < Rights.Length; j++) { length += Rights[j].Length; } + if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } + byte[] bytes = new byte[length]; + int i = 0; + header.ToBytes(bytes, ref i); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)Rights.Length; + for (int j = 0; j < Rights.Length; j++) { Rights[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- GrantUserRights ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < Rights.Length; j++) + { + output += Rights[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ChangeUserRightsPacket : Packet + { /// [XmlType("changeuserrights_agentdata")] public class AgentDataBlock @@ -52882,45 +47763,94 @@ namespace libsecondlife.Packets } } + /// + [XmlType("changeuserrights_rights")] + public class RightsBlock + { + public LLUUID AgentRelated; + public int RelatedRights; + + [XmlIgnore] + public int Length + { + get + { + return 20; + } + } + + public RightsBlock() { } + public RightsBlock(byte[] bytes, ref int i) + { + try + { + AgentRelated = new LLUUID(bytes, i); i += 16; + RelatedRights = (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) + { + Buffer.BlockCopy(AgentRelated.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(RelatedRights % 256); + bytes[i++] = (byte)((RelatedRights >> 8) % 256); + bytes[i++] = (byte)((RelatedRights >> 16) % 256); + bytes[i++] = (byte)((RelatedRights >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Rights --"); + output.AppendLine(String.Format("AgentRelated: {0}", AgentRelated)); + output.Append(String.Format("RelatedRights: {0}", RelatedRights)); + return output.ToString(); + } + } + private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.ChangeUserRights; } } - public RightsBlock[] Rights; public AgentDataBlock AgentData; + public RightsBlock[] Rights; public ChangeUserRightsPacket() { Header = new LowHeader(); - Header.ID = 370; + Header.ID = 321; Header.Reliable = true; - Rights = new RightsBlock[0]; AgentData = new AgentDataBlock(); + Rights = new RightsBlock[0]; } public ChangeUserRightsPacket(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++]; Rights = new RightsBlock[count]; for (int j = 0; j < count; j++) { Rights[j] = new RightsBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); } public ChangeUserRightsPacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); int count = (int)bytes[i++]; Rights = new RightsBlock[count]; for (int j = 0; j < count; j++) { Rights[j] = new RightsBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < Rights.Length; j++) { length += Rights[j].Length; } @@ -52928,9 +47858,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.ToBytes(bytes, ref i); bytes[i++] = (byte)Rights.Length; for (int j = 0; j < Rights.Length; j++) { Rights[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -52938,11 +47868,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ChangeUserRights ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < Rights.Length; j++) { output += Rights[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -53001,7 +47931,7 @@ namespace libsecondlife.Packets public OnlineNotificationPacket() { Header = new LowHeader(); - Header.ID = 371; + Header.ID = 322; Header.Reliable = true; AgentBlock = new AgentBlockBlock[0]; } @@ -53027,7 +47957,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < AgentBlock.Length; j++) { length += AgentBlock[j].Length; } @@ -53106,7 +48036,7 @@ namespace libsecondlife.Packets public OfflineNotificationPacket() { Header = new LowHeader(); - Header.ID = 372; + Header.ID = 323; Header.Reliable = true; AgentBlock = new AgentBlockBlock[0]; } @@ -53132,7 +48062,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < AgentBlock.Length; j++) { length += AgentBlock[j].Length; } @@ -53161,81 +48091,6 @@ namespace libsecondlife.Packets /// public class SetStartLocationRequestPacket : Packet { - /// - [XmlType("setstartlocationrequest_startlocationdata")] - public class StartLocationDataBlock - { - public LLVector3 LocationPos; - private byte[] _simname; - public byte[] SimName - { - get { return _simname; } - set - { - if (value == null) { _simname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _simname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } - } - } - public uint LocationID; - public LLVector3 LocationLookAt; - - [XmlIgnore] - public int Length - { - get - { - int length = 28; - if (SimName != null) { length += 1 + SimName.Length; } - return length; - } - } - - public StartLocationDataBlock() { } - public StartLocationDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - LocationPos = new LLVector3(bytes, i); i += 12; - length = (ushort)bytes[i++]; - _simname = new byte[length]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- StartLocationData --"); - output.AppendLine(String.Format("LocationPos: {0}", LocationPos)); - Helpers.FieldToString(output, SimName, "SimName"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("LocationID: {0}", LocationID)); - output.Append(String.Format("LocationLookAt: {0}", LocationLookAt)); - return output.ToString(); - } - } - /// [XmlType("setstartlocationrequest_agentdata")] public class AgentDataBlock @@ -53282,47 +48137,121 @@ namespace libsecondlife.Packets } } + /// + [XmlType("setstartlocationrequest_startlocationdata")] + public class StartLocationDataBlock + { + 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]; Buffer.BlockCopy(value, 0, _simname, 0, value.Length); } + } + } + public uint LocationID; + public LLVector3 LocationPos; + public LLVector3 LocationLookAt; + + [XmlIgnore] + public int Length + { + get + { + int length = 28; + if (SimName != null) { length += 1 + SimName.Length; } + return length; + } + } + + public StartLocationDataBlock() { } + public StartLocationDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + length = (ushort)bytes[i++]; + _simname = new byte[length]; + Buffer.BlockCopy(bytes, i, _simname, 0, length); i += length; + LocationID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + LocationPos = new LLVector3(bytes, i); i += 12; + LocationLookAt = 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; + Buffer.BlockCopy(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); + Buffer.BlockCopy(LocationPos.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LocationLookAt.GetBytes(), 0, bytes, i, 12); i += 12; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- StartLocationData --"); + Helpers.FieldToString(output, SimName, "SimName"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("LocationID: {0}", LocationID)); + output.AppendLine(String.Format("LocationPos: {0}", LocationPos)); + output.Append(String.Format("LocationLookAt: {0}", LocationLookAt)); + return output.ToString(); + } + } + 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 StartLocationDataBlock StartLocationData; public SetStartLocationRequestPacket() { Header = new LowHeader(); - Header.ID = 373; + Header.ID = 324; Header.Reliable = true; - Header.Zerocoded = true; - StartLocationData = new StartLocationDataBlock(); AgentData = new AgentDataBlock(); + StartLocationData = new StartLocationDataBlock(); } 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); + StartLocationData = new StartLocationDataBlock(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); + StartLocationData = new StartLocationDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += StartLocationData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + StartLocationData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -53330,8 +48259,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- SetStartLocationRequest ---" + Environment.NewLine; - output += StartLocationData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += StartLocationData.ToString() + Environment.NewLine; return output; } @@ -53344,8 +48273,10 @@ namespace libsecondlife.Packets [XmlType("assetuploadrequest_assetblock")] public class AssetBlockBlock { + public LLUUID TransactionID; public sbyte Type; public bool Tempfile; + public bool StoreLocal; private byte[] _assetdata; public byte[] AssetData { @@ -53357,8 +48288,6 @@ namespace libsecondlife.Packets else { _assetdata = new byte[value.Length]; Buffer.BlockCopy(value, 0, _assetdata, 0, value.Length); } } } - public LLUUID TransactionID; - public bool StoreLocal; [XmlIgnore] public int Length @@ -53377,13 +48306,13 @@ namespace libsecondlife.Packets int length; try { + TransactionID = new LLUUID(bytes, i); i += 16; Type = (sbyte)bytes[i++]; Tempfile = (bytes[i++] != 0) ? (bool)true : (bool)false; + StoreLocal = (bytes[i++] != 0) ? (bool)true : (bool)false; length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _assetdata = new byte[length]; Buffer.BlockCopy(bytes, i, _assetdata, 0, length); i += length; - TransactionID = new LLUUID(bytes, i); i += 16; - StoreLocal = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -53393,26 +48322,25 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)Type; bytes[i++] = (byte)((Tempfile) ? 1 : 0); + bytes[i++] = (byte)((StoreLocal) ? 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); Buffer.BlockCopy(AssetData, 0, bytes, i, AssetData.Length); i += AssetData.Length; - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((StoreLocal) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AssetBlock --"); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); output.AppendLine(String.Format("Type: {0}", Type)); output.AppendLine(String.Format("Tempfile: {0}", Tempfile)); + output.AppendLine(String.Format("StoreLocal: {0}", StoreLocal)); Helpers.FieldToString(output, AssetData, "AssetData"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); - output.Append(String.Format("StoreLocal: {0}", StoreLocal)); return output.ToString(); } } @@ -53425,7 +48353,7 @@ namespace libsecondlife.Packets public AssetUploadRequestPacket() { Header = new LowHeader(); - Header.ID = 383; + Header.ID = 333; Header.Reliable = true; AssetBlock = new AssetBlockBlock(); } @@ -53445,7 +48373,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AssetBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -53473,8 +48401,8 @@ namespace libsecondlife.Packets public class AssetBlockBlock { public LLUUID UUID; - public bool Success; public sbyte Type; + public bool Success; [XmlIgnore] public int Length @@ -53491,8 +48419,8 @@ namespace libsecondlife.Packets try { UUID = new LLUUID(bytes, i); i += 16; - Success = (bytes[i++] != 0) ? (bool)true : (bool)false; Type = (sbyte)bytes[i++]; + Success = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -53503,8 +48431,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(UUID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((Success) ? 1 : 0); bytes[i++] = (byte)Type; + bytes[i++] = (byte)((Success) ? 1 : 0); } public override string ToString() @@ -53512,8 +48440,8 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- AssetBlock --"); output.AppendLine(String.Format("UUID: {0}", UUID)); - output.AppendLine(String.Format("Success: {0}", Success)); - output.Append(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.Append(String.Format("Success: {0}", Success)); return output.ToString(); } } @@ -53526,7 +48454,7 @@ namespace libsecondlife.Packets public AssetUploadCompletePacket() { Header = new LowHeader(); - Header.ID = 384; + Header.ID = 334; Header.Reliable = true; AssetBlock = new AssetBlockBlock(); } @@ -53546,7 +48474,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AssetBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -53566,433 +48494,6 @@ namespace libsecondlife.Packets } - /// - public class ReputationAgentAssignPacket : Packet - { - /// - [XmlType("reputationagentassign_datablock")] - public class DataBlockBlock - { - public LLUUID RateeID; - public LLUUID RatorID; - public float Appearance; - public float Behavior; - public float Building; - - [XmlIgnore] - public int Length - { - get - { - return 44; - } - } - - public DataBlockBlock() { } - public DataBlockBlock(byte[] bytes, ref int i) - { - try - { - RateeID = new LLUUID(bytes, i); i += 16; - RatorID = new LLUUID(bytes, i); i += 16; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Appearance = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Behavior = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Building = BitConverter.ToSingle(bytes, i); i += 4; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - Buffer.BlockCopy(RateeID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(RatorID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(Appearance); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(Behavior); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(Building); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- DataBlock --"); - output.AppendLine(String.Format("RateeID: {0}", RateeID)); - output.AppendLine(String.Format("RatorID: {0}", RatorID)); - output.AppendLine(String.Format("Appearance: {0}", Appearance)); - output.AppendLine(String.Format("Behavior: {0}", Behavior)); - output.Append(String.Format("Building: {0}", Building)); - return output.ToString(); - } - } - - 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 = 385; - Header.Reliable = true; - DataBlock = new DataBlockBlock(); - } - - public ReputationAgentAssignPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - DataBlock = new DataBlockBlock(bytes, ref i); - } - - public ReputationAgentAssignPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - DataBlock = new DataBlockBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += DataBlock.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - DataBlock.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ReputationAgentAssign ---" + Environment.NewLine; - output += DataBlock.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ReputationIndividualRequestPacket : Packet - { - /// - [XmlType("reputationindividualrequest_reputationdata")] - public class ReputationDataBlock - { - public LLUUID ToID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public ReputationDataBlock() { } - public ReputationDataBlock(byte[] bytes, ref int i) - { - try - { - ToID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ToID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ReputationData --"); - output.Append(String.Format("ToID: {0}", ToID)); - return output.ToString(); - } - } - - /// - [XmlType("reputationindividualrequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - - 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 AgentDataBlock AgentData; - - public ReputationIndividualRequestPacket() - { - Header = new LowHeader(); - Header.ID = 386; - Header.Reliable = true; - ReputationData = new ReputationDataBlock(); - AgentData = new AgentDataBlock(); - } - - 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); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ReputationIndividualRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ReputationData = new ReputationDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ReputationData.Length; length += AgentData.Length;; - 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); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ReputationIndividualRequest ---" + Environment.NewLine; - output += ReputationData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ReputationIndividualReplyPacket : Packet - { - /// - [XmlType("reputationindividualreply_reputationdata")] - public class ReputationDataBlock - { - public float Appearance; - public LLUUID ToID; - public float Behavior; - public float Building; - - [XmlIgnore] - public int Length - { - get - { - return 28; - } - } - - 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; - 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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(ToID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(Behavior); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(Building); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ReputationData --"); - output.AppendLine(String.Format("Appearance: {0}", Appearance)); - output.AppendLine(String.Format("ToID: {0}", ToID)); - output.AppendLine(String.Format("Behavior: {0}", Behavior)); - output.Append(String.Format("Building: {0}", Building)); - return output.ToString(); - } - } - - /// - [XmlType("reputationindividualreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - - 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 AgentDataBlock AgentData; - - public ReputationIndividualReplyPacket() - { - Header = new LowHeader(); - Header.ID = 387; - Header.Reliable = true; - ReputationData = new ReputationDataBlock(); - AgentData = new AgentDataBlock(); - } - - 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); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ReputationIndividualReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ReputationData = new ReputationDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ReputationData.Length; length += AgentData.Length;; - 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); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ReputationIndividualReply ---" + Environment.NewLine; - output += ReputationData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - /// public class CreateGroupRequestPacket : Packet { @@ -54046,7 +48547,17 @@ namespace libsecondlife.Packets [XmlType("creategrouprequest_groupdata")] public class GroupDataBlock { - public bool AllowPublish; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } private byte[] _charter; public byte[] Charter { @@ -54059,21 +48570,11 @@ namespace libsecondlife.Packets } } 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } public LLUUID InsigniaID; public int MembershipFee; - public bool MaturePublish; public bool OpenEnrollment; + public bool AllowPublish; + public bool MaturePublish; [XmlIgnore] public int Length @@ -54081,8 +48582,8 @@ namespace libsecondlife.Packets get { int length = 24; - if (Charter != null) { length += 2 + Charter.Length; } if (Name != null) { length += 1 + Name.Length; } + if (Charter != null) { length += 2 + Charter.Length; } return length; } } @@ -54093,18 +48594,18 @@ namespace libsecondlife.Packets int length; try { - AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _charter = new byte[length]; Buffer.BlockCopy(bytes, i, _charter, 0, length); i += length; ShowInList = (bytes[i++] != 0) ? (bool)true : (bool)false; - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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; + AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -54114,38 +48615,38 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((AllowPublish) ? 1 : 0); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; 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); Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; Buffer.BlockCopy(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); + bytes[i++] = (byte)((AllowPublish) ? 1 : 0); + bytes[i++] = (byte)((MaturePublish) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); Helpers.FieldToString(output, Charter, "Charter"); output.Append(Environment.NewLine); output.AppendLine(String.Format("ShowInList: {0}", ShowInList)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("InsigniaID: {0}", InsigniaID)); output.AppendLine(String.Format("MembershipFee: {0}", MembershipFee)); - output.AppendLine(String.Format("MaturePublish: {0}", MaturePublish)); - output.Append(String.Format("OpenEnrollment: {0}", OpenEnrollment)); + output.AppendLine(String.Format("OpenEnrollment: {0}", OpenEnrollment)); + output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); + output.Append(String.Format("MaturePublish: {0}", MaturePublish)); return output.ToString(); } } @@ -54159,9 +48660,8 @@ namespace libsecondlife.Packets public CreateGroupRequestPacket() { Header = new LowHeader(); - Header.ID = 392; + Header.ID = 339; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); } @@ -54183,7 +48683,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -54208,74 +48708,6 @@ namespace libsecondlife.Packets /// public class CreateGroupReplyPacket : Packet { - /// - [XmlType("creategroupreply_replydata")] - public class ReplyDataBlock - { - private byte[] _message; - public byte[] Message - { - get { return _message; } - set - { - if (value == null) { _message = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } - } - } - public bool Success; - public LLUUID GroupID; - - [XmlIgnore] - public int Length - { - get - { - int length = 17; - if (Message != null) { length += 1 + Message.Length; } - return length; - } - } - - public ReplyDataBlock() { } - public ReplyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _message = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; - bytes[i++] = (byte)((Success) ? 1 : 0); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ReplyData --"); - Helpers.FieldToString(output, Message, "Message"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Success: {0}", Success)); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - /// [XmlType("creategroupreply_agentdata")] public class AgentDataBlock @@ -54318,46 +48750,113 @@ namespace libsecondlife.Packets } } + /// + [XmlType("creategroupreply_replydata")] + public class ReplyDataBlock + { + public LLUUID GroupID; + public bool Success; + 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]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 17; + if (Message != null) { length += 1 + Message.Length; } + return length; + } + } + + public ReplyDataBlock() { } + public ReplyDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + GroupID = new LLUUID(bytes, i); i += 16; + Success = (bytes[i++] != 0) ? (bool)true : (bool)false; + length = (ushort)bytes[i++]; + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Success) ? 1 : 0); + if(Message == null) { Console.WriteLine("Warning: Message is null, in " + this.GetType()); } + bytes[i++] = (byte)Message.Length; + Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ReplyData --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("Success: {0}", Success)); + Helpers.FieldToString(output, Message, "Message"); + return output.ToString(); + } + } + 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 ReplyDataBlock ReplyData; public CreateGroupReplyPacket() { Header = new LowHeader(); - Header.ID = 393; + Header.ID = 340; Header.Reliable = true; - ReplyData = new ReplyDataBlock(); AgentData = new AgentDataBlock(); + ReplyData = new ReplyDataBlock(); } 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); + ReplyData = new ReplyDataBlock(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); + ReplyData = new ReplyDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ReplyData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + ReplyData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -54365,8 +48864,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- CreateGroupReply ---" + Environment.NewLine; - output += ReplyData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ReplyData.ToString() + Environment.NewLine; return output; } @@ -54425,7 +48924,7 @@ namespace libsecondlife.Packets [XmlType("updategroupinfo_groupdata")] public class GroupDataBlock { - public bool AllowPublish; + public LLUUID GroupID; private byte[] _charter; public byte[] Charter { @@ -54439,10 +48938,10 @@ namespace libsecondlife.Packets } public bool ShowInList; public LLUUID InsigniaID; - public LLUUID GroupID; public int MembershipFee; - public bool MaturePublish; public bool OpenEnrollment; + public bool AllowPublish; + public bool MaturePublish; [XmlIgnore] public int Length @@ -54461,16 +48960,16 @@ namespace libsecondlife.Packets int length; try { - AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + GroupID = new LLUUID(bytes, i); i += 16; length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _charter = new byte[length]; Buffer.BlockCopy(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; + AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -54480,35 +48979,35 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((AllowPublish) ? 1 : 0); + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; 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); Buffer.BlockCopy(Charter, 0, bytes, i, Charter.Length); i += Charter.Length; bytes[i++] = (byte)((ShowInList) ? 1 : 0); Buffer.BlockCopy(InsigniaID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); + bytes[i++] = (byte)((AllowPublish) ? 1 : 0); + bytes[i++] = (byte)((MaturePublish) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); Helpers.FieldToString(output, Charter, "Charter"); output.Append(Environment.NewLine); output.AppendLine(String.Format("ShowInList: {0}", ShowInList)); output.AppendLine(String.Format("InsigniaID: {0}", InsigniaID)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); output.AppendLine(String.Format("MembershipFee: {0}", MembershipFee)); - output.AppendLine(String.Format("MaturePublish: {0}", MaturePublish)); - output.Append(String.Format("OpenEnrollment: {0}", OpenEnrollment)); + output.AppendLine(String.Format("OpenEnrollment: {0}", OpenEnrollment)); + output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); + output.Append(String.Format("MaturePublish: {0}", MaturePublish)); return output.ToString(); } } @@ -54522,9 +49021,8 @@ namespace libsecondlife.Packets public UpdateGroupInfoPacket() { Header = new LowHeader(); - Header.ID = 394; + Header.ID = 341; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); } @@ -54546,7 +49044,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -54571,59 +49069,6 @@ namespace libsecondlife.Packets /// public class GroupRoleChangesPacket : Packet { - /// - [XmlType("grouprolechanges_rolechange")] - public class RoleChangeBlock - { - public LLUUID MemberID; - public uint Change; - public LLUUID RoleID; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public RoleChangeBlock() { } - public RoleChangeBlock(byte[] bytes, ref int i) - { - try - { - MemberID = new LLUUID(bytes, i); i += 16; - Change = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - RoleID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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); - Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RoleChange --"); - output.AppendLine(String.Format("MemberID: {0}", MemberID)); - output.AppendLine(String.Format("Change: {0}", Change)); - output.Append(String.Format("RoleID: {0}", RoleID)); - return output.ToString(); - } - } - /// [XmlType("grouprolechanges_agentdata")] public class AgentDataBlock @@ -54674,45 +49119,98 @@ namespace libsecondlife.Packets } } + /// + [XmlType("grouprolechanges_rolechange")] + public class RoleChangeBlock + { + public LLUUID RoleID; + public LLUUID MemberID; + public uint Change; + + [XmlIgnore] + public int Length + { + get + { + return 36; + } + } + + public RoleChangeBlock() { } + public RoleChangeBlock(byte[] bytes, ref int i) + { + try + { + RoleID = new LLUUID(bytes, i); i += 16; + MemberID = new LLUUID(bytes, i); i += 16; + Change = (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) + { + Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(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); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RoleChange --"); + output.AppendLine(String.Format("RoleID: {0}", RoleID)); + output.AppendLine(String.Format("MemberID: {0}", MemberID)); + output.Append(String.Format("Change: {0}", Change)); + return output.ToString(); + } + } + 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 RoleChangeBlock[] RoleChange; public GroupRoleChangesPacket() { Header = new LowHeader(); - Header.ID = 395; + Header.ID = 342; Header.Reliable = true; - RoleChange = new RoleChangeBlock[0]; AgentData = new AgentDataBlock(); + RoleChange = new RoleChangeBlock[0]; } public GroupRoleChangesPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < RoleChange.Length; j++) { length += RoleChange[j].Length; } @@ -54720,9 +49218,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -54730,11 +49228,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupRoleChanges ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < RoleChange.Length; j++) { output += RoleChange[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -54840,9 +49338,8 @@ namespace libsecondlife.Packets public JoinGroupRequestPacket() { Header = new LowHeader(); - Header.ID = 396; + Header.ID = 343; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); } @@ -54864,7 +49361,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -54935,8 +49432,8 @@ namespace libsecondlife.Packets [XmlType("joingroupreply_groupdata")] public class GroupDataBlock { - public bool Success; public LLUUID GroupID; + public bool Success; [XmlIgnore] public int Length @@ -54952,8 +49449,8 @@ namespace libsecondlife.Packets { try { - Success = (bytes[i++] != 0) ? (bool)true : (bool)false; GroupID = new LLUUID(bytes, i); i += 16; + Success = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -54963,16 +49460,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((Success) ? 1 : 0); Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Success) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("Success: {0}", Success)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("Success: {0}", Success)); return output.ToString(); } } @@ -54986,7 +49483,7 @@ namespace libsecondlife.Packets public JoinGroupReplyPacket() { Header = new LowHeader(); - Header.ID = 397; + Header.ID = 344; Header.Reliable = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); @@ -55009,7 +49506,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -55080,48 +49577,6 @@ namespace libsecondlife.Packets } } - /// - [XmlType("ejectgroupmemberrequest_ejectdata")] - public class EjectDataBlock - { - public LLUUID EjecteeID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public EjectDataBlock() { } - public EjectDataBlock(byte[] bytes, ref int i) - { - try - { - EjecteeID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(EjecteeID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- EjectData --"); - output.Append(String.Format("EjecteeID: {0}", EjecteeID)); - return output.ToString(); - } - } - /// [XmlType("ejectgroupmemberrequest_groupdata")] public class GroupDataBlock @@ -55164,21 +49619,63 @@ namespace libsecondlife.Packets } } + /// + [XmlType("ejectgroupmemberrequest_ejectdata")] + public class EjectDataBlock + { + public LLUUID EjecteeID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public EjectDataBlock() { } + public EjectDataBlock(byte[] bytes, ref int i) + { + try + { + EjecteeID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(EjecteeID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- EjectData --"); + output.Append(String.Format("EjecteeID: {0}", EjecteeID)); + return output.ToString(); + } + } + 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 EjectDataBlock[] EjectData; public EjectGroupMemberRequestPacket() { Header = new LowHeader(); - Header.ID = 398; + Header.ID = 345; Header.Reliable = true; AgentData = new AgentDataBlock(); - EjectData = new EjectDataBlock[0]; GroupData = new GroupDataBlock(); + EjectData = new EjectDataBlock[0]; } public EjectGroupMemberRequestPacket(byte[] bytes, ref int i) @@ -55186,27 +49683,27 @@ namespace libsecondlife.Packets 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); 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); + GroupData = new GroupDataBlock(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; + int length = 10; length += AgentData.Length; length += GroupData.Length;; length++; for (int j = 0; j < EjectData.Length; j++) { length += EjectData[j].Length; } @@ -55215,9 +49712,9 @@ namespace libsecondlife.Packets int i = 0; header.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + GroupData.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; } @@ -55226,11 +49723,11 @@ namespace libsecondlife.Packets { string output = "--- EjectGroupMemberRequest ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += GroupData.ToString() + Environment.NewLine; for (int j = 0; j < EjectData.Length; j++) { output += EjectData[j].ToString() + Environment.NewLine; } - output += GroupData.ToString() + Environment.NewLine; return output; } @@ -55281,48 +49778,6 @@ namespace libsecondlife.Packets } } - /// - [XmlType("ejectgroupmemberreply_ejectdata")] - public class EjectDataBlock - { - public bool Success; - - [XmlIgnore] - public int Length - { - get - { - return 1; - } - } - - public EjectDataBlock() { } - public EjectDataBlock(byte[] bytes, ref int i) - { - try - { - Success = (bytes[i++] != 0) ? (bool)true : (bool)false; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)((Success) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- EjectData --"); - output.Append(String.Format("Success: {0}", Success)); - return output.ToString(); - } - } - /// [XmlType("ejectgroupmemberreply_groupdata")] public class GroupDataBlock @@ -55365,21 +49820,63 @@ namespace libsecondlife.Packets } } + /// + [XmlType("ejectgroupmemberreply_ejectdata")] + public class EjectDataBlock + { + public bool Success; + + [XmlIgnore] + public int Length + { + get + { + return 1; + } + } + + public EjectDataBlock() { } + public EjectDataBlock(byte[] bytes, ref int i) + { + try + { + Success = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)((Success) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- EjectData --"); + output.Append(String.Format("Success: {0}", Success)); + return output.ToString(); + } + } + 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 EjectDataBlock EjectData; public EjectGroupMemberReplyPacket() { Header = new LowHeader(); - Header.ID = 399; + Header.ID = 346; Header.Reliable = true; AgentData = new AgentDataBlock(); - EjectData = new EjectDataBlock(); GroupData = new GroupDataBlock(); + EjectData = new EjectDataBlock(); } public EjectGroupMemberReplyPacket(byte[] bytes, ref int i) @@ -55387,29 +49884,29 @@ namespace libsecondlife.Packets 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); + EjectData = new EjectDataBlock(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); + EjectData = new EjectDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += AgentData.Length; length += EjectData.Length; length += GroupData.Length;; + int length = 10; + length += AgentData.Length; length += GroupData.Length; length += EjectData.Length;; 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); + EjectData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -55418,8 +49915,8 @@ namespace libsecondlife.Packets { string output = "--- EjectGroupMemberReply ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; - output += EjectData.ToString() + Environment.NewLine; output += GroupData.ToString() + Environment.NewLine; + output += EjectData.ToString() + Environment.NewLine; return output; } @@ -55525,7 +50022,7 @@ namespace libsecondlife.Packets public LeaveGroupRequestPacket() { Header = new LowHeader(); - Header.ID = 400; + Header.ID = 347; Header.Reliable = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); @@ -55548,7 +50045,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -55619,8 +50116,8 @@ namespace libsecondlife.Packets [XmlType("leavegroupreply_groupdata")] public class GroupDataBlock { - public bool Success; public LLUUID GroupID; + public bool Success; [XmlIgnore] public int Length @@ -55636,8 +50133,8 @@ namespace libsecondlife.Packets { try { - Success = (bytes[i++] != 0) ? (bool)true : (bool)false; GroupID = new LLUUID(bytes, i); i += 16; + Success = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -55647,16 +50144,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((Success) ? 1 : 0); Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Success) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("Success: {0}", Success)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("Success: {0}", Success)); return output.ToString(); } } @@ -55670,7 +50167,7 @@ namespace libsecondlife.Packets public LeaveGroupReplyPacket() { Header = new LowHeader(); - Header.ID = 401; + Header.ID = 348; Header.Reliable = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); @@ -55693,7 +50190,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -55718,52 +50215,6 @@ namespace libsecondlife.Packets /// public class InviteGroupRequestPacket : Packet { - /// - [XmlType("invitegrouprequest_invitedata")] - public class InviteDataBlock - { - public LLUUID RoleID; - public LLUUID InviteeID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public InviteDataBlock() { } - public InviteDataBlock(byte[] bytes, ref int i) - { - try - { - RoleID = new LLUUID(bytes, i); i += 16; - InviteeID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(InviteeID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- InviteData --"); - output.AppendLine(String.Format("RoleID: {0}", RoleID)); - output.Append(String.Format("InviteeID: {0}", InviteeID)); - return output.ToString(); - } - } - /// [XmlType("invitegrouprequest_agentdata")] public class AgentDataBlock @@ -55852,49 +50303,95 @@ namespace libsecondlife.Packets } } + /// + [XmlType("invitegrouprequest_invitedata")] + public class InviteDataBlock + { + public LLUUID InviteeID; + public LLUUID RoleID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public InviteDataBlock() { } + public InviteDataBlock(byte[] bytes, ref int i) + { + try + { + InviteeID = 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) + { + Buffer.BlockCopy(InviteeID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- InviteData --"); + output.AppendLine(String.Format("InviteeID: {0}", InviteeID)); + output.Append(String.Format("RoleID: {0}", RoleID)); + return output.ToString(); + } + } + 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 InviteDataBlock[] InviteData; public InviteGroupRequestPacket() { Header = new LowHeader(); - Header.ID = 402; + Header.ID = 349; Header.Reliable = true; - InviteData = new InviteDataBlock[0]; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); + InviteData = new InviteDataBlock[0]; } public InviteGroupRequestPacket(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); 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; + AgentData = new AgentDataBlock(bytes, ref i); + GroupData = new GroupDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length; length += GroupData.Length;; length++; for (int j = 0; j < InviteData.Length; j++) { length += InviteData[j].Length; } @@ -55902,10 +50399,10 @@ namespace libsecondlife.Packets 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); + bytes[i++] = (byte)InviteData.Length; + for (int j = 0; j < InviteData.Length; j++) { InviteData[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -55913,12 +50410,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- InviteGroupRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += GroupData.ToString() + Environment.NewLine; for (int j = 0; j < InviteData.Length; j++) { output += InviteData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += GroupData.ToString() + Environment.NewLine; return output; } @@ -56024,7 +50521,7 @@ namespace libsecondlife.Packets public GroupProfileRequestPacket() { Header = new LowHeader(); - Header.ID = 404; + Header.ID = 351; Header.Reliable = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); @@ -56047,7 +50544,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -56118,21 +50615,7 @@ namespace libsecondlife.Packets [XmlType("groupprofilereply_groupdata")] public class GroupDataBlock { - public LLUUID OwnerRole; - public bool AllowPublish; - private byte[] _charter; - public byte[] Charter - { - get { return _charter; } - set - { - if (value == null) { _charter = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _charter = new byte[value.Length]; Buffer.BlockCopy(value, 0, _charter, 0, value.Length); } - } - } - public int GroupMembershipCount; - public bool ShowInList; + public LLUUID GroupID; private byte[] _name; public byte[] Name { @@ -56144,6 +50627,18 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } + private byte[] _charter; + public byte[] Charter + { + get { return _charter; } + set + { + if (value == null) { _charter = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _charter = new byte[value.Length]; Buffer.BlockCopy(value, 0, _charter, 0, value.Length); } + } + } + public bool ShowInList; private byte[] _membertitle; public byte[] MemberTitle { @@ -56155,15 +50650,17 @@ namespace libsecondlife.Packets else { _membertitle = new byte[value.Length]; Buffer.BlockCopy(value, 0, _membertitle, 0, 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 InsigniaID; public LLUUID FounderID; + public int MembershipFee; public bool OpenEnrollment; + public int Money; + public int GroupMembershipCount; + public int GroupRolesCount; + public bool AllowPublish; + public bool MaturePublish; + public LLUUID OwnerRole; [XmlIgnore] public int Length @@ -56171,8 +50668,8 @@ namespace libsecondlife.Packets get { int length = 92; - if (Charter != null) { length += 2 + Charter.Length; } if (Name != null) { length += 1 + Name.Length; } + if (Charter != null) { length += 2 + Charter.Length; } if (MemberTitle != null) { length += 1 + MemberTitle.Length; } return length; } @@ -56184,28 +50681,28 @@ namespace libsecondlife.Packets 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]; - Buffer.BlockCopy(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; + GroupID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _charter = new byte[length]; + Buffer.BlockCopy(bytes, i, _charter, 0, length); i += length; + ShowInList = (bytes[i++] != 0) ? (bool)true : (bool)false; length = (ushort)bytes[i++]; _membertitle = new byte[length]; Buffer.BlockCopy(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)); + InsigniaID = new LLUUID(bytes, i); i += 16; FounderID = 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; + Money = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + GroupMembershipCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + GroupRolesCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false; + OwnerRole = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -56215,34 +50712,18 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(OwnerRole.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((AllowPublish) ? 1 : 0); + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; 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); Buffer.BlockCopy(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; - Buffer.BlockCopy(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; Buffer.BlockCopy(MemberTitle, 0, bytes, i, MemberTitle.Length); i += MemberTitle.Length; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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); @@ -56251,37 +50732,53 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((PowersMask >> 40) % 256); bytes[i++] = (byte)((PowersMask >> 48) % 256); bytes[i++] = (byte)((PowersMask >> 56) % 256); + Buffer.BlockCopy(InsigniaID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FounderID.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); bytes[i++] = (byte)(Money % 256); bytes[i++] = (byte)((Money >> 8) % 256); bytes[i++] = (byte)((Money >> 16) % 256); bytes[i++] = (byte)((Money >> 24) % 256); - Buffer.BlockCopy(FounderID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((OpenEnrollment) ? 1 : 0); + 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)(GroupRolesCount % 256); + bytes[i++] = (byte)((GroupRolesCount >> 8) % 256); + bytes[i++] = (byte)((GroupRolesCount >> 16) % 256); + bytes[i++] = (byte)((GroupRolesCount >> 24) % 256); + bytes[i++] = (byte)((AllowPublish) ? 1 : 0); + bytes[i++] = (byte)((MaturePublish) ? 1 : 0); + Buffer.BlockCopy(OwnerRole.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("OwnerRole: {0}", OwnerRole)); - output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); - Helpers.FieldToString(output, Charter, "Charter"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("GroupMembershipCount: {0}", GroupMembershipCount)); - output.AppendLine(String.Format("ShowInList: {0}", ShowInList)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); + Helpers.FieldToString(output, Charter, "Charter"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ShowInList: {0}", ShowInList)); Helpers.FieldToString(output, MemberTitle, "MemberTitle"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("InsigniaID: {0}", InsigniaID)); - output.AppendLine(String.Format("GroupRolesCount: {0}", GroupRolesCount)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("MembershipFee: {0}", MembershipFee)); - output.AppendLine(String.Format("MaturePublish: {0}", MaturePublish)); output.AppendLine(String.Format("PowersMask: {0}", PowersMask)); - output.AppendLine(String.Format("Money: {0}", Money)); + output.AppendLine(String.Format("InsigniaID: {0}", InsigniaID)); output.AppendLine(String.Format("FounderID: {0}", FounderID)); - output.Append(String.Format("OpenEnrollment: {0}", OpenEnrollment)); + output.AppendLine(String.Format("MembershipFee: {0}", MembershipFee)); + output.AppendLine(String.Format("OpenEnrollment: {0}", OpenEnrollment)); + output.AppendLine(String.Format("Money: {0}", Money)); + output.AppendLine(String.Format("GroupMembershipCount: {0}", GroupMembershipCount)); + output.AppendLine(String.Format("GroupRolesCount: {0}", GroupRolesCount)); + output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); + output.AppendLine(String.Format("MaturePublish: {0}", MaturePublish)); + output.Append(String.Format("OwnerRole: {0}", OwnerRole)); return output.ToString(); } } @@ -56295,9 +50792,8 @@ namespace libsecondlife.Packets public GroupProfileReplyPacket() { Header = new LowHeader(); - Header.ID = 405; + Header.ID = 352; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); } @@ -56319,7 +50815,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -56344,6 +50840,56 @@ namespace libsecondlife.Packets /// public class GroupAccountSummaryRequestPacket : Packet { + /// + [XmlType("groupaccountsummaryrequest_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public LLUUID GroupID; + + [XmlIgnore] + public int Length + { + get + { + return 48; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("GroupID: {0}", GroupID)); + return output.ToString(); + } + } + /// [XmlType("groupaccountsummaryrequest_moneydata")] public class MoneyDataBlock @@ -56400,8 +50946,383 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GroupAccountSummaryRequest; } } + public AgentDataBlock AgentData; + public MoneyDataBlock MoneyData; + + public GroupAccountSummaryRequestPacket() + { + Header = new LowHeader(); + Header.ID = 353; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + MoneyData = new MoneyDataBlock(); + } + + public GroupAccountSummaryRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); + } + + public GroupAccountSummaryRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- GroupAccountSummaryRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += MoneyData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class GroupAccountSummaryReplyPacket : Packet + { /// - [XmlType("groupaccountsummaryrequest_agentdata")] + [XmlType("groupaccountsummaryreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID GroupID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("GroupID: {0}", GroupID)); + return output.ToString(); + } + } + + /// + [XmlType("groupaccountsummaryreply_moneydata")] + public class MoneyDataBlock + { + public LLUUID RequestID; + public int IntervalDays; + public int CurrentInterval; + 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]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } + } + } + public int Balance; + public int TotalCredits; + public int TotalDebits; + public int ObjectTaxCurrent; + public int LightTaxCurrent; + public int LandTaxCurrent; + public int GroupTaxCurrent; + public int ParcelDirFeeCurrent; + public int ObjectTaxEstimate; + public int LightTaxEstimate; + public int LandTaxEstimate; + public int GroupTaxEstimate; + public int ParcelDirFeeEstimate; + public int NonExemptMembers; + 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]; Buffer.BlockCopy(value, 0, _lasttaxdate, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _taxdate, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 80; + if (StartDate != null) { length += 1 + StartDate.Length; } + if (LastTaxDate != null) { length += 1 + LastTaxDate.Length; } + if (TaxDate != null) { length += 1 + TaxDate.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)); + CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _startdate = new byte[length]; + Buffer.BlockCopy(bytes, i, _startdate, 0, length); i += length; + Balance = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + TotalCredits = (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)); + 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)); + ParcelDirFeeCurrent = (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)); + ParcelDirFeeEstimate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + NonExemptMembers = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _lasttaxdate = new byte[length]; + Buffer.BlockCopy(bytes, i, _lasttaxdate, 0, length); i += length; + length = (ushort)bytes[i++]; + _taxdate = new byte[length]; + Buffer.BlockCopy(bytes, i, _taxdate, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(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); + if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); } + bytes[i++] = (byte)StartDate.Length; + Buffer.BlockCopy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.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)(TotalCredits % 256); + bytes[i++] = (byte)((TotalCredits >> 8) % 256); + bytes[i++] = (byte)((TotalCredits >> 16) % 256); + bytes[i++] = (byte)((TotalCredits >> 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)(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)(ParcelDirFeeCurrent % 256); + bytes[i++] = (byte)((ParcelDirFeeCurrent >> 8) % 256); + bytes[i++] = (byte)((ParcelDirFeeCurrent >> 16) % 256); + bytes[i++] = (byte)((ParcelDirFeeCurrent >> 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); + bytes[i++] = (byte)(ParcelDirFeeEstimate % 256); + bytes[i++] = (byte)((ParcelDirFeeEstimate >> 8) % 256); + bytes[i++] = (byte)((ParcelDirFeeEstimate >> 16) % 256); + bytes[i++] = (byte)((ParcelDirFeeEstimate >> 24) % 256); + bytes[i++] = (byte)(NonExemptMembers % 256); + bytes[i++] = (byte)((NonExemptMembers >> 8) % 256); + bytes[i++] = (byte)((NonExemptMembers >> 16) % 256); + bytes[i++] = (byte)((NonExemptMembers >> 24) % 256); + if(LastTaxDate == null) { Console.WriteLine("Warning: LastTaxDate is null, in " + this.GetType()); } + bytes[i++] = (byte)LastTaxDate.Length; + Buffer.BlockCopy(LastTaxDate, 0, bytes, i, LastTaxDate.Length); i += LastTaxDate.Length; + if(TaxDate == null) { Console.WriteLine("Warning: TaxDate is null, in " + this.GetType()); } + bytes[i++] = (byte)TaxDate.Length; + Buffer.BlockCopy(TaxDate, 0, bytes, i, TaxDate.Length); i += TaxDate.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- MoneyData --"); + output.AppendLine(String.Format("RequestID: {0}", RequestID)); + output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); + output.AppendLine(String.Format("CurrentInterval: {0}", CurrentInterval)); + Helpers.FieldToString(output, StartDate, "StartDate"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Balance: {0}", Balance)); + output.AppendLine(String.Format("TotalCredits: {0}", TotalCredits)); + output.AppendLine(String.Format("TotalDebits: {0}", TotalDebits)); + output.AppendLine(String.Format("ObjectTaxCurrent: {0}", ObjectTaxCurrent)); + output.AppendLine(String.Format("LightTaxCurrent: {0}", LightTaxCurrent)); + output.AppendLine(String.Format("LandTaxCurrent: {0}", LandTaxCurrent)); + output.AppendLine(String.Format("GroupTaxCurrent: {0}", GroupTaxCurrent)); + output.AppendLine(String.Format("ParcelDirFeeCurrent: {0}", ParcelDirFeeCurrent)); + output.AppendLine(String.Format("ObjectTaxEstimate: {0}", ObjectTaxEstimate)); + output.AppendLine(String.Format("LightTaxEstimate: {0}", LightTaxEstimate)); + output.AppendLine(String.Format("LandTaxEstimate: {0}", LandTaxEstimate)); + output.AppendLine(String.Format("GroupTaxEstimate: {0}", GroupTaxEstimate)); + output.AppendLine(String.Format("ParcelDirFeeEstimate: {0}", ParcelDirFeeEstimate)); + output.AppendLine(String.Format("NonExemptMembers: {0}", NonExemptMembers)); + Helpers.FieldToString(output, LastTaxDate, "LastTaxDate"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, TaxDate, "TaxDate"); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GroupAccountSummaryReply; } } + public AgentDataBlock AgentData; + public MoneyDataBlock MoneyData; + + public GroupAccountSummaryReplyPacket() + { + Header = new LowHeader(); + Header.ID = 354; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + MoneyData = new MoneyDataBlock(); + } + + public GroupAccountSummaryReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); + } + + public GroupAccountSummaryReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- GroupAccountSummaryReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += MoneyData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class GroupAccountDetailsRequestPacket : Packet + { + /// + [XmlType("groupaccountdetailsrequest_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -56450,384 +51371,6 @@ namespace libsecondlife.Packets } } - 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 = 406; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public GroupAccountSummaryRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GroupAccountSummaryRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupAccountSummaryRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupAccountSummaryReplyPacket : Packet - { - /// - [XmlType("groupaccountsummaryreply_moneydata")] - public class MoneyDataBlock - { - public int ParcelDirFeeCurrent; - private byte[] _taxdate; - public byte[] TaxDate - { - get { return _taxdate; } - set - { - if (value == null) { _taxdate = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _taxdate = new byte[value.Length]; Buffer.BlockCopy(value, 0, _taxdate, 0, 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]; Buffer.BlockCopy(value, 0, _lasttaxdate, 0, 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]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } - } - } - public int TotalCredits; - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - int length = 80; - if (TaxDate != null) { length += 1 + TaxDate.Length; } - if (LastTaxDate != null) { length += 1 + LastTaxDate.Length; } - if (StartDate != null) { length += 1 + StartDate.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - ParcelDirFeeCurrent = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _taxdate = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("ParcelDirFeeCurrent: {0}", ParcelDirFeeCurrent)); - Helpers.FieldToString(output, TaxDate, "TaxDate"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Balance: {0}", Balance)); - output.AppendLine(String.Format("ParcelDirFeeEstimate: {0}", ParcelDirFeeEstimate)); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("ObjectTaxCurrent: {0}", ObjectTaxCurrent)); - output.AppendLine(String.Format("LightTaxCurrent: {0}", LightTaxCurrent)); - output.AppendLine(String.Format("LandTaxCurrent: {0}", LandTaxCurrent)); - output.AppendLine(String.Format("GroupTaxCurrent: {0}", GroupTaxCurrent)); - output.AppendLine(String.Format("TotalDebits: {0}", TotalDebits)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - output.AppendLine(String.Format("ObjectTaxEstimate: {0}", ObjectTaxEstimate)); - output.AppendLine(String.Format("LightTaxEstimate: {0}", LightTaxEstimate)); - output.AppendLine(String.Format("LandTaxEstimate: {0}", LandTaxEstimate)); - output.AppendLine(String.Format("GroupTaxEstimate: {0}", GroupTaxEstimate)); - Helpers.FieldToString(output, LastTaxDate, "LastTaxDate"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("NonExemptMembers: {0}", NonExemptMembers)); - Helpers.FieldToString(output, StartDate, "StartDate"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("TotalCredits: {0}", TotalCredits)); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("groupaccountsummaryreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID GroupID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - GroupID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - - 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 = 407; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public GroupAccountSummaryReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GroupAccountSummaryReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupAccountSummaryReply ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupAccountDetailsRequestPacket : Packet - { /// [XmlType("groupaccountdetailsrequest_moneydata")] public class MoneyDataBlock @@ -56884,8 +51427,330 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GroupAccountDetailsRequest; } } + public AgentDataBlock AgentData; + public MoneyDataBlock MoneyData; + + public GroupAccountDetailsRequestPacket() + { + Header = new LowHeader(); + Header.ID = 355; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + MoneyData = new MoneyDataBlock(); + } + + public GroupAccountDetailsRequestPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); + } + + public GroupAccountDetailsRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + MoneyData = new MoneyDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.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); + AgentData.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 = "--- GroupAccountDetailsRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += MoneyData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class GroupAccountDetailsReplyPacket : Packet + { /// - [XmlType("groupaccountdetailsrequest_agentdata")] + [XmlType("groupaccountdetailsreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID GroupID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("GroupID: {0}", GroupID)); + return output.ToString(); + } + } + + /// + [XmlType("groupaccountdetailsreply_moneydata")] + public class MoneyDataBlock + { + public LLUUID RequestID; + public int IntervalDays; + public int CurrentInterval; + 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]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 24; + if (StartDate != null) { length += 1 + StartDate.Length; } + return length; + } + } + + public MoneyDataBlock() { } + public MoneyDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + RequestID = new LLUUID(bytes, i); i += 16; + IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _startdate = new byte[length]; + Buffer.BlockCopy(bytes, i, _startdate, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(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); + if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); } + bytes[i++] = (byte)StartDate.Length; + Buffer.BlockCopy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- MoneyData --"); + output.AppendLine(String.Format("RequestID: {0}", RequestID)); + output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); + output.AppendLine(String.Format("CurrentInterval: {0}", CurrentInterval)); + Helpers.FieldToString(output, StartDate, "StartDate"); + return output.ToString(); + } + } + + /// + [XmlType("groupaccountdetailsreply_historydata")] + public class HistoryDataBlock + { + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } + public int Amount; + + [XmlIgnore] + public int Length + { + get + { + int length = 4; + if (Description != null) { length += 1 + Description.Length; } + return length; + } + } + + public HistoryDataBlock() { } + public HistoryDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + 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(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + 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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- HistoryData --"); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + output.Append(String.Format("Amount: {0}", Amount)); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.GroupAccountDetailsReply; } } + public AgentDataBlock AgentData; + public MoneyDataBlock MoneyData; + public HistoryDataBlock[] HistoryData; + + public GroupAccountDetailsReplyPacket() + { + Header = new LowHeader(); + Header.ID = 356; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + MoneyData = new MoneyDataBlock(); + HistoryData = new HistoryDataBlock[0]; + } + + public GroupAccountDetailsReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + 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); } + } + + public GroupAccountDetailsReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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); } + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += MoneyData.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); + AgentData.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); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- GroupAccountDetailsReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += MoneyData.ToString() + Environment.NewLine; + for (int j = 0; j < HistoryData.Length; j++) + { + output += HistoryData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class GroupAccountTransactionsRequestPacket : Packet + { + /// + [XmlType("groupaccounttransactionsrequest_agentdata")] public class AgentDataBlock { public LLUUID AgentID; @@ -56934,330 +51799,6 @@ namespace libsecondlife.Packets } } - 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 = 408; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - AgentData = new AgentDataBlock(); - } - - public GroupAccountDetailsRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GroupAccountDetailsRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupAccountDetailsRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupAccountDetailsReplyPacket : Packet - { - /// - [XmlType("groupaccountdetailsreply_moneydata")] - public class MoneyDataBlock - { - public LLUUID RequestID; - public int IntervalDays; - private byte[] _startdate; - public byte[] StartDate - { - get { return _startdate; } - set - { - if (value == null) { _startdate = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _startdate = new byte[value.Length]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } - } - } - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - int length = 24; - if (StartDate != null) { length += 1 + StartDate.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - RequestID = new LLUUID(bytes, i); i += 16; - IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _startdate = new byte[length]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - Helpers.FieldToString(output, StartDate, "StartDate"); - output.Append(Environment.NewLine); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("groupaccountdetailsreply_historydata")] - public class HistoryDataBlock - { - public int Amount; - private byte[] _description; - public byte[] Description - { - get { return _description; } - set - { - if (value == null) { _description = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 4; - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public HistoryDataBlock() { } - public HistoryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Amount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _description = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- HistoryData --"); - output.AppendLine(String.Format("Amount: {0}", Amount)); - Helpers.FieldToString(output, Description, "Description"); - return output.ToString(); - } - } - - /// - [XmlType("groupaccountdetailsreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID GroupID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - GroupID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - - 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 = 409; - Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); - HistoryData = new HistoryDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public GroupAccountDetailsReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public GroupAccountDetailsReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - MoneyData = new MoneyDataBlock(bytes, ref i); - int count = (int)bytes[i++]; - HistoryData = new HistoryDataBlock[count]; - for (int j = 0; j < count; j++) - { HistoryData[j] = new HistoryDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; - length++; - for (int j = 0; j < HistoryData.Length; j++) { length += HistoryData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - MoneyData.ToBytes(bytes, ref i); - bytes[i++] = (byte)HistoryData.Length; - for (int j = 0; j < HistoryData.Length; j++) { HistoryData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupAccountDetailsReply ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; - for (int j = 0; j < HistoryData.Length; j++) - { - output += HistoryData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupAccountTransactionsRequestPacket : Packet - { /// [XmlType("groupaccounttransactionsrequest_moneydata")] public class MoneyDataBlock @@ -57314,97 +51855,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("groupaccounttransactionsrequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - public LLUUID GroupID; - - [XmlIgnore] - public int Length - { - get - { - return 48; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - GroupID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - 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 MoneyDataBlock MoneyData; public GroupAccountTransactionsRequestPacket() { Header = new LowHeader(); - Header.ID = 410; + Header.ID = 357; Header.Reliable = true; - Header.Zerocoded = true; - MoneyData = new MoneyDataBlock(); AgentData = new AgentDataBlock(); + MoneyData = new MoneyDataBlock(); } 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); + MoneyData = new MoneyDataBlock(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); + MoneyData = new MoneyDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += MoneyData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.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); - MoneyData.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + MoneyData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -57412,8 +51902,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupAccountTransactionsRequest ---" + Environment.NewLine; - output += MoneyData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += MoneyData.ToString() + Environment.NewLine; return output; } @@ -57422,198 +51912,6 @@ namespace libsecondlife.Packets /// public class GroupAccountTransactionsReplyPacket : Packet { - /// - [XmlType("groupaccounttransactionsreply_moneydata")] - public class MoneyDataBlock - { - public LLUUID RequestID; - public int IntervalDays; - private byte[] _startdate; - public byte[] StartDate - { - get { return _startdate; } - set - { - if (value == null) { _startdate = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _startdate = new byte[value.Length]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } - } - } - public int CurrentInterval; - - [XmlIgnore] - public int Length - { - get - { - int length = 24; - if (StartDate != null) { length += 1 + StartDate.Length; } - return length; - } - } - - public MoneyDataBlock() { } - public MoneyDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - RequestID = new LLUUID(bytes, i); i += 16; - IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _startdate = new byte[length]; - Buffer.BlockCopy(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) - { - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MoneyData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); - Helpers.FieldToString(output, StartDate, "StartDate"); - output.Append(Environment.NewLine); - output.Append(String.Format("CurrentInterval: {0}", CurrentInterval)); - return output.ToString(); - } - } - - /// - [XmlType("groupaccounttransactionsreply_historydata")] - public class HistoryDataBlock - { - private byte[] _time; - public byte[] Time - { - get { return _time; } - set - { - if (value == null) { _time = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _time = new byte[value.Length]; Buffer.BlockCopy(value, 0, _time, 0, 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]; Buffer.BlockCopy(value, 0, _item, 0, 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]; Buffer.BlockCopy(value, 0, _user, 0, value.Length); } - } - } - public int Type; - public int Amount; - - [XmlIgnore] - public int Length - { - get - { - int length = 8; - if (Time != null) { length += 1 + Time.Length; } - if (Item != null) { length += 1 + Item.Length; } - if (User != null) { length += 1 + User.Length; } - return length; - } - } - - public HistoryDataBlock() { } - public HistoryDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _time = new byte[length]; - Buffer.BlockCopy(bytes, i, _time, 0, length); i += length; - length = (ushort)bytes[i++]; - _item = new byte[length]; - Buffer.BlockCopy(bytes, i, _item, 0, length); i += length; - length = (ushort)bytes[i++]; - _user = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- HistoryData --"); - Helpers.FieldToString(output, Time, "Time"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Item, "Item"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, User, "User"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("Amount: {0}", Amount)); - return output.ToString(); - } - } - /// [XmlType("groupaccounttransactionsreply_agentdata")] public class AgentDataBlock @@ -57660,61 +51958,251 @@ namespace libsecondlife.Packets } } + /// + [XmlType("groupaccounttransactionsreply_moneydata")] + public class MoneyDataBlock + { + public LLUUID RequestID; + public int IntervalDays; + public int CurrentInterval; + 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]; Buffer.BlockCopy(value, 0, _startdate, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 24; + if (StartDate != null) { length += 1 + StartDate.Length; } + return length; + } + } + + public MoneyDataBlock() { } + public MoneyDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + RequestID = new LLUUID(bytes, i); i += 16; + IntervalDays = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + CurrentInterval = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _startdate = new byte[length]; + Buffer.BlockCopy(bytes, i, _startdate, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(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); + if(StartDate == null) { Console.WriteLine("Warning: StartDate is null, in " + this.GetType()); } + bytes[i++] = (byte)StartDate.Length; + Buffer.BlockCopy(StartDate, 0, bytes, i, StartDate.Length); i += StartDate.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- MoneyData --"); + output.AppendLine(String.Format("RequestID: {0}", RequestID)); + output.AppendLine(String.Format("IntervalDays: {0}", IntervalDays)); + output.AppendLine(String.Format("CurrentInterval: {0}", CurrentInterval)); + Helpers.FieldToString(output, StartDate, "StartDate"); + return output.ToString(); + } + } + + /// + [XmlType("groupaccounttransactionsreply_historydata")] + public class HistoryDataBlock + { + private byte[] _time; + public byte[] Time + { + get { return _time; } + set + { + if (value == null) { _time = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _time = new byte[value.Length]; Buffer.BlockCopy(value, 0, _time, 0, 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]; Buffer.BlockCopy(value, 0, _user, 0, value.Length); } + } + } + public int Type; + 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]; Buffer.BlockCopy(value, 0, _item, 0, value.Length); } + } + } + public int Amount; + + [XmlIgnore] + public int Length + { + get + { + int length = 8; + if (Time != null) { length += 1 + Time.Length; } + if (User != null) { length += 1 + User.Length; } + if (Item != null) { length += 1 + Item.Length; } + return length; + } + } + + public HistoryDataBlock() { } + public HistoryDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + length = (ushort)bytes[i++]; + _time = new byte[length]; + Buffer.BlockCopy(bytes, i, _time, 0, length); i += length; + length = (ushort)bytes[i++]; + _user = new byte[length]; + Buffer.BlockCopy(bytes, i, _user, 0, length); i += length; + Type = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _item = new byte[length]; + Buffer.BlockCopy(bytes, i, _item, 0, length); i += length; + 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; + Buffer.BlockCopy(Time, 0, bytes, i, Time.Length); i += Time.Length; + if(User == null) { Console.WriteLine("Warning: User is null, in " + this.GetType()); } + bytes[i++] = (byte)User.Length; + Buffer.BlockCopy(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); + if(Item == null) { Console.WriteLine("Warning: Item is null, in " + this.GetType()); } + bytes[i++] = (byte)Item.Length; + Buffer.BlockCopy(Item, 0, bytes, i, Item.Length); i += Item.Length; + 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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- HistoryData --"); + Helpers.FieldToString(output, Time, "Time"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, User, "User"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Type: {0}", Type)); + Helpers.FieldToString(output, Item, "Item"); + output.Append(Environment.NewLine); + output.Append(String.Format("Amount: {0}", Amount)); + return output.ToString(); + } + } + private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.GroupAccountTransactionsReply; } } + public AgentDataBlock AgentData; public MoneyDataBlock MoneyData; public HistoryDataBlock[] HistoryData; - public AgentDataBlock AgentData; public GroupAccountTransactionsReplyPacket() { Header = new LowHeader(); - Header.ID = 411; + Header.ID = 358; Header.Reliable = true; - Header.Zerocoded = true; + AgentData = new AgentDataBlock(); 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); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += MoneyData.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); + AgentData.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; } @@ -57722,12 +52210,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupAccountTransactionsReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; output += MoneyData.ToString() + Environment.NewLine; for (int j = 0; j < HistoryData.Length; j++) { output += HistoryData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -57782,48 +52270,6 @@ namespace libsecondlife.Packets } } - /// - [XmlType("groupactiveproposalsrequest_transactiondata")] - public class TransactionDataBlock - { - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TransactionDataBlock() { } - public TransactionDataBlock(byte[] bytes, ref int i) - { - try - { - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransactionData --"); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - /// [XmlType("groupactiveproposalsrequest_groupdata")] public class GroupDataBlock @@ -57866,176 +52312,27 @@ namespace libsecondlife.Packets } } - 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 = 412; - Header.Reliable = true; - AgentData = new AgentDataBlock(); - TransactionData = new TransactionDataBlock(); - GroupData = new GroupDataBlock(); - } - - public GroupActiveProposalsRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - AgentData = new AgentDataBlock(bytes, ref i); - TransactionData = new TransactionDataBlock(bytes, ref i); - GroupData = new GroupDataBlock(bytes, ref i); - } - - public GroupActiveProposalsRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - AgentData = new AgentDataBlock(bytes, ref i); - TransactionData = new TransactionDataBlock(bytes, ref i); - GroupData = new GroupDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length; length += TransactionData.Length; length += GroupData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - TransactionData.ToBytes(bytes, ref i); - GroupData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- GroupActiveProposalsRequest ---" + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - output += TransactionData.ToString() + Environment.NewLine; - output += GroupData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class GroupActiveProposalItemReplyPacket : Packet - { /// - [XmlType("groupactiveproposalitemreply_proposaldata")] - public class ProposalDataBlock + [XmlType("groupactiveproposalsrequest_transactiondata")] + public class TransactionDataBlock { - 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]; Buffer.BlockCopy(value, 0, _startdatetime, 0, 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]; Buffer.BlockCopy(value, 0, _proposaltext, 0, 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]; Buffer.BlockCopy(value, 0, _tersedateid, 0, 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]; Buffer.BlockCopy(value, 0, _enddatetime, 0, 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]; Buffer.BlockCopy(value, 0, _votecast, 0, value.Length); } - } - } - public int Quorum; - public LLUUID VoteInitiator; + public LLUUID TransactionID; [XmlIgnore] public int Length { get { - int length = 41; - if (StartDateTime != null) { length += 1 + StartDateTime.Length; } - if (ProposalText != null) { length += 1 + ProposalText.Length; } - if (TerseDateID != null) { length += 1 + TerseDateID.Length; } - if (EndDateTime != null) { length += 1 + EndDateTime.Length; } - if (VoteCast != null) { length += 1 + VoteCast.Length; } - return length; + return 16; } } - public ProposalDataBlock() { } - public ProposalDataBlock(byte[] bytes, ref int i) + public TransactionDataBlock() { } + public TransactionDataBlock(byte[] bytes, ref int i) { - int length; try { - length = (ushort)bytes[i++]; - _startdatetime = new byte[length]; - Buffer.BlockCopy(bytes, i, _startdatetime, 0, length); i += length; - length = (ushort)bytes[i++]; - _proposaltext = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _tersedateid, 0, length); i += length; - length = (ushort)bytes[i++]; - _enddatetime = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; + TransactionID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -58045,57 +52342,81 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length; - ba = BitConverter.GetBytes(Majority); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - if(TerseDateID == null) { Console.WriteLine("Warning: TerseDateID is null, in " + this.GetType()); } - bytes[i++] = (byte)TerseDateID.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(EndDateTime, 0, bytes, i, EndDateTime.Length); i += EndDateTime.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(VoteInitiator.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- ProposalData --"); - Helpers.FieldToString(output, StartDateTime, "StartDateTime"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, ProposalText, "ProposalText"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Majority: {0}", Majority)); - Helpers.FieldToString(output, TerseDateID, "TerseDateID"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, EndDateTime, "EndDateTime"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("VoteID: {0}", VoteID)); - output.AppendLine(String.Format("AlreadyVoted: {0}", AlreadyVoted)); - Helpers.FieldToString(output, VoteCast, "VoteCast"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Quorum: {0}", Quorum)); - output.Append(String.Format("VoteInitiator: {0}", VoteInitiator)); + output.AppendLine("-- TransactionData --"); + output.Append(String.Format("TransactionID: {0}", TransactionID)); return output.ToString(); } } + 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 GroupDataBlock GroupData; + public TransactionDataBlock TransactionData; + + public GroupActiveProposalsRequestPacket() + { + Header = new LowHeader(); + Header.ID = 359; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + GroupData = new GroupDataBlock(); + TransactionData = new TransactionDataBlock(); + } + + 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); + GroupData = new GroupDataBlock(bytes, ref i); + TransactionData = new TransactionDataBlock(bytes, ref i); + } + + public GroupActiveProposalsRequestPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + GroupData = new GroupDataBlock(bytes, ref i); + TransactionData = new TransactionDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; length += GroupData.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); + AgentData.ToBytes(bytes, ref i); + GroupData.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 = "--- GroupActiveProposalsRequest ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += GroupData.ToString() + Environment.NewLine; + output += TransactionData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class GroupActiveProposalItemReplyPacket : Packet + { /// [XmlType("groupactiveproposalitemreply_agentdata")] public class AgentDataBlock @@ -58146,8 +52467,8 @@ namespace libsecondlife.Packets [XmlType("groupactiveproposalitemreply_transactiondata")] public class TransactionDataBlock { - public uint TotalNumItems; public LLUUID TransactionID; + public uint TotalNumItems; [XmlIgnore] public int Length @@ -58163,8 +52484,8 @@ namespace libsecondlife.Packets { try { - TotalNumItems = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); TransactionID = new LLUUID(bytes, i); i += 16; + TotalNumItems = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -58174,19 +52495,185 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(TotalNumItems % 256); bytes[i++] = (byte)((TotalNumItems >> 8) % 256); bytes[i++] = (byte)((TotalNumItems >> 16) % 256); bytes[i++] = (byte)((TotalNumItems >> 24) % 256); - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- TransactionData --"); - output.AppendLine(String.Format("TotalNumItems: {0}", TotalNumItems)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.Append(String.Format("TotalNumItems: {0}", TotalNumItems)); + return output.ToString(); + } + } + + /// + [XmlType("groupactiveproposalitemreply_proposaldata")] + public class ProposalDataBlock + { + public LLUUID VoteID; + public LLUUID VoteInitiator; + 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]; Buffer.BlockCopy(value, 0, _tersedateid, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _startdatetime, 0, 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]; Buffer.BlockCopy(value, 0, _enddatetime, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _votecast, 0, value.Length); } + } + } + public float Majority; + public int Quorum; + 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]; Buffer.BlockCopy(value, 0, _proposaltext, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 41; + if (TerseDateID != null) { length += 1 + TerseDateID.Length; } + if (StartDateTime != null) { length += 1 + StartDateTime.Length; } + if (EndDateTime != null) { length += 1 + EndDateTime.Length; } + if (VoteCast != null) { length += 1 + VoteCast.Length; } + if (ProposalText != null) { length += 1 + ProposalText.Length; } + return length; + } + } + + public ProposalDataBlock() { } + public ProposalDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + VoteID = new LLUUID(bytes, i); i += 16; + VoteInitiator = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _tersedateid = new byte[length]; + Buffer.BlockCopy(bytes, i, _tersedateid, 0, length); i += length; + length = (ushort)bytes[i++]; + _startdatetime = new byte[length]; + Buffer.BlockCopy(bytes, i, _startdatetime, 0, length); i += length; + length = (ushort)bytes[i++]; + _enddatetime = new byte[length]; + Buffer.BlockCopy(bytes, i, _enddatetime, 0, length); i += length; + AlreadyVoted = (bytes[i++] != 0) ? (bool)true : (bool)false; + length = (ushort)bytes[i++]; + _votecast = new byte[length]; + Buffer.BlockCopy(bytes, i, _votecast, 0, length); i += length; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Majority = BitConverter.ToSingle(bytes, i); i += 4; + Quorum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _proposaltext = new byte[length]; + Buffer.BlockCopy(bytes, i, _proposaltext, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + Buffer.BlockCopy(VoteID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(VoteInitiator.GetBytes(), 0, bytes, i, 16); i += 16; + if(TerseDateID == null) { Console.WriteLine("Warning: TerseDateID is null, in " + this.GetType()); } + bytes[i++] = (byte)TerseDateID.Length; + Buffer.BlockCopy(TerseDateID, 0, bytes, i, TerseDateID.Length); i += TerseDateID.Length; + if(StartDateTime == null) { Console.WriteLine("Warning: StartDateTime is null, in " + this.GetType()); } + bytes[i++] = (byte)StartDateTime.Length; + Buffer.BlockCopy(StartDateTime, 0, bytes, i, StartDateTime.Length); i += StartDateTime.Length; + if(EndDateTime == null) { Console.WriteLine("Warning: EndDateTime is null, in " + this.GetType()); } + bytes[i++] = (byte)EndDateTime.Length; + Buffer.BlockCopy(EndDateTime, 0, bytes, i, EndDateTime.Length); i += EndDateTime.Length; + bytes[i++] = (byte)((AlreadyVoted) ? 1 : 0); + if(VoteCast == null) { Console.WriteLine("Warning: VoteCast is null, in " + this.GetType()); } + bytes[i++] = (byte)VoteCast.Length; + Buffer.BlockCopy(VoteCast, 0, bytes, i, VoteCast.Length); i += VoteCast.Length; + ba = BitConverter.GetBytes(Majority); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = (byte)(Quorum % 256); + bytes[i++] = (byte)((Quorum >> 8) % 256); + bytes[i++] = (byte)((Quorum >> 16) % 256); + bytes[i++] = (byte)((Quorum >> 24) % 256); + if(ProposalText == null) { Console.WriteLine("Warning: ProposalText is null, in " + this.GetType()); } + bytes[i++] = (byte)ProposalText.Length; + Buffer.BlockCopy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ProposalData --"); + output.AppendLine(String.Format("VoteID: {0}", VoteID)); + output.AppendLine(String.Format("VoteInitiator: {0}", VoteInitiator)); + Helpers.FieldToString(output, TerseDateID, "TerseDateID"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, StartDateTime, "StartDateTime"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, EndDateTime, "EndDateTime"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("AlreadyVoted: {0}", AlreadyVoted)); + Helpers.FieldToString(output, VoteCast, "VoteCast"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Majority: {0}", Majority)); + output.AppendLine(String.Format("Quorum: {0}", Quorum)); + Helpers.FieldToString(output, ProposalText, "ProposalText"); return output.ToString(); } } @@ -58194,47 +52681,46 @@ namespace libsecondlife.Packets 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 ProposalDataBlock[] ProposalData; public GroupActiveProposalItemReplyPacket() { Header = new LowHeader(); - Header.ID = 413; + Header.ID = 360; Header.Reliable = true; - Header.Zerocoded = true; - ProposalData = new ProposalDataBlock[0]; AgentData = new AgentDataBlock(); TransactionData = new TransactionDataBlock(); + ProposalData = new ProposalDataBlock[0]; } public GroupActiveProposalItemReplyPacket(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); 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; + AgentData = new AgentDataBlock(bytes, ref i); + TransactionData = new TransactionDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length; length += TransactionData.Length;; length++; for (int j = 0; j < ProposalData.Length; j++) { length += ProposalData[j].Length; } @@ -58242,10 +52728,10 @@ namespace libsecondlife.Packets 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); + bytes[i++] = (byte)ProposalData.Length; + for (int j = 0; j < ProposalData.Length; j++) { ProposalData[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -58253,12 +52739,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupActiveProposalItemReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += TransactionData.ToString() + Environment.NewLine; for (int j = 0; j < ProposalData.Length; j++) { output += ProposalData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += TransactionData.ToString() + Environment.NewLine; return output; } @@ -58313,48 +52799,6 @@ namespace libsecondlife.Packets } } - /// - [XmlType("groupvotehistoryrequest_transactiondata")] - public class TransactionDataBlock - { - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TransactionDataBlock() { } - public TransactionDataBlock(byte[] bytes, ref int i) - { - try - { - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransactionData --"); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - /// [XmlType("groupvotehistoryrequest_groupdata")] public class GroupDataBlock @@ -58397,21 +52841,63 @@ namespace libsecondlife.Packets } } + /// + [XmlType("groupvotehistoryrequest_transactiondata")] + public class TransactionDataBlock + { + public LLUUID TransactionID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public TransactionDataBlock() { } + public TransactionDataBlock(byte[] bytes, ref int i) + { + try + { + TransactionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TransactionData --"); + output.Append(String.Format("TransactionID: {0}", TransactionID)); + return output.ToString(); + } + } + 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 TransactionDataBlock TransactionData; public GroupVoteHistoryRequestPacket() { Header = new LowHeader(); - Header.ID = 414; + Header.ID = 361; Header.Reliable = true; AgentData = new AgentDataBlock(); - TransactionData = new TransactionDataBlock(); GroupData = new GroupDataBlock(); + TransactionData = new TransactionDataBlock(); } public GroupVoteHistoryRequestPacket(byte[] bytes, ref int i) @@ -58419,29 +52905,29 @@ namespace libsecondlife.Packets 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); + TransactionData = new TransactionDataBlock(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); + TransactionData = new TransactionDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += AgentData.Length; length += TransactionData.Length; length += GroupData.Length;; + int length = 10; + length += AgentData.Length; length += GroupData.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); AgentData.ToBytes(bytes, ref i); - TransactionData.ToBytes(bytes, ref i); GroupData.ToBytes(bytes, ref i); + TransactionData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -58450,8 +52936,8 @@ namespace libsecondlife.Packets { string output = "--- GroupVoteHistoryRequest ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; - output += TransactionData.ToString() + Environment.NewLine; output += GroupData.ToString() + Environment.NewLine; + output += TransactionData.ToString() + Environment.NewLine; return output; } @@ -58460,44 +52946,106 @@ namespace libsecondlife.Packets /// public class GroupVoteHistoryItemReplyPacket : Packet { + /// + [XmlType("groupvotehistoryitemreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID GroupID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("GroupID: {0}", GroupID)); + return output.ToString(); + } + } + + /// + [XmlType("groupvotehistoryitemreply_transactiondata")] + public class TransactionDataBlock + { + public LLUUID TransactionID; + public uint TotalNumItems; + + [XmlIgnore] + public int Length + { + get + { + return 20; + } + } + + public TransactionDataBlock() { } + public TransactionDataBlock(byte[] bytes, ref int i) + { + try + { + TransactionID = new LLUUID(bytes, i); i += 16; + TotalNumItems = (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) + { + Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(TotalNumItems % 256); + bytes[i++] = (byte)((TotalNumItems >> 8) % 256); + bytes[i++] = (byte)((TotalNumItems >> 16) % 256); + bytes[i++] = (byte)((TotalNumItems >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TransactionData --"); + output.AppendLine(String.Format("TransactionID: {0}", TransactionID)); + output.Append(String.Format("TotalNumItems: {0}", TotalNumItems)); + return output.ToString(); + } + } + /// [XmlType("groupvotehistoryitemreply_historyitemdata")] public class HistoryItemDataBlock { - private byte[] _startdatetime; - public byte[] StartDateTime - { - get { return _startdatetime; } - set - { - if (value == null) { _startdatetime = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _startdatetime = new byte[value.Length]; Buffer.BlockCopy(value, 0, _startdatetime, 0, 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]; Buffer.BlockCopy(value, 0, _voteresult, 0, value.Length); } - } - } - private byte[] _proposaltext; - public byte[] ProposalText - { - get { return _proposaltext; } - set - { - if (value == null) { _proposaltext = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _proposaltext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _proposaltext, 0, value.Length); } - } - } - public float Majority; + public LLUUID VoteID; private byte[] _tersedateid; public byte[] TerseDateID { @@ -58509,6 +53057,17 @@ namespace libsecondlife.Packets else { _tersedateid = new byte[value.Length]; Buffer.BlockCopy(value, 0, _tersedateid, 0, value.Length); } } } + 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]; Buffer.BlockCopy(value, 0, _startdatetime, 0, value.Length); } + } + } private byte[] _enddatetime; public byte[] EndDateTime { @@ -58520,8 +53079,7 @@ namespace libsecondlife.Packets else { _enddatetime = new byte[value.Length]; Buffer.BlockCopy(value, 0, _enddatetime, 0, value.Length); } } } - public LLUUID VoteID; - public int Quorum; + public LLUUID VoteInitiator; private byte[] _votetype; public byte[] VoteType { @@ -58533,7 +53091,30 @@ namespace libsecondlife.Packets else { _votetype = new byte[value.Length]; Buffer.BlockCopy(value, 0, _votetype, 0, value.Length); } } } - public LLUUID VoteInitiator; + 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]; Buffer.BlockCopy(value, 0, _voteresult, 0, value.Length); } + } + } + public float Majority; + public int Quorum; + private byte[] _proposaltext; + public byte[] ProposalText + { + get { return _proposaltext; } + set + { + if (value == null) { _proposaltext = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _proposaltext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _proposaltext, 0, value.Length); } + } + } [XmlIgnore] public int Length @@ -58541,12 +53122,12 @@ namespace libsecondlife.Packets 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 (StartDateTime != null) { length += 1 + StartDateTime.Length; } if (EndDateTime != null) { length += 1 + EndDateTime.Length; } if (VoteType != null) { length += 1 + VoteType.Length; } + if (VoteResult != null) { length += 1 + VoteResult.Length; } + if (ProposalText != null) { length += 2 + ProposalText.Length; } return length; } } @@ -58557,29 +53138,29 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)bytes[i++]; - _startdatetime = new byte[length]; - Buffer.BlockCopy(bytes, i, _startdatetime, 0, length); i += length; - length = (ushort)bytes[i++]; - _voteresult = new byte[length]; - Buffer.BlockCopy(bytes, i, _voteresult, 0, length); i += length; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _proposaltext = new byte[length]; - Buffer.BlockCopy(bytes, i, _proposaltext, 0, length); i += length; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Majority = BitConverter.ToSingle(bytes, i); i += 4; + VoteID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _tersedateid = new byte[length]; Buffer.BlockCopy(bytes, i, _tersedateid, 0, length); i += length; length = (ushort)bytes[i++]; + _startdatetime = new byte[length]; + Buffer.BlockCopy(bytes, i, _startdatetime, 0, length); i += length; + length = (ushort)bytes[i++]; _enddatetime = new byte[length]; Buffer.BlockCopy(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)); + VoteInitiator = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _votetype = new byte[length]; Buffer.BlockCopy(bytes, i, _votetype, 0, length); i += length; - VoteInitiator = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _voteresult = new byte[length]; + Buffer.BlockCopy(bytes, i, _voteresult, 0, length); i += length; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Majority = BitConverter.ToSingle(bytes, i); i += 4; + Quorum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _proposaltext = new byte[length]; + Buffer.BlockCopy(bytes, i, _proposaltext, 0, length); i += length; } catch (Exception) { @@ -58590,56 +53171,55 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length; - ba = BitConverter.GetBytes(Majority); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + Buffer.BlockCopy(VoteID.GetBytes(), 0, bytes, i, 16); i += 16; if(TerseDateID == null) { Console.WriteLine("Warning: TerseDateID is null, in " + this.GetType()); } bytes[i++] = (byte)TerseDateID.Length; Buffer.BlockCopy(TerseDateID, 0, bytes, i, TerseDateID.Length); i += TerseDateID.Length; + if(StartDateTime == null) { Console.WriteLine("Warning: StartDateTime is null, in " + this.GetType()); } + bytes[i++] = (byte)StartDateTime.Length; + Buffer.BlockCopy(StartDateTime, 0, bytes, i, StartDateTime.Length); i += StartDateTime.Length; if(EndDateTime == null) { Console.WriteLine("Warning: EndDateTime is null, in " + this.GetType()); } bytes[i++] = (byte)EndDateTime.Length; Buffer.BlockCopy(EndDateTime, 0, bytes, i, EndDateTime.Length); i += EndDateTime.Length; - Buffer.BlockCopy(VoteID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(VoteInitiator.GetBytes(), 0, bytes, i, 16); i += 16; + if(VoteType == null) { Console.WriteLine("Warning: VoteType is null, in " + this.GetType()); } + bytes[i++] = (byte)VoteType.Length; + Buffer.BlockCopy(VoteType, 0, bytes, i, VoteType.Length); i += VoteType.Length; + if(VoteResult == null) { Console.WriteLine("Warning: VoteResult is null, in " + this.GetType()); } + bytes[i++] = (byte)VoteResult.Length; + Buffer.BlockCopy(VoteResult, 0, bytes, i, VoteResult.Length); i += VoteResult.Length; + ba = BitConverter.GetBytes(Majority); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; 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; - Buffer.BlockCopy(VoteType, 0, bytes, i, VoteType.Length); i += VoteType.Length; - Buffer.BlockCopy(VoteInitiator.GetBytes(), 0, bytes, i, 16); i += 16; + 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); + Buffer.BlockCopy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- HistoryItemData --"); - Helpers.FieldToString(output, StartDateTime, "StartDateTime"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, VoteResult, "VoteResult"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, ProposalText, "ProposalText"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Majority: {0}", Majority)); + output.AppendLine(String.Format("VoteID: {0}", VoteID)); Helpers.FieldToString(output, TerseDateID, "TerseDateID"); output.Append(Environment.NewLine); + Helpers.FieldToString(output, StartDateTime, "StartDateTime"); + output.Append(Environment.NewLine); Helpers.FieldToString(output, EndDateTime, "EndDateTime"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("VoteID: {0}", VoteID)); - output.AppendLine(String.Format("Quorum: {0}", Quorum)); + output.AppendLine(String.Format("VoteInitiator: {0}", VoteInitiator)); Helpers.FieldToString(output, VoteType, "VoteType"); output.Append(Environment.NewLine); - output.Append(String.Format("VoteInitiator: {0}", VoteInitiator)); + Helpers.FieldToString(output, VoteResult, "VoteResult"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Majority: {0}", Majority)); + output.AppendLine(String.Format("Quorum: {0}", Quorum)); + Helpers.FieldToString(output, ProposalText, "ProposalText"); return output.ToString(); } } @@ -58715,161 +53295,65 @@ namespace libsecondlife.Packets } } - /// - [XmlType("groupvotehistoryitemreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID GroupID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - GroupID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - - /// - [XmlType("groupvotehistoryitemreply_transactiondata")] - public class TransactionDataBlock - { - public uint TotalNumItems; - public LLUUID TransactionID; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public TransactionDataBlock() { } - public TransactionDataBlock(byte[] bytes, ref int i) - { - try - { - TotalNumItems = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - TransactionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(TotalNumItems % 256); - bytes[i++] = (byte)((TotalNumItems >> 8) % 256); - bytes[i++] = (byte)((TotalNumItems >> 16) % 256); - bytes[i++] = (byte)((TotalNumItems >> 24) % 256); - Buffer.BlockCopy(TransactionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TransactionData --"); - output.AppendLine(String.Format("TotalNumItems: {0}", TotalNumItems)); - output.Append(String.Format("TransactionID: {0}", TransactionID)); - return output.ToString(); - } - } - 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 HistoryItemDataBlock HistoryItemData; + public VoteItemBlock[] VoteItem; public GroupVoteHistoryItemReplyPacket() { Header = new LowHeader(); - Header.ID = 415; + Header.ID = 362; Header.Reliable = true; - Header.Zerocoded = true; - HistoryItemData = new HistoryItemDataBlock(); - VoteItem = new VoteItemBlock[0]; AgentData = new AgentDataBlock(); TransactionData = new TransactionDataBlock(); + HistoryItemData = new HistoryItemDataBlock(); + VoteItem = new VoteItemBlock[0]; } public GroupVoteHistoryItemReplyPacket(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); 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; + AgentData = new AgentDataBlock(bytes, ref i); + TransactionData = new TransactionDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += TransactionData.Length; length += HistoryItemData.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); + AgentData.ToBytes(bytes, ref i); + TransactionData.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; } @@ -58877,13 +53361,13 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupVoteHistoryItemReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += TransactionData.ToString() + Environment.NewLine; output += HistoryItemData.ToString() + Environment.NewLine; for (int j = 0; j < VoteItem.Length; j++) { output += VoteItem[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += TransactionData.ToString() + Environment.NewLine; return output; } @@ -58892,92 +53376,6 @@ namespace libsecondlife.Packets /// public class StartGroupProposalPacket : Packet { - /// - [XmlType("startgroupproposal_proposaldata")] - public class ProposalDataBlock - { - public int Duration; - private byte[] _proposaltext; - public byte[] ProposalText - { - get { return _proposaltext; } - set - { - if (value == null) { _proposaltext = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _proposaltext = new byte[value.Length]; Buffer.BlockCopy(value, 0, _proposaltext, 0, value.Length); } - } - } - public float Majority; - public LLUUID GroupID; - public int Quorum; - - [XmlIgnore] - public int Length - { - get - { - int length = 28; - if (ProposalText != null) { length += 1 + ProposalText.Length; } - return length; - } - } - - public ProposalDataBlock() { } - public ProposalDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Duration = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _proposaltext = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length; - ba = BitConverter.GetBytes(Majority); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ProposalData --"); - output.AppendLine(String.Format("Duration: {0}", Duration)); - Helpers.FieldToString(output, ProposalText, "ProposalText"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Majority: {0}", Majority)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.Append(String.Format("Quorum: {0}", Quorum)); - return output.ToString(); - } - } - /// [XmlType("startgroupproposal_agentdata")] public class AgentDataBlock @@ -59024,47 +53422,131 @@ namespace libsecondlife.Packets } } + /// + [XmlType("startgroupproposal_proposaldata")] + public class ProposalDataBlock + { + public LLUUID GroupID; + public int Quorum; + public float Majority; + 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]; Buffer.BlockCopy(value, 0, _proposaltext, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 28; + if (ProposalText != null) { length += 1 + ProposalText.Length; } + return length; + } + } + + public ProposalDataBlock() { } + public ProposalDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + GroupID = new LLUUID(bytes, i); i += 16; + Quorum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Majority = BitConverter.ToSingle(bytes, i); i += 4; + Duration = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _proposaltext = new byte[length]; + Buffer.BlockCopy(bytes, i, _proposaltext, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + Buffer.BlockCopy(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); + ba = BitConverter.GetBytes(Majority); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + 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; + Buffer.BlockCopy(ProposalText, 0, bytes, i, ProposalText.Length); i += ProposalText.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ProposalData --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("Quorum: {0}", Quorum)); + output.AppendLine(String.Format("Majority: {0}", Majority)); + output.AppendLine(String.Format("Duration: {0}", Duration)); + Helpers.FieldToString(output, ProposalText, "ProposalText"); + return output.ToString(); + } + } + 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 ProposalDataBlock ProposalData; public StartGroupProposalPacket() { Header = new LowHeader(); - Header.ID = 416; + Header.ID = 363; Header.Reliable = true; - Header.Zerocoded = true; - ProposalData = new ProposalDataBlock(); AgentData = new AgentDataBlock(); + ProposalData = new ProposalDataBlock(); } 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); + ProposalData = new ProposalDataBlock(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); + ProposalData = new ProposalDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ProposalData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += ProposalData.Length;; 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); + ProposalData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -59072,8 +53554,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- StartGroupProposal ---" + Environment.NewLine; - output += ProposalData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ProposalData.ToString() + Environment.NewLine; return output; } @@ -59082,6 +53564,52 @@ namespace libsecondlife.Packets /// public class GroupProposalBallotPacket : Packet { + /// + [XmlType("groupproposalballot_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("groupproposalballot_proposaldata")] public class ProposalDataBlock @@ -59149,92 +53677,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("groupproposalballot_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 ProposalDataBlock ProposalData; public GroupProposalBallotPacket() { Header = new LowHeader(); - Header.ID = 417; + Header.ID = 364; Header.Reliable = true; - ProposalData = new ProposalDataBlock(); AgentData = new AgentDataBlock(); + ProposalData = new ProposalDataBlock(); } 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); + ProposalData = new ProposalDataBlock(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); + ProposalData = new ProposalDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += ProposalData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += ProposalData.Length;; 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); + ProposalData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -59242,8 +53724,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupProposalBallot ---" + Environment.NewLine; - output += ProposalData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ProposalData.ToString() + Environment.NewLine; return output; } @@ -59302,8 +53784,8 @@ namespace libsecondlife.Packets [XmlType("groupmembersrequest_groupdata")] public class GroupDataBlock { - public LLUUID RequestID; public LLUUID GroupID; + public LLUUID RequestID; [XmlIgnore] public int Length @@ -59319,8 +53801,8 @@ namespace libsecondlife.Packets { try { - RequestID = new LLUUID(bytes, i); i += 16; GroupID = new LLUUID(bytes, i); i += 16; + RequestID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -59330,16 +53812,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("RequestID: {0}", RequestID)); return output.ToString(); } } @@ -59353,7 +53835,7 @@ namespace libsecondlife.Packets public GroupMembersRequestPacket() { Header = new LowHeader(); - Header.ID = 419; + Header.ID = 366; Header.Reliable = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); @@ -59376,7 +53858,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -59401,112 +53883,6 @@ namespace libsecondlife.Packets /// public class GroupMembersReplyPacket : Packet { - /// - [XmlType("groupmembersreply_memberdata")] - public class MemberDataBlock - { - private byte[] _onlinestatus; - public byte[] OnlineStatus - { - get { return _onlinestatus; } - set - { - if (value == null) { _onlinestatus = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _onlinestatus = new byte[value.Length]; Buffer.BlockCopy(value, 0, _onlinestatus, 0, 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]; Buffer.BlockCopy(value, 0, _title, 0, value.Length); } - } - } - public ulong AgentPowers; - - [XmlIgnore] - public int Length - { - get - { - int length = 29; - if (OnlineStatus != null) { length += 1 + OnlineStatus.Length; } - if (Title != null) { length += 1 + Title.Length; } - return length; - } - } - - public MemberDataBlock() { } - public MemberDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _onlinestatus = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(OnlineStatus, 0, bytes, i, OnlineStatus.Length); i += OnlineStatus.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MemberData --"); - Helpers.FieldToString(output, OnlineStatus, "OnlineStatus"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("Contribution: {0}", Contribution)); - output.AppendLine(String.Format("IsOwner: {0}", IsOwner)); - Helpers.FieldToString(output, Title, "Title"); - output.Append(Environment.NewLine); - output.Append(String.Format("AgentPowers: {0}", AgentPowers)); - return output.ToString(); - } - } - /// [XmlType("groupmembersreply_agentdata")] public class AgentDataBlock @@ -59553,9 +53929,9 @@ namespace libsecondlife.Packets [XmlType("groupmembersreply_groupdata")] public class GroupDataBlock { + public LLUUID GroupID; public LLUUID RequestID; public int MemberCount; - public LLUUID GroupID; [XmlIgnore] public int Length @@ -59571,9 +53947,9 @@ namespace libsecondlife.Packets { try { + GroupID = new LLUUID(bytes, i); i += 16; 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) { @@ -59583,21 +53959,127 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.AppendLine(String.Format("MemberCount: {0}", MemberCount)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("MemberCount: {0}", MemberCount)); + return output.ToString(); + } + } + + /// + [XmlType("groupmembersreply_memberdata")] + public class MemberDataBlock + { + public LLUUID AgentID; + public int Contribution; + 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]; Buffer.BlockCopy(value, 0, _onlinestatus, 0, value.Length); } + } + } + public ulong AgentPowers; + 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]; Buffer.BlockCopy(value, 0, _title, 0, value.Length); } + } + } + public bool IsOwner; + + [XmlIgnore] + public int Length + { + get + { + int length = 29; + if (OnlineStatus != null) { length += 1 + OnlineStatus.Length; } + if (Title != null) { length += 1 + Title.Length; } + return length; + } + } + + public MemberDataBlock() { } + public MemberDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + AgentID = new LLUUID(bytes, i); i += 16; + Contribution = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _onlinestatus = new byte[length]; + Buffer.BlockCopy(bytes, i, _onlinestatus, 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)); + length = (ushort)bytes[i++]; + _title = new byte[length]; + Buffer.BlockCopy(bytes, i, _title, 0, length); i += length; + IsOwner = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(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); + if(OnlineStatus == null) { Console.WriteLine("Warning: OnlineStatus is null, in " + this.GetType()); } + bytes[i++] = (byte)OnlineStatus.Length; + Buffer.BlockCopy(OnlineStatus, 0, bytes, i, OnlineStatus.Length); i += OnlineStatus.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); + if(Title == null) { Console.WriteLine("Warning: Title is null, in " + this.GetType()); } + bytes[i++] = (byte)Title.Length; + Buffer.BlockCopy(Title, 0, bytes, i, Title.Length); i += Title.Length; + bytes[i++] = (byte)((IsOwner) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- MemberData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("Contribution: {0}", Contribution)); + Helpers.FieldToString(output, OnlineStatus, "OnlineStatus"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("AgentPowers: {0}", AgentPowers)); + Helpers.FieldToString(output, Title, "Title"); + output.Append(Environment.NewLine); + output.Append(String.Format("IsOwner: {0}", IsOwner)); return output.ToString(); } } @@ -59605,47 +54087,46 @@ namespace libsecondlife.Packets 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 MemberDataBlock[] MemberData; public GroupMembersReplyPacket() { Header = new LowHeader(); - Header.ID = 420; + Header.ID = 367; Header.Reliable = true; - Header.Zerocoded = true; - MemberData = new MemberDataBlock[0]; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); + MemberData = new MemberDataBlock[0]; } public GroupMembersReplyPacket(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); 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; + AgentData = new AgentDataBlock(bytes, ref i); + GroupData = new GroupDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length; length += GroupData.Length;; length++; for (int j = 0; j < MemberData.Length; j++) { length += MemberData[j].Length; } @@ -59653,10 +54134,10 @@ namespace libsecondlife.Packets 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); + bytes[i++] = (byte)MemberData.Length; + for (int j = 0; j < MemberData.Length; j++) { MemberData[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -59664,12 +54145,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupMembersReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += GroupData.ToString() + Environment.NewLine; for (int j = 0; j < MemberData.Length; j++) { output += MemberData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += GroupData.ToString() + Environment.NewLine; return output; } @@ -59736,9 +54217,8 @@ namespace libsecondlife.Packets public ActivateGroupPacket() { Header = new LowHeader(); - Header.ID = 421; + Header.ID = 368; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); } @@ -59757,7 +54237,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -59780,55 +54260,6 @@ namespace libsecondlife.Packets /// public class SetGroupContributionPacket : Packet { - /// - [XmlType("setgroupcontribution_data")] - public class DataBlock - { - public int Contribution; - public LLUUID GroupID; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - try - { - Contribution = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - GroupID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(Contribution % 256); - bytes[i++] = (byte)((Contribution >> 8) % 256); - bytes[i++] = (byte)((Contribution >> 16) % 256); - bytes[i++] = (byte)((Contribution >> 24) % 256); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.AppendLine(String.Format("Contribution: {0}", Contribution)); - output.Append(String.Format("GroupID: {0}", GroupID)); - return output.ToString(); - } - } - /// [XmlType("setgroupcontribution_agentdata")] public class AgentDataBlock @@ -59875,76 +54306,19 @@ namespace libsecondlife.Packets } } - 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 = 422; - Header.Reliable = true; - Data = new DataBlock(); - AgentData = new AgentDataBlock(); - } - - public SetGroupContributionPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public SetGroupContributionPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - Data = new DataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += Data.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - Data.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- SetGroupContribution ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class SetGroupAcceptNoticesPacket : Packet - { /// - [XmlType("setgroupacceptnotices_data")] + [XmlType("setgroupcontribution_data")] public class DataBlock { public LLUUID GroupID; - public bool AcceptNotices; + public int Contribution; [XmlIgnore] public int Length { get { - return 17; + return 20; } } @@ -59954,7 +54328,7 @@ namespace libsecondlife.Packets try { GroupID = new LLUUID(bytes, i); i += 16; - AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false; + Contribution = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -59965,7 +54339,10 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((AcceptNotices) ? 1 : 0); + bytes[i++] = (byte)(Contribution % 256); + bytes[i++] = (byte)((Contribution >> 8) % 256); + bytes[i++] = (byte)((Contribution >> 16) % 256); + bytes[i++] = (byte)((Contribution >> 24) % 256); } public override string ToString() @@ -59973,11 +54350,68 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- Data --"); output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.Append(String.Format("AcceptNotices: {0}", AcceptNotices)); + output.Append(String.Format("Contribution: {0}", Contribution)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.SetGroupContribution; } } + public AgentDataBlock AgentData; + public DataBlock Data; + + public SetGroupContributionPacket() + { + Header = new LowHeader(); + Header.ID = 369; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock(); + } + + public SetGroupContributionPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public SetGroupContributionPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- SetGroupContribution ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class SetGroupAcceptNoticesPacket : Packet + { /// [XmlType("setgroupacceptnotices_agentdata")] public class AgentDataBlock @@ -60024,46 +54458,92 @@ namespace libsecondlife.Packets } } + /// + [XmlType("setgroupacceptnotices_data")] + public class DataBlock + { + public LLUUID GroupID; + public bool AcceptNotices; + + [XmlIgnore] + public int Length + { + get + { + return 17; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + try + { + GroupID = new LLUUID(bytes, i); i += 16; + AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((AcceptNotices) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("AcceptNotices: {0}", AcceptNotices)); + return output.ToString(); + } + } + 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 DataBlock Data; public SetGroupAcceptNoticesPacket() { Header = new LowHeader(); - Header.ID = 423; + Header.ID = 370; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Data = new DataBlock(); } 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); + Data = new DataBlock(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); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += Data.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + Data.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -60071,8 +54551,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- SetGroupAcceptNotices ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -60131,8 +54611,8 @@ namespace libsecondlife.Packets [XmlType("grouproledatarequest_groupdata")] public class GroupDataBlock { - public LLUUID RequestID; public LLUUID GroupID; + public LLUUID RequestID; [XmlIgnore] public int Length @@ -60148,8 +54628,8 @@ namespace libsecondlife.Packets { try { - RequestID = new LLUUID(bytes, i); i += 16; GroupID = new LLUUID(bytes, i); i += 16; + RequestID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -60159,16 +54639,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("RequestID: {0}", RequestID)); return output.ToString(); } } @@ -60182,7 +54662,7 @@ namespace libsecondlife.Packets public GroupRoleDataRequestPacket() { Header = new LowHeader(); - Header.ID = 424; + Header.ID = 371; Header.Reliable = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); @@ -60205,7 +54685,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -60230,127 +54710,6 @@ namespace libsecondlife.Packets /// public class GroupRoleDataReplyPacket : Packet { - /// - [XmlType("grouproledatareply_roledata")] - public class RoleDataBlock - { - public uint Members; - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, 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]; Buffer.BlockCopy(value, 0, _title, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 28; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - if (Title != null) { length += 1 + Title.Length; } - return length; - } - } - - public RoleDataBlock() { } - public RoleDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - Members = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; - length = (ushort)bytes[i++]; - _title = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Title, 0, bytes, i, Title.Length); i += Title.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RoleData --"); - output.AppendLine(String.Format("Members: {0}", Members)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("RoleID: {0}", RoleID)); - output.AppendLine(String.Format("Powers: {0}", Powers)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Title, "Title"); - return output.ToString(); - } - } - /// [XmlType("grouproledatareply_agentdata")] public class AgentDataBlock @@ -60397,9 +54756,9 @@ namespace libsecondlife.Packets [XmlType("grouproledatareply_groupdata")] public class GroupDataBlock { - public int RoleCount; - public LLUUID RequestID; public LLUUID GroupID; + public LLUUID RequestID; + public int RoleCount; [XmlIgnore] public int Length @@ -60415,9 +54774,9 @@ namespace libsecondlife.Packets { 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; + RequestID = new LLUUID(bytes, i); i += 16; + RoleCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -60427,21 +54786,143 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(RoleCount % 256); bytes[i++] = (byte)((RoleCount >> 8) % 256); bytes[i++] = (byte)((RoleCount >> 16) % 256); bytes[i++] = (byte)((RoleCount >> 24) % 256); - Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("RoleCount: {0}", RoleCount)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("RoleCount: {0}", RoleCount)); + return output.ToString(); + } + } + + /// + [XmlType("grouproledatareply_roledata")] + public class RoleDataBlock + { + public LLUUID RoleID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _title, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } + public ulong Powers; + public uint Members; + + [XmlIgnore] + public int Length + { + get + { + int length = 28; + if (Name != null) { length += 1 + Name.Length; } + if (Title != null) { length += 1 + Title.Length; } + if (Description != null) { length += 1 + Description.Length; } + return length; + } + } + + public RoleDataBlock() { } + public RoleDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + RoleID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _title = new byte[length]; + Buffer.BlockCopy(bytes, i, _title, 0, length); i += length; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + 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)); + Members = (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) + { + Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Title == null) { Console.WriteLine("Warning: Title is null, in " + this.GetType()); } + bytes[i++] = (byte)Title.Length; + Buffer.BlockCopy(Title, 0, bytes, i, Title.Length); i += Title.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + 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); + bytes[i++] = (byte)(Members % 256); + bytes[i++] = (byte)((Members >> 8) % 256); + bytes[i++] = (byte)((Members >> 16) % 256); + bytes[i++] = (byte)((Members >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RoleData --"); + output.AppendLine(String.Format("RoleID: {0}", RoleID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Title, "Title"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Powers: {0}", Powers)); + output.Append(String.Format("Members: {0}", Members)); return output.ToString(); } } @@ -60449,46 +54930,46 @@ namespace libsecondlife.Packets 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 RoleDataBlock[] RoleData; public GroupRoleDataReplyPacket() { Header = new LowHeader(); - Header.ID = 425; + Header.ID = 372; Header.Reliable = true; - RoleData = new RoleDataBlock[0]; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); + RoleData = new RoleDataBlock[0]; } public GroupRoleDataReplyPacket(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); 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; + AgentData = new AgentDataBlock(bytes, ref i); + GroupData = new GroupDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length; length += GroupData.Length;; length++; for (int j = 0; j < RoleData.Length; j++) { length += RoleData[j].Length; } @@ -60496,10 +54977,10 @@ namespace libsecondlife.Packets 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); + bytes[i++] = (byte)RoleData.Length; + for (int j = 0; j < RoleData.Length; j++) { RoleData[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -60507,12 +54988,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupRoleDataReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += GroupData.ToString() + Environment.NewLine; for (int j = 0; j < RoleData.Length; j++) { output += RoleData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += GroupData.ToString() + Environment.NewLine; return output; } @@ -60571,8 +55052,8 @@ namespace libsecondlife.Packets [XmlType("grouprolemembersrequest_groupdata")] public class GroupDataBlock { - public LLUUID RequestID; public LLUUID GroupID; + public LLUUID RequestID; [XmlIgnore] public int Length @@ -60588,8 +55069,8 @@ namespace libsecondlife.Packets { try { - RequestID = new LLUUID(bytes, i); i += 16; GroupID = new LLUUID(bytes, i); i += 16; + RequestID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -60599,16 +55080,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("RequestID: {0}", RequestID)); return output.ToString(); } } @@ -60622,7 +55103,7 @@ namespace libsecondlife.Packets public GroupRoleMembersRequestPacket() { Header = new LowHeader(); - Header.ID = 426; + Header.ID = 373; Header.Reliable = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock(); @@ -60645,7 +55126,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length; length += GroupData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -60670,60 +55151,14 @@ namespace libsecondlife.Packets /// public class GroupRoleMembersReplyPacket : Packet { - /// - [XmlType("grouprolemembersreply_memberdata")] - public class MemberDataBlock - { - public LLUUID MemberID; - public LLUUID RoleID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public MemberDataBlock() { } - public MemberDataBlock(byte[] bytes, ref int i) - { - try - { - MemberID = new LLUUID(bytes, i); i += 16; - RoleID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(MemberID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- MemberData --"); - output.AppendLine(String.Format("MemberID: {0}", MemberID)); - output.Append(String.Format("RoleID: {0}", RoleID)); - return output.ToString(); - } - } - /// [XmlType("grouprolemembersreply_agentdata")] public class AgentDataBlock { public LLUUID AgentID; - public uint TotalPairs; - public LLUUID RequestID; public LLUUID GroupID; + public LLUUID RequestID; + public uint TotalPairs; [XmlIgnore] public int Length @@ -60740,9 +55175,9 @@ namespace libsecondlife.Packets 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; + RequestID = new LLUUID(bytes, i); i += 16; + TotalPairs = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -60753,12 +55188,12 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RequestID.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); - Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() @@ -60766,9 +55201,55 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("TotalPairs: {0}", TotalPairs)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("TotalPairs: {0}", TotalPairs)); + return output.ToString(); + } + } + + /// + [XmlType("grouprolemembersreply_memberdata")] + public class MemberDataBlock + { + public LLUUID RoleID; + public LLUUID MemberID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public MemberDataBlock() { } + public MemberDataBlock(byte[] bytes, ref int i) + { + try + { + RoleID = new LLUUID(bytes, i); i += 16; + MemberID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(MemberID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- MemberData --"); + output.AppendLine(String.Format("RoleID: {0}", RoleID)); + output.Append(String.Format("MemberID: {0}", MemberID)); return output.ToString(); } } @@ -60776,42 +55257,42 @@ namespace libsecondlife.Packets 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 MemberDataBlock[] MemberData; public GroupRoleMembersReplyPacket() { Header = new LowHeader(); - Header.ID = 427; + Header.ID = 374; Header.Reliable = true; - MemberData = new MemberDataBlock[0]; AgentData = new AgentDataBlock(); + MemberData = new MemberDataBlock[0]; } public GroupRoleMembersReplyPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < MemberData.Length; j++) { length += MemberData[j].Length; } @@ -60819,9 +55300,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -60829,11 +55310,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupRoleMembersReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < MemberData.Length; j++) { output += MemberData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -60847,9 +55328,9 @@ namespace libsecondlife.Packets public class AgentDataBlock { public LLUUID AgentID; - public LLUUID RequestID; public LLUUID SessionID; public LLUUID GroupID; + public LLUUID RequestID; [XmlIgnore] public int Length @@ -60866,9 +55347,9 @@ namespace libsecondlife.Packets 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; + RequestID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -60879,9 +55360,9 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() @@ -60889,9 +55370,9 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("RequestID: {0}", RequestID)); return output.ToString(); } } @@ -60904,7 +55385,7 @@ namespace libsecondlife.Packets public GroupTitlesRequestPacket() { Header = new LowHeader(); - Header.ID = 428; + Header.ID = 375; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -60924,7 +55405,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -60952,8 +55433,8 @@ namespace libsecondlife.Packets public class AgentDataBlock { public LLUUID AgentID; - public LLUUID RequestID; public LLUUID GroupID; + public LLUUID RequestID; [XmlIgnore] public int Length @@ -60970,8 +55451,8 @@ namespace libsecondlife.Packets try { AgentID = new LLUUID(bytes, i); i += 16; - RequestID = new LLUUID(bytes, i); i += 16; GroupID = new LLUUID(bytes, i); i += 16; + RequestID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -60982,8 +55463,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() @@ -60991,8 +55472,8 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("RequestID: {0}", RequestID)); - output.Append(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.Append(String.Format("RequestID: {0}", RequestID)); return output.ToString(); } } @@ -61001,8 +55482,6 @@ namespace libsecondlife.Packets [XmlType("grouptitlesreply_groupdata")] public class GroupDataBlock { - public bool Selected; - public LLUUID RoleID; private byte[] _title; public byte[] Title { @@ -61014,6 +55493,8 @@ namespace libsecondlife.Packets else { _title = new byte[value.Length]; Buffer.BlockCopy(value, 0, _title, 0, value.Length); } } } + public LLUUID RoleID; + public bool Selected; [XmlIgnore] public int Length @@ -61032,11 +55513,11 @@ namespace libsecondlife.Packets 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]; Buffer.BlockCopy(bytes, i, _title, 0, length); i += length; + RoleID = new LLUUID(bytes, i); i += 16; + Selected = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -61046,20 +55527,21 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((Selected) ? 1 : 0); - Buffer.BlockCopy(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; Buffer.BlockCopy(Title, 0, bytes, i, Title.Length); i += Title.Length; + Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((Selected) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("Selected: {0}", Selected)); - output.AppendLine(String.Format("RoleID: {0}", RoleID)); Helpers.FieldToString(output, Title, "Title"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("RoleID: {0}", RoleID)); + output.Append(String.Format("Selected: {0}", Selected)); return output.ToString(); } } @@ -61073,9 +55555,8 @@ namespace libsecondlife.Packets public GroupTitlesReplyPacket() { Header = new LowHeader(); - Header.ID = 429; + Header.ID = 376; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock[0]; } @@ -61103,7 +55584,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < GroupData.Length; j++) { length += GroupData[j].Length; } @@ -61196,7 +55677,7 @@ namespace libsecondlife.Packets public GroupTitleUpdatePacket() { Header = new LowHeader(); - Header.ID = 430; + Header.ID = 377; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -61216,7 +55697,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -61239,124 +55720,6 @@ namespace libsecondlife.Packets /// public class GroupRoleUpdatePacket : Packet { - /// - [XmlType("grouproleupdate_roledata")] - public class RoleDataBlock - { - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, 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]; Buffer.BlockCopy(value, 0, _title, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 25; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - if (Title != null) { length += 1 + Title.Length; } - return length; - } - } - - public RoleDataBlock() { } - public RoleDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; - length = (ushort)bytes[i++]; - _title = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Title, 0, bytes, i, Title.Length); i += Title.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RoleData --"); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("RoleID: {0}", RoleID)); - output.AppendLine(String.Format("UpdateType: {0}", UpdateType)); - output.AppendLine(String.Format("Powers: {0}", Powers)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Title, "Title"); - return output.ToString(); - } - } - /// [XmlType("grouproleupdate_agentdata")] public class AgentDataBlock @@ -61407,45 +55770,164 @@ namespace libsecondlife.Packets } } + /// + [XmlType("grouproleupdate_roledata")] + public class RoleDataBlock + { + public LLUUID RoleID; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _description, 0, 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]; Buffer.BlockCopy(value, 0, _title, 0, value.Length); } + } + } + public ulong Powers; + public byte UpdateType; + + [XmlIgnore] + public int Length + { + get + { + int length = 25; + if (Name != null) { length += 1 + Name.Length; } + if (Description != null) { length += 1 + Description.Length; } + if (Title != null) { length += 1 + Title.Length; } + return length; + } + } + + public RoleDataBlock() { } + public RoleDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + RoleID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + length = (ushort)bytes[i++]; + _title = new byte[length]; + Buffer.BlockCopy(bytes, i, _title, 0, length); i += length; + 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)); + UpdateType = (byte)bytes[i++]; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(RoleID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(Title, 0, bytes, i, Title.Length); i += Title.Length; + 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); + bytes[i++] = UpdateType; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RoleData --"); + output.AppendLine(String.Format("RoleID: {0}", RoleID)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Description, "Description"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Title, "Title"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Powers: {0}", Powers)); + output.Append(String.Format("UpdateType: {0}", UpdateType)); + return output.ToString(); + } + } + 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 RoleDataBlock[] RoleData; public GroupRoleUpdatePacket() { Header = new LowHeader(); - Header.ID = 431; + Header.ID = 378; Header.Reliable = true; - RoleData = new RoleDataBlock[0]; AgentData = new AgentDataBlock(); + RoleData = new RoleDataBlock[0]; } public GroupRoleUpdatePacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < RoleData.Length; j++) { length += RoleData[j].Length; } @@ -61453,9 +55935,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -61463,11 +55945,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- GroupRoleUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < RoleData.Length; j++) { output += RoleData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -61480,8 +55962,8 @@ namespace libsecondlife.Packets [XmlType("livehelpgrouprequest_requestdata")] public class RequestDataBlock { - public LLUUID AgentID; public LLUUID RequestID; + public LLUUID AgentID; [XmlIgnore] public int Length @@ -61497,8 +55979,8 @@ namespace libsecondlife.Packets { try { - AgentID = new LLUUID(bytes, i); i += 16; RequestID = new LLUUID(bytes, i); i += 16; + AgentID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -61508,16 +55990,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(RequestID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- RequestData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("RequestID: {0}", RequestID)); + output.AppendLine(String.Format("RequestID: {0}", RequestID)); + output.Append(String.Format("AgentID: {0}", AgentID)); return output.ToString(); } } @@ -61530,7 +56012,7 @@ namespace libsecondlife.Packets public LiveHelpGroupRequestPacket() { Header = new LowHeader(); - Header.ID = 432; + Header.ID = 379; Header.Reliable = true; RequestData = new RequestDataBlock(); } @@ -61550,7 +56032,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += RequestData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -61648,7 +56130,7 @@ namespace libsecondlife.Packets public LiveHelpGroupReplyPacket() { Header = new LowHeader(); - Header.ID = 433; + Header.ID = 380; Header.Reliable = true; ReplyData = new ReplyDataBlock(); } @@ -61668,7 +56150,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ReplyData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -61745,7 +56227,7 @@ namespace libsecondlife.Packets public AgentWearablesRequestPacket() { Header = new LowHeader(); - Header.ID = 434; + Header.ID = 381; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -61765,7 +56247,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -61788,63 +56270,13 @@ namespace libsecondlife.Packets /// public class AgentWearablesUpdatePacket : Packet { - /// - [XmlType("agentwearablesupdate_wearabledata")] - public class WearableDataBlock - { - public byte WearableType; - public LLUUID AssetID; - public LLUUID ItemID; - - [XmlIgnore] - public int Length - { - get - { - return 33; - } - } - - public WearableDataBlock() { } - public WearableDataBlock(byte[] bytes, ref int i) - { - try - { - WearableType = (byte)bytes[i++]; - AssetID = new LLUUID(bytes, i); i += 16; - ItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = WearableType; - Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- WearableData --"); - output.AppendLine(String.Format("WearableType: {0}", WearableType)); - output.AppendLine(String.Format("AssetID: {0}", AssetID)); - output.Append(String.Format("ItemID: {0}", ItemID)); - return output.ToString(); - } - } - /// [XmlType("agentwearablesupdate_agentdata")] public class AgentDataBlock { - public uint SerialNum; public LLUUID AgentID; public LLUUID SessionID; + public uint SerialNum; [XmlIgnore] public int Length @@ -61860,9 +56292,9 @@ namespace libsecondlife.Packets { 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; + SerialNum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -61872,108 +56304,39 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(SerialNum % 256); bytes[i++] = (byte)((SerialNum >> 8) % 256); bytes[i++] = (byte)((SerialNum >> 16) % 256); bytes[i++] = (byte)((SerialNum >> 24) % 256); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("SerialNum: {0}", SerialNum)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("SerialNum: {0}", SerialNum)); return output.ToString(); } } - 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 = 435; - Header.Reliable = true; - Header.Zerocoded = true; - WearableData = new WearableDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public AgentWearablesUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - WearableData = new WearableDataBlock[count]; - for (int j = 0; j < count; j++) - { WearableData[j] = new WearableDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AgentWearablesUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - WearableData = new WearableDataBlock[count]; - for (int j = 0; j < count; j++) - { WearableData[j] = new WearableDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)WearableData.Length; - for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AgentWearablesUpdate ---" + Environment.NewLine; - for (int j = 0; j < WearableData.Length; j++) - { - output += WearableData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AgentIsNowWearingPacket : Packet - { /// - [XmlType("agentisnowwearing_wearabledata")] + [XmlType("agentwearablesupdate_wearabledata")] public class WearableDataBlock { - public byte WearableType; public LLUUID ItemID; + public LLUUID AssetID; + public byte WearableType; [XmlIgnore] public int Length { get { - return 17; + return 33; } } @@ -61982,8 +56345,9 @@ namespace libsecondlife.Packets { try { - WearableType = (byte)bytes[i++]; ItemID = new LLUUID(bytes, i); i += 16; + AssetID = new LLUUID(bytes, i); i += 16; + WearableType = (byte)bytes[i++]; } catch (Exception) { @@ -61993,20 +56357,91 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = WearableType; Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = WearableType; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- WearableData --"); - output.AppendLine(String.Format("WearableType: {0}", WearableType)); - output.Append(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.Append(String.Format("WearableType: {0}", WearableType)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.AgentWearablesUpdate; } } + public AgentDataBlock AgentData; + public WearableDataBlock[] WearableData; + + public AgentWearablesUpdatePacket() + { + Header = new LowHeader(); + Header.ID = 382; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + WearableData = new WearableDataBlock[0]; + } + + public AgentWearablesUpdatePacket(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++]; + WearableData = new WearableDataBlock[count]; + for (int j = 0; j < count; j++) + { WearableData[j] = new WearableDataBlock(bytes, ref i); } + } + + public AgentWearablesUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + WearableData = new WearableDataBlock[count]; + for (int j = 0; j < count; j++) + { WearableData[j] = new WearableDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)WearableData.Length; + for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- AgentWearablesUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < WearableData.Length; j++) + { + output += WearableData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class AgentIsNowWearingPacket : Packet + { /// [XmlType("agentisnowwearing_agentdata")] public class AgentDataBlock @@ -62053,46 +56488,91 @@ namespace libsecondlife.Packets } } + /// + [XmlType("agentisnowwearing_wearabledata")] + public class WearableDataBlock + { + public LLUUID ItemID; + public byte WearableType; + + [XmlIgnore] + public int Length + { + get + { + return 17; + } + } + + public WearableDataBlock() { } + public WearableDataBlock(byte[] bytes, ref int i) + { + try + { + ItemID = new LLUUID(bytes, i); i += 16; + WearableType = (byte)bytes[i++]; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = WearableType; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- WearableData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.Append(String.Format("WearableType: {0}", WearableType)); + return output.ToString(); + } + } + 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 WearableDataBlock[] WearableData; public AgentIsNowWearingPacket() { Header = new LowHeader(); - Header.ID = 436; + Header.ID = 383; Header.Reliable = true; - Header.Zerocoded = true; - WearableData = new WearableDataBlock[0]; AgentData = new AgentDataBlock(); + WearableData = new WearableDataBlock[0]; } public AgentIsNowWearingPacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; } @@ -62100,9 +56580,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -62110,11 +56590,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentIsNowWearing ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < WearableData.Length; j++) { output += WearableData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -62123,6 +56603,59 @@ namespace libsecondlife.Packets /// public class AgentCachedTexturePacket : Packet { + /// + [XmlType("agentcachedtexture_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public int SerialNum; + + [XmlIgnore] + public int Length + { + get + { + return 36; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + SerialNum = (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) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(SerialNum % 256); + bytes[i++] = (byte)((SerialNum >> 8) % 256); + bytes[i++] = (byte)((SerialNum >> 16) % 256); + bytes[i++] = (byte)((SerialNum >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("SerialNum: {0}", SerialNum)); + return output.ToString(); + } + } + /// [XmlType("agentcachedtexture_wearabledata")] public class WearableDataBlock @@ -62169,13 +56702,82 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.AgentCachedTexture; } } + public AgentDataBlock AgentData; + public WearableDataBlock[] WearableData; + + public AgentCachedTexturePacket() + { + Header = new LowHeader(); + Header.ID = 384; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + WearableData = new WearableDataBlock[0]; + } + + public AgentCachedTexturePacket(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++]; + WearableData = new WearableDataBlock[count]; + for (int j = 0; j < count; j++) + { WearableData[j] = new WearableDataBlock(bytes, ref i); } + } + + public AgentCachedTexturePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + WearableData = new WearableDataBlock[count]; + for (int j = 0; j < count; j++) + { WearableData[j] = new WearableDataBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.ToBytes(bytes, ref i); + bytes[i++] = (byte)WearableData.Length; + for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- AgentCachedTexture ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < WearableData.Length; j++) + { + output += WearableData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class AgentCachedTextureResponsePacket : Packet + { /// - [XmlType("agentcachedtexture_agentdata")] + [XmlType("agentcachedtextureresponse_agentdata")] public class AgentDataBlock { - public int SerialNum; public LLUUID AgentID; public LLUUID SessionID; + public int SerialNum; [XmlIgnore] public int Length @@ -62191,9 +56793,9 @@ namespace libsecondlife.Packets { 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; + SerialNum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -62203,94 +56805,25 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(SerialNum % 256); bytes[i++] = (byte)((SerialNum >> 8) % 256); bytes[i++] = (byte)((SerialNum >> 16) % 256); bytes[i++] = (byte)((SerialNum >> 24) % 256); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("SerialNum: {0}", SerialNum)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.Append(String.Format("SerialNum: {0}", SerialNum)); return output.ToString(); } } - 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 = 437; - Header.Reliable = true; - WearableData = new WearableDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public AgentCachedTexturePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - WearableData = new WearableDataBlock[count]; - for (int j = 0; j < count; j++) - { WearableData[j] = new WearableDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public AgentCachedTexturePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - WearableData = new WearableDataBlock[count]; - for (int j = 0; j < count; j++) - { WearableData[j] = new WearableDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)WearableData.Length; - for (int j = 0; j < WearableData.Length; j++) { WearableData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AgentCachedTexture ---" + Environment.NewLine; - for (int j = 0; j < WearableData.Length; j++) - { - output += WearableData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class AgentCachedTextureResponsePacket : Packet - { /// [XmlType("agentcachedtextureresponse_wearabledata")] public class WearableDataBlock @@ -62358,98 +56891,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("agentcachedtextureresponse_agentdata")] - public class AgentDataBlock - { - public int SerialNum; - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 36; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - SerialNum = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(SerialNum % 256); - bytes[i++] = (byte)((SerialNum >> 8) % 256); - bytes[i++] = (byte)((SerialNum >> 16) % 256); - bytes[i++] = (byte)((SerialNum >> 24) % 256); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("SerialNum: {0}", SerialNum)); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 WearableDataBlock[] WearableData; public AgentCachedTextureResponsePacket() { Header = new LowHeader(); - Header.ID = 438; + Header.ID = 385; Header.Reliable = true; - WearableData = new WearableDataBlock[0]; AgentData = new AgentDataBlock(); + WearableData = new WearableDataBlock[0]; } public AgentCachedTextureResponsePacket(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++]; 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < WearableData.Length; j++) { length += WearableData[j].Length; } @@ -62457,9 +56937,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -62467,11 +56947,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentCachedTextureResponse ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < WearableData.Length; j++) { output += WearableData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -62534,7 +57014,7 @@ namespace libsecondlife.Packets public AgentDataUpdateRequestPacket() { Header = new LowHeader(); - Header.ID = 439; + Header.ID = 386; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -62554,7 +57034,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -62581,30 +57061,7 @@ namespace libsecondlife.Packets [XmlType("agentdataupdate_agentdata")] public class AgentDataBlock { - private byte[] _grouptitle; - public byte[] GroupTitle - { - get { return _grouptitle; } - set - { - if (value == null) { _grouptitle = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _grouptitle = new byte[value.Length]; Buffer.BlockCopy(value, 0, _grouptitle, 0, 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]; Buffer.BlockCopy(value, 0, _lastname, 0, value.Length); } - } - } private byte[] _firstname; public byte[] FirstName { @@ -62616,6 +57073,30 @@ namespace libsecondlife.Packets else { _firstname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _firstname, 0, 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]; Buffer.BlockCopy(value, 0, _lastname, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _grouptitle, 0, value.Length); } + } + } + public LLUUID ActiveGroupID; + public ulong GroupPowers; private byte[] _groupname; public byte[] GroupName { @@ -62627,7 +57108,6 @@ namespace libsecondlife.Packets else { _groupname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _groupname, 0, value.Length); } } } - public LLUUID ActiveGroupID; [XmlIgnore] public int Length @@ -62635,9 +57115,9 @@ namespace libsecondlife.Packets 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 (LastName != null) { length += 1 + LastName.Length; } + if (GroupTitle != null) { length += 1 + GroupTitle.Length; } if (GroupName != null) { length += 1 + GroupName.Length; } return length; } @@ -62649,21 +57129,21 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)bytes[i++]; - _grouptitle = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; - length = (ushort)bytes[i++]; _firstname = new byte[length]; Buffer.BlockCopy(bytes, i, _firstname, 0, length); i += length; length = (ushort)bytes[i++]; + _lastname = new byte[length]; + Buffer.BlockCopy(bytes, i, _lastname, 0, length); i += length; + length = (ushort)bytes[i++]; + _grouptitle = new byte[length]; + Buffer.BlockCopy(bytes, i, _grouptitle, 0, length); i += length; + ActiveGroupID = new LLUUID(bytes, i); i += 16; + 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)); + length = (ushort)bytes[i++]; _groupname = new byte[length]; Buffer.BlockCopy(bytes, i, _groupname, 0, length); i += length; - ActiveGroupID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -62673,9 +57153,17 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + if(FirstName == null) { Console.WriteLine("Warning: FirstName is null, in " + this.GetType()); } + bytes[i++] = (byte)FirstName.Length; + Buffer.BlockCopy(FirstName, 0, bytes, i, FirstName.Length); i += FirstName.Length; + if(LastName == null) { Console.WriteLine("Warning: LastName is null, in " + this.GetType()); } + bytes[i++] = (byte)LastName.Length; + Buffer.BlockCopy(LastName, 0, bytes, i, LastName.Length); i += LastName.Length; if(GroupTitle == null) { Console.WriteLine("Warning: GroupTitle is null, in " + this.GetType()); } bytes[i++] = (byte)GroupTitle.Length; Buffer.BlockCopy(GroupTitle, 0, bytes, i, GroupTitle.Length); i += GroupTitle.Length; + Buffer.BlockCopy(ActiveGroupID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(GroupPowers % 256); bytes[i++] = (byte)((GroupPowers >> 8) % 256); bytes[i++] = (byte)((GroupPowers >> 16) % 256); @@ -62684,34 +57172,25 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((GroupPowers >> 40) % 256); bytes[i++] = (byte)((GroupPowers >> 48) % 256); bytes[i++] = (byte)((GroupPowers >> 56) % 256); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; Buffer.BlockCopy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length; - Buffer.BlockCopy(ActiveGroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - Helpers.FieldToString(output, GroupTitle, "GroupTitle"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - Helpers.FieldToString(output, LastName, "LastName"); - output.Append(Environment.NewLine); Helpers.FieldToString(output, FirstName, "FirstName"); output.Append(Environment.NewLine); - Helpers.FieldToString(output, GroupName, "GroupName"); + Helpers.FieldToString(output, LastName, "LastName"); output.Append(Environment.NewLine); - output.Append(String.Format("ActiveGroupID: {0}", ActiveGroupID)); + Helpers.FieldToString(output, GroupTitle, "GroupTitle"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ActiveGroupID: {0}", ActiveGroupID)); + output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); + Helpers.FieldToString(output, GroupName, "GroupName"); return output.ToString(); } } @@ -62724,9 +57203,8 @@ namespace libsecondlife.Packets public AgentDataUpdatePacket() { Header = new LowHeader(); - Header.ID = 440; + Header.ID = 387; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); } @@ -62745,7 +57223,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -62772,6 +57250,9 @@ namespace libsecondlife.Packets [XmlType("groupdataupdate_agentgroupdata")] public class AgentGroupDataBlock { + public LLUUID AgentID; + public LLUUID GroupID; + public ulong AgentPowers; private byte[] _grouptitle; public byte[] GroupTitle { @@ -62783,9 +57264,6 @@ namespace libsecondlife.Packets else { _grouptitle = new byte[value.Length]; Buffer.BlockCopy(value, 0, _grouptitle, 0, value.Length); } } } - public LLUUID AgentID; - public LLUUID GroupID; - public ulong AgentPowers; [XmlIgnore] public int Length @@ -62804,12 +57282,12 @@ namespace libsecondlife.Packets int length; try { - length = (ushort)bytes[i++]; - _grouptitle = new byte[length]; - Buffer.BlockCopy(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)); + length = (ushort)bytes[i++]; + _grouptitle = new byte[length]; + Buffer.BlockCopy(bytes, i, _grouptitle, 0, length); i += length; } catch (Exception) { @@ -62819,9 +57297,6 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(GroupTitle, 0, bytes, i, GroupTitle.Length); i += GroupTitle.Length; Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(AgentPowers % 256); @@ -62832,17 +57307,19 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((AgentPowers >> 40) % 256); bytes[i++] = (byte)((AgentPowers >> 48) % 256); bytes[i++] = (byte)((AgentPowers >> 56) % 256); + if(GroupTitle == null) { Console.WriteLine("Warning: GroupTitle is null, in " + this.GetType()); } + bytes[i++] = (byte)GroupTitle.Length; + Buffer.BlockCopy(GroupTitle, 0, bytes, i, GroupTitle.Length); i += GroupTitle.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentGroupData --"); - Helpers.FieldToString(output, GroupTitle, "GroupTitle"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.Append(String.Format("AgentPowers: {0}", AgentPowers)); + output.AppendLine(String.Format("AgentPowers: {0}", AgentPowers)); + Helpers.FieldToString(output, GroupTitle, "GroupTitle"); return output.ToString(); } } @@ -62855,9 +57332,8 @@ namespace libsecondlife.Packets public GroupDataUpdatePacket() { Header = new LowHeader(); - Header.ID = 441; + Header.ID = 388; Header.Reliable = true; - Header.Zerocoded = true; AgentGroupData = new AgentGroupDataBlock[0]; } @@ -62882,7 +57358,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < AgentGroupData.Length; j++) { length += AgentGroupData[j].Length; } @@ -62957,11 +57433,11 @@ namespace libsecondlife.Packets [XmlType("agentgroupdataupdate_groupdata")] public class GroupDataBlock { - public ulong GroupPowers; - public int Contribution; public LLUUID GroupID; - public LLUUID GroupInsigniaID; + public ulong GroupPowers; public bool AcceptNotices; + public LLUUID GroupInsigniaID; + public int Contribution; private byte[] _groupname; public byte[] GroupName { @@ -62991,11 +57467,11 @@ namespace libsecondlife.Packets 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; + 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)); AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false; + GroupInsigniaID = new LLUUID(bytes, i); i += 16; + Contribution = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); length = (ushort)bytes[i++]; _groupname = new byte[length]; Buffer.BlockCopy(bytes, i, _groupname, 0, length); i += length; @@ -63008,6 +57484,7 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(GroupPowers % 256); bytes[i++] = (byte)((GroupPowers >> 8) % 256); bytes[i++] = (byte)((GroupPowers >> 16) % 256); @@ -63016,13 +57493,12 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((GroupPowers >> 40) % 256); bytes[i++] = (byte)((GroupPowers >> 48) % 256); bytes[i++] = (byte)((GroupPowers >> 56) % 256); + bytes[i++] = (byte)((AcceptNotices) ? 1 : 0); + Buffer.BlockCopy(GroupInsigniaID.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); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; Buffer.BlockCopy(GroupName, 0, bytes, i, GroupName.Length); i += GroupName.Length; @@ -63032,11 +57508,11 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); - output.AppendLine(String.Format("Contribution: {0}", Contribution)); output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("GroupInsigniaID: {0}", GroupInsigniaID)); + output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); output.AppendLine(String.Format("AcceptNotices: {0}", AcceptNotices)); + output.AppendLine(String.Format("GroupInsigniaID: {0}", GroupInsigniaID)); + output.AppendLine(String.Format("Contribution: {0}", Contribution)); Helpers.FieldToString(output, GroupName, "GroupName"); return output.ToString(); } @@ -63051,9 +57527,8 @@ namespace libsecondlife.Packets public AgentGroupDataUpdatePacket() { Header = new LowHeader(); - Header.ID = 442; + Header.ID = 389; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); GroupData = new GroupDataBlock[0]; } @@ -63081,7 +57556,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < GroupData.Length; j++) { length += GroupData[j].Length; } @@ -63166,9 +57641,8 @@ namespace libsecondlife.Packets public AgentDropGroupPacket() { Header = new LowHeader(); - Header.ID = 443; + Header.ID = 390; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); } @@ -63187,7 +57661,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -63214,8 +57688,8 @@ namespace libsecondlife.Packets [XmlType("createtrustedcircuit_datablock")] public class DataBlockBlock { - public byte[] Digest; public LLUUID EndPointID; + public byte[] Digest; [XmlIgnore] public int Length @@ -63231,9 +57705,9 @@ namespace libsecondlife.Packets { try { + EndPointID = new LLUUID(bytes, i); i += 16; Digest = new byte[32]; Buffer.BlockCopy(bytes, i, Digest, 0, 32); i += 32; - EndPointID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -63243,17 +57717,16 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(Digest, 0, bytes, i, 32);i += 32; Buffer.BlockCopy(EndPointID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Digest, 0, bytes, i, 32);i += 32; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- DataBlock --"); + output.AppendLine(String.Format("EndPointID: {0}", EndPointID)); Helpers.FieldToString(output, Digest, "Digest"); - output.Append(Environment.NewLine); - output.Append(String.Format("EndPointID: {0}", EndPointID)); return output.ToString(); } } @@ -63266,7 +57739,7 @@ namespace libsecondlife.Packets public CreateTrustedCircuitPacket() { Header = new LowHeader(); - Header.ID = 445; + Header.ID = 392; Header.Reliable = true; DataBlock = new DataBlockBlock(); } @@ -63286,7 +57759,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += DataBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -63359,7 +57832,7 @@ namespace libsecondlife.Packets public DenyTrustedCircuitPacket() { Header = new LowHeader(); - Header.ID = 446; + Header.ID = 393; Header.Reliable = true; DataBlock = new DataBlockBlock(); } @@ -63379,7 +57852,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += DataBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -63409,7 +57882,7 @@ namespace libsecondlife.Packets public RequestTrustedCircuitPacket() { Header = new LowHeader(); - Header.ID = 447; + Header.ID = 394; Header.Reliable = true; } @@ -63426,7 +57899,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -63447,126 +57920,6 @@ namespace libsecondlife.Packets /// public class RezSingleAttachmentFromInvPacket : Packet { - /// - [XmlType("rezsingleattachmentfrominv_objectdata")] - public class ObjectDataBlock - { - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } - } - } - public byte AttachmentPt; - public uint NextOwnerMask; - public uint GroupMask; - - [XmlIgnore] - public int Length - { - get - { - int length = 49; - if (Name != null) { length += 1 + Name.Length; } - if (Description != null) { length += 1 + Description.Length; } - return length; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ItemFlags: {0}", ItemFlags)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("AttachmentPt: {0}", AttachmentPt)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.Append(String.Format("GroupMask: {0}", GroupMask)); - return output.ToString(); - } - } - /// [XmlType("rezsingleattachmentfrominv_agentdata")] public class AgentDataBlock @@ -63613,68 +57966,17 @@ namespace libsecondlife.Packets } } - 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 = 448; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public RezSingleAttachmentFromInvPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public RezSingleAttachmentFromInvPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- RezSingleAttachmentFromInv ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RezMultipleAttachmentsFromInvPacket : Packet - { /// - [XmlType("rezmultipleattachmentsfrominv_objectdata")] + [XmlType("rezsingleattachmentfrominv_objectdata")] public class ObjectDataBlock { + public LLUUID ItemID; + public LLUUID OwnerID; + public byte AttachmentPt; + public uint ItemFlags; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; private byte[] _name; public byte[] Name { @@ -63686,10 +57988,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - public uint ItemFlags; - public LLUUID OwnerID; - public LLUUID ItemID; - public uint EveryoneMask; private byte[] _description; public byte[] Description { @@ -63701,9 +57999,6 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public byte AttachmentPt; - public uint NextOwnerMask; - public uint GroupMask; [XmlIgnore] public int Length @@ -63723,19 +58018,19 @@ namespace libsecondlife.Packets int length; try { + ItemID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + AttachmentPt = (byte)bytes[i++]; + ItemFlags = (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)); + 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)); length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(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) { @@ -63745,52 +58040,108 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = AttachmentPt; bytes[i++] = (byte)(ItemFlags % 256); bytes[i++] = (byte)((ItemFlags >> 8) % 256); bytes[i++] = (byte)((ItemFlags >> 16) % 256); bytes[i++] = (byte)((ItemFlags >> 24) % 256); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + 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); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("AttachmentPt: {0}", AttachmentPt)); + output.AppendLine(String.Format("ItemFlags: {0}", ItemFlags)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("ItemFlags: {0}", ItemFlags)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("AttachmentPt: {0}", AttachmentPt)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.Append(String.Format("GroupMask: {0}", GroupMask)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.RezSingleAttachmentFromInv; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public RezSingleAttachmentFromInvPacket() + { + Header = new LowHeader(); + Header.ID = 395; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public RezSingleAttachmentFromInvPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public RezSingleAttachmentFromInvPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- RezSingleAttachmentFromInv ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class RezMultipleAttachmentsFromInvPacket : Packet + { /// [XmlType("rezmultipleattachmentsfrominv_agentdata")] public class AgentDataBlock @@ -63842,8 +58193,8 @@ namespace libsecondlife.Packets public class HeaderDataBlock { public LLUUID CompoundMsgID; - public bool FirstDetachAll; public byte TotalObjects; + public bool FirstDetachAll; [XmlIgnore] public int Length @@ -63860,8 +58211,8 @@ namespace libsecondlife.Packets try { CompoundMsgID = new LLUUID(bytes, i); i += 16; - FirstDetachAll = (bytes[i++] != 0) ? (bool)true : (bool)false; TotalObjects = (byte)bytes[i++]; + FirstDetachAll = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -63872,8 +58223,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(CompoundMsgID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((FirstDetachAll) ? 1 : 0); bytes[i++] = TotalObjects; + bytes[i++] = (byte)((FirstDetachAll) ? 1 : 0); } public override string ToString() @@ -63881,8 +58232,127 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- HeaderData --"); output.AppendLine(String.Format("CompoundMsgID: {0}", CompoundMsgID)); - output.AppendLine(String.Format("FirstDetachAll: {0}", FirstDetachAll)); - output.Append(String.Format("TotalObjects: {0}", TotalObjects)); + output.AppendLine(String.Format("TotalObjects: {0}", TotalObjects)); + output.Append(String.Format("FirstDetachAll: {0}", FirstDetachAll)); + return output.ToString(); + } + } + + /// + [XmlType("rezmultipleattachmentsfrominv_objectdata")] + public class ObjectDataBlock + { + public LLUUID ItemID; + public LLUUID OwnerID; + public byte AttachmentPt; + public uint ItemFlags; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 49; + if (Name != null) { length += 1 + Name.Length; } + if (Description != null) { length += 1 + Description.Length; } + return length; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ItemID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + AttachmentPt = (byte)bytes[i++]; + ItemFlags = (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)); + 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)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _description = new byte[length]; + Buffer.BlockCopy(bytes, i, _description, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = AttachmentPt; + bytes[i++] = (byte)(ItemFlags % 256); + bytes[i++] = (byte)((ItemFlags >> 8) % 256); + bytes[i++] = (byte)((ItemFlags >> 16) % 256); + bytes[i++] = (byte)((ItemFlags >> 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)(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); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("AttachmentPt: {0}", AttachmentPt)); + output.AppendLine(String.Format("ItemFlags: {0}", ItemFlags)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Description, "Description"); return output.ToString(); } } @@ -63890,47 +58360,46 @@ namespace libsecondlife.Packets 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 ObjectDataBlock[] ObjectData; public RezMultipleAttachmentsFromInvPacket() { Header = new LowHeader(); - Header.ID = 449; + Header.ID = 396; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); HeaderData = new HeaderDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public RezMultipleAttachmentsFromInvPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length; length += HeaderData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -63938,10 +58407,10 @@ namespace libsecondlife.Packets 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); + 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; } @@ -63949,12 +58418,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RezMultipleAttachmentsFromInv ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += HeaderData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += HeaderData.ToString() + Environment.NewLine; return output; } @@ -64017,7 +58486,7 @@ namespace libsecondlife.Packets public DetachAttachmentIntoInvPacket() { Header = new LowHeader(); - Header.ID = 450; + Header.ID = 397; Header.Reliable = true; ObjectData = new ObjectDataBlock(); } @@ -64037,7 +58506,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += ObjectData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -64060,52 +58529,6 @@ namespace libsecondlife.Packets /// public class CreateNewOutfitAttachmentsPacket : Packet { - /// - [XmlType("createnewoutfitattachments_objectdata")] - public class ObjectDataBlock - { - public LLUUID OldFolderID; - public LLUUID OldItemID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - OldFolderID = new LLUUID(bytes, i); i += 16; - OldItemID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(OldFolderID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(OldItemID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("OldFolderID: {0}", OldFolderID)); - output.Append(String.Format("OldItemID: {0}", OldItemID)); - return output.ToString(); - } - } - /// [XmlType("createnewoutfitattachments_agentdata")] public class AgentDataBlock @@ -64194,49 +58617,95 @@ namespace libsecondlife.Packets } } + /// + [XmlType("createnewoutfitattachments_objectdata")] + public class ObjectDataBlock + { + public LLUUID OldItemID; + public LLUUID OldFolderID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + OldItemID = new LLUUID(bytes, i); i += 16; + OldFolderID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(OldItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OldFolderID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("OldItemID: {0}", OldItemID)); + output.Append(String.Format("OldFolderID: {0}", OldFolderID)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public CreateNewOutfitAttachmentsPacket() { Header = new LowHeader(); - Header.ID = 451; + Header.ID = 398; Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); HeaderData = new HeaderDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public CreateNewOutfitAttachmentsPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); + HeaderData = new HeaderDataBlock(bytes, ref i); 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; + int length = 10; length += AgentData.Length; length += HeaderData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -64244,10 +58713,10 @@ namespace libsecondlife.Packets 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); + 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; } @@ -64255,12 +58724,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- CreateNewOutfitAttachments ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += HeaderData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; - output += HeaderData.ToString() + Environment.NewLine; return output; } @@ -64323,7 +58792,7 @@ namespace libsecondlife.Packets public UserInfoRequestPacket() { Header = new LowHeader(); - Header.ID = 452; + Header.ID = 399; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -64343,7 +58812,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -64366,91 +58835,6 @@ namespace libsecondlife.Packets /// public class UserInfoReplyPacket : Packet { - /// - [XmlType("userinforeply_userdata")] - public class UserDataBlock - { - private byte[] _email; - public byte[] EMail - { - get { return _email; } - set - { - if (value == null) { _email = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _email = new byte[value.Length]; Buffer.BlockCopy(value, 0, _email, 0, value.Length); } - } - } - private byte[] _directoryvisibility; - public byte[] DirectoryVisibility - { - get { return _directoryvisibility; } - set - { - if (value == null) { _directoryvisibility = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _directoryvisibility = new byte[value.Length]; Buffer.BlockCopy(value, 0, _directoryvisibility, 0, value.Length); } - } - } - public bool IMViaEMail; - - [XmlIgnore] - public int Length - { - get - { - int length = 1; - if (EMail != null) { length += 2 + EMail.Length; } - if (DirectoryVisibility != null) { length += 1 + DirectoryVisibility.Length; } - return length; - } - } - - public UserDataBlock() { } - public UserDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _email = new byte[length]; - Buffer.BlockCopy(bytes, i, _email, 0, length); i += length; - length = (ushort)bytes[i++]; - _directoryvisibility = new byte[length]; - Buffer.BlockCopy(bytes, i, _directoryvisibility, 0, length); i += length; - IMViaEMail = (bytes[i++] != 0) ? (bool)true : (bool)false; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - if(EMail == null) { Console.WriteLine("Warning: EMail is null, in " + this.GetType()); } - bytes[i++] = (byte)(EMail.Length % 256); - bytes[i++] = (byte)((EMail.Length >> 8) % 256); - Buffer.BlockCopy(EMail, 0, bytes, i, EMail.Length); i += EMail.Length; - if(DirectoryVisibility == null) { Console.WriteLine("Warning: DirectoryVisibility is null, in " + this.GetType()); } - bytes[i++] = (byte)DirectoryVisibility.Length; - Buffer.BlockCopy(DirectoryVisibility, 0, bytes, i, DirectoryVisibility.Length); i += DirectoryVisibility.Length; - bytes[i++] = (byte)((IMViaEMail) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- UserData --"); - Helpers.FieldToString(output, EMail, "EMail"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, DirectoryVisibility, "DirectoryVisibility"); - output.Append(Environment.NewLine); - output.Append(String.Format("IMViaEMail: {0}", IMViaEMail)); - return output.ToString(); - } - } - /// [XmlType("userinforeply_agentdata")] public class AgentDataBlock @@ -64493,67 +58877,11 @@ namespace libsecondlife.Packets } } - 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 = 453; - Header.Reliable = true; - UserData = new UserDataBlock(); - AgentData = new AgentDataBlock(); - } - - public UserInfoReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - UserData = new UserDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public UserInfoReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - UserData = new UserDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += UserData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - UserData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- UserInfoReply ---" + Environment.NewLine; - output += UserData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class UpdateUserInfoPacket : Packet - { /// - [XmlType("updateuserinfo_userdata")] + [XmlType("userinforeply_userdata")] public class UserDataBlock { + public bool IMViaEMail; private byte[] _directoryvisibility; public byte[] DirectoryVisibility { @@ -64565,7 +58893,17 @@ namespace libsecondlife.Packets else { _directoryvisibility = new byte[value.Length]; Buffer.BlockCopy(value, 0, _directoryvisibility, 0, value.Length); } } } - public bool IMViaEMail; + private byte[] _email; + public byte[] EMail + { + get { return _email; } + set + { + if (value == null) { _email = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _email = new byte[value.Length]; Buffer.BlockCopy(value, 0, _email, 0, value.Length); } + } + } [XmlIgnore] public int Length @@ -64574,6 +58912,7 @@ namespace libsecondlife.Packets { int length = 1; if (DirectoryVisibility != null) { length += 1 + DirectoryVisibility.Length; } + if (EMail != null) { length += 2 + EMail.Length; } return length; } } @@ -64584,10 +58923,13 @@ namespace libsecondlife.Packets int length; try { + IMViaEMail = (bytes[i++] != 0) ? (bool)true : (bool)false; length = (ushort)bytes[i++]; _directoryvisibility = new byte[length]; Buffer.BlockCopy(bytes, i, _directoryvisibility, 0, length); i += length; - IMViaEMail = (bytes[i++] != 0) ? (bool)true : (bool)false; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _email = new byte[length]; + Buffer.BlockCopy(bytes, i, _email, 0, length); i += length; } catch (Exception) { @@ -64597,23 +58939,85 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + bytes[i++] = (byte)((IMViaEMail) ? 1 : 0); if(DirectoryVisibility == null) { Console.WriteLine("Warning: DirectoryVisibility is null, in " + this.GetType()); } bytes[i++] = (byte)DirectoryVisibility.Length; Buffer.BlockCopy(DirectoryVisibility, 0, bytes, i, DirectoryVisibility.Length); i += DirectoryVisibility.Length; - bytes[i++] = (byte)((IMViaEMail) ? 1 : 0); + 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); + Buffer.BlockCopy(EMail, 0, bytes, i, EMail.Length); i += EMail.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- UserData --"); + output.AppendLine(String.Format("IMViaEMail: {0}", IMViaEMail)); Helpers.FieldToString(output, DirectoryVisibility, "DirectoryVisibility"); output.Append(Environment.NewLine); - output.Append(String.Format("IMViaEMail: {0}", IMViaEMail)); + Helpers.FieldToString(output, EMail, "EMail"); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.UserInfoReply; } } + public AgentDataBlock AgentData; + public UserDataBlock UserData; + + public UserInfoReplyPacket() + { + Header = new LowHeader(); + Header.ID = 400; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + UserData = new UserDataBlock(); + } + + public UserInfoReplyPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new LowHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + UserData = new UserDataBlock(bytes, ref i); + } + + public UserInfoReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + UserData = new UserDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 10; + length += AgentData.Length; 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); + AgentData.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 = "--- UserInfoReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += UserData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class UpdateUserInfoPacket : Packet + { /// [XmlType("updateuserinfo_agentdata")] public class AgentDataBlock @@ -64660,46 +59064,109 @@ namespace libsecondlife.Packets } } + /// + [XmlType("updateuserinfo_userdata")] + public class UserDataBlock + { + public bool IMViaEMail; + private byte[] _directoryvisibility; + public byte[] DirectoryVisibility + { + get { return _directoryvisibility; } + set + { + if (value == null) { _directoryvisibility = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _directoryvisibility = new byte[value.Length]; Buffer.BlockCopy(value, 0, _directoryvisibility, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 1; + if (DirectoryVisibility != null) { length += 1 + DirectoryVisibility.Length; } + return length; + } + } + + public UserDataBlock() { } + public UserDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + IMViaEMail = (bytes[i++] != 0) ? (bool)true : (bool)false; + length = (ushort)bytes[i++]; + _directoryvisibility = new byte[length]; + Buffer.BlockCopy(bytes, i, _directoryvisibility, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)((IMViaEMail) ? 1 : 0); + if(DirectoryVisibility == null) { Console.WriteLine("Warning: DirectoryVisibility is null, in " + this.GetType()); } + bytes[i++] = (byte)DirectoryVisibility.Length; + Buffer.BlockCopy(DirectoryVisibility, 0, bytes, i, DirectoryVisibility.Length); i += DirectoryVisibility.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- UserData --"); + output.AppendLine(String.Format("IMViaEMail: {0}", IMViaEMail)); + Helpers.FieldToString(output, DirectoryVisibility, "DirectoryVisibility"); + return output.ToString(); + } + } + 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 UserDataBlock UserData; public UpdateUserInfoPacket() { Header = new LowHeader(); - Header.ID = 454; + Header.ID = 401; Header.Reliable = true; - UserData = new UserDataBlock(); AgentData = new AgentDataBlock(); + UserData = new UserDataBlock(); } 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); + UserData = new UserDataBlock(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); + UserData = new UserDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += UserData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + UserData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -64707,53 +59174,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- UpdateUserInfo ---" + Environment.NewLine; - output += UserData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - 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 = 460; - Header.Reliable = true; - } - - public StartParcelRemoveAckPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - } - - public StartParcelRemoveAckPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - } - - public override byte[] ToBytes() - { - int length = 8; -; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- StartParcelRemoveAck ---" + Environment.NewLine; + output += UserData.ToString() + Environment.NewLine; return output; } @@ -64762,6 +59184,48 @@ namespace libsecondlife.Packets /// public class InitiateDownloadPacket : Packet { + /// + [XmlType("initiatedownload_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + + [XmlIgnore] + public int Length + { + get + { + return 16; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.Append(String.Format("AgentID: {0}", AgentID)); + return output.ToString(); + } + } + /// [XmlType("initiatedownload_filedata")] public class FileDataBlock @@ -64841,88 +59305,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("initiatedownload_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.Append(String.Format("AgentID: {0}", AgentID)); - return output.ToString(); - } - } - 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 FileDataBlock FileData; public InitiateDownloadPacket() { Header = new LowHeader(); - Header.ID = 462; + Header.ID = 403; Header.Reliable = true; - FileData = new FileDataBlock(); AgentData = new AgentDataBlock(); + FileData = new FileDataBlock(); } 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); + FileData = new FileDataBlock(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); + FileData = new FileDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += FileData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += FileData.Length;; 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); + FileData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -64930,8 +59352,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- InitiateDownload ---" + Environment.NewLine; - output += FileData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += FileData.ToString() + Environment.NewLine; return output; } @@ -64944,8 +59366,6 @@ namespace libsecondlife.Packets [XmlType("systemmessage_methoddata")] public class MethodDataBlock { - public LLUUID Invoice; - public byte[] Digest; private byte[] _method; public byte[] Method { @@ -64957,6 +59377,8 @@ namespace libsecondlife.Packets else { _method = new byte[value.Length]; Buffer.BlockCopy(value, 0, _method, 0, value.Length); } } } + public LLUUID Invoice; + public byte[] Digest; [XmlIgnore] public int Length @@ -64975,12 +59397,12 @@ namespace libsecondlife.Packets int length; try { - Invoice = new LLUUID(bytes, i); i += 16; - Digest = new byte[32]; - Buffer.BlockCopy(bytes, i, Digest, 0, 32); i += 32; length = (ushort)bytes[i++]; _method = new byte[length]; Buffer.BlockCopy(bytes, i, _method, 0, length); i += length; + Invoice = new LLUUID(bytes, i); i += 16; + Digest = new byte[32]; + Buffer.BlockCopy(bytes, i, Digest, 0, 32); i += 32; } catch (Exception) { @@ -64990,21 +59412,21 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Digest, 0, bytes, i, 32);i += 32; if(Method == null) { Console.WriteLine("Warning: Method is null, in " + this.GetType()); } bytes[i++] = (byte)Method.Length; Buffer.BlockCopy(Method, 0, bytes, i, Method.Length); i += Method.Length; + Buffer.BlockCopy(Invoice.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Digest, 0, bytes, i, 32);i += 32; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- MethodData --"); + Helpers.FieldToString(output, Method, "Method"); + output.Append(Environment.NewLine); output.AppendLine(String.Format("Invoice: {0}", Invoice)); Helpers.FieldToString(output, Digest, "Digest"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, Method, "Method"); return output.ToString(); } } @@ -65077,9 +59499,8 @@ namespace libsecondlife.Packets public SystemMessagePacket() { Header = new LowHeader(); - Header.ID = 463; + Header.ID = 404; Header.Reliable = true; - Header.Zerocoded = true; MethodData = new MethodDataBlock(); ParamList = new ParamListBlock[0]; } @@ -65107,7 +59528,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += MethodData.Length;; length++; for (int j = 0; j < ParamList.Length; j++) { length += ParamList[j].Length; } @@ -65144,9 +59565,9 @@ namespace libsecondlife.Packets { public LLUUID AgentID; public LLUUID SessionID; - public bool Godlike; public uint Flags; public uint EstateID; + public bool Godlike; [XmlIgnore] public int Length @@ -65164,9 +59585,9 @@ namespace libsecondlife.Packets { 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)); + Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -65178,7 +59599,6 @@ namespace libsecondlife.Packets { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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); @@ -65187,6 +59607,7 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((EstateID >> 8) % 256); bytes[i++] = (byte)((EstateID >> 16) % 256); bytes[i++] = (byte)((EstateID >> 24) % 256); + bytes[i++] = (byte)((Godlike) ? 1 : 0); } public override string ToString() @@ -65195,9 +59616,9 @@ namespace libsecondlife.Packets output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("Godlike: {0}", Godlike)); output.AppendLine(String.Format("Flags: {0}", Flags)); - output.Append(String.Format("EstateID: {0}", EstateID)); + output.AppendLine(String.Format("EstateID: {0}", EstateID)); + output.Append(String.Format("Godlike: {0}", Godlike)); return output.ToString(); } } @@ -65210,7 +59631,7 @@ namespace libsecondlife.Packets public MapLayerRequestPacket() { Header = new LowHeader(); - Header.ID = 464; + Header.ID = 405; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -65230,7 +59651,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -65306,11 +59727,11 @@ namespace libsecondlife.Packets [XmlType("maplayerreply_layerdata")] public class LayerDataBlock { - public uint Top; - public LLUUID ImageID; public uint Left; - public uint Bottom; public uint Right; + public uint Top; + public uint Bottom; + public LLUUID ImageID; [XmlIgnore] public int Length @@ -65326,11 +59747,11 @@ namespace libsecondlife.Packets { 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)); + Top = (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)); + ImageID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -65340,34 +59761,34 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(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); + bytes[i++] = (byte)(Top % 256); + bytes[i++] = (byte)((Top >> 8) % 256); + bytes[i++] = (byte)((Top >> 16) % 256); + bytes[i++] = (byte)((Top >> 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); + Buffer.BlockCopy(ImageID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- LayerData --"); - output.AppendLine(String.Format("Top: {0}", Top)); - output.AppendLine(String.Format("ImageID: {0}", ImageID)); output.AppendLine(String.Format("Left: {0}", Left)); + output.AppendLine(String.Format("Right: {0}", Right)); + output.AppendLine(String.Format("Top: {0}", Top)); output.AppendLine(String.Format("Bottom: {0}", Bottom)); - output.Append(String.Format("Right: {0}", Right)); + output.Append(String.Format("ImageID: {0}", ImageID)); return output.ToString(); } } @@ -65381,7 +59802,7 @@ namespace libsecondlife.Packets public MapLayerReplyPacket() { Header = new LowHeader(); - Header.ID = 465; + Header.ID = 406; Header.Reliable = true; AgentData = new AgentDataBlock(); LayerData = new LayerDataBlock[0]; @@ -65410,7 +59831,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; length++; for (int j = 0; j < LayerData.Length; j++) { length += LayerData[j].Length; } @@ -65441,73 +59862,15 @@ namespace libsecondlife.Packets /// public class MapBlockRequestPacket : Packet { - /// - [XmlType("mapblockrequest_positiondata")] - public class PositionDataBlock - { - public ushort MaxX; - public ushort MaxY; - public ushort MinX; - public ushort MinY; - - [XmlIgnore] - public int Length - { - get - { - return 8; - } - } - - public PositionDataBlock() { } - public PositionDataBlock(byte[] bytes, ref int i) - { - try - { - MaxX = (ushort)(bytes[i++] + (bytes[i++] << 8)); - MaxY = (ushort)(bytes[i++] + (bytes[i++] << 8)); - MinX = (ushort)(bytes[i++] + (bytes[i++] << 8)); - MinY = (ushort)(bytes[i++] + (bytes[i++] << 8)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(MaxX % 256); - bytes[i++] = (byte)((MaxX >> 8) % 256); - bytes[i++] = (byte)(MaxY % 256); - bytes[i++] = (byte)((MaxY >> 8) % 256); - bytes[i++] = (byte)(MinX % 256); - bytes[i++] = (byte)((MinX >> 8) % 256); - bytes[i++] = (byte)(MinY % 256); - bytes[i++] = (byte)((MinY >> 8) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- PositionData --"); - output.AppendLine(String.Format("MaxX: {0}", MaxX)); - output.AppendLine(String.Format("MaxY: {0}", MaxY)); - output.AppendLine(String.Format("MinX: {0}", MinX)); - output.Append(String.Format("MinY: {0}", MinY)); - return output.ToString(); - } - } - /// [XmlType("mapblockrequest_agentdata")] public class AgentDataBlock { public LLUUID AgentID; public LLUUID SessionID; - public bool Godlike; public uint Flags; public uint EstateID; + public bool Godlike; [XmlIgnore] public int Length @@ -65525,9 +59888,9 @@ namespace libsecondlife.Packets { 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)); + Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -65539,7 +59902,6 @@ namespace libsecondlife.Packets { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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); @@ -65548,6 +59910,7 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((EstateID >> 8) % 256); bytes[i++] = (byte)((EstateID >> 16) % 256); bytes[i++] = (byte)((EstateID >> 24) % 256); + bytes[i++] = (byte)((Godlike) ? 1 : 0); } public override string ToString() @@ -65556,9 +59919,67 @@ namespace libsecondlife.Packets output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("Godlike: {0}", Godlike)); output.AppendLine(String.Format("Flags: {0}", Flags)); - output.Append(String.Format("EstateID: {0}", EstateID)); + output.AppendLine(String.Format("EstateID: {0}", EstateID)); + output.Append(String.Format("Godlike: {0}", Godlike)); + return output.ToString(); + } + } + + /// + [XmlType("mapblockrequest_positiondata")] + public class PositionDataBlock + { + public ushort MinX; + public ushort MaxX; + public ushort MinY; + public ushort MaxY; + + [XmlIgnore] + public int Length + { + get + { + return 8; + } + } + + public PositionDataBlock() { } + public PositionDataBlock(byte[] bytes, ref int i) + { + try + { + MinX = (ushort)(bytes[i++] + (bytes[i++] << 8)); + MaxX = (ushort)(bytes[i++] + (bytes[i++] << 8)); + MinY = (ushort)(bytes[i++] + (bytes[i++] << 8)); + MaxY = (ushort)(bytes[i++] + (bytes[i++] << 8)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(MinX % 256); + bytes[i++] = (byte)((MinX >> 8) % 256); + bytes[i++] = (byte)(MaxX % 256); + bytes[i++] = (byte)((MaxX >> 8) % 256); + bytes[i++] = (byte)(MinY % 256); + bytes[i++] = (byte)((MinY >> 8) % 256); + bytes[i++] = (byte)(MaxY % 256); + bytes[i++] = (byte)((MaxY >> 8) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- PositionData --"); + output.AppendLine(String.Format("MinX: {0}", MinX)); + output.AppendLine(String.Format("MaxX: {0}", MaxX)); + output.AppendLine(String.Format("MinY: {0}", MinY)); + output.Append(String.Format("MaxY: {0}", MaxY)); return output.ToString(); } } @@ -65566,43 +59987,43 @@ namespace libsecondlife.Packets 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 PositionDataBlock PositionData; public MapBlockRequestPacket() { Header = new LowHeader(); - Header.ID = 466; + Header.ID = 407; Header.Reliable = true; - PositionData = new PositionDataBlock(); AgentData = new AgentDataBlock(); + PositionData = new PositionDataBlock(); } 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); + PositionData = new PositionDataBlock(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); + PositionData = new PositionDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += PositionData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += PositionData.Length;; 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); + PositionData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -65610,8 +60031,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- MapBlockRequest ---" + Environment.NewLine; - output += PositionData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += PositionData.ToString() + Environment.NewLine; return output; } @@ -65620,6 +60041,70 @@ namespace libsecondlife.Packets /// public class MapNameRequestPacket : Packet { + /// + [XmlType("mapnamerequest_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + public uint Flags; + public uint EstateID; + public bool Godlike; + + [XmlIgnore] + public int Length + { + get + { + return 41; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + 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)); + Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(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); + 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)((Godlike) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("EstateID: {0}", EstateID)); + output.Append(String.Format("Godlike: {0}", Godlike)); + return output.ToString(); + } + } + /// [XmlType("mapnamerequest_namedata")] public class NameDataBlock @@ -65679,110 +60164,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("mapnamerequest_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - public bool Godlike; - public uint Flags; - public uint EstateID; - - [XmlIgnore] - public int Length - { - get - { - return 41; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false; - Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - EstateID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("Godlike: {0}", Godlike)); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.Append(String.Format("EstateID: {0}", EstateID)); - return output.ToString(); - } - } - 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 NameDataBlock NameData; public MapNameRequestPacket() { Header = new LowHeader(); - Header.ID = 467; + Header.ID = 408; Header.Reliable = true; - NameData = new NameDataBlock(); AgentData = new AgentDataBlock(); + NameData = new NameDataBlock(); } 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); + NameData = new NameDataBlock(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); + NameData = new NameDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += NameData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; length += NameData.Length;; 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); + NameData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -65790,8 +60211,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- MapNameRequest ---" + Environment.NewLine; - output += NameData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += NameData.ToString() + Environment.NewLine; return output; } @@ -65800,99 +60221,6 @@ namespace libsecondlife.Packets /// public class MapBlockReplyPacket : Packet { - /// - [XmlType("mapblockreply_data")] - public class DataBlock - { - public ushort X; - public ushort Y; - public uint RegionFlags; - public byte WaterHeight; - private byte[] _name; - public byte[] Name - { - get { return _name; } - set - { - if (value == null) { _name = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } - } - } - public byte Access; - public LLUUID MapImageID; - public byte Agents; - - [XmlIgnore] - public int Length - { - get - { - int length = 27; - if (Name != null) { length += 1 + Name.Length; } - return length; - } - } - - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) - { - int length; - try - { - X = (ushort)(bytes[i++] + (bytes[i++] << 8)); - Y = (ushort)(bytes[i++] + (bytes[i++] << 8)); - RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - WaterHeight = (byte)bytes[i++]; - length = (ushort)bytes[i++]; - _name = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; - bytes[i++] = Access; - Buffer.BlockCopy(MapImageID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = Agents; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.AppendLine(String.Format("X: {0}", X)); - output.AppendLine(String.Format("Y: {0}", Y)); - output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); - output.AppendLine(String.Format("WaterHeight: {0}", WaterHeight)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Access: {0}", Access)); - output.AppendLine(String.Format("MapImageID: {0}", MapImageID)); - output.Append(String.Format("Agents: {0}", Agents)); - return output.ToString(); - } - } - /// [XmlType("mapblockreply_agentdata")] public class AgentDataBlock @@ -65942,98 +60270,56 @@ namespace libsecondlife.Packets } } - 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 = 468; - Header.Reliable = true; - Data = new DataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public MapBlockReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MapBlockReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - Data = new DataBlock[count]; - for (int j = 0; j < count; j++) - { Data[j] = new DataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += AgentData.Length;; - length++; - for (int j = 0; j < Data.Length; j++) { length += Data[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)Data.Length; - for (int j = 0; j < Data.Length; j++) { Data[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MapBlockReply ---" + Environment.NewLine; - for (int j = 0; j < Data.Length; j++) - { - output += Data[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MapItemRequestPacket : Packet - { /// - [XmlType("mapitemrequest_requestdata")] - public class RequestDataBlock + [XmlType("mapblockreply_data")] + public class DataBlock { - public ulong RegionHandle; - public uint ItemType; + public ushort X; + public ushort Y; + 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]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } + } + } + public byte Access; + public uint RegionFlags; + public byte WaterHeight; + public byte Agents; + public LLUUID MapImageID; [XmlIgnore] public int Length { get { - return 12; + int length = 27; + if (Name != null) { length += 1 + Name.Length; } + return length; } } - public RequestDataBlock() { } - public RequestDataBlock(byte[] bytes, ref int i) + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) { + int length; 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)); + X = (ushort)(bytes[i++] + (bytes[i++] << 8)); + Y = (ushort)(bytes[i++] + (bytes[i++] << 8)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + Access = (byte)bytes[i++]; + RegionFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + WaterHeight = (byte)bytes[i++]; + Agents = (byte)bytes[i++]; + MapImageID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -66043,39 +60329,118 @@ namespace libsecondlife.Packets 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); + bytes[i++] = (byte)(X % 256); + bytes[i++] = (byte)((X >> 8) % 256); + bytes[i++] = (byte)(Y % 256); + bytes[i++] = (byte)((Y >> 8) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + bytes[i++] = Access; + 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; + bytes[i++] = Agents; + Buffer.BlockCopy(MapImageID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- RequestData --"); - output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.Append(String.Format("ItemType: {0}", ItemType)); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("X: {0}", X)); + output.AppendLine(String.Format("Y: {0}", Y)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Access: {0}", Access)); + output.AppendLine(String.Format("RegionFlags: {0}", RegionFlags)); + output.AppendLine(String.Format("WaterHeight: {0}", WaterHeight)); + output.AppendLine(String.Format("Agents: {0}", Agents)); + output.Append(String.Format("MapImageID: {0}", MapImageID)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.MapBlockReply; } } + public AgentDataBlock AgentData; + public DataBlock[] Data; + + public MapBlockReplyPacket() + { + Header = new LowHeader(); + Header.ID = 409; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + Data = new DataBlock[0]; + } + + public MapBlockReplyPacket(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++]; + Data = new DataBlock[count]; + for (int j = 0; j < count; j++) + { Data[j] = new DataBlock(bytes, ref i); } + } + + public MapBlockReplyPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(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); } + } + + public override byte[] ToBytes() + { + int length = 10; + 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); + AgentData.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 = "--- MapBlockReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < Data.Length; j++) + { + output += Data[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class MapItemRequestPacket : Packet + { /// [XmlType("mapitemrequest_agentdata")] public class AgentDataBlock { public LLUUID AgentID; public LLUUID SessionID; - public bool Godlike; public uint Flags; public uint EstateID; + public bool Godlike; [XmlIgnore] public int Length @@ -66093,9 +60458,9 @@ namespace libsecondlife.Packets { 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)); + Godlike = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -66107,7 +60472,6 @@ namespace libsecondlife.Packets { Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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); @@ -66116,6 +60480,7 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((EstateID >> 8) % 256); bytes[i++] = (byte)((EstateID >> 16) % 256); bytes[i++] = (byte)((EstateID >> 24) % 256); + bytes[i++] = (byte)((Godlike) ? 1 : 0); } public override string ToString() @@ -66124,9 +60489,65 @@ namespace libsecondlife.Packets output.AppendLine("-- AgentData --"); output.AppendLine(String.Format("AgentID: {0}", AgentID)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("Godlike: {0}", Godlike)); output.AppendLine(String.Format("Flags: {0}", Flags)); - output.Append(String.Format("EstateID: {0}", EstateID)); + output.AppendLine(String.Format("EstateID: {0}", EstateID)); + output.Append(String.Format("Godlike: {0}", Godlike)); + return output.ToString(); + } + } + + /// + [XmlType("mapitemrequest_requestdata")] + public class RequestDataBlock + { + public uint ItemType; + public ulong RegionHandle; + + [XmlIgnore] + public int Length + { + get + { + return 12; + } + } + + public RequestDataBlock() { } + public RequestDataBlock(byte[] bytes, ref int i) + { + try + { + ItemType = (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)); + } + 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); + 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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RequestData --"); + output.AppendLine(String.Format("ItemType: {0}", ItemType)); + output.Append(String.Format("RegionHandle: {0}", RegionHandle)); return output.ToString(); } } @@ -66134,43 +60555,43 @@ namespace libsecondlife.Packets 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 RequestDataBlock RequestData; public MapItemRequestPacket() { Header = new LowHeader(); - Header.ID = 469; + Header.ID = 410; Header.Reliable = true; - RequestData = new RequestDataBlock(); AgentData = new AgentDataBlock(); + RequestData = new RequestDataBlock(); } 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); + RequestData = new RequestDataBlock(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); + RequestData = new RequestDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += RequestData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + RequestData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -66178,8 +60599,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- MapItemRequest ---" + Environment.NewLine; - output += RequestData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += RequestData.ToString() + Environment.NewLine; return output; } @@ -66188,6 +60609,55 @@ namespace libsecondlife.Packets /// public class MapItemReplyPacket : Packet { + /// + [XmlType("mapitemreply_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public uint Flags; + + [XmlIgnore] + public int Length + { + get + { + return 20; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("Flags: {0}", Flags)); + return output.ToString(); + } + } + /// [XmlType("mapitemreply_requestdata")] public class RequestDataBlock @@ -66240,6 +60710,8 @@ namespace libsecondlife.Packets public uint X; public uint Y; public LLUUID ID; + public int Extra; + public int Extra2; private byte[] _name; public byte[] Name { @@ -66251,8 +60723,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, value.Length); } } } - public int Extra2; - public int Extra; [XmlIgnore] public int Length @@ -66274,11 +60744,11 @@ namespace libsecondlife.Packets 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; + Extra = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Extra2 = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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) { @@ -66297,17 +60767,17 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((Y >> 16) % 256); bytes[i++] = (byte)((Y >> 24) % 256); Buffer.BlockCopy(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; - Buffer.BlockCopy(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); + bytes[i++] = (byte)(Extra2 % 256); + bytes[i++] = (byte)((Extra2 >> 8) % 256); + bytes[i++] = (byte)((Extra2 >> 16) % 256); + bytes[i++] = (byte)((Extra2 >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; } public override string ToString() @@ -66317,59 +60787,9 @@ namespace libsecondlife.Packets output.AppendLine(String.Format("X: {0}", X)); output.AppendLine(String.Format("Y: {0}", Y)); output.AppendLine(String.Format("ID: {0}", ID)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); + output.AppendLine(String.Format("Extra: {0}", Extra)); output.AppendLine(String.Format("Extra2: {0}", Extra2)); - output.Append(String.Format("Extra: {0}", Extra)); - return output.ToString(); - } - } - - /// - [XmlType("mapitemreply_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public uint Flags; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("Flags: {0}", Flags)); + Helpers.FieldToString(output, Name, "Name"); return output.ToString(); } } @@ -66377,57 +60797,57 @@ namespace libsecondlife.Packets private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.MapItemReply; } } + public AgentDataBlock AgentData; public RequestDataBlock RequestData; public DataBlock[] Data; - public AgentDataBlock AgentData; public MapItemReplyPacket() { Header = new LowHeader(); - Header.ID = 470; + Header.ID = 411; Header.Reliable = true; + AgentData = new AgentDataBlock(); 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); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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;; + int length = 10; + length += AgentData.Length; length += RequestData.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); + AgentData.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; } @@ -66435,12 +60855,12 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- MapItemReply ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; output += RequestData.ToString() + Environment.NewLine; for (int j = 0; j < Data.Length; j++) { output += Data[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -66453,6 +60873,10 @@ namespace libsecondlife.Packets [XmlType("sendpostcard_agentdata")] public class AgentDataBlock { + public LLUUID AgentID; + public LLUUID SessionID; + public LLUUID AssetID; + public LLVector3d PosGlobal; private byte[] _to; public byte[] To { @@ -66464,21 +60888,17 @@ namespace libsecondlife.Packets else { _to = new byte[value.Length]; Buffer.BlockCopy(value, 0, _to, 0, value.Length); } } } - public LLUUID AgentID; - private byte[] _msg; - public byte[] Msg + private byte[] _from; + public byte[] From { - get { return _msg; } + get { return _from; } set { - if (value == null) { _msg = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _msg = new byte[value.Length]; Buffer.BlockCopy(value, 0, _msg, 0, value.Length); } + if (value == null) { _from = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _from = new byte[value.Length]; Buffer.BlockCopy(value, 0, _from, 0, value.Length); } } } - public bool AllowPublish; - public LLVector3d PosGlobal; - public LLUUID SessionID; private byte[] _name; public byte[] Name { @@ -66501,18 +60921,18 @@ namespace libsecondlife.Packets else { _subject = new byte[value.Length]; Buffer.BlockCopy(value, 0, _subject, 0, value.Length); } } } - private byte[] _from; - public byte[] From + private byte[] _msg; + public byte[] Msg { - get { return _from; } + get { return _msg; } set { - if (value == null) { _from = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _from = new byte[value.Length]; Buffer.BlockCopy(value, 0, _from, 0, value.Length); } + if (value == null) { _msg = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _msg = new byte[value.Length]; Buffer.BlockCopy(value, 0, _msg, 0, value.Length); } } } - public LLUUID AssetID; + public bool AllowPublish; public bool MaturePublish; [XmlIgnore] @@ -66522,10 +60942,10 @@ namespace libsecondlife.Packets { int length = 74; if (To != null) { length += 1 + To.Length; } - if (Msg != null) { length += 2 + Msg.Length; } + if (From != null) { length += 1 + From.Length; } if (Name != null) { length += 1 + Name.Length; } if (Subject != null) { length += 1 + Subject.Length; } - if (From != null) { length += 1 + From.Length; } + if (Msg != null) { length += 2 + Msg.Length; } return length; } } @@ -66536,26 +60956,26 @@ namespace libsecondlife.Packets int length; try { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + AssetID = new LLUUID(bytes, i); i += 16; + PosGlobal = new LLVector3d(bytes, i); i += 24; length = (ushort)bytes[i++]; _to = new byte[length]; Buffer.BlockCopy(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]; - Buffer.BlockCopy(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++]; + _from = new byte[length]; + Buffer.BlockCopy(bytes, i, _from, 0, length); i += length; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; length = (ushort)bytes[i++]; _subject = new byte[length]; Buffer.BlockCopy(bytes, i, _subject, 0, length); i += length; - length = (ushort)bytes[i++]; - _from = new byte[length]; - Buffer.BlockCopy(bytes, i, _from, 0, length); i += length; - AssetID = new LLUUID(bytes, i); i += 16; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _msg = new byte[length]; + Buffer.BlockCopy(bytes, i, _msg, 0, length); i += length; + AllowPublish = (bytes[i++] != 0) ? (bool)true : (bool)false; MaturePublish = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) @@ -66566,27 +60986,27 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AssetID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; if(To == null) { Console.WriteLine("Warning: To is null, in " + this.GetType()); } bytes[i++] = (byte)To.Length; Buffer.BlockCopy(To, 0, bytes, i, To.Length); i += To.Length; - Buffer.BlockCopy(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); - Buffer.BlockCopy(Msg, 0, bytes, i, Msg.Length); i += Msg.Length; - bytes[i++] = (byte)((AllowPublish) ? 1 : 0); - Buffer.BlockCopy(PosGlobal.GetBytes(), 0, bytes, i, 24); i += 24; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + if(From == null) { Console.WriteLine("Warning: From is null, in " + this.GetType()); } + bytes[i++] = (byte)From.Length; + Buffer.BlockCopy(From, 0, bytes, i, From.Length); i += From.Length; if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } bytes[i++] = (byte)Name.Length; Buffer.BlockCopy(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; Buffer.BlockCopy(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; - Buffer.BlockCopy(From, 0, bytes, i, From.Length); i += From.Length; - Buffer.BlockCopy(AssetID.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); + Buffer.BlockCopy(Msg, 0, bytes, i, Msg.Length); i += Msg.Length; + bytes[i++] = (byte)((AllowPublish) ? 1 : 0); bytes[i++] = (byte)((MaturePublish) ? 1 : 0); } @@ -66594,21 +61014,21 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); Helpers.FieldToString(output, To, "To"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - Helpers.FieldToString(output, Msg, "Msg"); + Helpers.FieldToString(output, From, "From"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); - output.AppendLine(String.Format("PosGlobal: {0}", PosGlobal)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); Helpers.FieldToString(output, Subject, "Subject"); output.Append(Environment.NewLine); - Helpers.FieldToString(output, From, "From"); + Helpers.FieldToString(output, Msg, "Msg"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("AssetID: {0}", AssetID)); + output.AppendLine(String.Format("AllowPublish: {0}", AllowPublish)); output.Append(String.Format("MaturePublish: {0}", MaturePublish)); return output.ToString(); } @@ -66622,7 +61042,7 @@ namespace libsecondlife.Packets public SendPostcardPacket() { Header = new LowHeader(); - Header.ID = 471; + Header.ID = 412; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -66642,7 +61062,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -66669,9 +61089,9 @@ namespace libsecondlife.Packets [XmlType("parcelmediacommandmessage_commandblock")] public class CommandBlockBlock { + public uint Flags; public uint Command; public float Time; - public uint Flags; [XmlIgnore] public int Length @@ -66687,10 +61107,10 @@ namespace libsecondlife.Packets { try { + Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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) { @@ -66701,6 +61121,10 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; + 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)(Command % 256); bytes[i++] = (byte)((Command >> 8) % 256); bytes[i++] = (byte)((Command >> 16) % 256); @@ -66708,19 +61132,15 @@ namespace libsecondlife.Packets ba = BitConverter.GetBytes(Time); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(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() { StringBuilder output = new StringBuilder(); output.AppendLine("-- CommandBlock --"); + output.AppendLine(String.Format("Flags: {0}", Flags)); output.AppendLine(String.Format("Command: {0}", Command)); - output.AppendLine(String.Format("Time: {0}", Time)); - output.Append(String.Format("Flags: {0}", Flags)); + output.Append(String.Format("Time: {0}", Time)); return output.ToString(); } } @@ -66733,7 +61153,7 @@ namespace libsecondlife.Packets public ParcelMediaCommandMessagePacket() { Header = new LowHeader(); - Header.ID = 480; + Header.ID = 419; Header.Reliable = true; CommandBlock = new CommandBlockBlock(); } @@ -66753,7 +61173,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += CommandBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -66780,7 +61200,6 @@ namespace libsecondlife.Packets [XmlType("parcelmediaupdate_datablock")] public class DataBlockBlock { - public LLUUID MediaID; private byte[] _mediaurl; public byte[] MediaURL { @@ -66792,6 +61211,7 @@ namespace libsecondlife.Packets else { _mediaurl = new byte[value.Length]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } } } + public LLUUID MediaID; public byte MediaAutoScale; [XmlIgnore] @@ -66811,10 +61231,10 @@ namespace libsecondlife.Packets int length; try { - MediaID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _mediaurl = new byte[length]; Buffer.BlockCopy(bytes, i, _mediaurl, 0, length); i += length; + MediaID = new LLUUID(bytes, i); i += 16; MediaAutoScale = (byte)bytes[i++]; } catch (Exception) @@ -66825,10 +61245,10 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(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; Buffer.BlockCopy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length; + Buffer.BlockCopy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = MediaAutoScale; } @@ -66836,9 +61256,9 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- DataBlock --"); - output.AppendLine(String.Format("MediaID: {0}", MediaID)); Helpers.FieldToString(output, MediaURL, "MediaURL"); output.Append(Environment.NewLine); + output.AppendLine(String.Format("MediaID: {0}", MediaID)); output.Append(String.Format("MediaAutoScale: {0}", MediaAutoScale)); return output.ToString(); } @@ -66852,7 +61272,7 @@ namespace libsecondlife.Packets public ParcelMediaUpdatePacket() { Header = new LowHeader(); - Header.ID = 481; + Header.ID = 420; Header.Reliable = true; DataBlock = new DataBlockBlock(); } @@ -66872,7 +61292,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += DataBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -66895,87 +61315,6 @@ namespace libsecondlife.Packets /// public class LandStatRequestPacket : Packet { - /// - [XmlType("landstatrequest_requestdata")] - public class RequestDataBlock - { - public uint RequestFlags; - public uint ReportType; - private byte[] _filter; - public byte[] Filter - { - get { return _filter; } - set - { - if (value == null) { _filter = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _filter = new byte[value.Length]; Buffer.BlockCopy(value, 0, _filter, 0, value.Length); } - } - } - public int ParcelLocalID; - - [XmlIgnore] - public int Length - { - get - { - int length = 12; - if (Filter != null) { length += 1 + Filter.Length; } - return length; - } - } - - public RequestDataBlock() { } - public RequestDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - ReportType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - length = (ushort)bytes[i++]; - _filter = new byte[length]; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RequestData --"); - output.AppendLine(String.Format("RequestFlags: {0}", RequestFlags)); - output.AppendLine(String.Format("ReportType: {0}", ReportType)); - Helpers.FieldToString(output, Filter, "Filter"); - output.Append(Environment.NewLine); - output.Append(String.Format("ParcelLocalID: {0}", ParcelLocalID)); - return output.ToString(); - } - } - /// [XmlType("landstatrequest_agentdata")] public class AgentDataBlock @@ -67022,46 +61361,127 @@ namespace libsecondlife.Packets } } + /// + [XmlType("landstatrequest_requestdata")] + public class RequestDataBlock + { + public uint ReportType; + public uint RequestFlags; + 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]; Buffer.BlockCopy(value, 0, _filter, 0, value.Length); } + } + } + public int ParcelLocalID; + + [XmlIgnore] + public int Length + { + get + { + int length = 12; + if (Filter != null) { length += 1 + Filter.Length; } + return length; + } + } + + public RequestDataBlock() { } + public RequestDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + ReportType = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _filter = new byte[length]; + Buffer.BlockCopy(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)(ReportType % 256); + bytes[i++] = (byte)((ReportType >> 8) % 256); + bytes[i++] = (byte)((ReportType >> 16) % 256); + bytes[i++] = (byte)((ReportType >> 24) % 256); + bytes[i++] = (byte)(RequestFlags % 256); + bytes[i++] = (byte)((RequestFlags >> 8) % 256); + bytes[i++] = (byte)((RequestFlags >> 16) % 256); + bytes[i++] = (byte)((RequestFlags >> 24) % 256); + if(Filter == null) { Console.WriteLine("Warning: Filter is null, in " + this.GetType()); } + bytes[i++] = (byte)Filter.Length; + Buffer.BlockCopy(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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RequestData --"); + output.AppendLine(String.Format("ReportType: {0}", ReportType)); + output.AppendLine(String.Format("RequestFlags: {0}", RequestFlags)); + Helpers.FieldToString(output, Filter, "Filter"); + output.Append(Environment.NewLine); + output.Append(String.Format("ParcelLocalID: {0}", ParcelLocalID)); + return output.ToString(); + } + } + 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 RequestDataBlock RequestData; public LandStatRequestPacket() { Header = new LowHeader(); - Header.ID = 482; + Header.ID = 421; Header.Reliable = true; - RequestData = new RequestDataBlock(); AgentData = new AgentDataBlock(); + RequestData = new RequestDataBlock(); } 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); + RequestData = new RequestDataBlock(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); + RequestData = new RequestDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += RequestData.Length; length += AgentData.Length;; + int length = 10; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + RequestData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -67069,8 +61489,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- LandStatRequest ---" + Environment.NewLine; - output += RequestData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += RequestData.ToString() + Environment.NewLine; return output; } @@ -67083,8 +61503,8 @@ namespace libsecondlife.Packets [XmlType("landstatreply_requestdata")] public class RequestDataBlock { - public uint RequestFlags; public uint ReportType; + public uint RequestFlags; public uint TotalObjectCount; [XmlIgnore] @@ -67101,8 +61521,8 @@ namespace libsecondlife.Packets { 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)); + RequestFlags = (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) @@ -67113,14 +61533,14 @@ namespace libsecondlife.Packets 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)(RequestFlags % 256); + bytes[i++] = (byte)((RequestFlags >> 8) % 256); + bytes[i++] = (byte)((RequestFlags >> 16) % 256); + bytes[i++] = (byte)((RequestFlags >> 24) % 256); bytes[i++] = (byte)(TotalObjectCount % 256); bytes[i++] = (byte)((TotalObjectCount >> 8) % 256); bytes[i++] = (byte)((TotalObjectCount >> 16) % 256); @@ -67131,8 +61551,8 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- RequestData --"); - output.AppendLine(String.Format("RequestFlags: {0}", RequestFlags)); output.AppendLine(String.Format("ReportType: {0}", ReportType)); + output.AppendLine(String.Format("RequestFlags: {0}", RequestFlags)); output.Append(String.Format("TotalObjectCount: {0}", TotalObjectCount)); return output.ToString(); } @@ -67142,9 +61562,12 @@ namespace libsecondlife.Packets [XmlType("landstatreply_reportdata")] public class ReportDataBlock { + public uint TaskLocalID; + public LLUUID TaskID; public float LocationX; public float LocationY; public float LocationZ; + public float Score; private byte[] _taskname; public byte[] TaskName { @@ -67156,9 +61579,6 @@ namespace libsecondlife.Packets else { _taskname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _taskname, 0, value.Length); } } } - public LLUUID TaskID; - public float Score; - public uint TaskLocalID; private byte[] _ownername; public byte[] OwnerName { @@ -67189,19 +61609,19 @@ namespace libsecondlife.Packets int length; try { + TaskLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + TaskID = new LLUUID(bytes, i); i += 16; 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; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Score = BitConverter.ToSingle(bytes, i); i += 4; length = (ushort)bytes[i++]; _taskname = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(bytes, i, _ownername, 0, length); i += length; @@ -67215,6 +61635,11 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; + bytes[i++] = (byte)(TaskLocalID % 256); + bytes[i++] = (byte)((TaskLocalID >> 8) % 256); + bytes[i++] = (byte)((TaskLocalID >> 16) % 256); + bytes[i++] = (byte)((TaskLocalID >> 24) % 256); + Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; ba = BitConverter.GetBytes(LocationX); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; @@ -67224,17 +61649,12 @@ namespace libsecondlife.Packets ba = BitConverter.GetBytes(LocationZ); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - if(TaskName == null) { Console.WriteLine("Warning: TaskName is null, in " + this.GetType()); } - bytes[i++] = (byte)TaskName.Length; - Buffer.BlockCopy(TaskName, 0, bytes, i, TaskName.Length); i += TaskName.Length; - Buffer.BlockCopy(TaskID.GetBytes(), 0, bytes, i, 16); i += 16; ba = BitConverter.GetBytes(Score); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(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(TaskName == null) { Console.WriteLine("Warning: TaskName is null, in " + this.GetType()); } + bytes[i++] = (byte)TaskName.Length; + Buffer.BlockCopy(TaskName, 0, bytes, i, TaskName.Length); i += TaskName.Length; if(OwnerName == null) { Console.WriteLine("Warning: OwnerName is null, in " + this.GetType()); } bytes[i++] = (byte)OwnerName.Length; Buffer.BlockCopy(OwnerName, 0, bytes, i, OwnerName.Length); i += OwnerName.Length; @@ -67244,14 +61664,14 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- ReportData --"); + output.AppendLine(String.Format("TaskLocalID: {0}", TaskLocalID)); + output.AppendLine(String.Format("TaskID: {0}", TaskID)); output.AppendLine(String.Format("LocationX: {0}", LocationX)); output.AppendLine(String.Format("LocationY: {0}", LocationY)); output.AppendLine(String.Format("LocationZ: {0}", LocationZ)); + output.AppendLine(String.Format("Score: {0}", Score)); Helpers.FieldToString(output, TaskName, "TaskName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("TaskID: {0}", TaskID)); - output.AppendLine(String.Format("Score: {0}", Score)); - output.AppendLine(String.Format("TaskLocalID: {0}", TaskLocalID)); Helpers.FieldToString(output, OwnerName, "OwnerName"); return output.ToString(); } @@ -67266,7 +61686,7 @@ namespace libsecondlife.Packets public LandStatReplyPacket() { Header = new LowHeader(); - Header.ID = 483; + Header.ID = 422; Header.Reliable = true; RequestData = new RequestDataBlock(); ReportData = new ReportDataBlock[0]; @@ -67295,7 +61715,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += RequestData.Length;; length++; for (int j = 0; j < ReportData.Length; j++) { length += ReportData[j].Length; } @@ -67324,13 +61744,13 @@ namespace libsecondlife.Packets } /// - public class SecuredTemplateChecksumRequestPacket : Packet + public class ErrorPacket : Packet { /// - [XmlType("securedtemplatechecksumrequest_tokenblock")] - public class TokenBlockBlock + [XmlType("error_agentdata")] + public class AgentDataBlock { - public LLUUID Token; + public LLUUID AgentID; [XmlIgnore] public int Length @@ -67341,12 +61761,12 @@ namespace libsecondlife.Packets } } - public TokenBlockBlock() { } - public TokenBlockBlock(byte[] bytes, ref int i) + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) { try { - Token = new LLUUID(bytes, i); i += 16; + AgentID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -67356,61 +61776,199 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(Token.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- TokenBlock --"); - output.Append(String.Format("Token: {0}", Token)); + output.AppendLine("-- AgentData --"); + output.Append(String.Format("AgentID: {0}", AgentID)); + return output.ToString(); + } + } + + /// + [XmlType("error_data")] + public class DataBlock + { + public int Code; + private byte[] _token; + public byte[] Token + { + get { return _token; } + set + { + if (value == null) { _token = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _token = new byte[value.Length]; Buffer.BlockCopy(value, 0, _token, 0, value.Length); } + } + } + public LLUUID ID; + private byte[] _system; + public byte[] System + { + get { return _system; } + set + { + if (value == null) { _system = null; return; } + if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } + else { _system = new byte[value.Length]; Buffer.BlockCopy(value, 0, _system, 0, value.Length); } + } + } + private byte[] _message; + public byte[] Message + { + get { return _message; } + set + { + if (value == null) { _message = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _message = new byte[value.Length]; Buffer.BlockCopy(value, 0, _message, 0, value.Length); } + } + } + private byte[] _data; + public byte[] Data + { + get { return _data; } + set + { + if (value == null) { _data = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _data = new byte[value.Length]; Buffer.BlockCopy(value, 0, _data, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 20; + if (Token != null) { length += 1 + Token.Length; } + if (System != null) { length += 1 + System.Length; } + if (Message != null) { length += 2 + Message.Length; } + if (Data != null) { length += 2 + Data.Length; } + return length; + } + } + + public DataBlock() { } + public DataBlock(byte[] bytes, ref int i) + { + int length; + try + { + Code = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _token = new byte[length]; + Buffer.BlockCopy(bytes, i, _token, 0, length); i += length; + ID = new LLUUID(bytes, i); i += 16; + length = (ushort)bytes[i++]; + _system = new byte[length]; + Buffer.BlockCopy(bytes, i, _system, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _message = new byte[length]; + Buffer.BlockCopy(bytes, i, _message, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _data = new byte[length]; + Buffer.BlockCopy(bytes, i, _data, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(Code % 256); + bytes[i++] = (byte)((Code >> 8) % 256); + bytes[i++] = (byte)((Code >> 16) % 256); + bytes[i++] = (byte)((Code >> 24) % 256); + if(Token == null) { Console.WriteLine("Warning: Token is null, in " + this.GetType()); } + bytes[i++] = (byte)Token.Length; + Buffer.BlockCopy(Token, 0, bytes, i, Token.Length); i += Token.Length; + Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; + if(System == null) { Console.WriteLine("Warning: System is null, in " + this.GetType()); } + bytes[i++] = (byte)System.Length; + Buffer.BlockCopy(System, 0, bytes, i, System.Length); i += System.Length; + 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); + Buffer.BlockCopy(Message, 0, bytes, i, Message.Length); i += Message.Length; + 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); + Buffer.BlockCopy(Data, 0, bytes, i, Data.Length); i += Data.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Data --"); + output.AppendLine(String.Format("Code: {0}", Code)); + Helpers.FieldToString(output, Token, "Token"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ID: {0}", ID)); + Helpers.FieldToString(output, System, "System"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Message, "Message"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Data, "Data"); return output.ToString(); } } 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 override PacketType Type { get { return PacketType.Error; } } + public AgentDataBlock AgentData; + public DataBlock Data; - public SecuredTemplateChecksumRequestPacket() + public ErrorPacket() { Header = new LowHeader(); - Header.ID = 65530; + Header.ID = 423; Header.Reliable = true; - TokenBlock = new TokenBlockBlock(); + AgentData = new AgentDataBlock(); + Data = new DataBlock(); } - public SecuredTemplateChecksumRequestPacket(byte[] bytes, ref int i) + public ErrorPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new LowHeader(bytes, ref i, ref packetEnd); - TokenBlock = new TokenBlockBlock(bytes, ref i); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); } - public SecuredTemplateChecksumRequestPacket(Header head, byte[] bytes, ref int i) + public ErrorPacket(Header head, byte[] bytes, ref int i) { Header = head; - TokenBlock = new TokenBlockBlock(bytes, ref i); + AgentData = new AgentDataBlock(bytes, ref i); + Data = new DataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 8; - length += TokenBlock.Length;; + int length = 10; + length += AgentData.Length; 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); - TokenBlock.ToBytes(bytes, ref i); + AgentData.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 = "--- SecuredTemplateChecksumRequest ---" + Environment.NewLine; - output += TokenBlock.ToString() + Environment.NewLine; + string output = "--- Error ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += Data.ToString() + Environment.NewLine; return output; } @@ -67498,7 +62056,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; length++; for (int j = 0; j < Packets.Length; j++) { length += Packets[j].Length; } @@ -67605,7 +62163,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; length += CircuitInfo.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -67652,7 +62210,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 8; + int length = 10; ; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -67670,383 +62228,9 @@ namespace libsecondlife.Packets } - /// - public class TemplateChecksumRequestPacket : Packet - { - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.TemplateChecksumRequest; } } - - public TemplateChecksumRequestPacket() - { - Header = new LowHeader(); - Header.ID = 65534; - Header.Reliable = true; - } - - public TemplateChecksumRequestPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - } - - public TemplateChecksumRequestPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - } - - public override byte[] ToBytes() - { - int length = 8; -; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- TemplateChecksumRequest ---" + Environment.NewLine; - return output; - } - - } - - /// - public class TemplateChecksumReplyPacket : Packet - { - /// - [XmlType("templatechecksumreply_datablock")] - public class DataBlockBlock - { - public byte ServerVersion; - public byte PatchVersion; - public uint Checksum; - public uint Flags; - public byte MajorVersion; - public byte MinorVersion; - - [XmlIgnore] - public int Length - { - get - { - return 12; - } - } - - public DataBlockBlock() { } - public DataBlockBlock(byte[] bytes, ref int i) - { - try - { - ServerVersion = (byte)bytes[i++]; - PatchVersion = (byte)bytes[i++]; - Checksum = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Flags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - MajorVersion = (byte)bytes[i++]; - MinorVersion = (byte)bytes[i++]; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = ServerVersion; - bytes[i++] = PatchVersion; - bytes[i++] = (byte)(Checksum % 256); - bytes[i++] = (byte)((Checksum >> 8) % 256); - bytes[i++] = (byte)((Checksum >> 16) % 256); - bytes[i++] = (byte)((Checksum >> 24) % 256); - bytes[i++] = (byte)(Flags % 256); - bytes[i++] = (byte)((Flags >> 8) % 256); - bytes[i++] = (byte)((Flags >> 16) % 256); - bytes[i++] = (byte)((Flags >> 24) % 256); - bytes[i++] = MajorVersion; - bytes[i++] = MinorVersion; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- DataBlock --"); - output.AppendLine(String.Format("ServerVersion: {0}", ServerVersion)); - output.AppendLine(String.Format("PatchVersion: {0}", PatchVersion)); - output.AppendLine(String.Format("Checksum: {0}", Checksum)); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("MajorVersion: {0}", MajorVersion)); - output.Append(String.Format("MinorVersion: {0}", MinorVersion)); - return output.ToString(); - } - } - - /// - [XmlType("templatechecksumreply_tokenblock")] - public class TokenBlockBlock - { - public LLUUID Token; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public TokenBlockBlock() { } - public TokenBlockBlock(byte[] bytes, ref int i) - { - try - { - Token = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(Token.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TokenBlock --"); - output.Append(String.Format("Token: {0}", Token)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.TemplateChecksumReply; } } - public DataBlockBlock DataBlock; - public TokenBlockBlock TokenBlock; - - public TemplateChecksumReplyPacket() - { - Header = new LowHeader(); - Header.ID = 65535; - Header.Reliable = true; - DataBlock = new DataBlockBlock(); - TokenBlock = new TokenBlockBlock(); - } - - public TemplateChecksumReplyPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - DataBlock = new DataBlockBlock(bytes, ref i); - TokenBlock = new TokenBlockBlock(bytes, ref i); - } - - public TemplateChecksumReplyPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - DataBlock = new DataBlockBlock(bytes, ref i); - TokenBlock = new TokenBlockBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += DataBlock.Length; length += TokenBlock.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - DataBlock.ToBytes(bytes, ref i); - TokenBlock.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- TemplateChecksumReply ---" + Environment.NewLine; - output += DataBlock.ToString() + Environment.NewLine; - output += TokenBlock.ToString() + Environment.NewLine; - return output; - } - - } - /// public class ObjectAddPacket : Packet { - /// - [XmlType("objectadd_objectdata")] - public class ObjectDataBlock - { - public uint AddFlags; - public sbyte PathTwistBegin; - public ushort PathEnd; - public ushort 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 ushort ProfileEnd; - public ushort PathBegin; - public byte BypassRaycast; - public byte PCode; - public byte PathCurve; - public LLVector3 Scale; - public byte State; - public sbyte PathTwist; - public ushort ProfileHollow; - public byte PathRevolutions; - public LLQuaternion Rotation; - public LLUUID RayTargetID; - - [XmlIgnore] - public int Length - { - get - { - return 96; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - AddFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - PathTwistBegin = (sbyte)bytes[i++]; - PathEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); - ProfileBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); - 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 = (ushort)(bytes[i++] + (bytes[i++] << 8)); - PathBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); - BypassRaycast = (byte)bytes[i++]; - PCode = (byte)bytes[i++]; - PathCurve = (byte)bytes[i++]; - Scale = new LLVector3(bytes, i); i += 12; - State = (byte)bytes[i++]; - PathTwist = (sbyte)bytes[i++]; - ProfileHollow = (ushort)(bytes[i++] + (bytes[i++] << 8)); - 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++] = (byte)(PathEnd % 256); - bytes[i++] = (byte)((PathEnd >> 8) % 256); - bytes[i++] = (byte)(ProfileBegin % 256); - bytes[i++] = (byte)((ProfileBegin >> 8) % 256); - bytes[i++] = (byte)PathRadiusOffset; - bytes[i++] = (byte)PathSkew; - Buffer.BlockCopy(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; - Buffer.BlockCopy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = (byte)(ProfileEnd % 256); - bytes[i++] = (byte)((ProfileEnd >> 8) % 256); - bytes[i++] = (byte)(PathBegin % 256); - bytes[i++] = (byte)((PathBegin >> 8) % 256); - bytes[i++] = BypassRaycast; - bytes[i++] = PCode; - bytes[i++] = PathCurve; - Buffer.BlockCopy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = State; - bytes[i++] = (byte)PathTwist; - bytes[i++] = (byte)(ProfileHollow % 256); - bytes[i++] = (byte)((ProfileHollow >> 8) % 256); - bytes[i++] = PathRevolutions; - Buffer.BlockCopy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("AddFlags: {0}", AddFlags)); - output.AppendLine(String.Format("PathTwistBegin: {0}", PathTwistBegin)); - output.AppendLine(String.Format("PathEnd: {0}", PathEnd)); - output.AppendLine(String.Format("ProfileBegin: {0}", ProfileBegin)); - output.AppendLine(String.Format("PathRadiusOffset: {0}", PathRadiusOffset)); - output.AppendLine(String.Format("PathSkew: {0}", PathSkew)); - output.AppendLine(String.Format("RayStart: {0}", RayStart)); - output.AppendLine(String.Format("ProfileCurve: {0}", ProfileCurve)); - output.AppendLine(String.Format("PathScaleX: {0}", PathScaleX)); - output.AppendLine(String.Format("PathScaleY: {0}", PathScaleY)); - output.AppendLine(String.Format("Material: {0}", Material)); - output.AppendLine(String.Format("PathShearX: {0}", PathShearX)); - output.AppendLine(String.Format("PathShearY: {0}", PathShearY)); - output.AppendLine(String.Format("PathTaperX: {0}", PathTaperX)); - output.AppendLine(String.Format("PathTaperY: {0}", PathTaperY)); - output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); - output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); - output.AppendLine(String.Format("ProfileEnd: {0}", ProfileEnd)); - output.AppendLine(String.Format("PathBegin: {0}", PathBegin)); - output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); - output.AppendLine(String.Format("PCode: {0}", PCode)); - output.AppendLine(String.Format("PathCurve: {0}", PathCurve)); - output.AppendLine(String.Format("Scale: {0}", Scale)); - output.AppendLine(String.Format("State: {0}", State)); - output.AppendLine(String.Format("PathTwist: {0}", PathTwist)); - output.AppendLine(String.Format("ProfileHollow: {0}", ProfileHollow)); - output.AppendLine(String.Format("PathRevolutions: {0}", PathRevolutions)); - output.AppendLine(String.Format("Rotation: {0}", Rotation)); - output.Append(String.Format("RayTargetID: {0}", RayTargetID)); - return output.ToString(); - } - } - /// [XmlType("objectadd_agentdata")] public class AgentDataBlock @@ -68097,104 +62281,83 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectAdd; } } - public ObjectDataBlock ObjectData; - public AgentDataBlock AgentData; - - public ObjectAddPacket() - { - Header = new MediumHeader(); - Header.ID = 2; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); - AgentData = new AgentDataBlock(); - } - - public ObjectAddPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new MediumHeader(bytes, ref i, ref packetEnd); - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public ObjectAddPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ObjectData = new ObjectDataBlock(bytes, ref i); - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 6; - length += ObjectData.Length; length += AgentData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ObjectData.ToBytes(bytes, ref i); - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectAdd ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class MultipleObjectUpdatePacket : Packet - { /// - [XmlType("multipleobjectupdate_objectdata")] + [XmlType("objectadd_objectdata")] public class ObjectDataBlock { - private byte[] _data; - public byte[] Data - { - get { return _data; } - set - { - if (value == null) { _data = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _data = new byte[value.Length]; Buffer.BlockCopy(value, 0, _data, 0, value.Length); } - } - } - public byte Type; - public uint ObjectLocalID; + public byte PCode; + public byte Material; + public uint AddFlags; + public byte PathCurve; + public byte ProfileCurve; + public ushort PathBegin; + public ushort PathEnd; + public byte PathScaleX; + public byte PathScaleY; + public byte PathShearX; + public byte PathShearY; + public sbyte PathTwist; + public sbyte PathTwistBegin; + public sbyte PathRadiusOffset; + public sbyte PathTaperX; + public sbyte PathTaperY; + public byte PathRevolutions; + public sbyte PathSkew; + public ushort ProfileBegin; + public ushort ProfileEnd; + public ushort ProfileHollow; + public byte BypassRaycast; + public LLVector3 RayStart; + public LLVector3 RayEnd; + public LLUUID RayTargetID; + public byte RayEndIsIntersection; + public LLVector3 Scale; + public LLQuaternion Rotation; + public byte State; [XmlIgnore] public int Length { get { - int length = 5; - if (Data != null) { length += 1 + Data.Length; } - return length; + return 96; } } public ObjectDataBlock() { } public ObjectDataBlock(byte[] bytes, ref int i) { - int length; try { - length = (ushort)bytes[i++]; - _data = new byte[length]; - Buffer.BlockCopy(bytes, i, _data, 0, length); i += length; - Type = (byte)bytes[i++]; - ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PCode = (byte)bytes[i++]; + Material = (byte)bytes[i++]; + AddFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PathCurve = (byte)bytes[i++]; + ProfileCurve = (byte)bytes[i++]; + PathBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); + PathEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); + PathScaleX = (byte)bytes[i++]; + PathScaleY = (byte)bytes[i++]; + PathShearX = (byte)bytes[i++]; + PathShearY = (byte)bytes[i++]; + PathTwist = (sbyte)bytes[i++]; + PathTwistBegin = (sbyte)bytes[i++]; + PathRadiusOffset = (sbyte)bytes[i++]; + PathTaperX = (sbyte)bytes[i++]; + PathTaperY = (sbyte)bytes[i++]; + PathRevolutions = (byte)bytes[i++]; + PathSkew = (sbyte)bytes[i++]; + ProfileBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); + ProfileEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); + ProfileHollow = (ushort)(bytes[i++] + (bytes[i++] << 8)); + BypassRaycast = (byte)bytes[i++]; + RayStart = new LLVector3(bytes, i); i += 12; + RayEnd = new LLVector3(bytes, i); i += 12; + RayTargetID = new LLUUID(bytes, i); i += 16; + RayEndIsIntersection = (byte)bytes[i++]; + Scale = new LLVector3(bytes, i); i += 12; + Rotation = new LLQuaternion(bytes, i, true); i += 12; + State = (byte)bytes[i++]; } catch (Exception) { @@ -68204,28 +62367,139 @@ namespace libsecondlife.Packets 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; - Buffer.BlockCopy(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); + bytes[i++] = PCode; + bytes[i++] = Material; + 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++] = PathCurve; + bytes[i++] = ProfileCurve; + bytes[i++] = (byte)(PathBegin % 256); + bytes[i++] = (byte)((PathBegin >> 8) % 256); + bytes[i++] = (byte)(PathEnd % 256); + bytes[i++] = (byte)((PathEnd >> 8) % 256); + bytes[i++] = PathScaleX; + bytes[i++] = PathScaleY; + bytes[i++] = PathShearX; + bytes[i++] = PathShearY; + bytes[i++] = (byte)PathTwist; + bytes[i++] = (byte)PathTwistBegin; + bytes[i++] = (byte)PathRadiusOffset; + bytes[i++] = (byte)PathTaperX; + bytes[i++] = (byte)PathTaperY; + bytes[i++] = PathRevolutions; + bytes[i++] = (byte)PathSkew; + bytes[i++] = (byte)(ProfileBegin % 256); + bytes[i++] = (byte)((ProfileBegin >> 8) % 256); + bytes[i++] = (byte)(ProfileEnd % 256); + bytes[i++] = (byte)((ProfileEnd >> 8) % 256); + bytes[i++] = (byte)(ProfileHollow % 256); + bytes[i++] = (byte)((ProfileHollow >> 8) % 256); + bytes[i++] = BypassRaycast; + Buffer.BlockCopy(RayStart.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RayEnd.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(RayTargetID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = RayEndIsIntersection; + Buffer.BlockCopy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(Rotation.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = State; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - Helpers.FieldToString(output, Data, "Data"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Type: {0}", Type)); - output.Append(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.AppendLine(String.Format("PCode: {0}", PCode)); + output.AppendLine(String.Format("Material: {0}", Material)); + output.AppendLine(String.Format("AddFlags: {0}", AddFlags)); + output.AppendLine(String.Format("PathCurve: {0}", PathCurve)); + output.AppendLine(String.Format("ProfileCurve: {0}", ProfileCurve)); + output.AppendLine(String.Format("PathBegin: {0}", PathBegin)); + output.AppendLine(String.Format("PathEnd: {0}", PathEnd)); + output.AppendLine(String.Format("PathScaleX: {0}", PathScaleX)); + output.AppendLine(String.Format("PathScaleY: {0}", PathScaleY)); + output.AppendLine(String.Format("PathShearX: {0}", PathShearX)); + output.AppendLine(String.Format("PathShearY: {0}", PathShearY)); + output.AppendLine(String.Format("PathTwist: {0}", PathTwist)); + output.AppendLine(String.Format("PathTwistBegin: {0}", PathTwistBegin)); + output.AppendLine(String.Format("PathRadiusOffset: {0}", PathRadiusOffset)); + output.AppendLine(String.Format("PathTaperX: {0}", PathTaperX)); + output.AppendLine(String.Format("PathTaperY: {0}", PathTaperY)); + output.AppendLine(String.Format("PathRevolutions: {0}", PathRevolutions)); + output.AppendLine(String.Format("PathSkew: {0}", PathSkew)); + output.AppendLine(String.Format("ProfileBegin: {0}", ProfileBegin)); + output.AppendLine(String.Format("ProfileEnd: {0}", ProfileEnd)); + output.AppendLine(String.Format("ProfileHollow: {0}", ProfileHollow)); + output.AppendLine(String.Format("BypassRaycast: {0}", BypassRaycast)); + output.AppendLine(String.Format("RayStart: {0}", RayStart)); + output.AppendLine(String.Format("RayEnd: {0}", RayEnd)); + output.AppendLine(String.Format("RayTargetID: {0}", RayTargetID)); + output.AppendLine(String.Format("RayEndIsIntersection: {0}", RayEndIsIntersection)); + output.AppendLine(String.Format("Scale: {0}", Scale)); + output.AppendLine(String.Format("Rotation: {0}", Rotation)); + output.Append(String.Format("State: {0}", State)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectAdd; } } + public AgentDataBlock AgentData; + public ObjectDataBlock ObjectData; + + public ObjectAddPacket() + { + Header = new MediumHeader(); + Header.ID = 1; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); + } + + public ObjectAddPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new MediumHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public ObjectAddPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + ObjectData = new ObjectDataBlock(bytes, ref i); + } + + public override byte[] ToBytes() + { + int length = 8; + length += AgentData.Length; 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); + AgentData.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 = "--- ObjectAdd ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; + return output; + } + + } + + /// + public class MultipleObjectUpdatePacket : Packet + { /// [XmlType("multipleobjectupdate_agentdata")] public class AgentDataBlock @@ -68272,99 +62546,46 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.MultipleObjectUpdate; } } - public ObjectDataBlock[] ObjectData; - public AgentDataBlock AgentData; - - public MultipleObjectUpdatePacket() - { - Header = new MediumHeader(); - Header.ID = 3; - Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; - AgentData = new AgentDataBlock(); - } - - public MultipleObjectUpdatePacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new MediumHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public MultipleObjectUpdatePacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 6; - length += AgentData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- MultipleObjectUpdate ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class RequestMultipleObjectsPacket : Packet - { /// - [XmlType("requestmultipleobjects_objectdata")] + [XmlType("multipleobjectupdate_objectdata")] public class ObjectDataBlock { - public uint ID; - public byte CacheMissType; + public uint ObjectLocalID; + public byte Type; + 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]; Buffer.BlockCopy(value, 0, _data, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 5; + int length = 5; + if (Data != null) { length += 1 + Data.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)); - CacheMissType = (byte)bytes[i++]; + ObjectLocalID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Type = (byte)bytes[i++]; + length = (ushort)bytes[i++]; + _data = new byte[length]; + Buffer.BlockCopy(bytes, i, _data, 0, length); i += length; } catch (Exception) { @@ -68374,23 +62595,96 @@ namespace libsecondlife.Packets 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; + 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++] = Type; + if(Data == null) { Console.WriteLine("Warning: Data is null, in " + this.GetType()); } + bytes[i++] = (byte)Data.Length; + Buffer.BlockCopy(Data, 0, bytes, i, Data.Length); i += Data.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("ID: {0}", ID)); - output.Append(String.Format("CacheMissType: {0}", CacheMissType)); + output.AppendLine(String.Format("ObjectLocalID: {0}", ObjectLocalID)); + output.AppendLine(String.Format("Type: {0}", Type)); + Helpers.FieldToString(output, Data, "Data"); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.MultipleObjectUpdate; } } + public AgentDataBlock AgentData; + public ObjectDataBlock[] ObjectData; + + public MultipleObjectUpdatePacket() + { + Header = new MediumHeader(); + Header.ID = 2; + Header.Reliable = true; + AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public MultipleObjectUpdatePacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new MediumHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public MultipleObjectUpdatePacket(Header head, byte[] bytes, ref int i) + { + Header = head; + AgentData = new AgentDataBlock(bytes, ref i); + 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 = 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); + AgentData.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 = "--- MultipleObjectUpdate ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class RequestMultipleObjectsPacket : Packet + { /// [XmlType("requestmultipleobjects_agentdata")] public class AgentDataBlock @@ -68437,46 +62731,94 @@ namespace libsecondlife.Packets } } + /// + [XmlType("requestmultipleobjects_objectdata")] + public class ObjectDataBlock + { + public byte CacheMissType; + public uint ID; + + [XmlIgnore] + public int Length + { + get + { + return 5; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + CacheMissType = (byte)bytes[i++]; + 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++] = CacheMissType; + 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() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("CacheMissType: {0}", CacheMissType)); + output.Append(String.Format("ID: {0}", ID)); + return output.ToString(); + } + } + 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 ObjectDataBlock[] ObjectData; public RequestMultipleObjectsPacket() { Header = new MediumHeader(); - Header.ID = 4; + Header.ID = 3; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public RequestMultipleObjectsPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new MediumHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 8; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -68484,9 +62826,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -68494,11 +62836,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RequestMultipleObjects ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -68507,6 +62849,52 @@ namespace libsecondlife.Packets /// public class ObjectPositionPacket : Packet { + /// + [XmlType("objectposition_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + /// [XmlType("objectposition_objectdata")] public class ObjectDataBlock @@ -68556,92 +62944,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("objectposition_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - 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 ObjectDataBlock[] ObjectData; public ObjectPositionPacket() { Header = new MediumHeader(); - Header.ID = 5; + Header.ID = 4; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectPositionPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new MediumHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 8; length += AgentData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -68649,9 +62990,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -68659,11 +63000,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectPosition ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -68672,55 +63013,6 @@ namespace libsecondlife.Packets /// public class RequestObjectPropertiesFamilyPacket : Packet { - /// - [XmlType("requestobjectpropertiesfamily_objectdata")] - public class ObjectDataBlock - { - public LLUUID ObjectID; - public uint RequestFlags; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public ObjectDataBlock() { } - public ObjectDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.Append(String.Format("RequestFlags: {0}", RequestFlags)); - return output.ToString(); - } - } - /// [XmlType("requestobjectpropertiesfamily_agentdata")] public class AgentDataBlock @@ -68767,47 +63059,95 @@ namespace libsecondlife.Packets } } + /// + [XmlType("requestobjectpropertiesfamily_objectdata")] + public class ObjectDataBlock + { + public uint RequestFlags; + public LLUUID ObjectID; + + [XmlIgnore] + public int Length + { + get + { + return 20; + } + } + + public ObjectDataBlock() { } + public ObjectDataBlock(byte[] bytes, ref int i) + { + try + { + RequestFlags = (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)(RequestFlags % 256); + bytes[i++] = (byte)((RequestFlags >> 8) % 256); + bytes[i++] = (byte)((RequestFlags >> 16) % 256); + bytes[i++] = (byte)((RequestFlags >> 24) % 256); + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("RequestFlags: {0}", RequestFlags)); + output.Append(String.Format("ObjectID: {0}", ObjectID)); + return output.ToString(); + } + } + 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 ObjectDataBlock ObjectData; public RequestObjectPropertiesFamilyPacket() { Header = new MediumHeader(); - Header.ID = 6; + Header.ID = 5; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock(); AgentData = new AgentDataBlock(); + ObjectData = new ObjectDataBlock(); } 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); + ObjectData = new ObjectDataBlock(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); + ObjectData = new ObjectDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 6; - length += ObjectData.Length; length += AgentData.Length;; + int length = 8; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + ObjectData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -68815,8 +63155,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RequestObjectPropertiesFamily ---" + Environment.NewLine; - output += ObjectData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ObjectData.ToString() + Environment.NewLine; return output; } @@ -68932,7 +63272,7 @@ namespace libsecondlife.Packets public CoarseLocationUpdatePacket() { Header = new MediumHeader(); - Header.ID = 7; + Header.ID = 6; Header.Reliable = true; Location = new LocationBlock[0]; Index = new IndexBlock(); @@ -68961,7 +63301,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 6; + int length = 8; length += Index.Length;; length++; for (int j = 0; j < Location.Length; j++) { length += Location[j].Length; } @@ -68992,136 +63332,6 @@ namespace libsecondlife.Packets /// public class CrossedRegionPacket : Packet { - /// - [XmlType("crossedregion_info")] - public class InfoBlock - { - public LLVector3 LookAt; - public LLVector3 Position; - - [XmlIgnore] - public int Length - { - get - { - return 24; - } - } - - public InfoBlock() { } - public InfoBlock(byte[] bytes, ref int i) - { - try - { - LookAt = new LLVector3(bytes, i); i += 12; - Position = new LLVector3(bytes, i); i += 12; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Info --"); - output.AppendLine(String.Format("LookAt: {0}", LookAt)); - output.Append(String.Format("Position: {0}", Position)); - return output.ToString(); - } - } - - /// - [XmlType("crossedregion_regiondata")] - public class RegionDataBlock - { - private byte[] _seedcapability; - public byte[] SeedCapability - { - get { return _seedcapability; } - set - { - if (value == null) { _seedcapability = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _seedcapability = new byte[value.Length]; Buffer.BlockCopy(value, 0, _seedcapability, 0, value.Length); } - } - } - public ushort SimPort; - public ulong RegionHandle; - public uint SimIP; - - [XmlIgnore] - public int Length - { - get - { - int length = 14; - if (SeedCapability != null) { length += 2 + SeedCapability.Length; } - return length; - } - } - - public RegionDataBlock() { } - public RegionDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _seedcapability = new byte[length]; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RegionData --"); - Helpers.FieldToString(output, SeedCapability, "SeedCapability"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("SimPort: {0}", SimPort)); - output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.Append(String.Format("SimIP: {0}", SimIP)); - return output.ToString(); - } - } - /// [XmlType("crossedregion_agentdata")] public class AgentDataBlock @@ -69168,51 +63378,180 @@ namespace libsecondlife.Packets } } + /// + [XmlType("crossedregion_regiondata")] + public class RegionDataBlock + { + public uint SimIP; + public ushort SimPort; + public ulong RegionHandle; + private byte[] _seedcapability; + public byte[] SeedCapability + { + get { return _seedcapability; } + set + { + if (value == null) { _seedcapability = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _seedcapability = new byte[value.Length]; Buffer.BlockCopy(value, 0, _seedcapability, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 14; + if (SeedCapability != null) { length += 2 + SeedCapability.Length; } + return length; + } + } + + public RegionDataBlock() { } + public RegionDataBlock(byte[] bytes, ref int i) + { + int length; + try + { + SimIP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _seedcapability = new byte[length]; + Buffer.BlockCopy(bytes, i, _seedcapability, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + 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)((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); + 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); + Buffer.BlockCopy(SeedCapability, 0, bytes, i, SeedCapability.Length); i += SeedCapability.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RegionData --"); + output.AppendLine(String.Format("SimIP: {0}", SimIP)); + output.AppendLine(String.Format("SimPort: {0}", SimPort)); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + Helpers.FieldToString(output, SeedCapability, "SeedCapability"); + return output.ToString(); + } + } + + /// + [XmlType("crossedregion_info")] + public class InfoBlock + { + public LLVector3 Position; + public LLVector3 LookAt; + + [XmlIgnore] + public int Length + { + get + { + return 24; + } + } + + public InfoBlock() { } + public InfoBlock(byte[] bytes, ref int i) + { + try + { + Position = new LLVector3(bytes, i); i += 12; + LookAt = new LLVector3(bytes, i); i += 12; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LookAt.GetBytes(), 0, bytes, i, 12); i += 12; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- Info --"); + output.AppendLine(String.Format("Position: {0}", Position)); + output.Append(String.Format("LookAt: {0}", LookAt)); + return output.ToString(); + } + } + 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 RegionDataBlock RegionData; + public InfoBlock Info; public CrossedRegionPacket() { Header = new MediumHeader(); - Header.ID = 8; + Header.ID = 7; Header.Reliable = true; - Info = new InfoBlock(); - RegionData = new RegionDataBlock(); AgentData = new AgentDataBlock(); + RegionData = new RegionDataBlock(); + Info = new InfoBlock(); } 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); + RegionData = new RegionDataBlock(bytes, ref i); + Info = new InfoBlock(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); + RegionData = new RegionDataBlock(bytes, ref i); + Info = new InfoBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 6; - length += Info.Length; length += RegionData.Length; length += AgentData.Length;; + int length = 8; + length += AgentData.Length; length += RegionData.Length; 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); - RegionData.ToBytes(bytes, ref i); AgentData.ToBytes(bytes, ref i); + RegionData.ToBytes(bytes, ref i); + Info.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -69220,9 +63559,9 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- CrossedRegion ---" + Environment.NewLine; - output += Info.ToString() + Environment.NewLine; - output += RegionData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += RegionData.ToString() + Environment.NewLine; + output += Info.ToString() + Environment.NewLine; return output; } @@ -69285,7 +63624,7 @@ namespace libsecondlife.Packets public ConfirmEnableSimulatorPacket() { Header = new MediumHeader(); - Header.ID = 9; + Header.ID = 8; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -69305,7 +63644,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 6; + int length = 8; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -69332,23 +63671,28 @@ namespace libsecondlife.Packets [XmlType("objectproperties_objectdata")] public class ObjectDataBlock { - public int OwnershipCost; - public ulong CreationDate; - public byte AggregatePermTexturesOwner; - private byte[] _sitname; - public byte[] SitName - { - get { return _sitname; } - set - { - if (value == null) { _sitname = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _sitname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _sitname, 0, value.Length); } - } - } public LLUUID ObjectID; - public byte SaleType; + public LLUUID CreatorID; + public LLUUID OwnerID; + public LLUUID GroupID; + public ulong CreationDate; public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public int OwnershipCost; + public byte SaleType; + public int SalePrice; + public byte AggregatePerms; + public byte AggregatePermTextures; + public byte AggregatePermTexturesOwner; + public uint Category; + public short InventorySerial; + public LLUUID ItemID; + public LLUUID FolderID; + public LLUUID FromTaskID; + public LLUUID LastOwnerID; private byte[] _name; public byte[] Name { @@ -69360,21 +63704,15 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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 + private byte[] _description; + public byte[] Description { - get { return _textureid; } + get { return _description; } set { - if (value == null) { _textureid = null; return; } + if (value == null) { _description = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _textureid = new byte[value.Length]; Buffer.BlockCopy(value, 0, _textureid, 0, value.Length); } + else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } private byte[] _touchname; @@ -69388,27 +63726,28 @@ namespace libsecondlife.Packets else { _touchname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _touchname, 0, value.Length); } } } - public LLUUID ItemID; - public byte AggregatePermTextures; - public LLUUID FolderID; - public short InventorySerial; - public uint EveryoneMask; - private byte[] _description; - public byte[] Description + private byte[] _sitname; + public byte[] SitName { - get { return _description; } + get { return _sitname; } set { - if (value == null) { _description = null; return; } + if (value == null) { _sitname = null; return; } if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } + else { _sitname = new byte[value.Length]; Buffer.BlockCopy(value, 0, _sitname, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _textureid, 0, value.Length); } } } - public LLUUID LastOwnerID; - public byte AggregatePerms; - public uint NextOwnerMask; - public uint GroupMask; - public uint OwnerMask; [XmlIgnore] public int Length @@ -69416,11 +63755,11 @@ namespace libsecondlife.Packets get { int length = 174; - if (SitName != null) { length += 1 + SitName.Length; } if (Name != null) { length += 1 + Name.Length; } - if (TextureID != null) { length += 1 + TextureID.Length; } - if (TouchName != null) { length += 1 + TouchName.Length; } if (Description != null) { length += 1 + Description.Length; } + if (TouchName != null) { length += 1 + TouchName.Length; } + if (SitName != null) { length += 1 + SitName.Length; } + if (TextureID != null) { length += 1 + TextureID.Length; } return length; } } @@ -69431,43 +63770,43 @@ namespace libsecondlife.Packets int length; try { - OwnershipCost = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - CreationDate = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); - AggregatePermTexturesOwner = (byte)bytes[i++]; - length = (ushort)bytes[i++]; - _sitname = new byte[length]; - Buffer.BlockCopy(bytes, i, _sitname, 0, length); i += length; ObjectID = new LLUUID(bytes, i); i += 16; - SaleType = (byte)bytes[i++]; + CreatorID = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; + CreationDate = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + OwnershipCost = (int)(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)); + AggregatePerms = (byte)bytes[i++]; + AggregatePermTextures = (byte)bytes[i++]; + AggregatePermTexturesOwner = (byte)bytes[i++]; + Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + InventorySerial = (short)(bytes[i++] + (bytes[i++] << 8)); + ItemID = new LLUUID(bytes, i); i += 16; + FolderID = new LLUUID(bytes, i); i += 16; + FromTaskID = new LLUUID(bytes, i); i += 16; + LastOwnerID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _textureid, 0, length); i += length; - length = (ushort)bytes[i++]; - _touchname = new byte[length]; - Buffer.BlockCopy(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]; Buffer.BlockCopy(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)); + length = (ushort)bytes[i++]; + _touchname = new byte[length]; + Buffer.BlockCopy(bytes, i, _touchname, 0, length); i += length; + length = (ushort)bytes[i++]; + _sitname = new byte[length]; + Buffer.BlockCopy(bytes, i, _sitname, 0, length); i += length; + length = (ushort)bytes[i++]; + _textureid = new byte[length]; + Buffer.BlockCopy(bytes, i, _textureid, 0, length); i += length; } catch (Exception) { @@ -69477,10 +63816,10 @@ namespace libsecondlife.Packets 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); + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(CreatorID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(CreationDate % 256); bytes[i++] = (byte)((CreationDate >> 8) % 256); bytes[i++] = (byte)((CreationDate >> 16) % 256); @@ -69489,101 +63828,100 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((CreationDate >> 40) % 256); bytes[i++] = (byte)((CreationDate >> 48) % 256); bytes[i++] = (byte)((CreationDate >> 56) % 256); - bytes[i++] = AggregatePermTexturesOwner; - if(SitName == null) { Console.WriteLine("Warning: SitName is null, in " + this.GetType()); } - bytes[i++] = (byte)SitName.Length; - Buffer.BlockCopy(SitName, 0, bytes, i, SitName.Length); i += SitName.Length; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(TouchName, 0, bytes, i, TouchName.Length); i += TouchName.Length; - Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = AggregatePermTextures; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; - Buffer.BlockCopy(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); + 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)(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)(OwnershipCost % 256); + bytes[i++] = (byte)((OwnershipCost >> 8) % 256); + bytes[i++] = (byte)((OwnershipCost >> 16) % 256); + bytes[i++] = (byte)((OwnershipCost >> 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); + bytes[i++] = AggregatePerms; + bytes[i++] = AggregatePermTextures; + bytes[i++] = AggregatePermTexturesOwner; + 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)(InventorySerial % 256); + bytes[i++] = (byte)((InventorySerial >> 8) % 256); + Buffer.BlockCopy(ItemID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FolderID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(FromTaskID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(LastOwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; + if(TouchName == null) { Console.WriteLine("Warning: TouchName is null, in " + this.GetType()); } + bytes[i++] = (byte)TouchName.Length; + Buffer.BlockCopy(TouchName, 0, bytes, i, TouchName.Length); i += TouchName.Length; + if(SitName == null) { Console.WriteLine("Warning: SitName is null, in " + this.GetType()); } + bytes[i++] = (byte)SitName.Length; + Buffer.BlockCopy(SitName, 0, bytes, i, SitName.Length); i += SitName.Length; + if(TextureID == null) { Console.WriteLine("Warning: TextureID is null, in " + this.GetType()); } + bytes[i++] = (byte)TextureID.Length; + Buffer.BlockCopy(TextureID, 0, bytes, i, TextureID.Length); i += TextureID.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("OwnershipCost: {0}", OwnershipCost)); - output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); - output.AppendLine(String.Format("AggregatePermTexturesOwner: {0}", AggregatePermTexturesOwner)); - Helpers.FieldToString(output, SitName, "SitName"); - output.Append(Environment.NewLine); output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("CreationDate: {0}", CreationDate)); output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("OwnershipCost: {0}", OwnershipCost)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + output.AppendLine(String.Format("AggregatePerms: {0}", AggregatePerms)); + output.AppendLine(String.Format("AggregatePermTextures: {0}", AggregatePermTextures)); + output.AppendLine(String.Format("AggregatePermTexturesOwner: {0}", AggregatePermTexturesOwner)); + output.AppendLine(String.Format("Category: {0}", Category)); + output.AppendLine(String.Format("InventorySerial: {0}", InventorySerial)); + output.AppendLine(String.Format("ItemID: {0}", ItemID)); + output.AppendLine(String.Format("FolderID: {0}", FolderID)); + output.AppendLine(String.Format("FromTaskID: {0}", FromTaskID)); + output.AppendLine(String.Format("LastOwnerID: {0}", LastOwnerID)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("FromTaskID: {0}", FromTaskID)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("CreatorID: {0}", CreatorID)); - Helpers.FieldToString(output, TextureID, "TextureID"); + Helpers.FieldToString(output, Description, "Description"); output.Append(Environment.NewLine); Helpers.FieldToString(output, TouchName, "TouchName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("ItemID: {0}", ItemID)); - output.AppendLine(String.Format("AggregatePermTextures: {0}", AggregatePermTextures)); - output.AppendLine(String.Format("FolderID: {0}", FolderID)); - output.AppendLine(String.Format("InventorySerial: {0}", InventorySerial)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); - Helpers.FieldToString(output, Description, "Description"); + Helpers.FieldToString(output, SitName, "SitName"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("LastOwnerID: {0}", LastOwnerID)); - output.AppendLine(String.Format("AggregatePerms: {0}", AggregatePerms)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); + Helpers.FieldToString(output, TextureID, "TextureID"); return output.ToString(); } } @@ -69596,9 +63934,8 @@ namespace libsecondlife.Packets public ObjectPropertiesPacket() { Header = new MediumHeader(); - Header.ID = 10; + Header.ID = 9; Header.Reliable = true; - Header.Zerocoded = true; ObjectData = new ObjectDataBlock[0]; } @@ -69623,7 +63960,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 6; + int length = 8; ; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -69656,10 +63993,20 @@ namespace libsecondlife.Packets [XmlType("objectpropertiesfamily_objectdata")] public class ObjectDataBlock { - public int OwnershipCost; + public uint RequestFlags; public LLUUID ObjectID; - public byte SaleType; + public LLUUID OwnerID; + public LLUUID GroupID; public uint BaseMask; + public uint OwnerMask; + public uint GroupMask; + public uint EveryoneMask; + public uint NextOwnerMask; + public int OwnershipCost; + public byte SaleType; + public int SalePrice; + public uint Category; + public LLUUID LastOwnerID; private byte[] _name; public byte[] Name { @@ -69671,12 +64018,6 @@ namespace libsecondlife.Packets else { _name = new byte[value.Length]; Buffer.BlockCopy(value, 0, _name, 0, 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 { @@ -69688,10 +64029,6 @@ namespace libsecondlife.Packets else { _description = new byte[value.Length]; Buffer.BlockCopy(value, 0, _description, 0, value.Length); } } } - public LLUUID LastOwnerID; - public uint NextOwnerMask; - public uint GroupMask; - public uint OwnerMask; [XmlIgnore] public int Length @@ -69711,26 +64048,26 @@ namespace libsecondlife.Packets int length; try { - OwnershipCost = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + RequestFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); ObjectID = new LLUUID(bytes, i); i += 16; - SaleType = (byte)bytes[i++]; + OwnerID = new LLUUID(bytes, i); i += 16; + GroupID = new LLUUID(bytes, i); i += 16; BaseMask = (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)); + GroupMask = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + OwnershipCost = (int)(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)); + Category = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + LastOwnerID = new LLUUID(bytes, i); i += 16; length = (ushort)bytes[i++]; _name = new byte[length]; Buffer.BlockCopy(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]; Buffer.BlockCopy(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) { @@ -69740,77 +64077,76 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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); + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(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; - Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; - Buffer.BlockCopy(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); + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + 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++] = (byte)(OwnerMask % 256); bytes[i++] = (byte)((OwnerMask >> 8) % 256); bytes[i++] = (byte)((OwnerMask >> 16) % 256); bytes[i++] = (byte)((OwnerMask >> 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)(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)(OwnershipCost % 256); + bytes[i++] = (byte)((OwnershipCost >> 8) % 256); + bytes[i++] = (byte)((OwnershipCost >> 16) % 256); + bytes[i++] = (byte)((OwnershipCost >> 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); + bytes[i++] = (byte)(Category % 256); + bytes[i++] = (byte)((Category >> 8) % 256); + bytes[i++] = (byte)((Category >> 16) % 256); + bytes[i++] = (byte)((Category >> 24) % 256); + Buffer.BlockCopy(LastOwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(Name, 0, bytes, i, Name.Length); i += Name.Length; + if(Description == null) { Console.WriteLine("Warning: Description is null, in " + this.GetType()); } + bytes[i++] = (byte)Description.Length; + Buffer.BlockCopy(Description, 0, bytes, i, Description.Length); i += Description.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("OwnershipCost: {0}", OwnershipCost)); + output.AppendLine(String.Format("RequestFlags: {0}", RequestFlags)); output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); output.AppendLine(String.Format("BaseMask: {0}", BaseMask)); + output.AppendLine(String.Format("OwnerMask: {0}", OwnerMask)); + output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); + output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); + output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); + output.AppendLine(String.Format("OwnershipCost: {0}", OwnershipCost)); + output.AppendLine(String.Format("SaleType: {0}", SaleType)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + output.AppendLine(String.Format("Category: {0}", Category)); + output.AppendLine(String.Format("LastOwnerID: {0}", LastOwnerID)); Helpers.FieldToString(output, Name, "Name"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("RequestFlags: {0}", RequestFlags)); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - output.AppendLine(String.Format("EveryoneMask: {0}", EveryoneMask)); Helpers.FieldToString(output, Description, "Description"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("LastOwnerID: {0}", LastOwnerID)); - output.AppendLine(String.Format("NextOwnerMask: {0}", NextOwnerMask)); - output.AppendLine(String.Format("GroupMask: {0}", GroupMask)); - output.Append(String.Format("OwnerMask: {0}", OwnerMask)); return output.ToString(); } } @@ -69823,9 +64159,8 @@ namespace libsecondlife.Packets public ObjectPropertiesFamilyPacket() { Header = new MediumHeader(); - Header.ID = 11; + Header.ID = 10; Header.Reliable = true; - Header.Zerocoded = true; ObjectData = new ObjectDataBlock(); } @@ -69844,7 +64179,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 6; + int length = 8; length += ObjectData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -69867,84 +64202,6 @@ namespace libsecondlife.Packets /// public class ParcelPropertiesRequestPacket : Packet { - /// - [XmlType("parcelpropertiesrequest_parceldata")] - public class ParcelDataBlock - { - public float East; - public float West; - public int SequenceID; - public bool SnapSelection; - public float North; - public float South; - - [XmlIgnore] - public int Length - { - get - { - return 21; - } - } - - public ParcelDataBlock() { } - public ParcelDataBlock(byte[] bytes, ref int i) - { - try - { - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - East = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - West = BitConverter.ToSingle(bytes, i); i += 4; - SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SnapSelection = (bytes[i++] != 0) ? (bool)true : (bool)false; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - North = BitConverter.ToSingle(bytes, i); i += 4; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - South = BitConverter.ToSingle(bytes, i); i += 4; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - ba = BitConverter.GetBytes(East); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(West); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - ba = BitConverter.GetBytes(South); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("East: {0}", East)); - output.AppendLine(String.Format("West: {0}", West)); - output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); - output.AppendLine(String.Format("SnapSelection: {0}", SnapSelection)); - output.AppendLine(String.Format("North: {0}", North)); - output.Append(String.Format("South: {0}", South)); - return output.ToString(); - } - } - /// [XmlType("parcelpropertiesrequest_agentdata")] public class AgentDataBlock @@ -69991,47 +64248,124 @@ namespace libsecondlife.Packets } } + /// + [XmlType("parcelpropertiesrequest_parceldata")] + public class ParcelDataBlock + { + public int SequenceID; + public float West; + public float South; + public float East; + public float North; + public bool SnapSelection; + + [XmlIgnore] + public int Length + { + get + { + return 21; + } + } + + public ParcelDataBlock() { } + public ParcelDataBlock(byte[] bytes, ref int i) + { + try + { + SequenceID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + West = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + South = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + East = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + North = BitConverter.ToSingle(bytes, i); i += 4; + SnapSelection = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + bytes[i++] = (byte)(SequenceID % 256); + bytes[i++] = (byte)((SequenceID >> 8) % 256); + bytes[i++] = (byte)((SequenceID >> 16) % 256); + bytes[i++] = (byte)((SequenceID >> 24) % 256); + ba = BitConverter.GetBytes(West); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(South); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(East); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(North); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = (byte)((SnapSelection) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ParcelData --"); + output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); + output.AppendLine(String.Format("West: {0}", West)); + output.AppendLine(String.Format("South: {0}", South)); + output.AppendLine(String.Format("East: {0}", East)); + output.AppendLine(String.Format("North: {0}", North)); + output.Append(String.Format("SnapSelection: {0}", SnapSelection)); + return output.ToString(); + } + } + 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 ParcelDataBlock ParcelData; public ParcelPropertiesRequestPacket() { Header = new MediumHeader(); - Header.ID = 12; + Header.ID = 11; Header.Reliable = true; - Header.Zerocoded = true; - ParcelData = new ParcelDataBlock(); AgentData = new AgentDataBlock(); + ParcelData = new ParcelDataBlock(); } 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); + ParcelData = new ParcelDataBlock(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); + ParcelData = new ParcelDataBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 6; - length += ParcelData.Length; length += AgentData.Length;; + int length = 8; + length += AgentData.Length; 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); AgentData.ToBytes(bytes, ref i); + ParcelData.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -70039,8 +64373,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ParcelPropertiesRequest ---" + Environment.NewLine; - output += ParcelData.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += ParcelData.ToString() + Environment.NewLine; return output; } @@ -70053,10 +64387,10 @@ namespace libsecondlife.Packets [XmlType("attachedsound_datablock")] public class DataBlockBlock { - public LLUUID ObjectID; - public float Gain; public LLUUID SoundID; + public LLUUID ObjectID; public LLUUID OwnerID; + public float Gain; public byte Flags; [XmlIgnore] @@ -70073,11 +64407,11 @@ namespace libsecondlife.Packets { try { + SoundID = new LLUUID(bytes, i); i += 16; ObjectID = new LLUUID(bytes, i); i += 16; + OwnerID = 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) @@ -70089,12 +64423,12 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; + Buffer.BlockCopy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; ba = BitConverter.GetBytes(Gain); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = Flags; } @@ -70102,10 +64436,10 @@ namespace libsecondlife.Packets { StringBuilder output = new StringBuilder(); output.AppendLine("-- DataBlock --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("Gain: {0}", Gain)); output.AppendLine(String.Format("SoundID: {0}", SoundID)); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("Gain: {0}", Gain)); output.Append(String.Format("Flags: {0}", Flags)); return output.ToString(); } @@ -70119,7 +64453,7 @@ namespace libsecondlife.Packets public AttachedSoundPacket() { Header = new MediumHeader(); - Header.ID = 14; + Header.ID = 13; Header.Reliable = true; DataBlock = new DataBlockBlock(); } @@ -70139,7 +64473,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 6; + int length = 8; length += DataBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -70220,7 +64554,7 @@ namespace libsecondlife.Packets public AttachedSoundGainChangePacket() { Header = new MediumHeader(); - Header.ID = 15; + Header.ID = 14; Header.Reliable = true; DataBlock = new DataBlockBlock(); } @@ -70240,7 +64574,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 6; + int length = 8; length += DataBlock.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -70260,107 +64594,6 @@ namespace libsecondlife.Packets } - /// - public class AttachedSoundCutoffRadiusPacket : Packet - { - /// - [XmlType("attachedsoundcutoffradius_datablock")] - public class DataBlockBlock - { - public LLUUID ObjectID; - public float Radius; - - [XmlIgnore] - public int Length - { - get - { - return 20; - } - } - - public DataBlockBlock() { } - public DataBlockBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Radius = BitConverter.ToSingle(bytes, i); i += 4; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(Radius); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- DataBlock --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.Append(String.Format("Radius: {0}", Radius)); - return output.ToString(); - } - } - - 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 = 16; - Header.Reliable = true; - DataBlock = new DataBlockBlock(); - } - - public AttachedSoundCutoffRadiusPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new MediumHeader(bytes, ref i, ref packetEnd); - DataBlock = new DataBlockBlock(bytes, ref i); - } - - public AttachedSoundCutoffRadiusPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - DataBlock = new DataBlockBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 6; - length += DataBlock.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - DataBlock.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AttachedSoundCutoffRadius ---" + Environment.NewLine; - output += DataBlock.ToString() + Environment.NewLine; - return output; - } - - } - /// public class PreloadSoundPacket : Packet { @@ -70369,8 +64602,8 @@ namespace libsecondlife.Packets public class DataBlockBlock { public LLUUID ObjectID; - public LLUUID SoundID; public LLUUID OwnerID; + public LLUUID SoundID; [XmlIgnore] public int Length @@ -70387,8 +64620,8 @@ namespace libsecondlife.Packets try { ObjectID = new LLUUID(bytes, i); i += 16; - SoundID = new LLUUID(bytes, i); i += 16; OwnerID = new LLUUID(bytes, i); i += 16; + SoundID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -70399,8 +64632,8 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() @@ -70408,8 +64641,8 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- DataBlock --"); output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("SoundID: {0}", SoundID)); - output.Append(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.Append(String.Format("SoundID: {0}", SoundID)); return output.ToString(); } } @@ -70422,7 +64655,7 @@ namespace libsecondlife.Packets public PreloadSoundPacket() { Header = new MediumHeader(); - Header.ID = 17; + Header.ID = 15; Header.Reliable = true; DataBlock = new DataBlockBlock[0]; } @@ -70448,7 +64681,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 6; + int length = 8; ; length++; for (int j = 0; j < DataBlock.Length; j++) { length += DataBlock[j].Length; } @@ -70477,91 +64710,6 @@ namespace libsecondlife.Packets /// public class ViewerEffectPacket : Packet { - /// - [XmlType("viewereffect_effect")] - public class EffectBlock - { - public float Duration; - public LLUUID ID; - public LLUUID AgentID; - 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]; Buffer.BlockCopy(value, 0, _typedata, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 41; - 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; - AgentID = new LLUUID(bytes, i); i += 16; - Type = (byte)bytes[i++]; - Color = new byte[4]; - Buffer.BlockCopy(bytes, i, Color, 0, 4); i += 4; - length = (ushort)bytes[i++]; - _typedata = new byte[length]; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = Type; - Buffer.BlockCopy(Color, 0, bytes, i, 4);i += 4; - if(TypeData == null) { Console.WriteLine("Warning: TypeData is null, in " + this.GetType()); } - bytes[i++] = (byte)TypeData.Length; - Buffer.BlockCopy(TypeData, 0, bytes, i, TypeData.Length); i += TypeData.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- Effect --"); - output.AppendLine(String.Format("Duration: {0}", Duration)); - output.AppendLine(String.Format("ID: {0}", ID)); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("Type: {0}", Type)); - Helpers.FieldToString(output, Color, "Color"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, TypeData, "TypeData"); - return output.ToString(); - } - } - /// [XmlType("viewereffect_agentdata")] public class AgentDataBlock @@ -70608,98 +64756,54 @@ namespace libsecondlife.Packets } } - 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 AgentDataBlock AgentData; - - public ViewerEffectPacket() - { - Header = new MediumHeader(); - Header.ID = 19; - Header.Reliable = true; - Header.Zerocoded = true; - Effect = new EffectBlock[0]; - AgentData = new AgentDataBlock(); - } - - 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); } - AgentData = new AgentDataBlock(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); } - AgentData = new AgentDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 6; - length += AgentData.Length;; - 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); } - AgentData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ViewerEffect ---" + Environment.NewLine; - for (int j = 0; j < Effect.Length; j++) - { - output += Effect[j].ToString() + Environment.NewLine; - } - output += AgentData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class SetSunPhasePacket : Packet - { /// - [XmlType("setsunphase_data")] - public class DataBlock + [XmlType("viewereffect_effect")] + public class EffectBlock { - public float Phase; + public LLUUID ID; + public LLUUID AgentID; + public byte Type; + public float Duration; + 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]; Buffer.BlockCopy(value, 0, _typedata, 0, value.Length); } + } + } [XmlIgnore] public int Length { get { - return 4; + int length = 41; + if (TypeData != null) { length += 1 + TypeData.Length; } + return length; } } - public DataBlock() { } - public DataBlock(byte[] bytes, ref int i) + public EffectBlock() { } + public EffectBlock(byte[] bytes, ref int i) { + int length; try { + ID = new LLUUID(bytes, i); i += 16; + AgentID = new LLUUID(bytes, i); i += 16; + Type = (byte)bytes[i++]; if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Phase = BitConverter.ToSingle(bytes, i); i += 4; + Duration = BitConverter.ToSingle(bytes, i); i += 4; + Color = new byte[4]; + Buffer.BlockCopy(bytes, i, Color, 0, 4); i += 4; + length = (ushort)bytes[i++]; + _typedata = new byte[length]; + Buffer.BlockCopy(bytes, i, _typedata, 0, length); i += length; } catch (Exception) { @@ -70710,115 +64814,94 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - ba = BitConverter.GetBytes(Phase); + Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = Type; + ba = BitConverter.GetBytes(Duration); if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + Buffer.BlockCopy(Color, 0, bytes, i, 4);i += 4; + if(TypeData == null) { Console.WriteLine("Warning: TypeData is null, in " + this.GetType()); } + bytes[i++] = (byte)TypeData.Length; + Buffer.BlockCopy(TypeData, 0, bytes, i, TypeData.Length); i += TypeData.Length; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- Data --"); - output.Append(String.Format("Phase: {0}", Phase)); - return output.ToString(); - } - } - - /// - [XmlType("setsunphase_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); + output.AppendLine("-- Effect --"); + output.AppendLine(String.Format("ID: {0}", ID)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("Type: {0}", Type)); + output.AppendLine(String.Format("Duration: {0}", Duration)); + Helpers.FieldToString(output, Color, "Color"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, TypeData, "TypeData"); return output.ToString(); } } 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 override PacketType Type { get { return PacketType.ViewerEffect; } } public AgentDataBlock AgentData; + public EffectBlock[] Effect; - public SetSunPhasePacket() + public ViewerEffectPacket() { Header = new MediumHeader(); - Header.ID = 20; + Header.ID = 17; Header.Reliable = true; - Data = new DataBlock(); AgentData = new AgentDataBlock(); + Effect = new EffectBlock[0]; } - public SetSunPhasePacket(byte[] bytes, ref int i) + public ViewerEffectPacket(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); + int count = (int)bytes[i++]; + Effect = new EffectBlock[count]; + for (int j = 0; j < count; j++) + { Effect[j] = new EffectBlock(bytes, ref i); } } - public SetSunPhasePacket(Header head, byte[] bytes, ref int i) + public ViewerEffectPacket(Header head, byte[] bytes, ref int i) { Header = head; - Data = new DataBlock(bytes, ref i); AgentData = new AgentDataBlock(bytes, ref i); + 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 += Data.Length; length += AgentData.Length;; + int length = 8; + length += AgentData.Length;; + 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); - Data.ToBytes(bytes, ref i); AgentData.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 = "--- SetSunPhase ---" + Environment.NewLine; - output += Data.ToString() + Environment.NewLine; + string output = "--- ViewerEffect ---" + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < Effect.Length; j++) + { + output += Effect[j].ToString() + Environment.NewLine; + } return output; } @@ -70904,7 +64987,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += PingID.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -70997,7 +65080,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += PingID.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -71024,18 +65107,18 @@ namespace libsecondlife.Packets [XmlType("agentupdate_agentdata")] public class AgentDataBlock { - public uint ControlFlags; - public LLVector3 CameraAtAxis; - public float Far; public LLUUID AgentID; - public LLVector3 CameraCenter; - public LLVector3 CameraLeftAxis; - public LLQuaternion HeadRotation; public LLUUID SessionID; - public LLVector3 CameraUpAxis; public LLQuaternion BodyRotation; - public byte Flags; + public LLQuaternion HeadRotation; public byte State; + public LLVector3 CameraCenter; + public LLVector3 CameraAtAxis; + public LLVector3 CameraLeftAxis; + public LLVector3 CameraUpAxis; + public float Far; + public uint ControlFlags; + public byte Flags; [XmlIgnore] public int Length @@ -71051,19 +65134,19 @@ namespace libsecondlife.Packets { try { - ControlFlags = (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; + BodyRotation = new LLQuaternion(bytes, i, true); i += 12; + HeadRotation = new LLQuaternion(bytes, i, true); i += 12; + State = (byte)bytes[i++]; + CameraCenter = new LLVector3(bytes, i); i += 12; CameraAtAxis = new LLVector3(bytes, i); i += 12; + CameraLeftAxis = new LLVector3(bytes, i); i += 12; + CameraUpAxis = 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; + ControlFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); Flags = (byte)bytes[i++]; - State = (byte)bytes[i++]; } catch (Exception) { @@ -71074,41 +65157,41 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(BodyRotation.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(HeadRotation.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = State; + Buffer.BlockCopy(CameraCenter.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(CameraAtAxis.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(CameraLeftAxis.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(CameraUpAxis.GetBytes(), 0, bytes, i, 12); i += 12; + ba = BitConverter.GetBytes(Far); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; bytes[i++] = (byte)(ControlFlags % 256); bytes[i++] = (byte)((ControlFlags >> 8) % 256); bytes[i++] = (byte)((ControlFlags >> 16) % 256); bytes[i++] = (byte)((ControlFlags >> 24) % 256); - Buffer.BlockCopy(CameraAtAxis.GetBytes(), 0, bytes, i, 12); i += 12; - ba = BitConverter.GetBytes(Far); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CameraCenter.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(CameraLeftAxis.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(HeadRotation.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(CameraUpAxis.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(BodyRotation.GetBytes(), 0, bytes, i, 12); i += 12; bytes[i++] = Flags; - bytes[i++] = State; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("ControlFlags: {0}", ControlFlags)); - output.AppendLine(String.Format("CameraAtAxis: {0}", CameraAtAxis)); - output.AppendLine(String.Format("Far: {0}", Far)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("CameraCenter: {0}", CameraCenter)); - output.AppendLine(String.Format("CameraLeftAxis: {0}", CameraLeftAxis)); - output.AppendLine(String.Format("HeadRotation: {0}", HeadRotation)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("CameraUpAxis: {0}", CameraUpAxis)); output.AppendLine(String.Format("BodyRotation: {0}", BodyRotation)); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.Append(String.Format("State: {0}", State)); + output.AppendLine(String.Format("HeadRotation: {0}", HeadRotation)); + output.AppendLine(String.Format("State: {0}", State)); + output.AppendLine(String.Format("CameraCenter: {0}", CameraCenter)); + output.AppendLine(String.Format("CameraAtAxis: {0}", CameraAtAxis)); + output.AppendLine(String.Format("CameraLeftAxis: {0}", CameraLeftAxis)); + output.AppendLine(String.Format("CameraUpAxis: {0}", CameraUpAxis)); + output.AppendLine(String.Format("Far: {0}", Far)); + output.AppendLine(String.Format("ControlFlags: {0}", ControlFlags)); + output.Append(String.Format("Flags: {0}", Flags)); return output.ToString(); } } @@ -71123,7 +65206,6 @@ namespace libsecondlife.Packets Header = new HighHeader(); Header.ID = 4; Header.Reliable = true; - Header.Zerocoded = true; AgentData = new AgentDataBlock(); } @@ -71142,7 +65224,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -71165,6 +65247,98 @@ namespace libsecondlife.Packets /// public class AgentAnimationPacket : Packet { + /// + [XmlType("agentanimation_agentdata")] + public class AgentDataBlock + { + public LLUUID AgentID; + public LLUUID SessionID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) + { + try + { + AgentID = new LLUUID(bytes, i); i += 16; + SessionID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.Append(String.Format("SessionID: {0}", SessionID)); + return output.ToString(); + } + } + + /// + [XmlType("agentanimation_animationlist")] + public class AnimationListBlock + { + public LLUUID AnimID; + public bool StartAnim; + + [XmlIgnore] + public int Length + { + get + { + return 17; + } + } + + public AnimationListBlock() { } + public AnimationListBlock(byte[] bytes, ref int i) + { + try + { + AnimID = new LLUUID(bytes, i); i += 16; + StartAnim = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(AnimID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((StartAnim) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AnimationList --"); + output.AppendLine(String.Format("AnimID: {0}", AnimID)); + output.Append(String.Format("StartAnim: {0}", StartAnim)); + return output.ToString(); + } + } + /// [XmlType("agentanimation_physicalavatareventlist")] public class PhysicalAvatarEventListBlock @@ -71224,161 +65398,69 @@ namespace libsecondlife.Packets } } - /// - [XmlType("agentanimation_animationlist")] - public class AnimationListBlock - { - public LLUUID AnimID; - public bool StartAnim; - - [XmlIgnore] - public int Length - { - get - { - return 17; - } - } - - public AnimationListBlock() { } - public AnimationListBlock(byte[] bytes, ref int i) - { - try - { - AnimID = new LLUUID(bytes, i); i += 16; - StartAnim = (bytes[i++] != 0) ? (bool)true : (bool)false; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AnimID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((StartAnim) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AnimationList --"); - output.AppendLine(String.Format("AnimID: {0}", AnimID)); - output.Append(String.Format("StartAnim: {0}", StartAnim)); - return output.ToString(); - } - } - - /// - [XmlType("agentanimation_agentdata")] - public class AgentDataBlock - { - public LLUUID AgentID; - public LLUUID SessionID; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - try - { - AgentID = new LLUUID(bytes, i); i += 16; - SessionID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.Append(String.Format("SessionID: {0}", SessionID)); - return output.ToString(); - } - } - private Header header; public override Header Header { get { return header; } set { header = value; } } public override PacketType Type { get { return PacketType.AgentAnimation; } } - public PhysicalAvatarEventListBlock[] PhysicalAvatarEventList; - public AnimationListBlock[] AnimationList; public AgentDataBlock AgentData; + public AnimationListBlock[] AnimationList; + public PhysicalAvatarEventListBlock[] PhysicalAvatarEventList; public AgentAnimationPacket() { Header = new HighHeader(); Header.ID = 5; Header.Reliable = true; - PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[0]; - AnimationList = new AnimationListBlock[0]; AgentData = new AgentDataBlock(); + AnimationList = new AnimationListBlock[0]; + PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[0]; } public AgentAnimationPacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new HighHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); int count = (int)bytes[i++]; - PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; - for (int j = 0; j < count; j++) - { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(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); } - AgentData = new AgentDataBlock(bytes, ref i); + count = (int)bytes[i++]; + PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; + for (int j = 0; j < count; j++) + { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(bytes, ref i); } } public AgentAnimationPacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); int count = (int)bytes[i++]; - PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; - for (int j = 0; j < count; j++) - { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(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); } - AgentData = new AgentDataBlock(bytes, ref i); + count = (int)bytes[i++]; + PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; + for (int j = 0; j < count; j++) + { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(bytes, ref i); } } public override byte[] ToBytes() { - int length = 5; + int length = 7; length += AgentData.Length;; length++; - for (int j = 0; j < PhysicalAvatarEventList.Length; j++) { length += PhysicalAvatarEventList[j].Length; } - length++; for (int j = 0; j < AnimationList.Length; j++) { length += AnimationList[j].Length; } + length++; + for (int j = 0; j < PhysicalAvatarEventList.Length; j++) { length += PhysicalAvatarEventList[j].Length; } if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); - bytes[i++] = (byte)PhysicalAvatarEventList.Length; - for (int j = 0; j < PhysicalAvatarEventList.Length; j++) { PhysicalAvatarEventList[j].ToBytes(bytes, ref i); } + AgentData.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); + bytes[i++] = (byte)PhysicalAvatarEventList.Length; + for (int j = 0; j < PhysicalAvatarEventList.Length; j++) { PhysicalAvatarEventList[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -71386,15 +65468,15 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentAnimation ---" + Environment.NewLine; - for (int j = 0; j < PhysicalAvatarEventList.Length; j++) - { - output += PhysicalAvatarEventList[j].ToString() + Environment.NewLine; - } + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < AnimationList.Length; j++) { output += AnimationList[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; + for (int j = 0; j < PhysicalAvatarEventList.Length; j++) + { + output += PhysicalAvatarEventList[j].ToString() + Environment.NewLine; + } return output; } @@ -71403,52 +65485,6 @@ namespace libsecondlife.Packets /// public class AgentRequestSitPacket : Packet { - /// - [XmlType("agentrequestsit_targetobject")] - public class TargetObjectBlock - { - public LLUUID TargetID; - public LLVector3 Offset; - - [XmlIgnore] - public int Length - { - get - { - return 28; - } - } - - public TargetObjectBlock() { } - public TargetObjectBlock(byte[] bytes, ref int i) - { - try - { - TargetID = new LLUUID(bytes, i); i += 16; - Offset = new LLVector3(bytes, i); i += 12; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Offset.GetBytes(), 0, bytes, i, 12); i += 12; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- TargetObject --"); - output.AppendLine(String.Format("TargetID: {0}", TargetID)); - output.Append(String.Format("Offset: {0}", Offset)); - return output.ToString(); - } - } - /// [XmlType("agentrequestsit_agentdata")] public class AgentDataBlock @@ -71495,47 +65531,92 @@ namespace libsecondlife.Packets } } + /// + [XmlType("agentrequestsit_targetobject")] + public class TargetObjectBlock + { + public LLUUID TargetID; + public LLVector3 Offset; + + [XmlIgnore] + public int Length + { + get + { + return 28; + } + } + + public TargetObjectBlock() { } + public TargetObjectBlock(byte[] bytes, ref int i) + { + try + { + TargetID = new LLUUID(bytes, i); i += 16; + Offset = new LLVector3(bytes, i); i += 12; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(TargetID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(Offset.GetBytes(), 0, bytes, i, 12); i += 12; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- TargetObject --"); + output.AppendLine(String.Format("TargetID: {0}", TargetID)); + output.Append(String.Format("Offset: {0}", Offset)); + return output.ToString(); + } + } + 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 TargetObjectBlock TargetObject; public AgentRequestSitPacket() { Header = new HighHeader(); Header.ID = 6; Header.Reliable = true; - Header.Zerocoded = true; - TargetObject = new TargetObjectBlock(); AgentData = new AgentDataBlock(); + TargetObject = new TargetObjectBlock(); } 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); + TargetObject = new TargetObjectBlock(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); + TargetObject = new TargetObjectBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 5; - length += TargetObject.Length; length += AgentData.Length;; + int length = 7; + length += AgentData.Length; length += TargetObject.Length;; 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); + TargetObject.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -71543,8 +65624,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AgentRequestSit ---" + Environment.NewLine; - output += TargetObject.ToString() + Environment.NewLine; output += AgentData.ToString() + Environment.NewLine; + output += TargetObject.ToString() + Environment.NewLine; return output; } @@ -71627,7 +65708,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -71650,71 +65731,6 @@ namespace libsecondlife.Packets /// public class RequestImagePacket : Packet { - /// - [XmlType("requestimage_requestimage")] - public class RequestImageBlock - { - public float DownloadPriority; - public sbyte DiscardLevel; - public byte Type; - public uint Packet; - public LLUUID Image; - - [XmlIgnore] - public int Length - { - get - { - return 26; - } - } - - public RequestImageBlock() { } - public RequestImageBlock(byte[] bytes, ref int i) - { - try - { - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - DownloadPriority = BitConverter.ToSingle(bytes, i); i += 4; - DiscardLevel = (sbyte)bytes[i++]; - Type = (byte)bytes[i++]; - Packet = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - Image = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - byte[] ba; - ba = BitConverter.GetBytes(DownloadPriority); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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); - Buffer.BlockCopy(Image.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RequestImage --"); - output.AppendLine(String.Format("DownloadPriority: {0}", DownloadPriority)); - output.AppendLine(String.Format("DiscardLevel: {0}", DiscardLevel)); - output.AppendLine(String.Format("Type: {0}", Type)); - output.AppendLine(String.Format("Packet: {0}", Packet)); - output.Append(String.Format("Image: {0}", Image)); - return output.ToString(); - } - } - /// [XmlType("requestimage_agentdata")] public class AgentDataBlock @@ -71761,45 +65777,110 @@ namespace libsecondlife.Packets } } + /// + [XmlType("requestimage_requestimage")] + public class RequestImageBlock + { + public LLUUID Image; + public sbyte DiscardLevel; + public float DownloadPriority; + public uint Packet; + public byte Type; + + [XmlIgnore] + public int Length + { + get + { + return 26; + } + } + + public RequestImageBlock() { } + public RequestImageBlock(byte[] bytes, ref int i) + { + try + { + Image = new LLUUID(bytes, i); i += 16; + DiscardLevel = (sbyte)bytes[i++]; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + DownloadPriority = BitConverter.ToSingle(bytes, i); i += 4; + Packet = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Type = (byte)bytes[i++]; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + byte[] ba; + Buffer.BlockCopy(Image.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)DiscardLevel; + ba = BitConverter.GetBytes(DownloadPriority); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + 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++] = Type; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RequestImage --"); + output.AppendLine(String.Format("Image: {0}", Image)); + output.AppendLine(String.Format("DiscardLevel: {0}", DiscardLevel)); + output.AppendLine(String.Format("DownloadPriority: {0}", DownloadPriority)); + output.AppendLine(String.Format("Packet: {0}", Packet)); + output.Append(String.Format("Type: {0}", Type)); + return output.ToString(); + } + } + 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 RequestImageBlock[] RequestImage; public RequestImagePacket() { Header = new HighHeader(); Header.ID = 8; Header.Reliable = true; - RequestImage = new RequestImageBlock[0]; AgentData = new AgentDataBlock(); + RequestImage = new RequestImageBlock[0]; } public RequestImagePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new HighHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); 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; + AgentData = new AgentDataBlock(bytes, ref i); 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; + int length = 7; length += AgentData.Length;; length++; for (int j = 0; j < RequestImage.Length; j++) { length += RequestImage[j].Length; } @@ -71807,9 +65888,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + AgentData.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; } @@ -71817,11 +65898,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- RequestImage ---" + Environment.NewLine; + output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < RequestImage.Length; j++) { output += RequestImage[j].ToString() + Environment.NewLine; } - output += AgentData.ToString() + Environment.NewLine; return output; } @@ -71835,9 +65916,9 @@ namespace libsecondlife.Packets public class ImageIDBlock { public LLUUID ID; - public ushort Packets; - public uint Size; public byte Codec; + public uint Size; + public ushort Packets; [XmlIgnore] public int Length @@ -71854,9 +65935,9 @@ namespace libsecondlife.Packets 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++]; + Size = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Packets = (ushort)(bytes[i++] + (bytes[i++] << 8)); } catch (Exception) { @@ -71867,13 +65948,13 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(ID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)(Packets % 256); - bytes[i++] = (byte)((Packets >> 8) % 256); + bytes[i++] = Codec; 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; + bytes[i++] = (byte)(Packets % 256); + bytes[i++] = (byte)((Packets >> 8) % 256); } public override string ToString() @@ -71881,9 +65962,9 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- ImageID --"); output.AppendLine(String.Format("ID: {0}", ID)); - output.AppendLine(String.Format("Packets: {0}", Packets)); + output.AppendLine(String.Format("Codec: {0}", Codec)); output.AppendLine(String.Format("Size: {0}", Size)); - output.Append(String.Format("Codec: {0}", Codec)); + output.Append(String.Format("Packets: {0}", Packets)); return output.ToString(); } } @@ -71980,7 +66061,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += ImageID.Length; length += ImageData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -72144,7 +66225,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += ImageID.Length; length += ImageData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -72303,7 +66384,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += LayerID.Length; length += LayerData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -72328,409 +66409,12 @@ namespace libsecondlife.Packets /// public class ObjectUpdatePacket : Packet { - /// - [XmlType("objectupdate_objectdata")] - public class ObjectDataBlock - { - public uint ID; - public uint UpdateFlags; - private byte[] _objectdata; - public byte[] ObjectData - { - get { return _objectdata; } - set - { - if (value == null) { _objectdata = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _objectdata = new byte[value.Length]; Buffer.BlockCopy(value, 0, _objectdata, 0, value.Length); } - } - } - public sbyte PathTwistBegin; - public uint CRC; - public LLVector3 JointPivot; - public ushort 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]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } - } - } - public byte[] TextColor; - public byte ClickAction; - public ushort 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 > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _data = new byte[value.Length]; Buffer.BlockCopy(value, 0, _data, 0, 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]; Buffer.BlockCopy(value, 0, _textureanim, 0, 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]; Buffer.BlockCopy(value, 0, _text, 0, 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]; Buffer.BlockCopy(value, 0, _extraparams, 0, value.Length); } - } - } - private byte[] _namevalue; - public byte[] NameValue - { - get { return _namevalue; } - set - { - if (value == null) { _namevalue = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _namevalue = new byte[value.Length]; Buffer.BlockCopy(value, 0, _namevalue, 0, value.Length); } - } - } - public byte PathShearX; - public byte PathShearY; - public sbyte PathTaperX; - public sbyte PathTaperY; - public float Radius; - public ushort ProfileEnd; - public byte JointType; - public ushort 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]; Buffer.BlockCopy(value, 0, _psblock, 0, 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 > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _textureentry = new byte[value.Length]; Buffer.BlockCopy(value, 0, _textureentry, 0, value.Length); } - } - } - public ushort ProfileHollow; - public byte PathRevolutions; - - [XmlIgnore] - public int Length - { - get - { - int length = 141; - 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]; - Buffer.BlockCopy(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 = (ushort)(bytes[i++] + (bytes[i++] << 8)); - length = (ushort)bytes[i++]; - _mediaurl = new byte[length]; - Buffer.BlockCopy(bytes, i, _mediaurl, 0, length); i += length; - TextColor = new byte[4]; - Buffer.BlockCopy(bytes, i, TextColor, 0, 4); i += 4; - ClickAction = (byte)bytes[i++]; - ProfileBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); - 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]; - Buffer.BlockCopy(bytes, i, _data, 0, length); i += length; - length = (ushort)bytes[i++]; - _textureanim = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _extraparams, 0, length); i += length; - length = (ushort)(bytes[i++] + (bytes[i++] << 8)); - _namevalue = new byte[length]; - Buffer.BlockCopy(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 = (ushort)(bytes[i++] + (bytes[i++] << 8)); - JointType = (byte)bytes[i++]; - PathBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); - length = (ushort)bytes[i++]; - _psblock = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(bytes, i, _textureentry, 0, length); i += length; - ProfileHollow = (ushort)(bytes[i++] + (bytes[i++] << 8)); - 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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(JointPivot.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = (byte)(PathEnd % 256); - bytes[i++] = (byte)((PathEnd >> 8) % 256); - if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); } - bytes[i++] = (byte)MediaURL.Length; - Buffer.BlockCopy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length; - Buffer.BlockCopy(TextColor, 0, bytes, i, 4);i += 4; - bytes[i++] = ClickAction; - bytes[i++] = (byte)(ProfileBegin % 256); - bytes[i++] = (byte)((ProfileBegin >> 8) % 256); - bytes[i++] = (byte)PathRadiusOffset; - ba = BitConverter.GetBytes(Gain); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Text, 0, bytes, i, Text.Length); i += Text.Length; - bytes[i++] = ProfileCurve; - bytes[i++] = PathScaleX; - bytes[i++] = PathScaleY; - bytes[i++] = Material; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - bytes[i++] = (byte)(ProfileEnd % 256); - bytes[i++] = (byte)((ProfileEnd >> 8) % 256); - bytes[i++] = JointType; - bytes[i++] = (byte)(PathBegin % 256); - bytes[i++] = (byte)((PathBegin >> 8) % 256); - if(PSBlock == null) { Console.WriteLine("Warning: PSBlock is null, in " + this.GetType()); } - bytes[i++] = (byte)PSBlock.Length; - Buffer.BlockCopy(PSBlock, 0, bytes, i, PSBlock.Length); i += PSBlock.Length; - bytes[i++] = PCode; - Buffer.BlockCopy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = PathCurve; - Buffer.BlockCopy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(JointAxisOrAnchor.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = Flags; - bytes[i++] = State; - bytes[i++] = (byte)PathTwist; - Buffer.BlockCopy(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); - Buffer.BlockCopy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length; - bytes[i++] = (byte)(ProfileHollow % 256); - bytes[i++] = (byte)((ProfileHollow >> 8) % 256); - bytes[i++] = PathRevolutions; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- ObjectData --"); - output.AppendLine(String.Format("ID: {0}", ID)); - output.AppendLine(String.Format("UpdateFlags: {0}", UpdateFlags)); - Helpers.FieldToString(output, ObjectData, "ObjectData"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("PathTwistBegin: {0}", PathTwistBegin)); - output.AppendLine(String.Format("CRC: {0}", CRC)); - output.AppendLine(String.Format("JointPivot: {0}", JointPivot)); - output.AppendLine(String.Format("PathEnd: {0}", PathEnd)); - Helpers.FieldToString(output, MediaURL, "MediaURL"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, TextColor, "TextColor"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ClickAction: {0}", ClickAction)); - output.AppendLine(String.Format("ProfileBegin: {0}", ProfileBegin)); - output.AppendLine(String.Format("PathRadiusOffset: {0}", PathRadiusOffset)); - output.AppendLine(String.Format("Gain: {0}", Gain)); - output.AppendLine(String.Format("PathSkew: {0}", PathSkew)); - Helpers.FieldToString(output, Data, "Data"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, TextureAnim, "TextureAnim"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ParentID: {0}", ParentID)); - Helpers.FieldToString(output, Text, "Text"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ProfileCurve: {0}", ProfileCurve)); - output.AppendLine(String.Format("PathScaleX: {0}", PathScaleX)); - output.AppendLine(String.Format("PathScaleY: {0}", PathScaleY)); - output.AppendLine(String.Format("Material: {0}", Material)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); - Helpers.FieldToString(output, ExtraParams, "ExtraParams"); - output.Append(Environment.NewLine); - Helpers.FieldToString(output, NameValue, "NameValue"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("PathShearX: {0}", PathShearX)); - output.AppendLine(String.Format("PathShearY: {0}", PathShearY)); - output.AppendLine(String.Format("PathTaperX: {0}", PathTaperX)); - output.AppendLine(String.Format("PathTaperY: {0}", PathTaperY)); - output.AppendLine(String.Format("Radius: {0}", Radius)); - output.AppendLine(String.Format("ProfileEnd: {0}", ProfileEnd)); - output.AppendLine(String.Format("JointType: {0}", JointType)); - output.AppendLine(String.Format("PathBegin: {0}", PathBegin)); - Helpers.FieldToString(output, PSBlock, "PSBlock"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("PCode: {0}", PCode)); - output.AppendLine(String.Format("FullID: {0}", FullID)); - output.AppendLine(String.Format("PathCurve: {0}", PathCurve)); - output.AppendLine(String.Format("Scale: {0}", Scale)); - output.AppendLine(String.Format("JointAxisOrAnchor: {0}", JointAxisOrAnchor)); - output.AppendLine(String.Format("Flags: {0}", Flags)); - output.AppendLine(String.Format("State: {0}", State)); - output.AppendLine(String.Format("PathTwist: {0}", PathTwist)); - output.AppendLine(String.Format("Sound: {0}", Sound)); - Helpers.FieldToString(output, TextureEntry, "TextureEntry"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("ProfileHollow: {0}", ProfileHollow)); - output.Append(String.Format("PathRevolutions: {0}", PathRevolutions)); - return output.ToString(); - } - } - /// [XmlType("objectupdate_regiondata")] public class RegionDataBlock { - public ushort TimeDilation; public ulong RegionHandle; + public ushort TimeDilation; [XmlIgnore] public int Length @@ -72746,8 +66430,8 @@ namespace libsecondlife.Packets { 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)); + TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8)); } catch (Exception) { @@ -72757,8 +66441,6 @@ namespace libsecondlife.Packets 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); @@ -72767,14 +66449,413 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((RegionHandle >> 40) % 256); bytes[i++] = (byte)((RegionHandle >> 48) % 256); bytes[i++] = (byte)((RegionHandle >> 56) % 256); + bytes[i++] = (byte)(TimeDilation % 256); + bytes[i++] = (byte)((TimeDilation >> 8) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- RegionData --"); - output.AppendLine(String.Format("TimeDilation: {0}", TimeDilation)); - output.Append(String.Format("RegionHandle: {0}", RegionHandle)); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.Append(String.Format("TimeDilation: {0}", TimeDilation)); + return output.ToString(); + } + } + + /// + [XmlType("objectupdate_objectdata")] + public class ObjectDataBlock + { + public uint ID; + public byte State; + public LLUUID FullID; + public uint CRC; + public byte PCode; + public byte Material; + public byte ClickAction; + public LLVector3 Scale; + 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]; Buffer.BlockCopy(value, 0, _objectdata, 0, value.Length); } + } + } + public uint ParentID; + public uint UpdateFlags; + public byte PathCurve; + public byte ProfileCurve; + public ushort PathBegin; + public ushort PathEnd; + public byte PathScaleX; + public byte PathScaleY; + public byte PathShearX; + public byte PathShearY; + public sbyte PathTwist; + public sbyte PathTwistBegin; + public sbyte PathRadiusOffset; + public sbyte PathTaperX; + public sbyte PathTaperY; + public byte PathRevolutions; + public sbyte PathSkew; + public ushort ProfileBegin; + public ushort ProfileEnd; + public ushort ProfileHollow; + private byte[] _textureentry; + public byte[] TextureEntry + { + get { return _textureentry; } + set + { + if (value == null) { _textureentry = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _textureentry = new byte[value.Length]; Buffer.BlockCopy(value, 0, _textureentry, 0, 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]; Buffer.BlockCopy(value, 0, _textureanim, 0, value.Length); } + } + } + private byte[] _namevalue; + public byte[] NameValue + { + get { return _namevalue; } + set + { + if (value == null) { _namevalue = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _namevalue = new byte[value.Length]; Buffer.BlockCopy(value, 0, _namevalue, 0, value.Length); } + } + } + private byte[] _data; + public byte[] Data + { + get { return _data; } + set + { + if (value == null) { _data = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _data = new byte[value.Length]; Buffer.BlockCopy(value, 0, _data, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _text, 0, value.Length); } + } + } + public byte[] TextColor; + 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]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _psblock, 0, value.Length); } + } + } + 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]; Buffer.BlockCopy(value, 0, _extraparams, 0, value.Length); } + } + } + public LLUUID Sound; + public LLUUID OwnerID; + public float Gain; + public byte Flags; + public float Radius; + public byte JointType; + public LLVector3 JointPivot; + public LLVector3 JointAxisOrAnchor; + + [XmlIgnore] + public int Length + { + get + { + int length = 141; + if (ObjectData != null) { length += 1 + ObjectData.Length; } + if (TextureEntry != null) { length += 2 + TextureEntry.Length; } + if (TextureAnim != null) { length += 1 + TextureAnim.Length; } + if (NameValue != null) { length += 2 + NameValue.Length; } + if (Data != null) { length += 2 + Data.Length; } + if (Text != null) { length += 1 + Text.Length; } + if (MediaURL != null) { length += 1 + MediaURL.Length; } + if (PSBlock != null) { length += 1 + PSBlock.Length; } + if (ExtraParams != null) { length += 1 + ExtraParams.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)); + State = (byte)bytes[i++]; + FullID = new LLUUID(bytes, i); i += 16; + CRC = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + PCode = (byte)bytes[i++]; + Material = (byte)bytes[i++]; + ClickAction = (byte)bytes[i++]; + Scale = new LLVector3(bytes, i); i += 12; + length = (ushort)bytes[i++]; + _objectdata = new byte[length]; + Buffer.BlockCopy(bytes, i, _objectdata, 0, length); i += length; + ParentID = (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)); + PathCurve = (byte)bytes[i++]; + ProfileCurve = (byte)bytes[i++]; + PathBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); + PathEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); + PathScaleX = (byte)bytes[i++]; + PathScaleY = (byte)bytes[i++]; + PathShearX = (byte)bytes[i++]; + PathShearY = (byte)bytes[i++]; + PathTwist = (sbyte)bytes[i++]; + PathTwistBegin = (sbyte)bytes[i++]; + PathRadiusOffset = (sbyte)bytes[i++]; + PathTaperX = (sbyte)bytes[i++]; + PathTaperY = (sbyte)bytes[i++]; + PathRevolutions = (byte)bytes[i++]; + PathSkew = (sbyte)bytes[i++]; + ProfileBegin = (ushort)(bytes[i++] + (bytes[i++] << 8)); + ProfileEnd = (ushort)(bytes[i++] + (bytes[i++] << 8)); + ProfileHollow = (ushort)(bytes[i++] + (bytes[i++] << 8)); + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _textureentry = new byte[length]; + Buffer.BlockCopy(bytes, i, _textureentry, 0, length); i += length; + length = (ushort)bytes[i++]; + _textureanim = new byte[length]; + Buffer.BlockCopy(bytes, i, _textureanim, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _namevalue = new byte[length]; + Buffer.BlockCopy(bytes, i, _namevalue, 0, length); i += length; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _data = new byte[length]; + Buffer.BlockCopy(bytes, i, _data, 0, length); i += length; + length = (ushort)bytes[i++]; + _text = new byte[length]; + Buffer.BlockCopy(bytes, i, _text, 0, length); i += length; + TextColor = new byte[4]; + Buffer.BlockCopy(bytes, i, TextColor, 0, 4); i += 4; + length = (ushort)bytes[i++]; + _mediaurl = new byte[length]; + Buffer.BlockCopy(bytes, i, _mediaurl, 0, length); i += length; + length = (ushort)bytes[i++]; + _psblock = new byte[length]; + Buffer.BlockCopy(bytes, i, _psblock, 0, length); i += length; + length = (ushort)bytes[i++]; + _extraparams = new byte[length]; + Buffer.BlockCopy(bytes, i, _extraparams, 0, length); i += length; + Sound = new LLUUID(bytes, i); i += 16; + OwnerID = new LLUUID(bytes, i); i += 16; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Gain = BitConverter.ToSingle(bytes, i); i += 4; + Flags = (byte)bytes[i++]; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Radius = BitConverter.ToSingle(bytes, i); i += 4; + JointType = (byte)bytes[i++]; + JointPivot = new LLVector3(bytes, i); i += 12; + JointAxisOrAnchor = new LLVector3(bytes, i); i += 12; + } + 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++] = State; + Buffer.BlockCopy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; + 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++] = PCode; + bytes[i++] = Material; + bytes[i++] = ClickAction; + Buffer.BlockCopy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; + if(ObjectData == null) { Console.WriteLine("Warning: ObjectData is null, in " + this.GetType()); } + bytes[i++] = (byte)ObjectData.Length; + Buffer.BlockCopy(ObjectData, 0, bytes, i, ObjectData.Length); i += ObjectData.Length; + bytes[i++] = (byte)(ParentID % 256); + bytes[i++] = (byte)((ParentID >> 8) % 256); + bytes[i++] = (byte)((ParentID >> 16) % 256); + bytes[i++] = (byte)((ParentID >> 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++] = PathCurve; + bytes[i++] = ProfileCurve; + bytes[i++] = (byte)(PathBegin % 256); + bytes[i++] = (byte)((PathBegin >> 8) % 256); + bytes[i++] = (byte)(PathEnd % 256); + bytes[i++] = (byte)((PathEnd >> 8) % 256); + bytes[i++] = PathScaleX; + bytes[i++] = PathScaleY; + bytes[i++] = PathShearX; + bytes[i++] = PathShearY; + bytes[i++] = (byte)PathTwist; + bytes[i++] = (byte)PathTwistBegin; + bytes[i++] = (byte)PathRadiusOffset; + bytes[i++] = (byte)PathTaperX; + bytes[i++] = (byte)PathTaperY; + bytes[i++] = PathRevolutions; + bytes[i++] = (byte)PathSkew; + bytes[i++] = (byte)(ProfileBegin % 256); + bytes[i++] = (byte)((ProfileBegin >> 8) % 256); + bytes[i++] = (byte)(ProfileEnd % 256); + bytes[i++] = (byte)((ProfileEnd >> 8) % 256); + bytes[i++] = (byte)(ProfileHollow % 256); + bytes[i++] = (byte)((ProfileHollow >> 8) % 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); + Buffer.BlockCopy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length; + if(TextureAnim == null) { Console.WriteLine("Warning: TextureAnim is null, in " + this.GetType()); } + bytes[i++] = (byte)TextureAnim.Length; + Buffer.BlockCopy(TextureAnim, 0, bytes, i, TextureAnim.Length); i += TextureAnim.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); + Buffer.BlockCopy(NameValue, 0, bytes, i, NameValue.Length); i += NameValue.Length; + 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); + Buffer.BlockCopy(Data, 0, bytes, i, Data.Length); i += Data.Length; + if(Text == null) { Console.WriteLine("Warning: Text is null, in " + this.GetType()); } + bytes[i++] = (byte)Text.Length; + Buffer.BlockCopy(Text, 0, bytes, i, Text.Length); i += Text.Length; + Buffer.BlockCopy(TextColor, 0, bytes, i, 4);i += 4; + if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); } + bytes[i++] = (byte)MediaURL.Length; + Buffer.BlockCopy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length; + if(PSBlock == null) { Console.WriteLine("Warning: PSBlock is null, in " + this.GetType()); } + bytes[i++] = (byte)PSBlock.Length; + Buffer.BlockCopy(PSBlock, 0, bytes, i, PSBlock.Length); i += PSBlock.Length; + if(ExtraParams == null) { Console.WriteLine("Warning: ExtraParams is null, in " + this.GetType()); } + bytes[i++] = (byte)ExtraParams.Length; + Buffer.BlockCopy(ExtraParams, 0, bytes, i, ExtraParams.Length); i += ExtraParams.Length; + Buffer.BlockCopy(Sound.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + ba = BitConverter.GetBytes(Gain); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = Flags; + ba = BitConverter.GetBytes(Radius); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = JointType; + Buffer.BlockCopy(JointPivot.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(JointAxisOrAnchor.GetBytes(), 0, bytes, i, 12); i += 12; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- ObjectData --"); + output.AppendLine(String.Format("ID: {0}", ID)); + output.AppendLine(String.Format("State: {0}", State)); + output.AppendLine(String.Format("FullID: {0}", FullID)); + output.AppendLine(String.Format("CRC: {0}", CRC)); + output.AppendLine(String.Format("PCode: {0}", PCode)); + output.AppendLine(String.Format("Material: {0}", Material)); + output.AppendLine(String.Format("ClickAction: {0}", ClickAction)); + output.AppendLine(String.Format("Scale: {0}", Scale)); + Helpers.FieldToString(output, ObjectData, "ObjectData"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("ParentID: {0}", ParentID)); + output.AppendLine(String.Format("UpdateFlags: {0}", UpdateFlags)); + output.AppendLine(String.Format("PathCurve: {0}", PathCurve)); + output.AppendLine(String.Format("ProfileCurve: {0}", ProfileCurve)); + output.AppendLine(String.Format("PathBegin: {0}", PathBegin)); + output.AppendLine(String.Format("PathEnd: {0}", PathEnd)); + output.AppendLine(String.Format("PathScaleX: {0}", PathScaleX)); + output.AppendLine(String.Format("PathScaleY: {0}", PathScaleY)); + output.AppendLine(String.Format("PathShearX: {0}", PathShearX)); + output.AppendLine(String.Format("PathShearY: {0}", PathShearY)); + output.AppendLine(String.Format("PathTwist: {0}", PathTwist)); + output.AppendLine(String.Format("PathTwistBegin: {0}", PathTwistBegin)); + output.AppendLine(String.Format("PathRadiusOffset: {0}", PathRadiusOffset)); + output.AppendLine(String.Format("PathTaperX: {0}", PathTaperX)); + output.AppendLine(String.Format("PathTaperY: {0}", PathTaperY)); + output.AppendLine(String.Format("PathRevolutions: {0}", PathRevolutions)); + output.AppendLine(String.Format("PathSkew: {0}", PathSkew)); + output.AppendLine(String.Format("ProfileBegin: {0}", ProfileBegin)); + output.AppendLine(String.Format("ProfileEnd: {0}", ProfileEnd)); + output.AppendLine(String.Format("ProfileHollow: {0}", ProfileHollow)); + Helpers.FieldToString(output, TextureEntry, "TextureEntry"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, TextureAnim, "TextureAnim"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, NameValue, "NameValue"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Data, "Data"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Text, "Text"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, TextColor, "TextColor"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, MediaURL, "MediaURL"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, PSBlock, "PSBlock"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, ExtraParams, "ExtraParams"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("Sound: {0}", Sound)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("Gain: {0}", Gain)); + output.AppendLine(String.Format("Flags: {0}", Flags)); + output.AppendLine(String.Format("Radius: {0}", Radius)); + output.AppendLine(String.Format("JointType: {0}", JointType)); + output.AppendLine(String.Format("JointPivot: {0}", JointPivot)); + output.Append(String.Format("JointAxisOrAnchor: {0}", JointAxisOrAnchor)); return output.ToString(); } } @@ -72782,43 +66863,42 @@ namespace libsecondlife.Packets 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 ObjectDataBlock[] ObjectData; public ObjectUpdatePacket() { Header = new HighHeader(); Header.ID = 12; Header.Reliable = true; - Header.Zerocoded = true; - ObjectData = new ObjectDataBlock[0]; RegionData = new RegionDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ObjectUpdatePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new HighHeader(bytes, ref i, ref packetEnd); + RegionData = new RegionDataBlock(bytes, ref i); 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; + RegionData = new RegionDataBlock(bytes, ref i); 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; + int length = 7; length += RegionData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -72826,9 +66906,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + RegionData.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; } @@ -72836,11 +66916,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ObjectUpdate ---" + Environment.NewLine; + output += RegionData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += RegionData.ToString() + Environment.NewLine; return output; } @@ -72849,6 +66929,60 @@ namespace libsecondlife.Packets /// public class ObjectUpdateCompressedPacket : Packet { + /// + [XmlType("objectupdatecompressed_regiondata")] + public class RegionDataBlock + { + public ulong RegionHandle; + public ushort TimeDilation; + + [XmlIgnore] + public int Length + { + get + { + return 10; + } + } + + 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)); + TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8)); + } + 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)(TimeDilation % 256); + bytes[i++] = (byte)((TimeDilation >> 8) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- RegionData --"); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.Append(String.Format("TimeDilation: {0}", TimeDilation)); + return output.ToString(); + } + } + /// [XmlType("objectupdatecompressed_objectdata")] public class ObjectDataBlock @@ -72916,12 +67050,81 @@ namespace libsecondlife.Packets } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectUpdateCompressed; } } + public RegionDataBlock RegionData; + public ObjectDataBlock[] ObjectData; + + public ObjectUpdateCompressedPacket() + { + Header = new HighHeader(); + Header.ID = 13; + Header.Reliable = true; + RegionData = new RegionDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectUpdateCompressedPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new HighHeader(bytes, ref i, ref packetEnd); + RegionData = new RegionDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectUpdateCompressedPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + RegionData = new RegionDataBlock(bytes, ref i); + 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 = 7; + 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); + RegionData.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 = "--- ObjectUpdateCompressed ---" + Environment.NewLine; + output += RegionData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ObjectUpdateCachedPacket : Packet + { /// - [XmlType("objectupdatecompressed_regiondata")] + [XmlType("objectupdatecached_regiondata")] public class RegionDataBlock { - public ushort TimeDilation; public ulong RegionHandle; + public ushort TimeDilation; [XmlIgnore] public int Length @@ -72937,8 +67140,8 @@ namespace libsecondlife.Packets { 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)); + TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8)); } catch (Exception) { @@ -72948,8 +67151,6 @@ namespace libsecondlife.Packets 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); @@ -72958,94 +67159,27 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((RegionHandle >> 40) % 256); bytes[i++] = (byte)((RegionHandle >> 48) % 256); bytes[i++] = (byte)((RegionHandle >> 56) % 256); + bytes[i++] = (byte)(TimeDilation % 256); + bytes[i++] = (byte)((TimeDilation >> 8) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- RegionData --"); - output.AppendLine(String.Format("TimeDilation: {0}", TimeDilation)); - output.Append(String.Format("RegionHandle: {0}", RegionHandle)); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.Append(String.Format("TimeDilation: {0}", TimeDilation)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectUpdateCompressed; } } - public ObjectDataBlock[] ObjectData; - public RegionDataBlock RegionData; - - public ObjectUpdateCompressedPacket() - { - Header = new HighHeader(); - Header.ID = 13; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - RegionData = new RegionDataBlock(); - } - - public ObjectUpdateCompressedPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new HighHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - RegionData = new RegionDataBlock(bytes, ref i); - } - - public ObjectUpdateCompressedPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - RegionData = new RegionDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 5; - length += RegionData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - RegionData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectUpdateCompressed ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += RegionData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ObjectUpdateCachedPacket : Packet - { /// [XmlType("objectupdatecached_objectdata")] public class ObjectDataBlock { public uint ID; - public uint UpdateFlags; public uint CRC; + public uint UpdateFlags; [XmlIgnore] public int Length @@ -73062,8 +67196,8 @@ namespace libsecondlife.Packets 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)); + UpdateFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); } catch (Exception) { @@ -73077,14 +67211,14 @@ namespace libsecondlife.Packets 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); + bytes[i++] = (byte)(UpdateFlags % 256); + bytes[i++] = (byte)((UpdateFlags >> 8) % 256); + bytes[i++] = (byte)((UpdateFlags >> 16) % 256); + bytes[i++] = (byte)((UpdateFlags >> 24) % 256); } public override string ToString() @@ -73092,18 +67226,87 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- ObjectData --"); output.AppendLine(String.Format("ID: {0}", ID)); - output.AppendLine(String.Format("UpdateFlags: {0}", UpdateFlags)); - output.Append(String.Format("CRC: {0}", CRC)); + output.AppendLine(String.Format("CRC: {0}", CRC)); + output.Append(String.Format("UpdateFlags: {0}", UpdateFlags)); return output.ToString(); } } + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.ObjectUpdateCached; } } + public RegionDataBlock RegionData; + public ObjectDataBlock[] ObjectData; + + public ObjectUpdateCachedPacket() + { + Header = new HighHeader(); + Header.ID = 14; + Header.Reliable = true; + RegionData = new RegionDataBlock(); + ObjectData = new ObjectDataBlock[0]; + } + + public ObjectUpdateCachedPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new HighHeader(bytes, ref i, ref packetEnd); + RegionData = new RegionDataBlock(bytes, ref i); + int count = (int)bytes[i++]; + ObjectData = new ObjectDataBlock[count]; + for (int j = 0; j < count; j++) + { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } + } + + public ObjectUpdateCachedPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + RegionData = new RegionDataBlock(bytes, ref i); + 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 = 7; + 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); + RegionData.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 = "--- ObjectUpdateCached ---" + Environment.NewLine; + output += RegionData.ToString() + Environment.NewLine; + for (int j = 0; j < ObjectData.Length; j++) + { + output += ObjectData[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class ImprovedTerseObjectUpdatePacket : Packet + { /// - [XmlType("objectupdatecached_regiondata")] + [XmlType("improvedterseobjectupdate_regiondata")] public class RegionDataBlock { - public ushort TimeDilation; public ulong RegionHandle; + public ushort TimeDilation; [XmlIgnore] public int Length @@ -73119,8 +67322,8 @@ namespace libsecondlife.Packets { 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)); + TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8)); } catch (Exception) { @@ -73130,8 +67333,6 @@ namespace libsecondlife.Packets 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); @@ -73140,87 +67341,20 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((RegionHandle >> 40) % 256); bytes[i++] = (byte)((RegionHandle >> 48) % 256); bytes[i++] = (byte)((RegionHandle >> 56) % 256); + bytes[i++] = (byte)(TimeDilation % 256); + bytes[i++] = (byte)((TimeDilation >> 8) % 256); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- RegionData --"); - output.AppendLine(String.Format("TimeDilation: {0}", TimeDilation)); - output.Append(String.Format("RegionHandle: {0}", RegionHandle)); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.Append(String.Format("TimeDilation: {0}", TimeDilation)); return output.ToString(); } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.ObjectUpdateCached; } } - public ObjectDataBlock[] ObjectData; - public RegionDataBlock RegionData; - - public ObjectUpdateCachedPacket() - { - Header = new HighHeader(); - Header.ID = 14; - Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; - RegionData = new RegionDataBlock(); - } - - public ObjectUpdateCachedPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new HighHeader(bytes, ref i, ref packetEnd); - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - RegionData = new RegionDataBlock(bytes, ref i); - } - - public ObjectUpdateCachedPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - int count = (int)bytes[i++]; - ObjectData = new ObjectDataBlock[count]; - for (int j = 0; j < count; j++) - { ObjectData[j] = new ObjectDataBlock(bytes, ref i); } - RegionData = new RegionDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 5; - length += RegionData.Length;; - length++; - for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - bytes[i++] = (byte)ObjectData.Length; - for (int j = 0; j < ObjectData.Length; j++) { ObjectData[j].ToBytes(bytes, ref i); } - RegionData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- ObjectUpdateCached ---" + Environment.NewLine; - for (int j = 0; j < ObjectData.Length; j++) - { - output += ObjectData[j].ToString() + Environment.NewLine; - } - output += RegionData.ToString() + Environment.NewLine; - return output; - } - - } - - /// - public class ImprovedTerseObjectUpdatePacket : Packet - { /// [XmlType("improvedterseobjectupdate_objectdata")] public class ObjectDataBlock @@ -73301,99 +67435,45 @@ namespace libsecondlife.Packets } } - /// - [XmlType("improvedterseobjectupdate_regiondata")] - public class RegionDataBlock - { - public ushort TimeDilation; - public ulong RegionHandle; - - [XmlIgnore] - public int Length - { - get - { - return 10; - } - } - - public RegionDataBlock() { } - public RegionDataBlock(byte[] bytes, ref int i) - { - try - { - TimeDilation = (ushort)(bytes[i++] + (bytes[i++] << 8)); - RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(TimeDilation % 256); - bytes[i++] = (byte)((TimeDilation >> 8) % 256); - bytes[i++] = (byte)(RegionHandle % 256); - bytes[i++] = (byte)((RegionHandle >> 8) % 256); - bytes[i++] = (byte)((RegionHandle >> 16) % 256); - bytes[i++] = (byte)((RegionHandle >> 24) % 256); - bytes[i++] = (byte)((RegionHandle >> 32) % 256); - bytes[i++] = (byte)((RegionHandle >> 40) % 256); - bytes[i++] = (byte)((RegionHandle >> 48) % 256); - bytes[i++] = (byte)((RegionHandle >> 56) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RegionData --"); - output.AppendLine(String.Format("TimeDilation: {0}", TimeDilation)); - output.Append(String.Format("RegionHandle: {0}", RegionHandle)); - return output.ToString(); - } - } - 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 ObjectDataBlock[] ObjectData; public ImprovedTerseObjectUpdatePacket() { Header = new HighHeader(); Header.ID = 15; Header.Reliable = true; - ObjectData = new ObjectDataBlock[0]; RegionData = new RegionDataBlock(); + ObjectData = new ObjectDataBlock[0]; } public ImprovedTerseObjectUpdatePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new HighHeader(bytes, ref i, ref packetEnd); + RegionData = new RegionDataBlock(bytes, ref i); 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; + RegionData = new RegionDataBlock(bytes, ref i); 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; + int length = 7; length += RegionData.Length;; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -73401,9 +67481,9 @@ namespace libsecondlife.Packets byte[] bytes = new byte[length]; int i = 0; header.ToBytes(bytes, ref i); + RegionData.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; } @@ -73411,11 +67491,11 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ImprovedTerseObjectUpdate ---" + Environment.NewLine; + output += RegionData.ToString() + Environment.NewLine; for (int j = 0; j < ObjectData.Length; j++) { output += ObjectData[j].ToString() + Environment.NewLine; } - output += RegionData.ToString() + Environment.NewLine; return output; } @@ -73503,7 +67583,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; ; length++; for (int j = 0; j < ObjectData.Length; j++) { length += ObjectData[j].Length; } @@ -73529,122 +67609,6 @@ namespace libsecondlife.Packets } - /// - public class AgentToNewRegionPacket : Packet - { - /// - [XmlType("agenttonewregion_regiondata")] - public class RegionDataBlock - { - public uint IP; - public LLUUID SessionID; - public ushort Port; - public ulong Handle; - - [XmlIgnore] - public int Length - { - get - { - return 30; - } - } - - public RegionDataBlock() { } - public RegionDataBlock(byte[] bytes, ref int i) - { - try - { - IP = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - SessionID = new LLUUID(bytes, i); i += 16; - Port = (ushort)((bytes[i++] << 8) + bytes[i++]); - Handle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(IP % 256); - bytes[i++] = (byte)((IP >> 8) % 256); - bytes[i++] = (byte)((IP >> 16) % 256); - bytes[i++] = (byte)((IP >> 24) % 256); - Buffer.BlockCopy(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() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- RegionData --"); - output.AppendLine(String.Format("IP: {0}", IP)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("Port: {0}", Port)); - output.Append(String.Format("Handle: {0}", Handle)); - return output.ToString(); - } - } - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AgentToNewRegion; } } - public RegionDataBlock RegionData; - - public AgentToNewRegionPacket() - { - Header = new HighHeader(); - Header.ID = 17; - Header.Reliable = true; - RegionData = new RegionDataBlock(); - } - - public AgentToNewRegionPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new HighHeader(bytes, ref i, ref packetEnd); - RegionData = new RegionDataBlock(bytes, ref i); - } - - public AgentToNewRegionPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - RegionData = new RegionDataBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 5; - length += RegionData.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - RegionData.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AgentToNewRegion ---" + Environment.NewLine; - output += RegionData.ToString() + Environment.NewLine; - return output; - } - - } - /// public class TransferPacketPacket : Packet { @@ -73653,6 +67617,9 @@ namespace libsecondlife.Packets public class TransferDataBlock { public LLUUID TransferID; + public int ChannelType; + public int Packet; + public int Status; private byte[] _data; public byte[] Data { @@ -73664,9 +67631,6 @@ namespace libsecondlife.Packets else { _data = new byte[value.Length]; Buffer.BlockCopy(value, 0, _data, 0, value.Length); } } } - public int Packet; - public int ChannelType; - public int Status; [XmlIgnore] public int Length @@ -73686,12 +67650,12 @@ namespace libsecondlife.Packets try { TransferID = new LLUUID(bytes, i); i += 16; + ChannelType = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + Packet = (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)); length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _data = new byte[length]; Buffer.BlockCopy(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) { @@ -73702,22 +67666,22 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { Buffer.BlockCopy(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); - Buffer.BlockCopy(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)(Packet % 256); + bytes[i++] = (byte)((Packet >> 8) % 256); + bytes[i++] = (byte)((Packet >> 16) % 256); + bytes[i++] = (byte)((Packet >> 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); + 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); + Buffer.BlockCopy(Data, 0, bytes, i, Data.Length); i += Data.Length; } public override string ToString() @@ -73725,11 +67689,10 @@ namespace libsecondlife.Packets StringBuilder output = new StringBuilder(); output.AppendLine("-- TransferData --"); output.AppendLine(String.Format("TransferID: {0}", TransferID)); - Helpers.FieldToString(output, Data, "Data"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Packet: {0}", Packet)); output.AppendLine(String.Format("ChannelType: {0}", ChannelType)); - output.Append(String.Format("Status: {0}", Status)); + output.AppendLine(String.Format("Packet: {0}", Packet)); + output.AppendLine(String.Format("Status: {0}", Status)); + Helpers.FieldToString(output, Data, "Data"); return output.ToString(); } } @@ -73742,7 +67705,7 @@ namespace libsecondlife.Packets public TransferPacketPacket() { Header = new HighHeader(); - Header.ID = 18; + Header.ID = 17; Header.Reliable = true; TransferData = new TransferDataBlock(); } @@ -73762,7 +67725,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += TransferData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -73785,6 +67748,62 @@ namespace libsecondlife.Packets /// public class SendXferPacketPacket : Packet { + /// + [XmlType("sendxferpacket_xferid")] + public class XferIDBlock + { + public ulong ID; + public uint Packet; + + [XmlIgnore] + public int Length + { + get + { + return 12; + } + } + + public XferIDBlock() { } + public XferIDBlock(byte[] bytes, ref int i) + { + try + { + ID = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); + Packet = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)(ID % 256); + bytes[i++] = (byte)((ID >> 8) % 256); + bytes[i++] = (byte)((ID >> 16) % 256); + bytes[i++] = (byte)((ID >> 24) % 256); + bytes[i++] = (byte)((ID >> 32) % 256); + bytes[i++] = (byte)((ID >> 40) % 256); + bytes[i++] = (byte)((ID >> 48) % 256); + bytes[i++] = (byte)((ID >> 56) % 256); + bytes[i++] = (byte)(Packet % 256); + bytes[i++] = (byte)((Packet >> 8) % 256); + bytes[i++] = (byte)((Packet >> 16) % 256); + bytes[i++] = (byte)((Packet >> 24) % 256); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- XferID --"); + output.AppendLine(String.Format("ID: {0}", ID)); + output.Append(String.Format("Packet: {0}", Packet)); + return output.ToString(); + } + } + /// [XmlType("sendxferpacket_datapacket")] public class DataPacketBlock @@ -73845,102 +67864,46 @@ namespace libsecondlife.Packets } } - /// - [XmlType("sendxferpacket_xferid")] - public class XferIDBlock - { - public ulong ID; - public uint Packet; - - [XmlIgnore] - public int Length - { - get - { - return 12; - } - } - - public XferIDBlock() { } - public XferIDBlock(byte[] bytes, ref int i) - { - try - { - ID = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); - Packet = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(ID % 256); - bytes[i++] = (byte)((ID >> 8) % 256); - bytes[i++] = (byte)((ID >> 16) % 256); - bytes[i++] = (byte)((ID >> 24) % 256); - bytes[i++] = (byte)((ID >> 32) % 256); - bytes[i++] = (byte)((ID >> 40) % 256); - bytes[i++] = (byte)((ID >> 48) % 256); - bytes[i++] = (byte)((ID >> 56) % 256); - bytes[i++] = (byte)(Packet % 256); - bytes[i++] = (byte)((Packet >> 8) % 256); - bytes[i++] = (byte)((Packet >> 16) % 256); - bytes[i++] = (byte)((Packet >> 24) % 256); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- XferID --"); - output.AppendLine(String.Format("ID: {0}", ID)); - output.Append(String.Format("Packet: {0}", Packet)); - return output.ToString(); - } - } - 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 DataPacketBlock DataPacket; public SendXferPacketPacket() { Header = new HighHeader(); - Header.ID = 19; + Header.ID = 18; Header.Reliable = true; - DataPacket = new DataPacketBlock(); XferID = new XferIDBlock(); + DataPacket = new DataPacketBlock(); } 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); + DataPacket = new DataPacketBlock(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); + DataPacket = new DataPacketBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 5; - length += DataPacket.Length; length += XferID.Length;; + int length = 7; + length += XferID.Length; length += DataPacket.Length;; 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); + DataPacket.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -73948,8 +67911,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- SendXferPacket ---" + Environment.NewLine; - output += DataPacket.ToString() + Environment.NewLine; output += XferID.ToString() + Environment.NewLine; + output += DataPacket.ToString() + Environment.NewLine; return output; } @@ -74022,7 +67985,7 @@ namespace libsecondlife.Packets public ConfirmXferPacketPacket() { Header = new HighHeader(); - Header.ID = 20; + Header.ID = 19; Header.Reliable = true; XferID = new XferIDBlock(); } @@ -74042,7 +68005,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += XferID.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -74065,107 +68028,6 @@ namespace libsecondlife.Packets /// public class AvatarAnimationPacket : Packet { - /// - [XmlType("avataranimation_physicalavatareventlist")] - public class PhysicalAvatarEventListBlock - { - 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]; Buffer.BlockCopy(value, 0, _typedata, 0, value.Length); } - } - } - - [XmlIgnore] - public int Length - { - get - { - int length = 0; - if (TypeData != null) { length += 1 + TypeData.Length; } - return length; - } - } - - public PhysicalAvatarEventListBlock() { } - public PhysicalAvatarEventListBlock(byte[] bytes, ref int i) - { - int length; - try - { - length = (ushort)bytes[i++]; - _typedata = new byte[length]; - Buffer.BlockCopy(bytes, i, _typedata, 0, length); i += length; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - if(TypeData == null) { Console.WriteLine("Warning: TypeData is null, in " + this.GetType()); } - bytes[i++] = (byte)TypeData.Length; - Buffer.BlockCopy(TypeData, 0, bytes, i, TypeData.Length); i += TypeData.Length; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- PhysicalAvatarEventList --"); - Helpers.FieldToString(output, TypeData, "TypeData"); - return output.ToString(); - } - } - - /// - [XmlType("avataranimation_animationsourcelist")] - public class AnimationSourceListBlock - { - public LLUUID ObjectID; - - [XmlIgnore] - public int Length - { - get - { - return 16; - } - } - - public AnimationSourceListBlock() { } - public AnimationSourceListBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AnimationSourceList --"); - output.Append(String.Format("ObjectID: {0}", ObjectID)); - return output.ToString(); - } - } - /// [XmlType("avataranimation_sender")] public class SenderBlock @@ -74257,142 +68119,27 @@ namespace libsecondlife.Packets } } - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.AvatarAnimation; } } - public PhysicalAvatarEventListBlock[] PhysicalAvatarEventList; - public AnimationSourceListBlock[] AnimationSourceList; - public SenderBlock Sender; - public AnimationListBlock[] AnimationList; - - public AvatarAnimationPacket() - { - Header = new HighHeader(); - Header.ID = 21; - Header.Reliable = true; - PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[0]; - 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++]; - PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; - for (int j = 0; j < count; j++) - { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(bytes, ref i); } - 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++]; - PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; - for (int j = 0; j < count; j++) - { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(bytes, ref i); } - 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 < PhysicalAvatarEventList.Length; j++) { length += PhysicalAvatarEventList[j].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)PhysicalAvatarEventList.Length; - for (int j = 0; j < PhysicalAvatarEventList.Length; j++) { PhysicalAvatarEventList[j].ToBytes(bytes, ref i); } - bytes[i++] = (byte)AnimationSourceList.Length; - for (int j = 0; j < AnimationSourceList.Length; j++) { AnimationSourceList[j].ToBytes(bytes, ref i); } - Sender.ToBytes(bytes, ref i); - bytes[i++] = (byte)AnimationList.Length; - for (int j = 0; j < AnimationList.Length; j++) { AnimationList[j].ToBytes(bytes, ref i); } - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- AvatarAnimation ---" + Environment.NewLine; - for (int j = 0; j < PhysicalAvatarEventList.Length; j++) - { - output += PhysicalAvatarEventList[j].ToString() + Environment.NewLine; - } - for (int j = 0; j < AnimationSourceList.Length; j++) - { - output += AnimationSourceList[j].ToString() + Environment.NewLine; - } - output += Sender.ToString() + Environment.NewLine; - for (int j = 0; j < AnimationList.Length; j++) - { - output += AnimationList[j].ToString() + Environment.NewLine; - } - return output; - } - - } - - /// - public class AvatarSitResponsePacket : Packet - { /// - [XmlType("avatarsitresponse_sittransform")] - public class SitTransformBlock + [XmlType("avataranimation_animationsourcelist")] + public class AnimationSourceListBlock { - public bool AutoPilot; - public bool ForceMouselook; - public LLVector3 CameraEyeOffset; - public LLVector3 CameraAtOffset; - public LLVector3 SitPosition; - public LLQuaternion SitRotation; + public LLUUID ObjectID; [XmlIgnore] public int Length { get { - return 50; + return 16; } } - public SitTransformBlock() { } - public SitTransformBlock(byte[] bytes, ref int i) + public AnimationSourceListBlock() { } + public AnimationSourceListBlock(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; + ObjectID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -74402,28 +68149,182 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = (byte)((AutoPilot) ? 1 : 0); - bytes[i++] = (byte)((ForceMouselook) ? 1 : 0); - Buffer.BlockCopy(CameraEyeOffset.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(CameraAtOffset.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(SitPosition.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(SitRotation.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- SitTransform --"); - output.AppendLine(String.Format("AutoPilot: {0}", AutoPilot)); - output.AppendLine(String.Format("ForceMouselook: {0}", ForceMouselook)); - output.AppendLine(String.Format("CameraEyeOffset: {0}", CameraEyeOffset)); - output.AppendLine(String.Format("CameraAtOffset: {0}", CameraAtOffset)); - output.AppendLine(String.Format("SitPosition: {0}", SitPosition)); - output.Append(String.Format("SitRotation: {0}", SitRotation)); + output.AppendLine("-- AnimationSourceList --"); + output.Append(String.Format("ObjectID: {0}", ObjectID)); return output.ToString(); } } + /// + [XmlType("avataranimation_physicalavatareventlist")] + public class PhysicalAvatarEventListBlock + { + 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]; Buffer.BlockCopy(value, 0, _typedata, 0, value.Length); } + } + } + + [XmlIgnore] + public int Length + { + get + { + int length = 0; + if (TypeData != null) { length += 1 + TypeData.Length; } + return length; + } + } + + public PhysicalAvatarEventListBlock() { } + public PhysicalAvatarEventListBlock(byte[] bytes, ref int i) + { + int length; + try + { + length = (ushort)bytes[i++]; + _typedata = new byte[length]; + Buffer.BlockCopy(bytes, i, _typedata, 0, length); i += length; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + if(TypeData == null) { Console.WriteLine("Warning: TypeData is null, in " + this.GetType()); } + bytes[i++] = (byte)TypeData.Length; + Buffer.BlockCopy(TypeData, 0, bytes, i, TypeData.Length); i += TypeData.Length; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- PhysicalAvatarEventList --"); + Helpers.FieldToString(output, TypeData, "TypeData"); + return output.ToString(); + } + } + + private Header header; + public override Header Header { get { return header; } set { header = value; } } + public override PacketType Type { get { return PacketType.AvatarAnimation; } } + public SenderBlock Sender; + public AnimationListBlock[] AnimationList; + public AnimationSourceListBlock[] AnimationSourceList; + public PhysicalAvatarEventListBlock[] PhysicalAvatarEventList; + + public AvatarAnimationPacket() + { + Header = new HighHeader(); + Header.ID = 20; + Header.Reliable = true; + Sender = new SenderBlock(); + AnimationList = new AnimationListBlock[0]; + AnimationSourceList = new AnimationSourceListBlock[0]; + PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[0]; + } + + public AvatarAnimationPacket(byte[] bytes, ref int i) + { + int packetEnd = bytes.Length - 1; + Header = new HighHeader(bytes, ref i, ref packetEnd); + Sender = new SenderBlock(bytes, ref i); + int count = (int)bytes[i++]; + AnimationList = new AnimationListBlock[count]; + for (int j = 0; j < count; j++) + { AnimationList[j] = new AnimationListBlock(bytes, ref i); } + count = (int)bytes[i++]; + AnimationSourceList = new AnimationSourceListBlock[count]; + for (int j = 0; j < count; j++) + { AnimationSourceList[j] = new AnimationSourceListBlock(bytes, ref i); } + count = (int)bytes[i++]; + PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; + for (int j = 0; j < count; j++) + { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(bytes, ref i); } + } + + public AvatarAnimationPacket(Header head, byte[] bytes, ref int i) + { + Header = head; + Sender = new SenderBlock(bytes, ref i); + int count = (int)bytes[i++]; + AnimationList = new AnimationListBlock[count]; + for (int j = 0; j < count; j++) + { AnimationList[j] = new AnimationListBlock(bytes, ref i); } + count = (int)bytes[i++]; + AnimationSourceList = new AnimationSourceListBlock[count]; + for (int j = 0; j < count; j++) + { AnimationSourceList[j] = new AnimationSourceListBlock(bytes, ref i); } + count = (int)bytes[i++]; + PhysicalAvatarEventList = new PhysicalAvatarEventListBlock[count]; + for (int j = 0; j < count; j++) + { PhysicalAvatarEventList[j] = new PhysicalAvatarEventListBlock(bytes, ref i); } + } + + public override byte[] ToBytes() + { + int length = 7; + length += Sender.Length;; + length++; + for (int j = 0; j < AnimationList.Length; j++) { length += AnimationList[j].Length; } + length++; + for (int j = 0; j < AnimationSourceList.Length; j++) { length += AnimationSourceList[j].Length; } + length++; + for (int j = 0; j < PhysicalAvatarEventList.Length; j++) { length += PhysicalAvatarEventList[j].Length; } + 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); + bytes[i++] = (byte)AnimationList.Length; + for (int j = 0; j < AnimationList.Length; j++) { AnimationList[j].ToBytes(bytes, ref i); } + bytes[i++] = (byte)AnimationSourceList.Length; + for (int j = 0; j < AnimationSourceList.Length; j++) { AnimationSourceList[j].ToBytes(bytes, ref i); } + bytes[i++] = (byte)PhysicalAvatarEventList.Length; + for (int j = 0; j < PhysicalAvatarEventList.Length; j++) { PhysicalAvatarEventList[j].ToBytes(bytes, ref i); } + if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } + return bytes; + } + + public override string ToString() + { + string output = "--- AvatarAnimation ---" + Environment.NewLine; + output += Sender.ToString() + Environment.NewLine; + for (int j = 0; j < AnimationList.Length; j++) + { + output += AnimationList[j].ToString() + Environment.NewLine; + } + for (int j = 0; j < AnimationSourceList.Length; j++) + { + output += AnimationSourceList[j].ToString() + Environment.NewLine; + } + for (int j = 0; j < PhysicalAvatarEventList.Length; j++) + { + output += PhysicalAvatarEventList[j].ToString() + Environment.NewLine; + } + return output; + } + + } + + /// + public class AvatarSitResponsePacket : Packet + { /// [XmlType("avatarsitresponse_sitobject")] public class SitObjectBlock @@ -74466,47 +68367,108 @@ namespace libsecondlife.Packets } } + /// + [XmlType("avatarsitresponse_sittransform")] + public class SitTransformBlock + { + public bool AutoPilot; + public LLVector3 SitPosition; + public LLQuaternion SitRotation; + public LLVector3 CameraEyeOffset; + public LLVector3 CameraAtOffset; + public bool ForceMouselook; + + [XmlIgnore] + public int Length + { + get + { + return 50; + } + } + + public SitTransformBlock() { } + public SitTransformBlock(byte[] bytes, ref int i) + { + try + { + AutoPilot = (bytes[i++] != 0) ? (bool)true : (bool)false; + SitPosition = new LLVector3(bytes, i); i += 12; + SitRotation = new LLQuaternion(bytes, i, true); i += 12; + CameraEyeOffset = new LLVector3(bytes, i); i += 12; + CameraAtOffset = new LLVector3(bytes, i); i += 12; + ForceMouselook = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = (byte)((AutoPilot) ? 1 : 0); + Buffer.BlockCopy(SitPosition.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(SitRotation.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(CameraEyeOffset.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(CameraAtOffset.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = (byte)((ForceMouselook) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- SitTransform --"); + output.AppendLine(String.Format("AutoPilot: {0}", AutoPilot)); + output.AppendLine(String.Format("SitPosition: {0}", SitPosition)); + output.AppendLine(String.Format("SitRotation: {0}", SitRotation)); + output.AppendLine(String.Format("CameraEyeOffset: {0}", CameraEyeOffset)); + output.AppendLine(String.Format("CameraAtOffset: {0}", CameraAtOffset)); + output.Append(String.Format("ForceMouselook: {0}", ForceMouselook)); + return output.ToString(); + } + } + 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 SitTransformBlock SitTransform; public AvatarSitResponsePacket() { Header = new HighHeader(); - Header.ID = 22; + Header.ID = 21; Header.Reliable = true; - Header.Zerocoded = true; - SitTransform = new SitTransformBlock(); SitObject = new SitObjectBlock(); + SitTransform = new SitTransformBlock(); } 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); + SitTransform = new SitTransformBlock(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); + SitTransform = new SitTransformBlock(bytes, ref i); } public override byte[] ToBytes() { - int length = 5; - length += SitTransform.Length; length += SitObject.Length;; + int length = 7; + length += SitObject.Length; length += SitTransform.Length;; 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); + SitTransform.ToBytes(bytes, ref i); if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -74514,8 +68476,8 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- AvatarSitResponse ---" + Environment.NewLine; - output += SitTransform.ToString() + Environment.NewLine; output += SitObject.ToString() + Environment.NewLine; + output += SitTransform.ToString() + Environment.NewLine; return output; } @@ -74574,9 +68536,8 @@ namespace libsecondlife.Packets public CameraConstraintPacket() { Header = new HighHeader(); - Header.ID = 23; + Header.ID = 22; Header.Reliable = true; - Header.Zerocoded = true; CameraCollidePlane = new CameraCollidePlaneBlock(); } @@ -74595,7 +68556,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += CameraCollidePlane.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -74622,68 +68583,21 @@ namespace libsecondlife.Packets [XmlType("parcelproperties_parceldata")] public class ParcelDataBlock { - 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]; Buffer.BlockCopy(value, 0, _mediaurl, 0, 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, 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 bool SnapSelection; public int SelfCount; + public int OtherCount; + public int PublicCount; + public int LocalID; + public LLUUID OwnerID; + public bool IsGroupOwned; + public uint AuctionID; + public int ClaimDate; + public int ClaimPrice; + public int RentPrice; + public LLVector3 AABBMin; + public LLVector3 AABBMax; private byte[] _bitmap; public byte[] Bitmap { @@ -74695,18 +68609,42 @@ namespace libsecondlife.Packets else { _bitmap = new byte[value.Length]; Buffer.BlockCopy(value, 0, _bitmap, 0, value.Length); } } } + public int Area; public byte Status; - public LLUUID SnapshotID; - public bool SnapSelection; - public byte LandingType; + public int SimWideMaxPrims; public int SimWideTotalPrims; - public uint AuctionID; - public LLUUID AuthBuyerID; - public float PassHours; + public int MaxPrims; + public int TotalPrims; + public int OwnerPrims; + public int GroupPrims; + public int OtherPrims; + public int SelectedPrims; + public float ParcelPrimBonus; + public int OtherCleanTime; public uint ParcelFlags; - public int PassPrice; - public int ClaimDate; - public byte MediaAutoScale; + public int SalePrice; + 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]; Buffer.BlockCopy(value, 0, _name, 0, 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]; Buffer.BlockCopy(value, 0, _desc, 0, value.Length); } + } + } private byte[] _musicurl; public byte[] MusicURL { @@ -74718,9 +68656,32 @@ namespace libsecondlife.Packets else { _musicurl = new byte[value.Length]; Buffer.BlockCopy(value, 0, _musicurl, 0, value.Length); } } } - public float ParcelPrimBonus; - public int ClaimPrice; - public int RentPrice; + 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]; Buffer.BlockCopy(value, 0, _mediaurl, 0, value.Length); } + } + } + public LLUUID MediaID; + public byte MediaAutoScale; + public LLUUID GroupID; + public int PassPrice; + public float PassHours; + public byte Category; + public LLUUID AuthBuyerID; + public LLUUID SnapshotID; + public LLVector3 UserLocation; + public LLVector3 UserLookAt; + public byte LandingType; + public bool RegionPushOverride; + public bool RegionDenyAnonymous; + public bool RegionDenyIdentified; + public bool RegionDenyTransacted; [XmlIgnore] public int Length @@ -74728,11 +68689,11 @@ namespace libsecondlife.Packets get { int length = 238; - if (MediaURL != null) { length += 1 + MediaURL.Length; } + if (Bitmap != null) { length += 2 + Bitmap.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; } + if (MediaURL != null) { length += 1 + MediaURL.Length; } return length; } } @@ -74743,67 +68704,67 @@ namespace libsecondlife.Packets int length; try { - 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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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; + SnapSelection = (bytes[i++] != 0) ? (bool)true : (bool)false; SelfCount = (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)); + PublicCount = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + LocalID = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + OwnerID = new LLUUID(bytes, i); i += 16; + IsGroupOwned = (bytes[i++] != 0) ? (bool)true : (bool)false; + AuctionID = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + ClaimDate = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + 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)); + AABBMin = new LLVector3(bytes, i); i += 12; + AABBMax = new LLVector3(bytes, i); i += 12; length = (ushort)(bytes[i++] + (bytes[i++] << 8)); _bitmap = new byte[length]; Buffer.BlockCopy(bytes, i, _bitmap, 0, length); i += length; + Area = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); Status = (byte)bytes[i++]; - SnapshotID = new LLUUID(bytes, i); i += 16; - SnapSelection = (bytes[i++] != 0) ? (bool)true : (bool)false; - LandingType = (byte)bytes[i++]; + SimWideMaxPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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; + MaxPrims = (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)); + OwnerPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + GroupPrims = (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)); + SelectedPrims = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - PassHours = BitConverter.ToSingle(bytes, i); i += 4; + ParcelPrimBonus = BitConverter.ToSingle(bytes, i); i += 4; + OtherCleanTime = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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++]; + SalePrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + length = (ushort)bytes[i++]; + _name = new byte[length]; + Buffer.BlockCopy(bytes, i, _name, 0, length); i += length; + length = (ushort)bytes[i++]; + _desc = new byte[length]; + Buffer.BlockCopy(bytes, i, _desc, 0, length); i += length; length = (ushort)bytes[i++]; _musicurl = new byte[length]; Buffer.BlockCopy(bytes, i, _musicurl, 0, length); i += length; + length = (ushort)bytes[i++]; + _mediaurl = new byte[length]; + Buffer.BlockCopy(bytes, i, _mediaurl, 0, length); i += length; + MediaID = new LLUUID(bytes, i); i += 16; + MediaAutoScale = (byte)bytes[i++]; + GroupID = new LLUUID(bytes, i); i += 16; + PassPrice = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 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)); + PassHours = BitConverter.ToSingle(bytes, i); i += 4; + Category = (byte)bytes[i++]; + AuthBuyerID = new LLUUID(bytes, i); i += 16; + SnapshotID = new LLUUID(bytes, i); i += 16; + UserLocation = new LLVector3(bytes, i); i += 12; + UserLookAt = new LLVector3(bytes, i); i += 12; + LandingType = (byte)bytes[i++]; + RegionPushOverride = (bytes[i++] != 0) ? (bool)true : (bool)false; + RegionDenyAnonymous = (bytes[i++] != 0) ? (bool)true : (bool)false; + RegionDenyIdentified = (bytes[i++] != 0) ? (bool)true : (bool)false; + RegionDenyTransacted = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -74814,131 +68775,41 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - 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); - Buffer.BlockCopy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(UserLookAt.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(AABBMax.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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; - Buffer.BlockCopy(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; - Buffer.BlockCopy(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); - Buffer.BlockCopy(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); - Buffer.BlockCopy(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)((SnapSelection) ? 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); - Buffer.BlockCopy(Bitmap, 0, bytes, i, Bitmap.Length); i += Bitmap.Length; - bytes[i++] = Status; - Buffer.BlockCopy(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)(OtherCount % 256); + bytes[i++] = (byte)((OtherCount >> 8) % 256); + bytes[i++] = (byte)((OtherCount >> 16) % 256); + bytes[i++] = (byte)((OtherCount >> 24) % 256); + bytes[i++] = (byte)(PublicCount % 256); + bytes[i++] = (byte)((PublicCount >> 8) % 256); + bytes[i++] = (byte)((PublicCount >> 16) % 256); + bytes[i++] = (byte)((PublicCount >> 24) % 256); + bytes[i++] = (byte)(LocalID % 256); + bytes[i++] = (byte)((LocalID >> 8) % 256); + bytes[i++] = (byte)((LocalID >> 16) % 256); + bytes[i++] = (byte)((LocalID >> 24) % 256); + Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)((IsGroupOwned) ? 1 : 0); bytes[i++] = (byte)(AuctionID % 256); bytes[i++] = (byte)((AuctionID >> 8) % 256); bytes[i++] = (byte)((AuctionID >> 16) % 256); bytes[i++] = (byte)((AuctionID >> 24) % 256); - Buffer.BlockCopy(AuthBuyerID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(PassHours); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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; - Buffer.BlockCopy(MusicURL, 0, bytes, i, MusicURL.Length); i += MusicURL.Length; - ba = BitConverter.GetBytes(ParcelPrimBonus); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; bytes[i++] = (byte)(ClaimPrice % 256); bytes[i++] = (byte)((ClaimPrice >> 8) % 256); bytes[i++] = (byte)((ClaimPrice >> 16) % 256); @@ -74947,66 +68818,156 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((RentPrice >> 8) % 256); bytes[i++] = (byte)((RentPrice >> 16) % 256); bytes[i++] = (byte)((RentPrice >> 24) % 256); + Buffer.BlockCopy(AABBMin.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(AABBMax.GetBytes(), 0, bytes, i, 12); i += 12; + 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); + Buffer.BlockCopy(Bitmap, 0, bytes, i, Bitmap.Length); i += Bitmap.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++] = Status; + 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)(SimWideTotalPrims % 256); + bytes[i++] = (byte)((SimWideTotalPrims >> 8) % 256); + bytes[i++] = (byte)((SimWideTotalPrims >> 16) % 256); + bytes[i++] = (byte)((SimWideTotalPrims >> 24) % 256); + bytes[i++] = (byte)(MaxPrims % 256); + bytes[i++] = (byte)((MaxPrims >> 8) % 256); + bytes[i++] = (byte)((MaxPrims >> 16) % 256); + bytes[i++] = (byte)((MaxPrims >> 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)(OwnerPrims % 256); + bytes[i++] = (byte)((OwnerPrims >> 8) % 256); + bytes[i++] = (byte)((OwnerPrims >> 16) % 256); + bytes[i++] = (byte)((OwnerPrims >> 24) % 256); + 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)(OtherPrims % 256); + bytes[i++] = (byte)((OtherPrims >> 8) % 256); + bytes[i++] = (byte)((OtherPrims >> 16) % 256); + bytes[i++] = (byte)((OtherPrims >> 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); + ba = BitConverter.GetBytes(ParcelPrimBonus); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = (byte)(OtherCleanTime % 256); + bytes[i++] = (byte)((OtherCleanTime >> 8) % 256); + bytes[i++] = (byte)((OtherCleanTime >> 16) % 256); + bytes[i++] = (byte)((OtherCleanTime >> 24) % 256); + 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)(SalePrice % 256); + bytes[i++] = (byte)((SalePrice >> 8) % 256); + bytes[i++] = (byte)((SalePrice >> 16) % 256); + bytes[i++] = (byte)((SalePrice >> 24) % 256); + if(Name == null) { Console.WriteLine("Warning: Name is null, in " + this.GetType()); } + bytes[i++] = (byte)Name.Length; + Buffer.BlockCopy(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; + Buffer.BlockCopy(Desc, 0, bytes, i, Desc.Length); i += Desc.Length; + if(MusicURL == null) { Console.WriteLine("Warning: MusicURL is null, in " + this.GetType()); } + bytes[i++] = (byte)MusicURL.Length; + Buffer.BlockCopy(MusicURL, 0, bytes, i, MusicURL.Length); i += MusicURL.Length; + if(MediaURL == null) { Console.WriteLine("Warning: MediaURL is null, in " + this.GetType()); } + bytes[i++] = (byte)MediaURL.Length; + Buffer.BlockCopy(MediaURL, 0, bytes, i, MediaURL.Length); i += MediaURL.Length; + Buffer.BlockCopy(MediaID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = MediaAutoScale; + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = (byte)(PassPrice % 256); + bytes[i++] = (byte)((PassPrice >> 8) % 256); + bytes[i++] = (byte)((PassPrice >> 16) % 256); + bytes[i++] = (byte)((PassPrice >> 24) % 256); + ba = BitConverter.GetBytes(PassHours); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = Category; + Buffer.BlockCopy(AuthBuyerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SnapshotID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(UserLocation.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(UserLookAt.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = LandingType; + bytes[i++] = (byte)((RegionPushOverride) ? 1 : 0); + bytes[i++] = (byte)((RegionDenyAnonymous) ? 1 : 0); + bytes[i++] = (byte)((RegionDenyIdentified) ? 1 : 0); + bytes[i++] = (byte)((RegionDenyTransacted) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- ParcelData --"); - output.AppendLine(String.Format("GroupPrims: {0}", GroupPrims)); - output.AppendLine(String.Format("SelectedPrims: {0}", SelectedPrims)); - output.AppendLine(String.Format("MediaID: {0}", MediaID)); - output.AppendLine(String.Format("UserLookAt: {0}", UserLookAt)); - output.AppendLine(String.Format("AABBMax: {0}", AABBMax)); - output.AppendLine(String.Format("AABBMin: {0}", AABBMin)); output.AppendLine(String.Format("RequestResult: {0}", RequestResult)); - output.AppendLine(String.Format("OwnerPrims: {0}", OwnerPrims)); - output.AppendLine(String.Format("RegionPushOverride: {0}", RegionPushOverride)); - output.AppendLine(String.Format("RegionDenyAnonymous: {0}", RegionDenyAnonymous)); - Helpers.FieldToString(output, MediaURL, "MediaURL"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("LocalID: {0}", LocalID)); - output.AppendLine(String.Format("SimWideMaxPrims: {0}", SimWideMaxPrims)); - output.AppendLine(String.Format("TotalPrims: {0}", TotalPrims)); - output.AppendLine(String.Format("OtherCount: {0}", OtherCount)); - output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); - output.AppendLine(String.Format("UserLocation: {0}", UserLocation)); - output.AppendLine(String.Format("MaxPrims: {0}", MaxPrims)); - Helpers.FieldToString(output, Name, "Name"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("OtherCleanTime: {0}", OtherCleanTime)); - Helpers.FieldToString(output, Desc, "Desc"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("Area: {0}", Area)); - output.AppendLine(String.Format("OtherPrims: {0}", OtherPrims)); - output.AppendLine(String.Format("RegionDenyIdentified: {0}", RegionDenyIdentified)); - output.AppendLine(String.Format("Category: {0}", Category)); - output.AppendLine(String.Format("PublicCount: {0}", PublicCount)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); - output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); output.AppendLine(String.Format("SequenceID: {0}", SequenceID)); - output.AppendLine(String.Format("RegionDenyTransacted: {0}", RegionDenyTransacted)); + output.AppendLine(String.Format("SnapSelection: {0}", SnapSelection)); output.AppendLine(String.Format("SelfCount: {0}", SelfCount)); + output.AppendLine(String.Format("OtherCount: {0}", OtherCount)); + output.AppendLine(String.Format("PublicCount: {0}", PublicCount)); + output.AppendLine(String.Format("LocalID: {0}", LocalID)); + output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("IsGroupOwned: {0}", IsGroupOwned)); + output.AppendLine(String.Format("AuctionID: {0}", AuctionID)); + output.AppendLine(String.Format("ClaimDate: {0}", ClaimDate)); + output.AppendLine(String.Format("ClaimPrice: {0}", ClaimPrice)); + output.AppendLine(String.Format("RentPrice: {0}", RentPrice)); + output.AppendLine(String.Format("AABBMin: {0}", AABBMin)); + output.AppendLine(String.Format("AABBMax: {0}", AABBMax)); Helpers.FieldToString(output, Bitmap, "Bitmap"); output.Append(Environment.NewLine); + output.AppendLine(String.Format("Area: {0}", Area)); output.AppendLine(String.Format("Status: {0}", Status)); - output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); - output.AppendLine(String.Format("SnapSelection: {0}", SnapSelection)); - output.AppendLine(String.Format("LandingType: {0}", LandingType)); + output.AppendLine(String.Format("SimWideMaxPrims: {0}", SimWideMaxPrims)); output.AppendLine(String.Format("SimWideTotalPrims: {0}", SimWideTotalPrims)); - output.AppendLine(String.Format("AuctionID: {0}", AuctionID)); - output.AppendLine(String.Format("AuthBuyerID: {0}", AuthBuyerID)); - output.AppendLine(String.Format("PassHours: {0}", PassHours)); + output.AppendLine(String.Format("MaxPrims: {0}", MaxPrims)); + output.AppendLine(String.Format("TotalPrims: {0}", TotalPrims)); + output.AppendLine(String.Format("OwnerPrims: {0}", OwnerPrims)); + output.AppendLine(String.Format("GroupPrims: {0}", GroupPrims)); + output.AppendLine(String.Format("OtherPrims: {0}", OtherPrims)); + output.AppendLine(String.Format("SelectedPrims: {0}", SelectedPrims)); + output.AppendLine(String.Format("ParcelPrimBonus: {0}", ParcelPrimBonus)); + output.AppendLine(String.Format("OtherCleanTime: {0}", OtherCleanTime)); output.AppendLine(String.Format("ParcelFlags: {0}", ParcelFlags)); - output.AppendLine(String.Format("PassPrice: {0}", PassPrice)); - output.AppendLine(String.Format("ClaimDate: {0}", ClaimDate)); - output.AppendLine(String.Format("MediaAutoScale: {0}", MediaAutoScale)); + output.AppendLine(String.Format("SalePrice: {0}", SalePrice)); + Helpers.FieldToString(output, Name, "Name"); + output.Append(Environment.NewLine); + Helpers.FieldToString(output, Desc, "Desc"); + output.Append(Environment.NewLine); Helpers.FieldToString(output, MusicURL, "MusicURL"); output.Append(Environment.NewLine); - output.AppendLine(String.Format("ParcelPrimBonus: {0}", ParcelPrimBonus)); - output.AppendLine(String.Format("ClaimPrice: {0}", ClaimPrice)); - output.Append(String.Format("RentPrice: {0}", RentPrice)); + Helpers.FieldToString(output, MediaURL, "MediaURL"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("MediaID: {0}", MediaID)); + output.AppendLine(String.Format("MediaAutoScale: {0}", MediaAutoScale)); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("PassPrice: {0}", PassPrice)); + output.AppendLine(String.Format("PassHours: {0}", PassHours)); + output.AppendLine(String.Format("Category: {0}", Category)); + output.AppendLine(String.Format("AuthBuyerID: {0}", AuthBuyerID)); + output.AppendLine(String.Format("SnapshotID: {0}", SnapshotID)); + output.AppendLine(String.Format("UserLocation: {0}", UserLocation)); + output.AppendLine(String.Format("UserLookAt: {0}", UserLookAt)); + output.AppendLine(String.Format("LandingType: {0}", LandingType)); + output.AppendLine(String.Format("RegionPushOverride: {0}", RegionPushOverride)); + output.AppendLine(String.Format("RegionDenyAnonymous: {0}", RegionDenyAnonymous)); + output.AppendLine(String.Format("RegionDenyIdentified: {0}", RegionDenyIdentified)); + output.Append(String.Format("RegionDenyTransacted: {0}", RegionDenyTransacted)); return output.ToString(); } } @@ -75019,9 +68980,8 @@ namespace libsecondlife.Packets public ParcelPropertiesPacket() { Header = new HighHeader(); - Header.ID = 24; + Header.ID = 23; Header.Reliable = true; - Header.Zerocoded = true; ParcelData = new ParcelDataBlock(); } @@ -75040,7 +69000,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += ParcelData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -75064,26 +69024,107 @@ namespace libsecondlife.Packets public class ChildAgentUpdatePacket : Packet { /// - [XmlType("childagentupdate_visualparam")] - public class VisualParamBlock + [XmlType("childagentupdate_agentdata")] + public class AgentDataBlock { - public byte ParamValue; + public ulong RegionHandle; + public uint ViewerCircuitCode; + public LLUUID AgentID; + public LLUUID SessionID; + public LLVector3 AgentPos; + public LLVector3 AgentVel; + public LLVector3 Center; + public LLVector3 Size; + public LLVector3 AtAxis; + public LLVector3 LeftAxis; + public LLVector3 UpAxis; + public bool ChangedGrid; + public float Far; + public float Aspect; + 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]; Buffer.BlockCopy(value, 0, _throttles, 0, value.Length); } + } + } + public uint LocomotionState; + public LLQuaternion HeadRotation; + public LLQuaternion BodyRotation; + public uint ControlFlags; + public float EnergyLevel; + public byte GodLevel; + public bool AlwaysRun; + public LLUUID PreyAgent; + public byte AgentAccess; + private byte[] _agenttextures; + public byte[] AgentTextures + { + get { return _agenttextures; } + set + { + if (value == null) { _agenttextures = null; return; } + if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } + else { _agenttextures = new byte[value.Length]; Buffer.BlockCopy(value, 0, _agenttextures, 0, value.Length); } + } + } + public LLUUID ActiveGroupID; [XmlIgnore] public int Length { get { - return 1; + int length = 208; + if (Throttles != null) { length += 1 + Throttles.Length; } + if (AgentTextures != null) { length += 2 + AgentTextures.Length; } + return length; } } - public VisualParamBlock() { } - public VisualParamBlock(byte[] bytes, ref int i) + public AgentDataBlock() { } + public AgentDataBlock(byte[] bytes, ref int i) { + int length; try { - ParamValue = (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)); + 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; + AgentPos = new LLVector3(bytes, i); i += 12; + AgentVel = new LLVector3(bytes, i); i += 12; + Center = new LLVector3(bytes, i); i += 12; + Size = new LLVector3(bytes, i); i += 12; + AtAxis = new LLVector3(bytes, i); i += 12; + LeftAxis = new LLVector3(bytes, i); i += 12; + UpAxis = new LLVector3(bytes, i); i += 12; + ChangedGrid = (bytes[i++] != 0) ? (bool)true : (bool)false; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Far = BitConverter.ToSingle(bytes, i); i += 4; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Aspect = BitConverter.ToSingle(bytes, i); i += 4; + length = (ushort)bytes[i++]; + _throttles = new byte[length]; + Buffer.BlockCopy(bytes, i, _throttles, 0, length); i += length; + LocomotionState = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + HeadRotation = new LLQuaternion(bytes, i, true); i += 12; + BodyRotation = new LLQuaternion(bytes, i, true); i += 12; + ControlFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + EnergyLevel = BitConverter.ToSingle(bytes, i); i += 4; + GodLevel = (byte)bytes[i++]; + AlwaysRun = (bytes[i++] != 0) ? (bool)true : (bool)false; + PreyAgent = new LLUUID(bytes, i); i += 16; + AgentAccess = (byte)bytes[i++]; + length = (ushort)(bytes[i++] + (bytes[i++] << 8)); + _agenttextures = new byte[length]; + Buffer.BlockCopy(bytes, i, _agenttextures, 0, length); i += length; + ActiveGroupID = new LLUUID(bytes, i); i += 16; } catch (Exception) { @@ -75093,14 +69134,197 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { - bytes[i++] = ParamValue; + byte[] ba; + 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)(ViewerCircuitCode % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256); + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(AgentPos.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(Center.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(Size.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(UpAxis.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = (byte)((ChangedGrid) ? 1 : 0); + ba = BitConverter.GetBytes(Far); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + ba = BitConverter.GetBytes(Aspect); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + if(Throttles == null) { Console.WriteLine("Warning: Throttles is null, in " + this.GetType()); } + bytes[i++] = (byte)Throttles.Length; + Buffer.BlockCopy(Throttles, 0, bytes, i, Throttles.Length); i += Throttles.Length; + bytes[i++] = (byte)(LocomotionState % 256); + bytes[i++] = (byte)((LocomotionState >> 8) % 256); + bytes[i++] = (byte)((LocomotionState >> 16) % 256); + bytes[i++] = (byte)((LocomotionState >> 24) % 256); + Buffer.BlockCopy(HeadRotation.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(BodyRotation.GetBytes(), 0, bytes, i, 12); i += 12; + 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(EnergyLevel); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; + bytes[i++] = GodLevel; + bytes[i++] = (byte)((AlwaysRun) ? 1 : 0); + Buffer.BlockCopy(PreyAgent.GetBytes(), 0, bytes, i, 16); i += 16; + bytes[i++] = AgentAccess; + 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); + Buffer.BlockCopy(AgentTextures, 0, bytes, i, AgentTextures.Length); i += AgentTextures.Length; + Buffer.BlockCopy(ActiveGroupID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); - output.AppendLine("-- VisualParam --"); - output.Append(String.Format("ParamValue: {0}", ParamValue)); + output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); + output.AppendLine(String.Format("ViewerCircuitCode: {0}", ViewerCircuitCode)); + output.AppendLine(String.Format("AgentID: {0}", AgentID)); + output.AppendLine(String.Format("SessionID: {0}", SessionID)); + output.AppendLine(String.Format("AgentPos: {0}", AgentPos)); + output.AppendLine(String.Format("AgentVel: {0}", AgentVel)); + output.AppendLine(String.Format("Center: {0}", Center)); + output.AppendLine(String.Format("Size: {0}", Size)); + output.AppendLine(String.Format("AtAxis: {0}", AtAxis)); + output.AppendLine(String.Format("LeftAxis: {0}", LeftAxis)); + output.AppendLine(String.Format("UpAxis: {0}", UpAxis)); + output.AppendLine(String.Format("ChangedGrid: {0}", ChangedGrid)); + output.AppendLine(String.Format("Far: {0}", Far)); + output.AppendLine(String.Format("Aspect: {0}", Aspect)); + Helpers.FieldToString(output, Throttles, "Throttles"); + output.Append(Environment.NewLine); + output.AppendLine(String.Format("LocomotionState: {0}", LocomotionState)); + output.AppendLine(String.Format("HeadRotation: {0}", HeadRotation)); + output.AppendLine(String.Format("BodyRotation: {0}", BodyRotation)); + output.AppendLine(String.Format("ControlFlags: {0}", ControlFlags)); + output.AppendLine(String.Format("EnergyLevel: {0}", EnergyLevel)); + output.AppendLine(String.Format("GodLevel: {0}", GodLevel)); + output.AppendLine(String.Format("AlwaysRun: {0}", AlwaysRun)); + output.AppendLine(String.Format("PreyAgent: {0}", PreyAgent)); + output.AppendLine(String.Format("AgentAccess: {0}", AgentAccess)); + Helpers.FieldToString(output, AgentTextures, "AgentTextures"); + output.Append(Environment.NewLine); + output.Append(String.Format("ActiveGroupID: {0}", ActiveGroupID)); + return output.ToString(); + } + } + + /// + [XmlType("childagentupdate_groupdata")] + public class GroupDataBlock + { + public LLUUID GroupID; + public ulong GroupPowers; + public bool AcceptNotices; + + [XmlIgnore] + public int Length + { + get + { + return 25; + } + } + + public GroupDataBlock() { } + public GroupDataBlock(byte[] bytes, ref int i) + { + try + { + GroupID = new LLUUID(bytes, i); i += 16; + 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)); + AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; + 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)((AcceptNotices) ? 1 : 0); + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- GroupData --"); + output.AppendLine(String.Format("GroupID: {0}", GroupID)); + output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); + output.Append(String.Format("AcceptNotices: {0}", AcceptNotices)); + return output.ToString(); + } + } + + /// + [XmlType("childagentupdate_animationdata")] + public class AnimationDataBlock + { + public LLUUID Animation; + public LLUUID ObjectID; + + [XmlIgnore] + public int Length + { + get + { + return 32; + } + } + + public AnimationDataBlock() { } + public AnimationDataBlock(byte[] bytes, ref int i) + { + try + { + Animation = new LLUUID(bytes, i); i += 16; + ObjectID = new LLUUID(bytes, i); i += 16; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(Animation.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- AnimationData --"); + output.AppendLine(String.Format("Animation: {0}", Animation)); + output.Append(String.Format("ObjectID: {0}", ObjectID)); return output.ToString(); } } @@ -75147,312 +69371,6 @@ namespace libsecondlife.Packets } } - /// - [XmlType("childagentupdate_animationdata")] - public class AnimationDataBlock - { - public LLUUID ObjectID; - public LLUUID Animation; - - [XmlIgnore] - public int Length - { - get - { - return 32; - } - } - - public AnimationDataBlock() { } - public AnimationDataBlock(byte[] bytes, ref int i) - { - try - { - ObjectID = new LLUUID(bytes, i); i += 16; - Animation = new LLUUID(bytes, i); i += 16; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(Animation.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AnimationData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.Append(String.Format("Animation: {0}", Animation)); - return output.ToString(); - } - } - - /// - [XmlType("childagentupdate_agentdata")] - public class AgentDataBlock - { - public uint ViewerCircuitCode; - public uint ControlFlags; - public float Far; - public LLUUID AgentID; - public bool ChangedGrid; - public LLQuaternion HeadRotation; - public LLUUID SessionID; - public LLVector3 LeftAxis; - public LLVector3 Size; - public byte GodLevel; - public ulong RegionHandle; - public byte AgentAccess; - public LLVector3 AgentVel; - public LLVector3 AgentPos; - public LLUUID PreyAgent; - private byte[] _throttles; - public byte[] Throttles - { - get { return _throttles; } - set - { - if (value == null) { _throttles = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { _throttles = new byte[value.Length]; Buffer.BlockCopy(value, 0, _throttles, 0, value.Length); } - } - } - public LLVector3 UpAxis; - private byte[] _agenttextures; - public byte[] AgentTextures - { - get { return _agenttextures; } - set - { - if (value == null) { _agenttextures = null; return; } - if (value.Length > 1500) { throw new OverflowException("Value exceeds 1500 characters"); } - else { _agenttextures = new byte[value.Length]; Buffer.BlockCopy(value, 0, _agenttextures, 0, value.Length); } - } - } - public LLVector3 AtAxis; - public LLVector3 Center; - public LLQuaternion BodyRotation; - public float Aspect; - public bool AlwaysRun; - public float EnergyLevel; - public uint LocomotionState; - public LLUUID ActiveGroupID; - - [XmlIgnore] - public int Length - { - get - { - int length = 208; - if (Throttles != null) { length += 1 + Throttles.Length; } - if (AgentTextures != null) { length += 2 + AgentTextures.Length; } - return length; - } - } - - public AgentDataBlock() { } - public AgentDataBlock(byte[] bytes, ref int i) - { - int length; - try - { - ViewerCircuitCode = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - ControlFlags = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); - Far = BitConverter.ToSingle(bytes, i); i += 4; - AgentID = new LLUUID(bytes, i); i += 16; - ChangedGrid = (bytes[i++] != 0) ? (bool)true : (bool)false; - HeadRotation = new LLQuaternion(bytes, i, true); i += 12; - SessionID = new LLUUID(bytes, i); i += 16; - LeftAxis = new LLVector3(bytes, i); i += 12; - Size = new LLVector3(bytes, i); i += 12; - GodLevel = (byte)bytes[i++]; - RegionHandle = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); - AgentAccess = (byte)bytes[i++]; - AgentVel = new LLVector3(bytes, i); i += 12; - AgentPos = new LLVector3(bytes, i); i += 12; - PreyAgent = new LLUUID(bytes, i); i += 16; - length = (ushort)bytes[i++]; - _throttles = new byte[length]; - Buffer.BlockCopy(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]; - Buffer.BlockCopy(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); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((ChangedGrid) ? 1 : 0); - Buffer.BlockCopy(HeadRotation.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(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; - Buffer.BlockCopy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(AgentPos.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(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; - Buffer.BlockCopy(Throttles, 0, bytes, i, Throttles.Length); i += Throttles.Length; - Buffer.BlockCopy(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); - Buffer.BlockCopy(AgentTextures, 0, bytes, i, AgentTextures.Length); i += AgentTextures.Length; - Buffer.BlockCopy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(Center.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(BodyRotation.GetBytes(), 0, bytes, i, 12); i += 12; - ba = BitConverter.GetBytes(Aspect); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(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); } - Buffer.BlockCopy(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); - Buffer.BlockCopy(ActiveGroupID.GetBytes(), 0, bytes, i, 16); i += 16; - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- AgentData --"); - output.AppendLine(String.Format("ViewerCircuitCode: {0}", ViewerCircuitCode)); - output.AppendLine(String.Format("ControlFlags: {0}", ControlFlags)); - output.AppendLine(String.Format("Far: {0}", Far)); - output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("ChangedGrid: {0}", ChangedGrid)); - output.AppendLine(String.Format("HeadRotation: {0}", HeadRotation)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("LeftAxis: {0}", LeftAxis)); - output.AppendLine(String.Format("Size: {0}", Size)); - output.AppendLine(String.Format("GodLevel: {0}", GodLevel)); - output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.AppendLine(String.Format("AgentAccess: {0}", AgentAccess)); - output.AppendLine(String.Format("AgentVel: {0}", AgentVel)); - output.AppendLine(String.Format("AgentPos: {0}", AgentPos)); - output.AppendLine(String.Format("PreyAgent: {0}", PreyAgent)); - Helpers.FieldToString(output, Throttles, "Throttles"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("UpAxis: {0}", UpAxis)); - Helpers.FieldToString(output, AgentTextures, "AgentTextures"); - output.Append(Environment.NewLine); - output.AppendLine(String.Format("AtAxis: {0}", AtAxis)); - output.AppendLine(String.Format("Center: {0}", Center)); - output.AppendLine(String.Format("BodyRotation: {0}", BodyRotation)); - output.AppendLine(String.Format("Aspect: {0}", Aspect)); - output.AppendLine(String.Format("AlwaysRun: {0}", AlwaysRun)); - output.AppendLine(String.Format("EnergyLevel: {0}", EnergyLevel)); - output.AppendLine(String.Format("LocomotionState: {0}", LocomotionState)); - output.Append(String.Format("ActiveGroupID: {0}", ActiveGroupID)); - return output.ToString(); - } - } - - /// - [XmlType("childagentupdate_groupdata")] - public class GroupDataBlock - { - public ulong GroupPowers; - public LLUUID GroupID; - public bool AcceptNotices; - - [XmlIgnore] - public int Length - { - get - { - return 25; - } - } - - public GroupDataBlock() { } - public GroupDataBlock(byte[] bytes, ref int i) - { - try - { - GroupPowers = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + ((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + ((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + ((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56)); - GroupID = new LLUUID(bytes, i); i += 16; - AcceptNotices = (bytes[i++] != 0) ? (bool)true : (bool)false; - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(GroupPowers % 256); - bytes[i++] = (byte)((GroupPowers >> 8) % 256); - bytes[i++] = (byte)((GroupPowers >> 16) % 256); - bytes[i++] = (byte)((GroupPowers >> 24) % 256); - bytes[i++] = (byte)((GroupPowers >> 32) % 256); - bytes[i++] = (byte)((GroupPowers >> 40) % 256); - bytes[i++] = (byte)((GroupPowers >> 48) % 256); - bytes[i++] = (byte)((GroupPowers >> 56) % 256); - Buffer.BlockCopy(GroupID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((AcceptNotices) ? 1 : 0); - } - - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine("-- GroupData --"); - output.AppendLine(String.Format("GroupPowers: {0}", GroupPowers)); - output.AppendLine(String.Format("GroupID: {0}", GroupID)); - output.Append(String.Format("AcceptNotices: {0}", AcceptNotices)); - return output.ToString(); - } - } - /// [XmlType("childagentupdate_nvpairdata")] public class NVPairDataBlock @@ -75513,112 +69431,153 @@ namespace libsecondlife.Packets } } + /// + [XmlType("childagentupdate_visualparam")] + public class VisualParamBlock + { + public byte ParamValue; + + [XmlIgnore] + public int Length + { + get + { + return 1; + } + } + + public VisualParamBlock() { } + public VisualParamBlock(byte[] bytes, ref int i) + { + try + { + ParamValue = (byte)bytes[i++]; + } + catch (Exception) + { + throw new MalformedDataException(); + } + } + + public void ToBytes(byte[] bytes, ref int i) + { + bytes[i++] = ParamValue; + } + + public override string ToString() + { + StringBuilder output = new StringBuilder(); + output.AppendLine("-- VisualParam --"); + output.Append(String.Format("ParamValue: {0}", ParamValue)); + return output.ToString(); + } + } + 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 AnimationDataBlock[] AnimationData; + public GranterBlockBlock[] GranterBlock; public NVPairDataBlock[] NVPairData; + public VisualParamBlock[] VisualParam; public ChildAgentUpdatePacket() { Header = new HighHeader(); - Header.ID = 26; + Header.ID = 25; 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]; + AnimationData = new AnimationDataBlock[0]; + GranterBlock = new GranterBlockBlock[0]; NVPairData = new NVPairDataBlock[0]; + VisualParam = new VisualParamBlock[0]; } public ChildAgentUpdatePacket(byte[] bytes, ref int i) { int packetEnd = bytes.Length - 1; Header = new HighHeader(bytes, ref i, ref packetEnd); + AgentData = new AgentDataBlock(bytes, ref i); int count = (int)bytes[i++]; - VisualParam = new VisualParamBlock[count]; + GroupData = new GroupDataBlock[count]; for (int j = 0; j < count; j++) - { VisualParam[j] = new VisualParamBlock(bytes, ref i); } + { GroupData[j] = new GroupDataBlock(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); } 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); } + count = (int)bytes[i++]; + VisualParam = new VisualParamBlock[count]; + for (int j = 0; j < count; j++) + { VisualParam[j] = new VisualParamBlock(bytes, ref i); } } public ChildAgentUpdatePacket(Header head, byte[] bytes, ref int i) { Header = head; + AgentData = new AgentDataBlock(bytes, ref i); int count = (int)bytes[i++]; - VisualParam = new VisualParamBlock[count]; + GroupData = new GroupDataBlock[count]; for (int j = 0; j < count; j++) - { VisualParam[j] = new VisualParamBlock(bytes, ref i); } + { GroupData[j] = new GroupDataBlock(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); } 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); } + count = (int)bytes[i++]; + VisualParam = new VisualParamBlock[count]; + for (int j = 0; j < count; j++) + { VisualParam[j] = new VisualParamBlock(bytes, ref i); } } public override byte[] ToBytes() { - int length = 5; + int length = 7; 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 < AnimationData.Length; j++) { length += AnimationData[j].Length; } + length++; + for (int j = 0; j < GranterBlock.Length; j++) { length += GranterBlock[j].Length; } + length++; for (int j = 0; j < NVPairData.Length; j++) { length += NVPairData[j].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); } - 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)AnimationData.Length; + for (int j = 0; j < AnimationData.Length; j++) { AnimationData[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)NVPairData.Length; for (int j = 0; j < NVPairData.Length; j++) { NVPairData[j].ToBytes(bytes, ref i); } + bytes[i++] = (byte)VisualParam.Length; + for (int j = 0; j < VisualParam.Length; j++) { VisualParam[j].ToBytes(bytes, ref i); } if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } return bytes; } @@ -75626,27 +69585,27 @@ namespace libsecondlife.Packets public override string ToString() { string output = "--- ChildAgentUpdate ---" + Environment.NewLine; - for (int j = 0; j < VisualParam.Length; j++) - { - output += VisualParam[j].ToString() + Environment.NewLine; - } - for (int j = 0; j < GranterBlock.Length; j++) - { - output += GranterBlock[j].ToString() + Environment.NewLine; - } - for (int j = 0; j < AnimationData.Length; j++) - { - output += AnimationData[j].ToString() + Environment.NewLine; - } output += AgentData.ToString() + Environment.NewLine; for (int j = 0; j < GroupData.Length; j++) { output += GroupData[j].ToString() + Environment.NewLine; } + for (int j = 0; j < AnimationData.Length; j++) + { + output += AnimationData[j].ToString() + Environment.NewLine; + } + for (int j = 0; j < GranterBlock.Length; j++) + { + output += GranterBlock[j].ToString() + Environment.NewLine; + } for (int j = 0; j < NVPairData.Length; j++) { output += NVPairData[j].ToString() + Environment.NewLine; } + for (int j = 0; j < VisualParam.Length; j++) + { + output += VisualParam[j].ToString() + Environment.NewLine; + } return output; } @@ -75659,10 +69618,10 @@ namespace libsecondlife.Packets [XmlType("childagentalive_agentdata")] public class AgentDataBlock { + public ulong RegionHandle; public uint ViewerCircuitCode; public LLUUID AgentID; public LLUUID SessionID; - public ulong RegionHandle; [XmlIgnore] public int Length @@ -75678,10 +69637,10 @@ namespace libsecondlife.Packets { 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)); 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) { @@ -75691,12 +69650,6 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(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); @@ -75705,16 +69658,22 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((RegionHandle >> 40) % 256); bytes[i++] = (byte)((RegionHandle >> 48) % 256); bytes[i++] = (byte)((RegionHandle >> 56) % 256); + bytes[i++] = (byte)(ViewerCircuitCode % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256); + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); output.AppendLine(String.Format("ViewerCircuitCode: {0}", ViewerCircuitCode)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.Append(String.Format("RegionHandle: {0}", RegionHandle)); + output.Append(String.Format("SessionID: {0}", SessionID)); return output.ToString(); } } @@ -75727,7 +69686,7 @@ namespace libsecondlife.Packets public ChildAgentAlivePacket() { Header = new HighHeader(); - Header.ID = 27; + Header.ID = 26; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -75747,7 +69706,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -75774,18 +69733,18 @@ namespace libsecondlife.Packets [XmlType("childagentpositionupdate_agentdata")] public class AgentDataBlock { + public ulong RegionHandle; 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 AgentVel; public LLVector3 Center; + public LLVector3 Size; + public LLVector3 AtAxis; + public LLVector3 LeftAxis; + public LLVector3 UpAxis; + public bool ChangedGrid; [XmlIgnore] public int Length @@ -75801,18 +69760,18 @@ namespace libsecondlife.Packets { 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)); 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; + AgentVel = new LLVector3(bytes, i); i += 12; Center = new LLVector3(bytes, i); i += 12; + Size = new LLVector3(bytes, i); i += 12; + AtAxis = new LLVector3(bytes, i); i += 12; + LeftAxis = new LLVector3(bytes, i); i += 12; + UpAxis = new LLVector3(bytes, i); i += 12; + ChangedGrid = (bytes[i++] != 0) ? (bool)true : (bool)false; } catch (Exception) { @@ -75822,15 +69781,6 @@ namespace libsecondlife.Packets 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); - Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = (byte)((ChangedGrid) ? 1 : 0); - Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; - Buffer.BlockCopy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(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); @@ -75839,29 +69789,38 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((RegionHandle >> 40) % 256); bytes[i++] = (byte)((RegionHandle >> 48) % 256); bytes[i++] = (byte)((RegionHandle >> 56) % 256); - Buffer.BlockCopy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = (byte)(ViewerCircuitCode % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 8) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 16) % 256); + bytes[i++] = (byte)((ViewerCircuitCode >> 24) % 256); + Buffer.BlockCopy(AgentID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(SessionID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(AgentPos.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(UpAxis.GetBytes(), 0, bytes, i, 12); i += 12; - Buffer.BlockCopy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(AgentVel.GetBytes(), 0, bytes, i, 12); i += 12; Buffer.BlockCopy(Center.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(Size.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(AtAxis.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(LeftAxis.GetBytes(), 0, bytes, i, 12); i += 12; + Buffer.BlockCopy(UpAxis.GetBytes(), 0, bytes, i, 12); i += 12; + bytes[i++] = (byte)((ChangedGrid) ? 1 : 0); } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- AgentData --"); + output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); output.AppendLine(String.Format("ViewerCircuitCode: {0}", ViewerCircuitCode)); output.AppendLine(String.Format("AgentID: {0}", AgentID)); - output.AppendLine(String.Format("ChangedGrid: {0}", ChangedGrid)); output.AppendLine(String.Format("SessionID: {0}", SessionID)); - output.AppendLine(String.Format("LeftAxis: {0}", LeftAxis)); - output.AppendLine(String.Format("Size: {0}", Size)); - output.AppendLine(String.Format("RegionHandle: {0}", RegionHandle)); - output.AppendLine(String.Format("AgentVel: {0}", AgentVel)); output.AppendLine(String.Format("AgentPos: {0}", AgentPos)); - output.AppendLine(String.Format("UpAxis: {0}", UpAxis)); + output.AppendLine(String.Format("AgentVel: {0}", AgentVel)); + output.AppendLine(String.Format("Center: {0}", Center)); + output.AppendLine(String.Format("Size: {0}", Size)); output.AppendLine(String.Format("AtAxis: {0}", AtAxis)); - output.Append(String.Format("Center: {0}", Center)); + output.AppendLine(String.Format("LeftAxis: {0}", LeftAxis)); + output.AppendLine(String.Format("UpAxis: {0}", UpAxis)); + output.Append(String.Format("ChangedGrid: {0}", ChangedGrid)); return output.ToString(); } } @@ -75874,7 +69833,7 @@ namespace libsecondlife.Packets public ChildAgentPositionUpdatePacket() { Header = new HighHeader(); - Header.ID = 28; + Header.ID = 27; Header.Reliable = true; AgentData = new AgentDataBlock(); } @@ -75894,7 +69853,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += AgentData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; @@ -75921,13 +69880,13 @@ namespace libsecondlife.Packets [XmlType("soundtrigger_sounddata")] public class SoundDataBlock { - public LLUUID ObjectID; - public float Gain; - public LLUUID ParentID; public LLUUID SoundID; public LLUUID OwnerID; + public LLUUID ObjectID; + public LLUUID ParentID; public ulong Handle; public LLVector3 Position; + public float Gain; [XmlIgnore] public int Length @@ -75943,14 +69902,14 @@ namespace libsecondlife.Packets { 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; + ObjectID = new LLUUID(bytes, i); i += 16; + ParentID = 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; + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4); + Gain = BitConverter.ToSingle(bytes, i); i += 4; } catch (Exception) { @@ -75961,13 +69920,10 @@ namespace libsecondlife.Packets public void ToBytes(byte[] bytes, ref int i) { byte[] ba; - Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; - ba = BitConverter.GetBytes(Gain); - if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } - Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; - Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(SoundID.GetBytes(), 0, bytes, i, 16); i += 16; Buffer.BlockCopy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ObjectID.GetBytes(), 0, bytes, i, 16); i += 16; + Buffer.BlockCopy(ParentID.GetBytes(), 0, bytes, i, 16); i += 16; bytes[i++] = (byte)(Handle % 256); bytes[i++] = (byte)((Handle >> 8) % 256); bytes[i++] = (byte)((Handle >> 16) % 256); @@ -75977,19 +69933,22 @@ namespace libsecondlife.Packets bytes[i++] = (byte)((Handle >> 48) % 256); bytes[i++] = (byte)((Handle >> 56) % 256); Buffer.BlockCopy(Position.GetBytes(), 0, bytes, i, 12); i += 12; + ba = BitConverter.GetBytes(Gain); + if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); } + Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4; } public override string ToString() { StringBuilder output = new StringBuilder(); output.AppendLine("-- SoundData --"); - output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); - output.AppendLine(String.Format("Gain: {0}", Gain)); - output.AppendLine(String.Format("ParentID: {0}", ParentID)); output.AppendLine(String.Format("SoundID: {0}", SoundID)); output.AppendLine(String.Format("OwnerID: {0}", OwnerID)); + output.AppendLine(String.Format("ObjectID: {0}", ObjectID)); + output.AppendLine(String.Format("ParentID: {0}", ParentID)); output.AppendLine(String.Format("Handle: {0}", Handle)); - output.Append(String.Format("Position: {0}", Position)); + output.AppendLine(String.Format("Position: {0}", Position)); + output.Append(String.Format("Gain: {0}", Gain)); return output.ToString(); } } @@ -76002,7 +69961,7 @@ namespace libsecondlife.Packets public SoundTriggerPacket() { Header = new HighHeader(); - Header.ID = 31; + Header.ID = 29; Header.Reliable = true; SoundData = new SoundDataBlock(); } @@ -76022,7 +69981,7 @@ namespace libsecondlife.Packets public override byte[] ToBytes() { - int length = 5; + int length = 7; length += SoundData.Length;; if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } byte[] bytes = new byte[length]; diff --git a/libsecondlife/examples/TestClient/TestClient.csproj b/libsecondlife/examples/TestClient/TestClient.csproj index cb872b57..27cccbdc 100644 --- a/libsecondlife/examples/TestClient/TestClient.csproj +++ b/libsecondlife/examples/TestClient/TestClient.csproj @@ -109,4 +109,4 @@ --> - \ No newline at end of file + diff --git a/libsecondlife/libsecondlife.Utilities/Utilities.cs b/libsecondlife/libsecondlife.Utilities/Utilities.cs index be8f9329..ca03b697 100644 --- a/libsecondlife/libsecondlife.Utilities/Utilities.cs +++ b/libsecondlife/libsecondlife.Utilities/Utilities.cs @@ -202,7 +202,6 @@ namespace libsecondlife.Utilities protected SecondLife Client; protected Dictionary avatars = new Dictionary(); protected Dictionary NameLookupEvents = new Dictionary(); - protected Dictionary StatisticsLookupEvents = new Dictionary(); protected Dictionary PropertiesLookupEvents = new Dictionary(); protected Dictionary InterestsLookupEvents = new Dictionary(); protected Dictionary GroupsLookupEvents = new Dictionary(); @@ -214,7 +213,6 @@ namespace libsecondlife.Utilities Client.Avatars.OnAvatarNames += new AvatarManager.AvatarNamesCallback(Avatars_OnAvatarNames); Client.Avatars.OnAvatarInterests += new AvatarManager.AvatarInterestsCallback(Avatars_OnAvatarInterests); Client.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties); - Client.Avatars.OnAvatarStatistics += new AvatarManager.AvatarStatisticsCallback(Avatars_OnAvatarStatistics); Client.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups); //Client.Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(Objects_OnNewAvatar); @@ -276,7 +274,7 @@ namespace libsecondlife.Utilities } public bool GetAvatarProfile(LLUUID id, out Avatar.Interests interests, out Avatar.AvatarProperties properties, - out Avatar.Statistics statistics, out List groups) + out List groups) { // Do a local lookup first if (avatars.ContainsKey(id) && avatars[id].ProfileProperties.BornOn != null && @@ -284,7 +282,6 @@ namespace libsecondlife.Utilities { interests = avatars[id].ProfileInterests; properties = avatars[id].ProfileProperties; - statistics = avatars[id].ProfileStatistics; groups = avatars[id].Groups; return true; @@ -297,9 +294,6 @@ namespace libsecondlife.Utilities lock (InterestsLookupEvents) if (!InterestsLookupEvents.ContainsKey(id)) InterestsLookupEvents[id] = new ManualResetEvent(false); - lock (StatisticsLookupEvents) - if (!StatisticsLookupEvents.ContainsKey(id)) - StatisticsLookupEvents[id] = new ManualResetEvent(false); lock (GroupsLookupEvents) if (!GroupsLookupEvents.ContainsKey(id)) GroupsLookupEvents[id] = new ManualResetEvent(false); @@ -310,7 +304,6 @@ namespace libsecondlife.Utilities // Wait for all of the events to complete PropertiesLookupEvents[id].WaitOne(5000, false); InterestsLookupEvents[id].WaitOne(5000, false); - StatisticsLookupEvents[id].WaitOne(5000, false); GroupsLookupEvents[id].WaitOne(5000, false); // Destroy the ManualResetEvents @@ -318,8 +311,6 @@ namespace libsecondlife.Utilities PropertiesLookupEvents.Remove(id); lock (InterestsLookupEvents) InterestsLookupEvents.Remove(id); - lock (StatisticsLookupEvents) - StatisticsLookupEvents.Remove(id); lock (GroupsLookupEvents) GroupsLookupEvents.Remove(id); @@ -329,7 +320,6 @@ namespace libsecondlife.Utilities { interests = avatars[id].ProfileInterests; properties = avatars[id].ProfileProperties; - statistics = avatars[id].ProfileStatistics; groups = avatars[id].Groups; return true; @@ -338,7 +328,6 @@ namespace libsecondlife.Utilities { interests = new Avatar.Interests(); properties = new Avatar.AvatarProperties(); - statistics = new Avatar.Statistics(); groups = null; return false; @@ -379,20 +368,6 @@ namespace libsecondlife.Utilities } } - void Avatars_OnAvatarStatistics(LLUUID avatarID, Avatar.Statistics statistics) - { - lock (avatars) - { - if (!avatars.ContainsKey(avatarID)) - avatars[avatarID] = new Avatar(); - - avatars[avatarID].ProfileStatistics = statistics; - } - - if (StatisticsLookupEvents.ContainsKey(avatarID)) - StatisticsLookupEvents[avatarID].Set(); - } - void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties) { lock (avatars) diff --git a/libsecondlife/mapgenerator/ProtocolManager.cs b/libsecondlife/mapgenerator/ProtocolManager.cs index 197a6fbc..b3183256 100644 --- a/libsecondlife/mapgenerator/ProtocolManager.cs +++ b/libsecondlife/mapgenerator/ProtocolManager.cs @@ -423,9 +423,6 @@ namespace libsecondlife private void LoadMapFile(string mapFile) { FileStream map; - ushort low = 1; - ushort medium = 1; - ushort high = 1; // Load the protocol map file try @@ -482,7 +479,7 @@ namespace libsecondlife else if (trimmedline == "}") { // Reached the end of the packet - currentPacket.Blocks.Sort(); + // currentPacket.Blocks.Sort(); inPacket = false; } else @@ -498,68 +495,71 @@ namespace libsecondlife //Hash packet name to insure correct keyword ordering KeywordPosition(tokens[0]); + uint packetID; + + // Remove the leading "0x" + if (tokens[2].Length > 2 && tokens[2].Substring(0, 2) == "0x") + { + tokens[2] = tokens[2].Substring(2, tokens[2].Length - 2); + packetID = UInt32.Parse(tokens[2], System.Globalization.NumberStyles.HexNumber); + } else { + packetID = UInt32.Parse(tokens[2]); + } + + if (tokens[1] == "Fixed") { - // Remove the leading "0x" - if (tokens[2].Substring(0, 2) == "0x") - { - tokens[2] = tokens[2].Substring(2, tokens[2].Length - 2); - } - - uint fixedID = UInt32.Parse(tokens[2], System.Globalization.NumberStyles.HexNumber); + // Truncate the id to a short - fixedID ^= 0xFFFF0000; - LowMaps[fixedID] = new MapPacket(); - LowMaps[fixedID].ID = (ushort)fixedID; - LowMaps[fixedID].Frequency = PacketFrequency.Low; - LowMaps[fixedID].Name = tokens[0]; - LowMaps[fixedID].Trusted = (tokens[3] == "Trusted"); - LowMaps[fixedID].Encoded = (tokens[4] == "Zerocoded"); - LowMaps[fixedID].Blocks = new List(); + packetID &= 0xFFFF; + LowMaps[packetID] = new MapPacket(); + LowMaps[packetID].ID = (ushort)packetID; + LowMaps[packetID].Frequency = PacketFrequency.Low; + LowMaps[packetID].Name = tokens[0]; + LowMaps[packetID].Trusted = (tokens[3] == "Trusted"); + LowMaps[packetID].Encoded = (tokens[4] == "Zerocoded"); + LowMaps[packetID].Blocks = new List(); - currentPacket = LowMaps[fixedID]; + currentPacket = LowMaps[packetID]; } else if (tokens[1] == "Low") { - LowMaps[low] = new MapPacket(); - LowMaps[low].ID = low; - LowMaps[low].Frequency = PacketFrequency.Low; - LowMaps[low].Name = tokens[0]; - LowMaps[low].Trusted = (tokens[2] == "Trusted"); - LowMaps[low].Encoded = (tokens[3] == "Zerocoded"); - LowMaps[low].Blocks = new List(); + LowMaps[packetID] = new MapPacket(); + LowMaps[packetID].ID = (ushort)packetID; + LowMaps[packetID].Frequency = PacketFrequency.Low; + LowMaps[packetID].Name = tokens[0]; + LowMaps[packetID].Trusted = (tokens[2] == "Trusted"); + LowMaps[packetID].Encoded = (tokens[3] == "Zerocoded"); + LowMaps[packetID].Blocks = new List(); - currentPacket = LowMaps[low]; + currentPacket = LowMaps[packetID]; - low++; } else if (tokens[1] == "Medium") { - MediumMaps[medium] = new MapPacket(); - MediumMaps[medium].ID = medium; - MediumMaps[medium].Frequency = PacketFrequency.Medium; - MediumMaps[medium].Name = tokens[0]; - MediumMaps[medium].Trusted = (tokens[2] == "Trusted"); - MediumMaps[medium].Encoded = (tokens[3] == "Zerocoded"); - MediumMaps[medium].Blocks = new List(); + MediumMaps[packetID] = new MapPacket(); + MediumMaps[packetID].ID = (ushort)packetID; + MediumMaps[packetID].Frequency = PacketFrequency.Medium; + MediumMaps[packetID].Name = tokens[0]; + MediumMaps[packetID].Trusted = (tokens[2] == "Trusted"); + MediumMaps[packetID].Encoded = (tokens[3] == "Zerocoded"); + MediumMaps[packetID].Blocks = new List(); - currentPacket = MediumMaps[medium]; + currentPacket = MediumMaps[packetID]; - medium++; } else if (tokens[1] == "High") { - HighMaps[high] = new MapPacket(); - HighMaps[high].ID = high; - HighMaps[high].Frequency = PacketFrequency.High; - HighMaps[high].Name = tokens[0]; - HighMaps[high].Trusted = (tokens[2] == "Trusted"); - HighMaps[high].Encoded = (tokens[3] == "Zerocoded"); - HighMaps[high].Blocks = new List(); + HighMaps[packetID] = new MapPacket(); + HighMaps[packetID].ID = (ushort)packetID; + HighMaps[packetID].Frequency = PacketFrequency.High; + HighMaps[packetID].Name = tokens[0]; + HighMaps[packetID].Trusted = (tokens[2] == "Trusted"); + HighMaps[packetID].Encoded = (tokens[3] == "Zerocoded"); + HighMaps[packetID].Blocks = new List(); - currentPacket = HighMaps[high]; + currentPacket = HighMaps[packetID]; - high++; } else { @@ -603,7 +603,7 @@ namespace libsecondlife } else if (trimmedline == "}") { - currentBlock.Fields.Sort(); + // currentBlock.Fields.Sort(); inBlock = false; } else if (trimmedline.Length != 0 && trimmedline.Substring(0, 2) != "//") diff --git a/libsecondlife/mapgenerator/mapgenerator.cs b/libsecondlife/mapgenerator/mapgenerator.cs index e7f1844e..37f0ada4 100644 --- a/libsecondlife/mapgenerator/mapgenerator.cs +++ b/libsecondlife/mapgenerator/mapgenerator.cs @@ -608,9 +608,9 @@ namespace mapgenerator writer.WriteLine(" public override byte[] ToBytes()" + Environment.NewLine + " {"); writer.Write(" int length = "); - if (packet.Frequency == PacketFrequency.Low) { writer.WriteLine("8;"); } - else if (packet.Frequency == PacketFrequency.Medium) { writer.WriteLine("6;"); } - else { writer.WriteLine("5;"); } + if (packet.Frequency == PacketFrequency.Low) { writer.WriteLine("10;"); } + else if (packet.Frequency == PacketFrequency.Medium) { writer.WriteLine("8;"); } + else { writer.WriteLine("7;"); } foreach (MapBlock block in packet.Blocks) { @@ -780,13 +780,13 @@ namespace mapgenerator " Default,"); foreach (MapPacket packet in protocol.LowMaps) if (packet != null) - writer.WriteLine(" " + packet.Name + ","); + writer.WriteLine(" " + packet.Name + " = " + (0x10000 | packet.ID) + ","); foreach (MapPacket packet in protocol.MediumMaps) if (packet != null) - writer.WriteLine(" " + packet.Name + ","); + writer.WriteLine(" " + packet.Name + " = " + (0x20000 | packet.ID) + ","); foreach (MapPacket packet in protocol.HighMaps) if (packet != null) - writer.WriteLine(" " + packet.Name + ","); + writer.WriteLine(" " + packet.Name + " = " + (0x30000 | packet.ID) + ","); writer.WriteLine(" }" + Environment.NewLine); @@ -851,35 +851,35 @@ namespace mapgenerator // Write the Packet.BuildPacket() function writer.WriteLine( " public static Packet BuildPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer)" + Environment.NewLine + - " {" + Environment.NewLine + " ushort id;" + Environment.NewLine + + " {" + Environment.NewLine + " ushort id; PacketFrequency freq;" + Environment.NewLine + " int i = 0;" + Environment.NewLine + " Header header = Header.BuildHeader(bytes, ref i, ref packetEnd);" + Environment.NewLine + " if (header.Zerocoded)" + Environment.NewLine + " {" + Environment.NewLine + " packetEnd = Helpers.ZeroDecode(bytes, packetEnd + 1, zeroBuffer) - 1;" + Environment.NewLine + " bytes = zeroBuffer;" + Environment.NewLine + " }" + Environment.NewLine + Environment.NewLine + - " if (bytes[4] == 0xFF)" + Environment.NewLine + " {" + Environment.NewLine + - " if (bytes[5] == 0xFF)" + Environment.NewLine + " {" + Environment.NewLine + - " id = (ushort)((bytes[6] << 8) + bytes[7]);" + Environment.NewLine + + " if (bytes[6] == 0xFF)" + Environment.NewLine + " {" + Environment.NewLine + + " if (bytes[7] == 0xFF)" + Environment.NewLine + " {" + Environment.NewLine + + " id = (ushort)((bytes[8] << 8) + bytes[9]); freq = PacketFrequency.Low;" + Environment.NewLine + " switch (id)" + Environment.NewLine + " {"); foreach (MapPacket packet in protocol.LowMaps) if (packet != null) writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);"); writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine + " else" + Environment.NewLine + - " {" + Environment.NewLine + " id = (ushort)bytes[5];" + Environment.NewLine + + " {" + Environment.NewLine + " id = (ushort)bytes[7]; freq = PacketFrequency.Medium;" + Environment.NewLine + " switch (id)" + Environment.NewLine + " {"); foreach (MapPacket packet in protocol.MediumMaps) if (packet != null) writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);"); writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine + " }" + Environment.NewLine + " else" + Environment.NewLine + " {" + Environment.NewLine + - " id = (ushort)bytes[4];" + Environment.NewLine + + " id = (ushort)bytes[6]; freq = PacketFrequency.High;" + Environment.NewLine + " switch (id)" + Environment.NewLine + " {"); foreach (MapPacket packet in protocol.HighMaps) if (packet != null) writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);"); writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine + Environment.NewLine + - " throw new MalformedDataException(\"Unknown packet ID\");" + Environment.NewLine + + " throw new MalformedDataException(\"Unknown packet ID \"+freq+\" \"+id);" + Environment.NewLine + " }" + Environment.NewLine + " }" + Environment.NewLine); diff --git a/libsecondlife/mapgenerator/template.cs b/libsecondlife/mapgenerator/template.cs index 45de5431..34d7df44 100644 --- a/libsecondlife/mapgenerator/template.cs +++ b/libsecondlife/mapgenerator/template.cs @@ -109,8 +109,11 @@ namespace libsecondlife.Packets [XmlIgnore] public uint Sequence { - get { return (uint)((Data[1] << 16) + (Data[2] << 8) + Data[3]); } - set { Data[1] = (byte)(value >> 16); Data[2] = (byte)(value >> 8); Data[3] = (byte)(value % 256); } + get { return (uint)((Data[1] << 24) + (Data[2] << 16) + (Data[3] << 8) + Data[4]); } + set { + Data[1] = (byte)(value >> 24); Data[2] = (byte)(value >> 16); + Data[3] = (byte)(value >> 8); Data[4] = (byte)(value % 256); + } } /// Numeric ID number of this packet [XmlIgnore] @@ -152,9 +155,9 @@ namespace libsecondlife.Packets /// public static Header BuildHeader(byte[] bytes, ref int pos, ref int packetEnd) { - if (bytes[4] == 0xFF) + if (bytes[6] == 0xFF) { - if (bytes[5] == 0xFF) + if (bytes[7] == 0xFF) { return new LowHeader(bytes, ref pos, ref packetEnd); } @@ -215,8 +218,8 @@ namespace libsecondlife.Packets /// public override ushort ID { - get { return (ushort)((Data[6] << 8) + Data[7]); } - set { Data[6] = (byte)(value >> 8); Data[7] = (byte)(value % 256); } + get { return (ushort)((Data[8] << 8) + Data[9]); } + set { Data[8] = (byte)(value >> 8); Data[9] = (byte)(value % 256); } } /// public override PacketFrequency Frequency { get { return PacketFrequency.Low; } } @@ -226,8 +229,8 @@ namespace libsecondlife.Packets /// public LowHeader() { - Data = new byte[8]; - Data[4] = Data[5] = 0xFF; + Data = new byte[10]; + Data[6] = Data[7] = 0xFF; AckList = new uint[0]; } @@ -239,15 +242,15 @@ namespace libsecondlife.Packets /// public LowHeader(byte[] bytes, ref int pos, ref int packetEnd) { - if (bytes.Length < 8) { throw new MalformedDataException(); } - Data = new byte[8]; - Buffer.BlockCopy(bytes, 0, Data, 0, 8); + if (bytes.Length < 10) { throw new MalformedDataException(); } + Data = new byte[10]; + Buffer.BlockCopy(bytes, 0, Data, 0, 10); - if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0 && bytes[6] == 0) + if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0 && bytes[8] == 0) { - if (bytes[7] == 1) + if (bytes[9] == 1) { - Data[7] = bytes[8]; + Data[9] = bytes[10]; } else { @@ -255,6 +258,57 @@ namespace libsecondlife.Packets } } + pos = 10; + CreateAckList(bytes, ref packetEnd); + } + + /// + /// + /// + /// + /// + public override void ToBytes(byte[] bytes, ref int i) + { + Buffer.BlockCopy(Data, 0, bytes, i, 10); + i += 10; + } + } + + /// + /// + /// + public class MediumHeader : Header + { + /// + public override ushort ID + { + get { return (ushort)Data[7]; } + set { Data[7] = (byte)value; } + } + /// + public override PacketFrequency Frequency { get { return PacketFrequency.Medium; } } + + /// + /// + /// + public MediumHeader() + { + Data = new byte[8]; + Data[6] = 0xFF; + AckList = new uint[0]; + } + + /// + /// + /// + /// + /// + /// + public MediumHeader(byte[] bytes, ref int pos, ref int packetEnd) + { + if (bytes.Length < 8) { throw new MalformedDataException(); } + Data = new byte[8]; + Buffer.BlockCopy(bytes, 0, Data, 0, 8); pos = 8; CreateAckList(bytes, ref packetEnd); } @@ -271,57 +325,6 @@ namespace libsecondlife.Packets } } - /// - /// - /// - public class MediumHeader : Header - { - /// - public override ushort ID - { - get { return (ushort)Data[5]; } - set { Data[5] = (byte)value; } - } - /// - public override PacketFrequency Frequency { get { return PacketFrequency.Medium; } } - - /// - /// - /// - public MediumHeader() - { - Data = new byte[6]; - Data[4] = 0xFF; - AckList = new uint[0]; - } - - /// - /// - /// - /// - /// - /// - public MediumHeader(byte[] bytes, ref int pos, ref int packetEnd) - { - if (bytes.Length < 6) { throw new MalformedDataException(); } - Data = new byte[6]; - Buffer.BlockCopy(bytes, 0, Data, 0, 6); - pos = 6; - CreateAckList(bytes, ref packetEnd); - } - - /// - /// - /// - /// - /// - public override void ToBytes(byte[] bytes, ref int i) - { - Buffer.BlockCopy(Data, 0, bytes, i, 6); - i += 6; - } - } - /// /// /// @@ -330,8 +333,8 @@ namespace libsecondlife.Packets /// public override ushort ID { - get { return (ushort)Data[4]; } - set { Data[4] = (byte)value; } + get { return (ushort)Data[6]; } + set { Data[6] = (byte)value; } } /// public override PacketFrequency Frequency { get { return PacketFrequency.High; } } @@ -341,7 +344,7 @@ namespace libsecondlife.Packets /// public HighHeader() { - Data = new byte[5]; + Data = new byte[7]; AckList = new uint[0]; } @@ -353,10 +356,10 @@ namespace libsecondlife.Packets /// public HighHeader(byte[] bytes, ref int pos, ref int packetEnd) { - if (bytes.Length < 5) { throw new MalformedDataException(); } - Data = new byte[5]; - Buffer.BlockCopy(bytes, 0, Data, 0, 5); - pos = 5; + if (bytes.Length < 7) { throw new MalformedDataException(); } + Data = new byte[7]; + Buffer.BlockCopy(bytes, 0, Data, 0, 7); + pos = 7; CreateAckList(bytes, ref packetEnd); } @@ -367,7 +370,7 @@ namespace libsecondlife.Packets /// public override void ToBytes(byte[] bytes, ref int i) { - Buffer.BlockCopy(Data, 0, bytes, i, 5); - i += 5; + Buffer.BlockCopy(Data, 0, bytes, i, 7); + i += 7; } }