Serialize() public method

Serialize the object
public Serialize ( ) : OSDMap
return OSDMap
        public void PlacesReplyMessage()
        {
            PlacesReplyMessage s = new PlacesReplyMessage();
            s.TransactionID = UUID.Random();
            s.AgentID = UUID.Random();
            s.QueryID = UUID.Random();
            s.QueryDataBlocks = new PlacesReplyMessage.QueryData[2];

            PlacesReplyMessage.QueryData q1 = new PlacesReplyMessage.QueryData();
            q1.ActualArea = 1024;
            q1.BillableArea = 768;
            q1.Description = "Test Description Q1";
            q1.Dwell = 1435.4f;
            q1.Flags = 1 << 6;
            q1.GlobalX = 1;
            q1.GlobalY = 2;
            q1.GlobalZ = 3;
            q1.Name = "Test Name Q1";
            q1.OwnerID = UUID.Random();
            q1.Price = 1;
            q1.ProductSku = "021";
            q1.SimName = "Hooper";
            q1.SnapShotID = UUID.Random();

            s.QueryDataBlocks[0] = q1;

            PlacesReplyMessage.QueryData q2 = new PlacesReplyMessage.QueryData();
            q2.ActualArea = 512;
            q2.BillableArea = 384;
            q2.Description = "Test Description Q2";
            q2.Dwell = 1;
            q2.Flags = 1 << 4;
            q2.GlobalX = 4;
            q2.GlobalY = 5;
            q2.GlobalZ = 6;
            q2.Name = "Test Name Q2";
            q2.OwnerID = UUID.Random();
            q2.Price = 2;
            q2.ProductSku = "022";
            q2.SimName = "Tethys";
            q2.SnapShotID = UUID.Random();

            s.QueryDataBlocks[1] = q2;

            OSDMap map = s.Serialize();

            PlacesReplyMessage t = new PlacesReplyMessage();
            t.Deserialize(map);

            Assert.AreEqual(s.AgentID, t.AgentID);
            Assert.AreEqual(s.TransactionID, t.TransactionID);
            Assert.AreEqual(s.QueryID, t.QueryID);

            for (int i = 0; i < s.QueryDataBlocks.Length; i++)
            {
                Assert.AreEqual(s.QueryDataBlocks[i].ActualArea, t.QueryDataBlocks[i].ActualArea);
                Assert.AreEqual(s.QueryDataBlocks[i].BillableArea, t.QueryDataBlocks[i].BillableArea);
                Assert.AreEqual(s.QueryDataBlocks[i].Description, t.QueryDataBlocks[i].Description);
                Assert.AreEqual(s.QueryDataBlocks[i].Dwell, t.QueryDataBlocks[i].Dwell);
                Assert.AreEqual(s.QueryDataBlocks[i].Flags, t.QueryDataBlocks[i].Flags);
                Assert.AreEqual(s.QueryDataBlocks[i].GlobalX, t.QueryDataBlocks[i].GlobalX);
                Assert.AreEqual(s.QueryDataBlocks[i].GlobalY, t.QueryDataBlocks[i].GlobalY);
                Assert.AreEqual(s.QueryDataBlocks[i].GlobalZ, t.QueryDataBlocks[i].GlobalZ);
                Assert.AreEqual(s.QueryDataBlocks[i].Name, t.QueryDataBlocks[i].Name);
                Assert.AreEqual(s.QueryDataBlocks[i].OwnerID, t.QueryDataBlocks[i].OwnerID);
                Assert.AreEqual(s.QueryDataBlocks[i].Price, t.QueryDataBlocks[i].Price);
                Assert.AreEqual(s.QueryDataBlocks[i].ProductSku, t.QueryDataBlocks[i].ProductSku);
                Assert.AreEqual(s.QueryDataBlocks[i].SimName, t.QueryDataBlocks[i].SimName);
                Assert.AreEqual(s.QueryDataBlocks[i].SnapShotID, t.QueryDataBlocks[i].SnapShotID);
            }
        }
        public static OSD PlacesQuery(PlacesReplyPacket PlacesReply, string[] regionType)
        {
            OpenMetaverse.Messages.Linden.PlacesReplyMessage message = new PlacesReplyMessage();
            message.AgentID = PlacesReply.AgentData.AgentID;
            message.QueryID = PlacesReply.AgentData.QueryID;
            message.TransactionID = PlacesReply.TransactionData.TransactionID;
            message.QueryDataBlocks = new PlacesReplyMessage.QueryData[PlacesReply.QueryData.Length];
            OSDMap placesReply = new OSDMap {{"message", OSD.FromString("PlacesReplyMessage")}};

            int i = 0;
            foreach (PlacesReplyPacket.QueryDataBlock groupDataBlock in PlacesReply.QueryData)
            {
                message.QueryDataBlocks[i] = new PlacesReplyMessage.QueryData();
                message.QueryDataBlocks[i].ActualArea = groupDataBlock.ActualArea;
                message.QueryDataBlocks[i].BillableArea = groupDataBlock.BillableArea;
                message.QueryDataBlocks[i].Description = Utils.BytesToString(groupDataBlock.Desc);
                message.QueryDataBlocks[i].Dwell = groupDataBlock.Dwell;
                message.QueryDataBlocks[i].Flags = groupDataBlock.Flags;
                message.QueryDataBlocks[i].GlobalX = groupDataBlock.GlobalX;
                message.QueryDataBlocks[i].GlobalY = groupDataBlock.GlobalY;
                message.QueryDataBlocks[i].GlobalZ = groupDataBlock.GlobalZ;
                message.QueryDataBlocks[i].Name = Utils.BytesToString(groupDataBlock.Name);
                message.QueryDataBlocks[i].OwnerID = groupDataBlock.OwnerID;
                message.QueryDataBlocks[i].SimName = Utils.BytesToString(groupDataBlock.SimName);
                message.QueryDataBlocks[i].SnapShotID = groupDataBlock.SnapshotID;
                message.QueryDataBlocks[i].ProductSku = regionType[i];
                message.QueryDataBlocks[i].Price = groupDataBlock.Price;

                i++;
            }
            OSDMap map = message.Serialize();
            placesReply["body"] = map;
            return placesReply;
        }