Ejemplo n.º 1
0
        /// -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        // -----------------------------------------------------------------
        protected ResponseBase MessageFormatRequestHandler(RequestBase irequest)
        {
            if (irequest.GetType() != typeof(MessageFormatRequest))
            {
                m_log.WarnFormat("[InfoHandler] wrong type");
                return(new ResponseBase(ResponseCode.Failure, "wrong type"));
            }

            MessageFormatRequest req = (MessageFormatRequest)irequest;

            Type type = null;

            if (!MessageBase.FindRegisteredTypeByName(req.MessageName, out type))
            {
                m_log.WarnFormat("[InfoHandler] unknown type");
                return(new ResponseBase(ResponseCode.Failure, "unknown type"));
            }

            RequestBase obj = (RequestBase)Activator.CreateInstance(type);

            return(new MessageFormatResponse(obj.SerializeToString()));
        }