Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates a GetConfig Message
        /// </summary>
        /// <param name="kp"></param>
        /// <param name="kpInstance"></param>
        /// <param name="token"></param>
        /// <param name="assetService"></param>
        /// <param name="assetServiceParameters"></param>
        /// <returns>GetConfig Message</returns>
        public SSAPMessage <SSAPBodyMessage> GenerateGetConfigMessage(string kp, string kpInstance, string token, string assetService, Dictionary <string, string> assetServiceParameters)
        {
            var body = new SSAPBodyConfigMessage()
            {
                InstanciaKp       = kpInstance,
                Kp                = kp,
                Token             = token,
                AssetService      = assetService,
                AssetServiceParam = assetServiceParameters
            };

            return(new SSAPMessage <SSAPBodyMessage>()
            {
                Body = body,
                Direction = SSAPMessageDirectionEnum.REQUEST,
                MessageType = SSAPMessageTypesEnum.CONFIG
            });
        }