Example #1
0
        public IActionResult Index()
        {
            ViewData["Message"] = "";
            var client             = new WebClients();
            var firstQuery         = client.GetWikiGeoSearchAsync();
            var wikiGeoSearchRoot  = firstQuery.Result;
            var wikiGeoSearchQuery = wikiGeoSearchRoot.query;
            var wikiGeoSearches    = wikiGeoSearchQuery.Geosearch;

            return(View(wikiGeoSearches));
        }
 private void InitializeAsync()
 {
     for (int i = 0; i < ParallelDownloads; i++)
     {
         WebClient client = new WebClient();
         client.DownloadProgressChanged += WebClient_DownloadProgressChanged;
         client.DownloadFileCompleted   += WebClient_DownloadDataCompleted;
         WebClients.Add(client);
     }
     treeViewPutioFiles.NodeMouseClick += (sender, args) => treeViewPutioFiles.SelectedNode = args.Node;
 }
        public ActionResult Create(WebClients webClients)
        {
            Clients clients = new Clients();

            clients.SetClients(webClients.ClientId, webClients.ClientName, webClients.ClientSecret, webClients.ClientScope);

            var jsonString = JsonConvert.SerializeObject(webClients);

            HttpContext.Session.SetString(ClientKey, jsonString);

            return(View());
        }
Example #4
0
        public string Request(string url)
        {
            string data;

            if (!UseProxy)
            {
                data = WebClients.DownloadString(url);
            }
            else
            {
                data = WebClients.DownloadString(url, Proxy, ProxyUsername, ProxyPassword, UseProxyDefaultCredentials, null);
            }

            return(data);
        }
Example #5
0
        public ActionResult Index()
        {
            ViewData["Message"] = "";
            var         client      = new WebClients();
            ImageTitles imageTitles = new ImageTitles();

            var firstQuery = client.GetWikiGeoSearch();

            imageTitles.SearchQuery = client.SearchQuery;
            var wikiGeoSearchRoot  = firstQuery;
            var wikiGeoSearchQuery = wikiGeoSearchRoot.query;
            var wikiGeoSearches    = wikiGeoSearchQuery.Geosearch;

            List <string> titles = new List <string>();

            foreach (var geoSearch in wikiGeoSearches)
            {
                var innerResult = client.GetWikiImages(geoSearch.Pageid);

                string title = string.Empty;
                foreach (var wikiImage in  innerResult.Images)
                {
                    if (wikiImage.Title.StartsWith("File:"))
                    {
                        title = wikiImage.Title.Substring("File:".Length);
                    }
                    else
                    {
                        title = wikiImage.Title;
                    }
                    titles.Add(title);
                }
            }


            var fullImageList = getSimilarTitles(titles);
            List <LevenshteinMetrics> sortedImages = fullImageList.OrderBy(m => m.Distance).Take(50).ToList();

            imageTitles.SimilarTitles = sortedImages;
            return(View(imageTitles));
        }