Example #1
0
        // search item function
        public void SearchFunction()
        {
            string Input = SearchInput.Text.Replace(" ", "+");

            try
            {
                WebClient client = new WebClient();
                client.Proxy = null;
                Stream       stream = client.OpenRead("http://services.runescape.com/m=itemdb_rs/api/catalogue/items.json?category=" + CatagoryBox.SelectedIndex + "&alpha=" + Input + "&page=1");
                StreamReader reader = new StreamReader(stream);
                jObject = JObject.Parse(reader.ReadLine());
                stream.Close();
            }
            catch
            {
            }

            ResultListView.BeginUpdate();
            ResultListView.Items.Clear();

            i = 0;
            try
            {
                while (true)
                {
                    var lvi = new ListViewItem(new string[] { (string)jObject["items"][i]["name"], (string)jObject["items"][i]["id"], (string)jObject["items"][i]["current"]["price"] });
                    ResultListView.Items.Add(lvi);
                    i++;
                }
            }
            catch
            {
                ResultListView.EndUpdate();
            }
        }
Example #2
0
        // search item function
        public void SearchFunction()
        {
            string Input = SearchInput.Text.Replace(" ", "+");

            try
            {
                WebClient client = new WebClient();
                client.Proxy = null;
                Stream       stream = client.OpenRead("http://services.runescape.com/m=itemdb_rs/bestiary/beastSearch.json?term=" + Input);
                StreamReader reader = new StreamReader(stream);
                var          json   = reader.ReadToEnd();
                json1 = JsonConvert.DeserializeObject <dynamic[]>(json);

                stream.Close();
            }
            catch
            {
            }

            ResultListView.BeginUpdate();
            ResultListView.Items.Clear();

            i = 0;
            Console.WriteLine();
            try
            {
                while (true)
                {
                    var lvi = new ListViewItem(new string[] { (string)json1[i].label, (string)json1[i].value });
                    ResultListView.Items.Add(lvi);
                    i++;
                }
            }
            catch
            {
                ResultListView.EndUpdate();
            }
        }