Exemple #1
0
        public static List <IRequest> Serialize(ISession session, string rawRequest)
        {
            List <IRequest> requestList = new List <IRequest>();

            rawRequest = PCMRequestBase.NormalizeRequest(rawRequest);
            if (rawRequest[0] != '\\')
            {
                LogWriter.ToLog(LogEventLevel.Error, "Invalid request recieved!");
                return(null);
            }
            string[] commands = rawRequest.Split("\\final\\", StringSplitOptions.RemoveEmptyEntries);
            foreach (var command in commands)
            {
                IRequest request = GenerateRequest(command);
                if (request == null)
                {
                    continue;
                }
                var flag = (GPError)request.Parse();
                if (flag != GPError.NoError)
                {
                    session.SendAsync(ErrorMsg.BuildGPErrorMsg(flag));
                    continue;
                }
                requestList.Add(request);
            }
            return(requestList);
        }
 protected virtual void BuildErrorResponse()
 {
     _sendingBuffer = ErrorMsg.BuildGPErrorMsg(_errorCode);
 }