Пример #1
0
        public static Collection <PartialMatche> Search(string strSearch, GamesPlateform plateform)
        {
            if (string.IsNullOrEmpty(strSearch) == false)
            {
                Uri strUrl;
                switch (plateform)
                {
                case GamesPlateform.All:
                    strUrl = new Uri(string.Format(Url + @"/GetGamesList.php?name={0}", strSearch));
                    break;

                case GamesPlateform.Nds:
                    strUrl =
                        new Uri(string.Format(Url + @"/GetGamesList.php?name={0}&platform={1}", strSearch,
                                              "Nintendo DS"));
                    break;

                default:
                    strUrl = new Uri(string.Format(Url + @"/GetGamesList.php?name={0}", strSearch));
                    break;
                }

                string results = Util.GetRest(strUrl);
                if (string.IsNullOrEmpty(results) == false)
                {
                    XElement restResponse = XElement.Parse(results);
                    return(TheGamesDb.GamesToPartialMatche(restResponse));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }