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); }
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); }