OpenMetaverse.Messages.Linden.SendPostcardMessage.Deserialize C# (CSharp) Méthode

Deserialize() public méthode

Deserialize the message
public Deserialize ( OSDMap map ) : void
map OSDMap An containing the data
Résultat void
        public void Deserialize(OSDMap map)
        {
            FromEmail = map["from"].AsString();
            Message = map["msg"].AsString();
            FromName = map["name"].AsString();
            GlobalPosition = map["pos-global"].AsVector3();
            Subject = map["subject"].AsString();
            ToEmail = map["to"].AsString();
        }
    }

Usage Example

        public void SendPostcardMessage()
        {
            SendPostcardMessage s = new SendPostcardMessage();
            s.FromEmail = "*****@*****.**";
            s.FromName = "Jim Radford";
            s.GlobalPosition = Vector3.One;
            s.Message = "Hello, How are you today?";
            s.Subject = "Postcard from the edge";
            s.ToEmail = "*****@*****.**";

            OSDMap map = s.Serialize();

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

            Assert.AreEqual(s.FromEmail, t.FromEmail);
            Assert.AreEqual(s.FromName, t.FromName);
            Assert.AreEqual(s.GlobalPosition, t.GlobalPosition);
            Assert.AreEqual(s.Message, t.Message);
            Assert.AreEqual(s.Subject, t.Subject);
            Assert.AreEqual(s.ToEmail, t.ToEmail);
        }
SendPostcardMessage