static string GetCall(ProgressBar progressBar, string uri) { var urlItem = new KuUrlItem(); var kUDownloaders = new KuDownloaders(progressBar, urlItem); return(kUDownloaders.DownloadHtmlString(uri)); }
//static string GetCall(string Url) //{ // var request = WebRequest.Create(Url); // var response = request.GetResponse(); // var dataStream = response.GetResponseStream(); // var reader = new StreamReader(dataStream); // var responseFromServer = reader.ReadToEnd(); // reader.Close(); // response.Close(); // return responseFromServer; //} private static void GetUrlItems(ProgressBar progressBar) { _mainList = new List <KuUrlItem>(); try { var htmlParser = new HtmlParser(); var iHtmlDocument = htmlParser.Parse(GetCall(progressBar, KuConfigurator.BaseUrl)); var links = iHtmlDocument.Links; foreach (var link in links) { var fullName = link.TextContent; var tmp = new List <string>(fullName.Split(Delimiter, 3)); tmp = KuFilter.Normalize(tmp); var isStableVersion = KuFilter.StableVersion(tmp); if (tmp.Count <= 0 || !isStableVersion) { continue; } var urlItem = new KuUrlItem { FullName = fullName, SplitName = tmp }; _mainList.Add(urlItem); } } catch (Exception e) { Program.Log.LogError("Error", e); } }
public bool DownloadFile(KuUrlItem urlItem) { var downloader = new File(_progressBar, urlItem); return(downloader.Download(urlItem)); }
public KuDownloaders(ProgressBar progressBar, KuUrlItem urlItem) { _progressBar = progressBar; _urlItem = urlItem; }
public static bool DownloadFile(ProgressBar progressBar, KuUrlItem urlItem) { return(DownloadFile(progressBar, urlItem.Uri, urlItem.FilePath, urlItem.FileName)); }
public bool Download(KuUrlItem urlItem) { return(Download(urlItem.Uri, urlItem.FilePath, urlItem.FileName)); }
public File(ProgressBar progressBar, KuUrlItem urlItem) : base(progressBar, urlItem) { }
public HtmlString(ProgressBar progressBar, KuUrlItem urlItem) : base(progressBar, urlItem) { }