OpenMetaverse.Messages.Linden.TeleportFinishMessage.Serialize C# (CSharp) Method

Serialize() public method

Serialize the object
public Serialize ( ) : OSDMap
return OSDMap
        public OSDMap Serialize()
        {
            OSDMap map = new OSDMap(1);

            OSDArray infoArray = new OSDArray(1);

            OSDMap info = new OSDMap(8);
            info.Add("AgentID", OSD.FromUUID(AgentID));
            info.Add("LocationID", OSD.FromInteger(LocationID)); // Unused by the client
            info.Add("RegionHandle", OSD.FromULong(RegionHandle));
            info.Add("SeedCapability", OSD.FromUri(SeedCapability));
            info.Add("SimAccess", OSD.FromInteger((byte)SimAccess));
            info.Add("SimIP", MessageUtils.FromIP(IP));
            info.Add("SimPort", OSD.FromInteger(Port));
            info.Add("TeleportFlags", OSD.FromUInteger((uint)Flags));

            infoArray.Add(info);

            map.Add("Info", infoArray);

            return map;
        }

Usage Example

        public void TeleportFinishMessage()
        {
            TeleportFinishMessage s = new TeleportFinishMessage();
            s.AgentID = UUID.Random();
            s.Flags = TeleportFlags.ViaLocation | TeleportFlags.IsFlying;
            s.IP = testIP;
            s.LocationID = 32767;
            s.Port = 3000;
            s.RegionHandle = testHandle;
            s.SeedCapability = testURI;
            s.SimAccess = SimAccess.Mature;

            OSDMap map = s.Serialize();

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

            Assert.AreEqual(s.AgentID, t.AgentID);
            Assert.AreEqual(s.Flags, t.Flags);
            Assert.AreEqual(s.IP, t.IP);
            Assert.AreEqual(s.LocationID, t.LocationID);
            Assert.AreEqual(s.Port, t.Port);
            Assert.AreEqual(s.RegionHandle, t.RegionHandle);
            Assert.AreEqual(s.SeedCapability, t.SeedCapability);
            Assert.AreEqual(s.SimAccess, t.SimAccess);
        }
TeleportFinishMessage