- Autocommit - 2022/09/22 13:48:33

This commit is contained in:
CSiCoAlm committed 2022-09-22 13:48:33 +02:00
1 parent 3cd03879f0
commit 495dc4b15a
3 files changed
+69 -4

No files matched your search

+40 -1
View File
@@ -112,6 +112,44 @@ namespace A69WD {
return true;
}
public bool StartParallel(bool DownRac,int numThred) {
if (state != EngineStatusEnum.StandBy) return false;
dtStartTime = DateTime.Now;
downRac = DownRac;
RaiseEvent_Updating("Inizio lo scrap dei link dei racconti con " + numThred.ToString("00") + " thread");
state = EngineStatusEnum.Starting;
for (int i = 0; i < numThred; i++) {
if (toDownload.Count > 0) {
// proseguo con il download:
string lk = toDownload.First();
toDownload.Remove(lk);
string fn = Path.Combine(Cfg.Settings.PathAnalizadedRaccFile, GetFileName(lk));
using (MyWebClient client = new MyWebClient(lk, fn)) {
//client.Encoding = Encoding.ASCII;
client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0");
client.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
client.Headers.Add("Cookie", "euconsent-v2=CPG74goPG74goAKAeAENBcCsAP_AAH_AAAwIH3tf_X__bX9j-_59__t0eY1f9_7_v-wzjhfdt-8N2P_X_L0X42E7PF36pq4KuR4Eu3LBIQNlHOHUTUmw6okVrTPsak2Mr7NKJ7LEmnMZe2dYGHtfn91TuZKY7_78_9fz3_-v_v___9f3r-3_3__59X---_e_V399zLv9__3__9gfiASYal8AF2JY4Mk0aVQogQhWEh0AoAKKAYWiawgYXBTsrAI9QQMAEJqAjAiBBiCjFgEAAgEASERASAHggEQBEAgABACpAQgAImAQWAFgYBAAKAaFiBFAEIEhBkcFRymBARItFBPZWAJRd7GmEIZRYAUCj-iowEShBAsDISFg5gAA.YAAAAAAAAAAA");
client.Headers.Add("DNT", "1");
client.Headers.Add("TE", "Trailers");
////client.DownloadFile(new Uri(lk), fn);
//client.DownloadProgressChanged += Client_DownloadProgressChanged;
//client.DownloadFileCompleted += Client_DownloadFileCompleted;
//client.DownloadDataCompleted += Client_DownloadDataCompleted;
client.DownloadStringCompleted += Client_DownloadStringCompleted;
////client.DownloadFileAsync(new Uri(lk), fn);
////client.DownloadDataAsync(new Uri(lk));
client.DownloadStringAsync(new Uri(lk));
}
}
}
return true;
}
public bool Stop() {
switch (state) {
case EngineStatusEnum.NotReady:
@@ -184,7 +222,6 @@ namespace A69WD {
/// </summary>
public event EventHandler<EngineEventArgs> Updating;
private void Client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) {
object obj = new Object();
lock (obj) {
@@ -379,6 +416,8 @@ namespace A69WD {
} catch { return false; }
}
#endregion
+24 -1
View File
@@ -31,6 +31,8 @@
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.btnShowLog = new System.Windows.Forms.Button();
this.cbSoloFileIndice = new System.Windows.Forms.CheckBox();
this.tbNumThred = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnClose
@@ -103,18 +105,37 @@
// cbSoloFileIndice
//
this.cbSoloFileIndice.AutoSize = true;
this.cbSoloFileIndice.Location = new System.Drawing.Point(325, 20);
this.cbSoloFileIndice.Location = new System.Drawing.Point(321, 9);
this.cbSoloFileIndice.Name = "cbSoloFileIndice";
this.cbSoloFileIndice.Size = new System.Drawing.Size(76, 17);
this.cbSoloFileIndice.TabIndex = 18;
this.cbSoloFileIndice.Text = "Solo Index";
this.cbSoloFileIndice.UseVisualStyleBackColor = true;
//
// tbNumThred
//
this.tbNumThred.Location = new System.Drawing.Point(321, 25);
this.tbNumThred.Name = "tbNumThred";
this.tbNumThred.Size = new System.Drawing.Size(22, 20);
this.tbNumThred.TabIndex = 19;
this.tbNumThred.Text = "4";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(345, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.TabIndex = 20;
this.label1.Text = "Num Thread";
//
// frmDownloader
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(524, 74);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbNumThred);
this.Controls.Add(this.cbSoloFileIndice);
this.Controls.Add(this.btnShowLog);
this.Controls.Add(this.btnImportLinks);
@@ -139,5 +160,7 @@
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button btnShowLog;
private System.Windows.Forms.CheckBox cbSoloFileIndice;
private System.Windows.Forms.TextBox tbNumThred;
private System.Windows.Forms.Label label1;
}
}
+5 -2
View File
@@ -42,7 +42,8 @@ namespace A69WD {
private void btnDownloadAll_Click(object sender, EventArgs e) {
//engine.Start(true);
engine.Start(!cbSoloFileIndice.Checked);
//engine.Start(!cbSoloFileIndice.Checked);
engine.StartParallel(!cbSoloFileIndice.Checked, int.Parse(tbNumThred.Text));
}
private void btnShowLog_Click(object sender, EventArgs e) {
@@ -81,10 +82,12 @@ namespace A69WD {
#endregion
#endregion
}//class frmDownloader
}//namespace A69WD