Exemplo n.º 1
0
        protected ResponseMessage queryAndVerify(RequestMessage paramRequestMessage)

        {
            paramRequestMessage.writeTo(getOutStream());
            ResponseMessage          localResponseMessage = new ResponseMessage(this.inStream);
            List <Command>           localList1           = paramRequestMessage.Commands();
            List <ResponseContainer> localList2           = localResponseMessage.responses();

            if (localList1.Count > localList2.Count)
            {
                throw new TraCIException("not enough responses received");
            }
            for (int i = 0; i < localList1.Count; i++)
            {
                Command           localCommand           = (Command)localList1[i];
                ResponseContainer localResponseContainer = (ResponseContainer)localList2[i];
                StatusResponse    localStatusResponse    = localResponseContainer.getStatus();
                verify("command and status IDs match", Convert.ToInt32(localCommand.Id()), Convert.ToInt32(localStatusResponse.Id()));
                if (localStatusResponse.Result() != 0)
                {
                    throw new TraCIException("SUMO error for command " + localStatusResponse.Id() + ": " + localStatusResponse.Description());
                }
            }
            return(localResponseMessage);
        }