OpenMetaverse.Messages.Linden.EstablishAgentCommunicationMessage.Deserialize C# (CSharp) Method

Deserialize() public method

Deserialize the message
public Deserialize ( OSDMap map ) : void
map OSDMap An containing the data
return void
        public void Deserialize(OSDMap map)
        {
            string ipAndPort = map["sim-ip-and-port"].AsString();
            int i = ipAndPort.IndexOf(':');

            AgentID = map["agent-id"].AsUUID();
            Address = IPAddress.Parse(ipAndPort.Substring(0, i));
            Port = Int32.Parse(ipAndPort.Substring(i + 1));
            SeedCapability = map["seed-capability"].AsUri();
        }
    }

Usage Example

        public void EstablishAgentCommunicationMessage()
        {
            EstablishAgentCommunicationMessage s = new EstablishAgentCommunicationMessage();
            s.Address = testIP;
            s.AgentID = UUID.Random();
            s.Port = 3000;
            s.SeedCapability = testURI;

            OSDMap map = s.Serialize();

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

            Assert.AreEqual(s.Address, t.Address);
            Assert.AreEqual(s.AgentID, t.AgentID);
            Assert.AreEqual(s.Port, t.Port);
            Assert.AreEqual(s.SeedCapability, t.SeedCapability);
        }
EstablishAgentCommunicationMessage