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

Deserialize() public method

Deserialize the message
public Deserialize ( OSDMap map ) : void
map OSDMap An containing the data
return void
        public override void Deserialize(OSDMap map)
        {
            Method = map["method"].AsString();
            SessionID = map["session-id"].AsUUID();

            OSDMap paramsMap = (OSDMap)map["params"];
            OSDMap muteMap = (OSDMap)paramsMap["mute_info"];

            AgentID = paramsMap["agent_id"].AsUUID();

            if (muteMap.ContainsKey("text"))
                RequestKey = "text";
            else if (muteMap.ContainsKey("voice"))
                RequestKey = "voice";

            RequestValue = muteMap[RequestKey].AsBoolean();
        }
    }

Usage Example

        public void ChatSessionRequestMuteUpdate()
        {
            ChatSessionRequestMuteUpdate s = new ChatSessionRequestMuteUpdate();
            s.AgentID = UUID.Random();
            s.RequestKey = "text";
            s.RequestValue = true;
            s.SessionID = UUID.Random();

            OSDMap map = s.Serialize();

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

            Assert.AreEqual(s.AgentID, t.AgentID);
            Assert.AreEqual(s.Method, t.Method);
            Assert.AreEqual(s.RequestKey, t.RequestKey);
            Assert.AreEqual(s.RequestValue, t.RequestValue);
            Assert.AreEqual(s.SessionID, t.SessionID);
        }