protected override SSAPBodyMessage Create(Type objectType, JObject jsonObject) { string type = jsonObject["@type"].Value <String>(); switch (type) { case "SSAPBodyReturnMessage": return(SSAPBodyReturnMessage.FromJson(jsonObject.ToString())); case "SSAPBodyConfigMessage": return(SSAPBodyConfigMessage.FromJson(jsonObject.ToString())); case "SSAPBodyJoinMessage": return(SSAPBodyJoinMessage.FromJson(jsonObject.ToString())); case "SSAPBodyJoinTokenMessage": return(SSAPBodyJoinMessage.FromJson(jsonObject.ToString())); case "SSAPBodyJoinUserAndPasswordMessage": return(SSAPBodyJoinUserAndPasswordMessage.FromJson(jsonObject.ToString())); case "SSAPBodyLeaveMessage": return(SSAPBodyLeaveMessage.FromJson(jsonObject.ToString())); case "SSAPBodyMessage": return(SSAPBodyMessage.FromJson(jsonObject.ToString())); case "SSAPBodyOperationMessage": return(SSAPBodyOperationMessage.FromJson(jsonObject.ToString())); case "SSAPBodyQueryMessage": return(SSAPBodyQueryMessage.FromJson(jsonObject.ToString())); case "SSAPBodyQueryWithParamMessage": return(SSAPBodyQueryWithParamMessage.FromJson(jsonObject.ToString())); case "SSAPBodySubscribeMessage": return(SSAPBodySubscribeMessage.FromJson(jsonObject.ToString())); case "SSAPBodyUnsubscribeMessage": return(SSAPBodyUnsubscribeMessage.FromJson(jsonObject.ToString())); case "SSAPBodyLogMessage": return(SSAPBodyLogMessage.FromJson(jsonObject.ToString())); default: return(null); } }
/// <summary> /// Generates a native Subscribe Message /// </summary> /// <param name="sessionKey">Session Key</param> /// <param name="ontology">Ontoogy</param> /// <param name="msRefresh">Refresh Time in milliseconds</param> /// <param name="query">Query</param> /// <param name="queryType">Query Type</param> /// <returns>Subscribe Message</returns> public SSAPMessage <SSAPBodySubscribeMessage> GenerateSubscribeMessage(string sessionKey, string ontology, int msRefresh, string query, SSAPQueryTypeEnum queryType) { var body = new SSAPBodySubscribeMessage() { Query = query, MsRefresh = msRefresh, QueryType = queryType }; return(new SSAPMessage <SSAPBodySubscribeMessage>() { SessionKey = sessionKey, Body = body, Direction = SSAPMessageDirectionEnum.REQUEST, MessageType = SSAPMessageTypesEnum.SUBSCRIBE, Ontology = ontology }); }