Example #1
0
        public BooruResult GetFromID(string id)
        {
            BooruResult booruResult = null;

            using (var web = new WebClient())
            {
                try
                {
                    string response = web.DownloadString(ENDPOINTID + id + ".json");
                    JArray jArray   = new JArray()
                    {
                        JToken.Parse(response)
                    };
                    booruResult = new BooruResult(jArray);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            return(booruResult);
        }
Example #2
0
        public BooruResult GetFromMD5(string md5)
        {
            BooruResult booruResult = null;

            using (var web = new WebClient())
            {
                web.QueryString.Add("limit", "1");
                web.QueryString.Add("tags", "md5:" + md5);

                try
                {
                    string response = web.DownloadString(ENDPOINTMD5);
                    JArray jArray   = JArray.Parse(response);
                    booruResult = new BooruResult(jArray);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            return(booruResult);
        }