예제 #1
0
        public async Task <SiteProdInfo> RetrieveProdInfo(Uri uri)
        {
            var url = new Uri("http://api.pouet.net/v1/prod/?id=" + uri.Segments[2]);

            using (var wc = new System.Net.WebClient())
            {
                string contents = await wc.DownloadStringTaskAsync(url);

                if (contents != null && contents.Length > 0)
                {
                    var response = JsonConvert.DeserializeObject <Response>(contents);
                    if (response.success)
                    {
                        SiteProdInfo info = new SiteProdInfo()
                        {
                            ID           = response.prod.id,
                            Name         = response.prod.name,
                            Group        = response.prod.groups?.FirstOrDefault()?.name,
                            DownloadLink = response.prod.download,
                            ReleaseDate  = response.prod.releaseDate,
                        };
                        return(info);
                    }
                }
            }
            return(null);
        }
예제 #2
0
        public async Task <SiteProdInfo> RetrieveProdInfo(Uri uri)
        {
            var url = new Uri("http://demozoo.org/api/v1/productions/" + uri.Segments[2] + "/?format=json");

            using (var wc = new System.Net.WebClient())
            {
                string contents = await wc.DownloadStringTaskAsync(url);

                if (contents != null && contents.Length > 0)
                {
                    var response = JsonConvert.DeserializeObject <Response>(contents);
                    if (response != null && response.title != null)
                    {
                        SiteProdInfo info = new SiteProdInfo()
                        {
                            ID           = response.id,
                            Name         = response.title,
                            Group        = response.author_nicks?.FirstOrDefault()?.name,
                            DownloadLink = response.download_links?.FirstOrDefault()?.url,
                            ReleaseDate  = response.release_date,
                        };
                        return(info);
                    }
                }
            }
            return(null);
        }
예제 #3
0
        private void ProdList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var listBox = sender as ListBox;
            int index   = listBox.IndexFromPoint(e.Location);
            KeyValuePair <string, List <Sites.SiteProdInfo> > data = (KeyValuePair <string, List <Sites.SiteProdInfo> >)listBox.Tag;

            Sites.SiteProdInfo prodInfo = data.Value[index];

            var          download = new DownloadDialog($"conduit://{data.Key}/prod/{prodInfo.ID}");
            DialogResult result   = download.ShowDialog();
        }