private void reportAsNotWorkingToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult r = MessageBox.Show(this, "WARNING: Abusing this feature WILL get you blacklisted. Are you sure you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (r != DialogResult.Yes) { return; } ListView.SelectedListViewItemCollection m = listView1.SelectedItems; ListViewItem[] items = new ListViewItem[m.Count]; m.CopyTo(items, 0); int id = Int32.Parse(items[0].Text); WebRequest request = WebRequest.Create("https://sbr.devjoe.me/api/numbers.php?req=report&id=" + id); string JSON = "{}"; using (WebResponse response = request.GetResponse()) { using (Stream data = response.GetResponseStream()) { using (StreamReader read = new StreamReader(data)) { JSON = read.ReadToEnd(); } } } ReportEntries.RootObject re = JsonConvert.DeserializeObject <ReportEntries.RootObject>(JSON); if (!re.success) { MessageBox.Show(this, "An error occurred while sending the request.\n\nDetails:\n" + re.error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(this, "Success! Here's a summary of what was sent:\n\nIP: " + re.summary.ip + "\nType: " + re.summary.type + "\nID: " + re.summary.id, "Sent", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static T[] ToArray <T>(this ListView.SelectedListViewItemCollection objects) { T[] array = new T[objects.Count]; objects.CopyTo(array, 0); return(array); }
public void CopyTo(GenericListViewItem <T>[] items, Int32 index) { _items.CopyTo(items, index); }