Example #1
0
        private BlackjackResponse send(BlackjackRequest request)
        {
            // If the client is configured for single player mode,
            // just call the enginer directly.
            if (true == Config.SinglePlayerMode)
            {
                return(_singlePlayerEngine.Process(request));
            }

            GameEngineProxy proxy =
                new GameEngineProxy();

            try
            {
                proxy.Open();

                return(proxy.Process(request));
            }
            finally
            {
                if (proxy != null &&
                    proxy.State == CommunicationState.Opened)
                {
                    proxy.Close();
                }
            }
        }
Example #2
0
 private string toString(BlackjackRequest request)
 {
     try
     {
         return(request.ToString());
     }
     catch (Exception exception)
     {
         return(exception.Message);
     }
 }
Example #3
0
        /// <summary>
        /// Processes the incoming blackjack request.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public BlackjackResponse Process(BlackjackRequest request)
        {
            BlackjackResponse response = null;

            try
            {
                response = _engine.Process(request);
            }
            catch (Exception exception)
            {
                response = new BlackjackResponse(
                    request.Table,
                    BlackjackResult.Failure,
                    exception.Message);

                LogHelper.Instance().Write(
                    "Error processing request: " + toString(request),
                    LogEntrySeverityEnum.Error,
                    exception);
            }

            return(response);
        }
Example #4
0
 public BlackjackResponse Process(BlackjackRequest request)
 {
     return(Channel.Process(request));
 }