Exemplo n.º 1
0
 private Beatmap(string setId, IBeatmapMirrorSiteClient mirrorSite)
 {
     _response       = HttpWebHelper.GetResponse(mirrorSite.UrlDownload + setId);
     _setId          = setId;
     _fileName       = mirrorSite.GetFileName(_response);
     _fileLength     = _response.ContentLength;
     _name           = GetBeatmapName(_fileName);
     _downloaded     = 0;
     _downloadStream = _response.GetResponseStream();
 }
Exemplo n.º 2
0
        public Dictionary <string, string> SearchBeatmap(string keyWords)
        {
            var searchResult   = new Dictionary <string, string>();
            var responseStream = HttpWebHelper.GetResponseStream(UrlSearch + keyWords);
            var doc            = new HtmlDocument();

            doc.Load(responseStream, Encoding.UTF8);
            var nodeHeaders = doc.DocumentNode.SelectNodes("/html[1]/head[1]/body[1]/div[2]/div[2]/div[1]");

            try
            {
                foreach (HtmlNode node in nodeHeaders)
                {
                    string beatmap = node.SelectSingleNode("./a[1]").InnerText;
                    string id      = node.SelectSingleNode("./div[1]/a[1]").InnerText;
                    searchResult.Add(id, beatmap);
                }
            }
            catch (Exception)
            {
                return(searchResult);
            }
            return(searchResult);
        }