Ejemplo n.º 1
0
        private void btnComicVineNew_Click(object sender, EventArgs e)
        {
            _cvVolumeSearchResponse = null;
            txtComicSeachText.Text  = null;


            _cvVolumeSearchResponse = ComicVineManager.GetNewThisWeek();
            BindComicVineResults();
        }
Ejemplo n.º 2
0
        private void btnSearchComicVine_Click(object sender, EventArgs e)
        {
            _cvVolumeSearchResponse = null;
            if (string.IsNullOrWhiteSpace(txtComicSeachText.Text))
            {
                return;
            }

            _cvVolumeSearchResponse = ComicVineManager.GetVolumeSearchResults(txtComicSeachText.Text);
            BindComicVineResults();
        }
Ejemplo n.º 3
0
        public static CvVolumeSearchResponse GetNewThisWeek()
        {
            CvVolumeSearchResponse response = new CvVolumeSearchResponse();

            response.Volumes = new List <CvVolume>();

            RestClient r = new RestClient("https://comicvine.gamespot.com/feeds/new-comics/");

            var request = new RestRequest("", Method.GET);


            XmlReaderSettings settings = new XmlReaderSettings();

            settings.DtdProcessing = DtdProcessing.Ignore;

            var    res     = r.Execute(request);
            string rawFeed = res.Content;

            var xDoc = XDocument.Parse(rawFeed); //XDocument.Load(filename)

            xDoc.Descendants("cache").ToList().ForEach(a => a.Remove());

            var newxml = xDoc.ToString();



            XmlReader xmlReader = XmlReader.Create(new StringReader(newxml), settings);


            SyndicationFeed feed = SyndicationFeed.Load(xmlReader);

            foreach (SyndicationItem item in feed.Items)
            {
                //get issue ID
                string[] uriChunks = item.Links[0].Uri.AbsoluteUri.Split('/');
                string   issueId   = uriChunks[uriChunks.Length - 2].Split('-')[1].Trim();
                CvIssue  issue     = GetIssue(issueId).Issue;

                CvVolume volume = issue.Volume;

                volume.Name += " Issue #" + issue.IssueNumber;
                response.Volumes.Add(volume);
            }

            return(response);
        }