예제 #1
0
        public static AmiiboList GetAllAmiibos()
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
            var list = new AmiiboList();

            try
            {
                var json = JObject.Parse(new WebClient().DownloadString(AmiiboAPIURL));
                foreach (var entry in json["amiibo"])
                {
                    var amiibo = new Amiibo
                    {
                        AmiiboName    = entry["name"].ToString(),
                        SeriesName    = entry["amiiboSeries"].ToString(),
                        CharacterName = entry["character"].ToString(),
                        ImageURL      = entry["image"].ToString(),
                        AmiiboId      = entry["head"].ToString() + entry["tail"].ToString(),
                    };
                    list.Amiibos.Add(amiibo);
                }
            }
            catch (Exception ex)
            {
                ExceptionUtils.LogExceptionMessage(ex);
            }
            return(list);
        }
예제 #2
0
        public static AmiiboList GetAllAmiibos()
        {
            var list = new AmiiboList();

            try
            {
                var json = JObject.Parse(Utils.GetFromURL(AmiiboAPIURL));
                foreach (var entry in json["amiibo"])
                {
                    var amiibo = new Amiibo
                    {
                        AmiiboName    = entry["name"].ToString().Replace('/', '_'), // Avoid amiibo names conflicting with system paths
                        SeriesName    = entry["amiiboSeries"].ToString(),
                        CharacterName = entry["character"].ToString(),
                        ImageURL      = entry["image"].ToString(),
                        AmiiboId      = entry["head"].ToString() + entry["tail"].ToString(),
                    };
                    list.Amiibos.Add(amiibo);
                }
            }
            catch (Exception ex)
            {
                Utils.LogExceptionMessage(ex);
            }
            return(list);
        }
예제 #3
0
        public static AmiiboList GetAllAmiibos()
        {
            AmiiboList list = new AmiiboList();

            try
            {
                var json = JObject.Parse(new WebClient().DownloadString(AmiiboAPIURL));

                foreach (var entry in json["amiibo"])
                {
                    var amiibo = new Amiibo
                    {
                        AmiiboName    = entry["name"].ToString(),
                        SeriesName    = entry["amiiboSeries"].ToString(),
                        CharacterName = entry["character"].ToString(),
                        ImageURL      = entry["image"].ToString(),
                        AmiiboId      = entry["head"].ToString() + entry["tail"].ToString(),
                    };
                    list.Amiibos.Add(amiibo);
                }
            }
            catch (Exception ex)
            {
                ExceptionUtils.LogExceptionMessage(ex);
            }
            return(list);
        }