/* * This function send a get user statistics request to the server * Input: none * Output: list of the user statistics */ public List <string> getUserStatistics() { send_data(messageCode.GETSTATISTICSCODE); GetStatisticsRes result = recv_data <GetStatisticsRes>(); if (result.status == 1) { return(result.statistics.Skip(1).Take(5).ToList <string>()); // delete not important information } else { return(null); } }
/* * This function send a get high scores request to the server * Input: none * Output: dictionary of the top 5 users and their score */ public Dictionary <string, string> getHighScores() { send_data(messageCode.GETSTATISTICSCODE); GetStatisticsRes result = recv_data <GetStatisticsRes>(); if (result.status == 1) { result.statistics = result.statistics.Skip(6).ToList <string>(); // delete not important information Dictionary <string, string> res = new Dictionary <string, string>(); // insert the keys and values to the dictionary for (int i = 0; i < result.statistics.Count(); i++) { res.Add(result.statistics[i], result.statistics[++i]); } return(res); } else { return(null); } }