public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) { OSDMap message = new OSDMap {{"message", OSD.FromString("ParcelProperties")}}; OSD message_body = parcelPropertiesMessage.Serialize(); message.Add("body", message_body); return message; }
public void ReflectionPerformanceParcelProperties() { DateTime messageTestTime = DateTime.UtcNow; for (int x = 0; x < TEST_ITER; x++) { ParcelPropertiesMessage s = new ParcelPropertiesMessage(); s.AABBMax = Vector3.Parse("<1,2,3>"); s.AABBMin = Vector3.Parse("<2,3,1>"); s.Area = 1024; s.AuctionID = uint.MaxValue; s.AuthBuyerID = UUID.Random(); s.Bitmap = Utils.EmptyBytes; s.Category = ParcelCategory.Educational; s.ClaimDate = new DateTime(2008, 12, 25, 3, 15, 22); s.ClaimPrice = 1000; s.Desc = "Test Description"; s.GroupID = UUID.Random(); s.GroupPrims = 50; s.IsGroupOwned = false; s.LandingType = LandingType.None; s.LocalID = 1; s.MaxPrims = 234; s.MediaAutoScale = false; s.MediaDesc = "Example Media Description"; s.MediaHeight = 480; s.MediaID = UUID.Random(); s.MediaLoop = false; s.MediaType = "text/html"; s.MediaURL = "http://www.openmetaverse.co"; s.MediaWidth = 640; s.MusicURL = "http://scfire-ntc-aa04.stream.aol.com:80/stream/1075"; // Yee Haw s.Name = "Test Name"; s.ObscureMedia = false; s.ObscureMusic = false; s.OtherCleanTime = 5; s.OtherCount = 200; s.OtherPrims = 300; s.OwnerID = UUID.Random(); s.OwnerPrims = 0; s.ParcelFlags = ParcelFlags.AllowDamage | ParcelFlags.AllowGroupScripts | ParcelFlags.AllowVoiceChat; s.ParcelPrimBonus = 0f; s.PassHours = 1.5f; s.PassPrice = 10; s.PublicCount = 20; s.RegionDenyAgeUnverified = false; s.RegionDenyAnonymous = false; s.RegionPushOverride = true; s.RentPrice = 0; s.RequestResult = ParcelResult.Single; s.SalePrice = 9999; s.SelectedPrims = 1; s.SelfCount = 2; s.SequenceID = -4000; s.SimWideMaxPrims = 937; s.SimWideTotalPrims = 117; s.SnapSelection = false; s.SnapshotID = UUID.Random(); s.Status = ParcelStatus.Leased; s.TotalPrims = 219; s.UserLocation = Vector3.Parse("<3,4,5>"); s.UserLookAt = Vector3.Parse("<5,4,3>"); OSDMap map = s.Serialize(); ParcelPropertiesMessage t = new ParcelPropertiesMessage(); t.Deserialize(map); Assert.AreEqual(s.AABBMax, t.AABBMax); Assert.AreEqual(s.AABBMin, t.AABBMin); Assert.AreEqual(s.Area, t.Area); Assert.AreEqual(s.AuctionID, t.AuctionID); Assert.AreEqual(s.AuthBuyerID, t.AuthBuyerID); Assert.AreEqual(s.Bitmap, t.Bitmap); Assert.AreEqual(s.Category, t.Category); Assert.AreEqual(s.ClaimDate, t.ClaimDate); Assert.AreEqual(s.ClaimPrice, t.ClaimPrice); Assert.AreEqual(s.Desc, t.Desc); Assert.AreEqual(s.GroupID, t.GroupID); Assert.AreEqual(s.GroupPrims, t.GroupPrims); Assert.AreEqual(s.IsGroupOwned, t.IsGroupOwned); Assert.AreEqual(s.LandingType, t.LandingType); Assert.AreEqual(s.LocalID, t.LocalID); Assert.AreEqual(s.MaxPrims, t.MaxPrims); Assert.AreEqual(s.MediaAutoScale, t.MediaAutoScale); Assert.AreEqual(s.MediaDesc, t.MediaDesc); Assert.AreEqual(s.MediaHeight, t.MediaHeight); Assert.AreEqual(s.MediaID, t.MediaID); Assert.AreEqual(s.MediaLoop, t.MediaLoop); Assert.AreEqual(s.MediaType, t.MediaType); Assert.AreEqual(s.MediaURL, t.MediaURL); Assert.AreEqual(s.MediaWidth, t.MediaWidth); Assert.AreEqual(s.MusicURL, t.MusicURL); Assert.AreEqual(s.Name, t.Name); Assert.AreEqual(s.ObscureMedia, t.ObscureMedia); Assert.AreEqual(s.ObscureMusic, t.ObscureMusic); Assert.AreEqual(s.OtherCleanTime, t.OtherCleanTime); Assert.AreEqual(s.OtherCount, t.OtherCount); Assert.AreEqual(s.OtherPrims, t.OtherPrims); Assert.AreEqual(s.OwnerID, t.OwnerID); Assert.AreEqual(s.OwnerPrims, t.OwnerPrims); Assert.AreEqual(s.ParcelFlags, t.ParcelFlags); Assert.AreEqual(s.ParcelPrimBonus, t.ParcelPrimBonus); Assert.AreEqual(s.PassHours, t.PassHours); Assert.AreEqual(s.PassPrice, t.PassPrice); Assert.AreEqual(s.PublicCount, t.PublicCount); Assert.AreEqual(s.RegionDenyAgeUnverified, t.RegionDenyAgeUnverified); Assert.AreEqual(s.RegionDenyAnonymous, t.RegionDenyAnonymous); Assert.AreEqual(s.RegionPushOverride, t.RegionPushOverride); Assert.AreEqual(s.RentPrice, t.RentPrice); Assert.AreEqual(s.RequestResult, t.RequestResult); Assert.AreEqual(s.SalePrice, t.SalePrice); Assert.AreEqual(s.SelectedPrims, t.SelectedPrims); Assert.AreEqual(s.SelfCount, t.SelfCount); Assert.AreEqual(s.SequenceID, t.SequenceID); Assert.AreEqual(s.SimWideMaxPrims, t.SimWideMaxPrims); Assert.AreEqual(s.SimWideTotalPrims, t.SimWideTotalPrims); Assert.AreEqual(s.SnapSelection, t.SnapSelection); Assert.AreEqual(s.SnapshotID, t.SnapshotID); Assert.AreEqual(s.Status, t.Status); Assert.AreEqual(s.TotalPrims, t.TotalPrims); Assert.AreEqual(s.UserLocation, t.UserLocation); Assert.AreEqual(s.UserLookAt, t.UserLookAt); } TimeSpan duration = DateTime.UtcNow - messageTestTime; Console.WriteLine("ParcelPropertiesMessage: OMV Message System Serialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, duration); BinaryFormatter formatter = new BinaryFormatter(); DateTime xmlTestTime = DateTime.UtcNow; for (int x = 0; x < TEST_ITER; x++) { ParcelPropertiesMessage s = new ParcelPropertiesMessage(); s.AABBMax = Vector3.Parse("<1,2,3>"); s.AABBMin = Vector3.Parse("<2,3,1>"); s.Area = 1024; s.AuctionID = uint.MaxValue; s.AuthBuyerID = UUID.Random(); s.Bitmap = Utils.EmptyBytes; s.Category = ParcelCategory.Educational; s.ClaimDate = new DateTime(2008, 12, 25, 3, 15, 22); s.ClaimPrice = 1000; s.Desc = "Test Description"; s.GroupID = UUID.Random(); s.GroupPrims = 50; s.IsGroupOwned = false; s.LandingType = LandingType.None; s.LocalID = 1; s.MaxPrims = 234; s.MediaAutoScale = false; s.MediaDesc = "Example Media Description"; s.MediaHeight = 480; s.MediaID = UUID.Random(); s.MediaLoop = false; s.MediaType = "text/html"; s.MediaURL = "http://www.openmetaverse.co"; s.MediaWidth = 640; s.MusicURL = "http://scfire-ntc-aa04.stream.aol.com:80/stream/1075"; // Yee Haw s.Name = "Test Name"; s.ObscureMedia = false; s.ObscureMusic = false; s.OtherCleanTime = 5; s.OtherCount = 200; s.OtherPrims = 300; s.OwnerID = UUID.Random(); s.OwnerPrims = 0; s.ParcelFlags = ParcelFlags.AllowDamage | ParcelFlags.AllowGroupScripts | ParcelFlags.AllowVoiceChat; s.ParcelPrimBonus = 0f; s.PassHours = 1.5f; s.PassPrice = 10; s.PublicCount = 20; s.RegionDenyAgeUnverified = false; s.RegionDenyAnonymous = false; s.RegionPushOverride = true; s.RentPrice = 0; s.RequestResult = ParcelResult.Single; s.SalePrice = 9999; s.SelectedPrims = 1; s.SelfCount = 2; s.SequenceID = -4000; s.SimWideMaxPrims = 937; s.SimWideTotalPrims = 117; s.SnapSelection = false; s.SnapshotID = UUID.Random(); s.Status = ParcelStatus.Leased; s.TotalPrims = 219; s.UserLocation = Vector3.Parse("<3,4,5>"); s.UserLookAt = Vector3.Parse("<5,4,3>"); MemoryStream stream = new MemoryStream(); formatter.Serialize(stream, s); stream.Seek(0, SeekOrigin.Begin); ParcelPropertiesMessage t = (ParcelPropertiesMessage)formatter.Deserialize(stream); Assert.AreEqual(s.AABBMax, t.AABBMax); Assert.AreEqual(s.AABBMin, t.AABBMin); Assert.AreEqual(s.Area, t.Area); Assert.AreEqual(s.AuctionID, t.AuctionID); Assert.AreEqual(s.AuthBuyerID, t.AuthBuyerID); Assert.AreEqual(s.Bitmap, t.Bitmap); Assert.AreEqual(s.Category, t.Category); Assert.AreEqual(s.ClaimDate, t.ClaimDate); Assert.AreEqual(s.ClaimPrice, t.ClaimPrice); Assert.AreEqual(s.Desc, t.Desc); Assert.AreEqual(s.GroupID, t.GroupID); Assert.AreEqual(s.GroupPrims, t.GroupPrims); Assert.AreEqual(s.IsGroupOwned, t.IsGroupOwned); Assert.AreEqual(s.LandingType, t.LandingType); Assert.AreEqual(s.LocalID, t.LocalID); Assert.AreEqual(s.MaxPrims, t.MaxPrims); Assert.AreEqual(s.MediaAutoScale, t.MediaAutoScale); Assert.AreEqual(s.MediaDesc, t.MediaDesc); Assert.AreEqual(s.MediaHeight, t.MediaHeight); Assert.AreEqual(s.MediaID, t.MediaID); Assert.AreEqual(s.MediaLoop, t.MediaLoop); Assert.AreEqual(s.MediaType, t.MediaType); Assert.AreEqual(s.MediaURL, t.MediaURL); Assert.AreEqual(s.MediaWidth, t.MediaWidth); Assert.AreEqual(s.MusicURL, t.MusicURL); Assert.AreEqual(s.Name, t.Name); Assert.AreEqual(s.ObscureMedia, t.ObscureMedia); Assert.AreEqual(s.ObscureMusic, t.ObscureMusic); Assert.AreEqual(s.OtherCleanTime, t.OtherCleanTime); Assert.AreEqual(s.OtherCount, t.OtherCount); Assert.AreEqual(s.OtherPrims, t.OtherPrims); Assert.AreEqual(s.OwnerID, t.OwnerID); Assert.AreEqual(s.OwnerPrims, t.OwnerPrims); Assert.AreEqual(s.ParcelFlags, t.ParcelFlags); Assert.AreEqual(s.ParcelPrimBonus, t.ParcelPrimBonus); Assert.AreEqual(s.PassHours, t.PassHours); Assert.AreEqual(s.PassPrice, t.PassPrice); Assert.AreEqual(s.PublicCount, t.PublicCount); Assert.AreEqual(s.RegionDenyAgeUnverified, t.RegionDenyAgeUnverified); Assert.AreEqual(s.RegionDenyAnonymous, t.RegionDenyAnonymous); Assert.AreEqual(s.RegionPushOverride, t.RegionPushOverride); Assert.AreEqual(s.RentPrice, t.RentPrice); Assert.AreEqual(s.RequestResult, t.RequestResult); Assert.AreEqual(s.SalePrice, t.SalePrice); Assert.AreEqual(s.SelectedPrims, t.SelectedPrims); Assert.AreEqual(s.SelfCount, t.SelfCount); Assert.AreEqual(s.SequenceID, t.SequenceID); Assert.AreEqual(s.SimWideMaxPrims, t.SimWideMaxPrims); Assert.AreEqual(s.SimWideTotalPrims, t.SimWideTotalPrims); Assert.AreEqual(s.SnapSelection, t.SnapSelection); Assert.AreEqual(s.SnapshotID, t.SnapshotID); Assert.AreEqual(s.Status, t.Status); Assert.AreEqual(s.TotalPrims, t.TotalPrims); Assert.AreEqual(s.UserLocation, t.UserLocation); Assert.AreEqual(s.UserLookAt, t.UserLookAt); } TimeSpan durationxml = DateTime.UtcNow - xmlTestTime; Console.WriteLine("ParcelPropertiesMessage: .NET BinarySerialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, durationxml); }
public void ParcelPropertiesMessage() { ParcelPropertiesMessage s = new ParcelPropertiesMessage(); s.AABBMax = Vector3.Parse("<1,2,3>"); s.AABBMin = Vector3.Parse("<2,3,1>"); s.Area = 1024; s.AuctionID = uint.MaxValue; s.AuthBuyerID = UUID.Random(); s.Bitmap = Utils.EmptyBytes; s.Category = ParcelCategory.Educational; s.ClaimDate = new DateTime(2008, 12, 25, 3, 15, 22); s.ClaimPrice = 1000; s.Desc = "Test Description"; s.GroupID = UUID.Random(); s.GroupPrims = 50; s.IsGroupOwned = false; s.LandingType = LandingType.None; s.LocalID = 1; s.MaxPrims = 234; s.MediaAutoScale = false; s.MediaDesc = "Example Media Description"; s.MediaHeight = 480; s.MediaID = UUID.Random(); s.MediaLoop = false; s.MediaType = "text/html"; s.MediaURL = "http://www.openmetaverse.co"; s.MediaWidth = 640; s.MusicURL = "http://scfire-ntc-aa04.stream.aol.com:80/stream/1075"; // Yee Haw s.Name = "Test Name"; s.ObscureMedia = false; s.ObscureMusic = false; s.OtherCleanTime = 5; s.OtherCount = 200; s.OtherPrims = 300; s.OwnerID = UUID.Random(); s.OwnerPrims = 0; s.ParcelFlags = ParcelFlags.AllowDamage | ParcelFlags.AllowGroupScripts | ParcelFlags.AllowVoiceChat; s.ParcelPrimBonus = 0f; s.PassHours = 1.5f; s.PassPrice = 10; s.PublicCount = 20; s.RegionDenyAgeUnverified = false; s.RegionDenyAnonymous = false; s.RegionPushOverride = true; s.RentPrice = 0; s.RequestResult = ParcelResult.Single; s.SalePrice = 9999; s.SelectedPrims = 1; s.SelfCount = 2; s.SequenceID = -4000; s.SimWideMaxPrims = 937; s.SimWideTotalPrims = 117; s.SnapSelection = false; s.SnapshotID = UUID.Random(); s.Status = ParcelStatus.Leased; s.TotalPrims = 219; s.UserLocation = Vector3.Parse("<3,4,5>"); s.UserLookAt = Vector3.Parse("<5,4,3>"); OSDMap map = s.Serialize(); ParcelPropertiesMessage t = new ParcelPropertiesMessage(); t.Deserialize(map); Assert.AreEqual(s.AABBMax, t.AABBMax); Assert.AreEqual(s.AABBMin, t.AABBMin); Assert.AreEqual(s.Area, t.Area); Assert.AreEqual(s.AuctionID, t.AuctionID); Assert.AreEqual(s.AuthBuyerID, t.AuthBuyerID); Assert.AreEqual(s.Bitmap, t.Bitmap); Assert.AreEqual(s.Category, t.Category); Assert.AreEqual(s.ClaimDate, t.ClaimDate); Assert.AreEqual(s.ClaimPrice, t.ClaimPrice); Assert.AreEqual(s.Desc, t.Desc); Assert.AreEqual(s.GroupID, t.GroupID); Assert.AreEqual(s.GroupPrims, t.GroupPrims); Assert.AreEqual(s.IsGroupOwned, t.IsGroupOwned); Assert.AreEqual(s.LandingType, t.LandingType); Assert.AreEqual(s.LocalID, t.LocalID); Assert.AreEqual(s.MaxPrims, t.MaxPrims); Assert.AreEqual(s.MediaAutoScale, t.MediaAutoScale); Assert.AreEqual(s.MediaDesc, t.MediaDesc); Assert.AreEqual(s.MediaHeight, t.MediaHeight); Assert.AreEqual(s.MediaID, t.MediaID); Assert.AreEqual(s.MediaLoop, t.MediaLoop); Assert.AreEqual(s.MediaType, t.MediaType); Assert.AreEqual(s.MediaURL, t.MediaURL); Assert.AreEqual(s.MediaWidth, t.MediaWidth); Assert.AreEqual(s.MusicURL, t.MusicURL); Assert.AreEqual(s.Name, t.Name); Assert.AreEqual(s.ObscureMedia, t.ObscureMedia); Assert.AreEqual(s.ObscureMusic, t.ObscureMusic); Assert.AreEqual(s.OtherCleanTime, t.OtherCleanTime); Assert.AreEqual(s.OtherCount, t.OtherCount); Assert.AreEqual(s.OtherPrims, t.OtherPrims); Assert.AreEqual(s.OwnerID, t.OwnerID); Assert.AreEqual(s.OwnerPrims, t.OwnerPrims); Assert.AreEqual(s.ParcelFlags, t.ParcelFlags); Assert.AreEqual(s.ParcelPrimBonus, t.ParcelPrimBonus); Assert.AreEqual(s.PassHours, t.PassHours); Assert.AreEqual(s.PassPrice, t.PassPrice); Assert.AreEqual(s.PublicCount, t.PublicCount); Assert.AreEqual(s.RegionDenyAgeUnverified, t.RegionDenyAgeUnverified); Assert.AreEqual(s.RegionDenyAnonymous, t.RegionDenyAnonymous); Assert.AreEqual(s.RegionPushOverride, t.RegionPushOverride); Assert.AreEqual(s.RentPrice, t.RentPrice); Assert.AreEqual(s.RequestResult, t.RequestResult); Assert.AreEqual(s.SalePrice, t.SalePrice); Assert.AreEqual(s.SelectedPrims, t.SelectedPrims); Assert.AreEqual(s.SelfCount, t.SelfCount); Assert.AreEqual(s.SequenceID, t.SequenceID); Assert.AreEqual(s.SimWideMaxPrims, t.SimWideMaxPrims); Assert.AreEqual(s.SimWideTotalPrims, t.SimWideTotalPrims); Assert.AreEqual(s.SnapSelection, t.SnapSelection); Assert.AreEqual(s.SnapshotID, t.SnapshotID); Assert.AreEqual(s.Status, t.Status); Assert.AreEqual(s.TotalPrims, t.TotalPrims); Assert.AreEqual(s.UserLocation, t.UserLocation); Assert.AreEqual(s.UserLookAt, t.UserLookAt); }
private void SendParcelProperties(int parcelID, int sequenceID, bool snapSelection, ParcelResult result, LLAgent agent) { SceneParcel parcel; if (m_parcels.TryGetParcel(parcelID, out parcel)) { // Owner sanity check if (parcel.OwnerID == UUID.Zero) { m_log.Warn("Assigning parcel " + parcel.Name + " to " + agent.Name); parcel.OwnerID = agent.ID; m_parcels.AddOrUpdateParcel(parcel); } // Claim date sanity check if (parcel.ClaimDate <= Utils.Epoch) { m_log.Warn("Resetting invalid parcel claim date"); parcel.ClaimDate = DateTime.UtcNow; m_parcels.AddOrUpdateParcel(parcel); } ParcelPropertiesMessage properties = new ParcelPropertiesMessage(); properties.Area = ParcelManager.GetParcelArea(parcel, out properties.AABBMin, out properties.AABBMax); properties.AuctionID = 0; // Unused properties.AuthBuyerID = parcel.AuthBuyerID; properties.Bitmap = parcel.Bitmap; properties.Category = parcel.Category; properties.ClaimDate = parcel.ClaimDate; properties.ClaimPrice = 0; // Deprecated properties.Desc = parcel.Desc; properties.GroupID = parcel.GroupID; properties.IsGroupOwned = parcel.IsGroupOwned; properties.LandingType = parcel.Landing; properties.LocalID = parcel.LocalID; properties.MaxPrims = parcel.MaxPrims; properties.MediaAutoScale = parcel.Media.MediaAutoScale; properties.MediaDesc = parcel.Media.MediaDesc; properties.MediaHeight = parcel.Media.MediaHeight; properties.MediaID = parcel.Media.MediaID; properties.MediaLoop = parcel.Media.MediaLoop; properties.MediaType = parcel.Media.MediaType; properties.MediaURL = parcel.Media.MediaURL; properties.MediaWidth = parcel.Media.MediaWidth; properties.MusicURL = parcel.Media.MediaURL; properties.Name = parcel.Name; properties.ObscureMedia = parcel.ObscureMedia; properties.ObscureMusic = parcel.ObscureMusic; properties.OtherCleanTime = parcel.AutoReturnTime; properties.OwnerID = parcel.OwnerID; properties.ParcelFlags = parcel.Flags; properties.ParcelPrimBonus = 1f; properties.PassHours = parcel.PassHours; properties.PassPrice = parcel.PassPrice; properties.RegionDenyAgeUnverified = parcel.DenyAgeUnverified; properties.RegionDenyAnonymous = parcel.DenyAnonymous; properties.RegionDenyIdentified = false; properties.RegionDenyTransacted = false; properties.RegionPushOverride = parcel.PushOverride; properties.RentPrice = 0; // Deprecated properties.RequestResult = result; properties.SalePrice = parcel.SalePrice; properties.SequenceID = sequenceID; properties.SnapSelection = snapSelection; properties.SnapshotID = parcel.SnapshotID; properties.Status = parcel.Status; properties.UserLocation = parcel.LandingLocation; properties.UserLookAt = parcel.LandingLookAt; int ownerPrims = 0; int groupPrims = 0; int otherPrims = 0; int selectedPrims = 0; lock (parcel.ParcelEntities) { foreach (ISceneEntity entity in parcel.ParcelEntities.Values) { // TODO: We don't currently track whether objects have been shared/deeded to group? if (entity.OwnerID == parcel.OwnerID) ++ownerPrims; else ++otherPrims; // TODO: We don't currently track selected prims } } properties.OwnerPrims = ownerPrims; properties.GroupPrims = groupPrims; properties.OtherPrims = otherPrims; properties.TotalPrims = ownerPrims + groupPrims + otherPrims; properties.SelectedPrims = selectedPrims; // TODO: Implement these properties.SimWideMaxPrims = 0; properties.SimWideTotalPrims = 0; // TODO: What are these? properties.SelfCount = 0; properties.PublicCount = 0; properties.OtherCount = 0; agent.EventQueue.QueueEvent("ParcelProperties", properties.Serialize()); } else { m_log.Warn("SendParcelProperties() called for unknown parcel " + parcelID); } }