Exemplo n.º 1
0
            public GetScoresResponse Get([FromBody] GetScoresRequest request)
            {
                var response = new GetScoresResponse();

                try
                {
                    if (request == null)
                    {
                        throw new Exception("request is null - input format may be incorrect");
                    }

                    if (request.publicKey != PublicKey)
                    {
                        throw new Exception("invalid access key");
                    }

                    if (string.IsNullOrEmpty(request.game))
                    {
                        throw new Exception("no game was specified");
                    }

                    var maxCount = request.maxCount > 0 ? request.maxCount : int.MaxValue;
                    response.scores = highScores.GetScores(request.game, maxCount);
                    response.status = 0;
                }
                catch (Exception ex)
                {
                    response.status  = 1;
                    response.message = ex.ToString();
                }

                return(response);
            }