using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { } } }
using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
using System.Diagnostics; // , using System.Net; // , Web using System.Threading; // ,
WebClient wc = new WebClient(); // Web
static string DownloadSkinsForAimp(WebClient wc) { Console.WriteLine("Downloading began"); try { for (int i = 0; i <= 5; i++) { string id = "79" + i; string name = GetNameOfSkin(wc, id); // , string path = "aimp.ru/index.php?do=download&sub=catalog&id=" + id; try { // Process.Start("chrome.exe", path); Console.WriteLine("Download " + name + " is succesfull!"); // 5 , , Thread.Sleep(5000); } catch { Console.WriteLine("Download" + name + "failed"); } } } catch { return "\nSomething went is wrong"; } return "\nDownloading complete"; }
static string GetNameOfSkin(WebClient wc, string id) { // html string html = wc.DownloadString("http://www.aimp.ru/index.php?do=catalog&rec_id=" + id); // id // 5 id string rightPartOfHtml = html.Substring(html.IndexOf(id) + 5); // string name = rightPartOfHtml.Substring(0, rightPartOfHtml.IndexOf("<")).Replace(" ", "_"); // return name; }
Console.WriteLine(DownloadSkinsForAimp(wc)); // , //
static string DownloadCertificates(WebClient wc) { // , string currentUser = Environment.UserName; Console.WriteLine("Downloading began"); try { for (int i = 0; i <= 5; i++) { try { // '.pdf' wc.DownloadFile("https://geekbrains.ru//certificates//7075" + i + ".pdf", "c:\\users\\" + currentUser + "\\downloads\\7075" + i + ".pdf"); Console.WriteLine("Download certificate №7075" + i + " is succesfull"); } catch { Console.WriteLine("Download certificate №7075" + i + " is failed"); } } } catch { return "\nSomething went is wrong"; } return "\nDownloading certificates are complite!"; }
Source: https://habr.com/ru/post/282119/
All Articles