Пример #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);
            }
        }
Пример #2
0
        /// <summary>
        /// Generates a log Message
        /// </summary>
        /// <param name="thinkp">thinkp</param>
        /// <param name="instanciathinkp">instanciathinkp</param>
        /// <param name="token">token</param>
        /// <param name="level">level</param>
        /// <param name="code">code</param>
        /// <param name="message">message</param>
        /// <param name="timestamp">timestamp</param>
        /// <returns>Log Message</returns>
        public SSAPMessage <SSAPBodyLogMessage> GenerateLogMessage(string thinkp, string instanciathinkp, string token, SSAPLogLevel level, string code, string message, string timestamp)
        {
            var body = new SSAPBodyLogMessage()
            {
                Code            = code,
                Instanciathinkp = instanciathinkp,
                Level           = level,
                Message         = message,
                Owner           = "",
                Thinkp          = thinkp,
                Timestamp       = timestamp,
                Token           = token
            };

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