Example #1
0
        public string PingCharacter(int character_id)
        {
            GamePongResponse response = new GamePongResponse();

            if (RestUtilities.ValidateJSONRequestHasAuthenticatedSession(Session, out response.result) &&
                RestUtilities.ValidateJSONRequestSessionOwnsCharacter(Session, character_id, out response.result))
            {
                PingCharacterRequestProcessor pingProcessor = new PingCharacterRequestProcessor(character_id);

                if (pingProcessor.ProcessRequest(
                        ApplicationConstants.CONNECTION_STRING,
                        Application,
                        out response.result))
                {
                    response.event_list = pingProcessor.ResultGameEvents;
                    response.result     = SuccessMessages.GENERAL_SUCCESS;
                }
                else
                {
                    response.event_list = new GameEvent[] { };
                }
            }


            return(JSONUtilities.SerializeJSONResponse <GamePongResponse>(response));
        }
Example #2
0
        public string PingCharacter(int character_id)
        {
            GamePongResponse response = new GamePongResponse();

            if (RestUtilities.ValidateJSONRequestHasAuthenticatedSession(Session, out response.result) &&
                RestUtilities.ValidateJSONRequestSessionOwnsCharacter(Session, character_id, out response.result))
            {
                PingCharacterRequestProcessor pingProcessor = new PingCharacterRequestProcessor(character_id);

                if (pingProcessor.ProcessRequest(
                        ApplicationConstants.CONNECTION_STRING,
                        Application,
                        out response.result))
                {
                    response.event_list = pingProcessor.ResultGameEvents;
                    response.result = SuccessMessages.GENERAL_SUCCESS;
                }
                else
                {
                    response.event_list = new GameEvent[] { };
                }
            }

            return JSONUtilities.SerializeJSONResponse<GamePongResponse>(response);
        }
        protected static bool PingCharacter(
            RequestCache requestCache,
            int character_id,
            out GameEvent[] event_list,
            out string result_code)
        {
            PingCharacterRequestProcessor pingProcessor = new PingCharacterRequestProcessor(character_id);
            bool success = pingProcessor.ProcessRequest(requestCache, out result_code);

            if (success)
            {
                result_code = SuccessMessages.GENERAL_SUCCESS;
                event_list = pingProcessor.ResultGameEvents;
            }
            else
            {
                event_list = new GameEvent[] { };
            }

            return success;
        }