- Autocommit - 2022/09/21 19:54:54
This commit is contained in:
1 parent
620c5d9cfb
commit
01021811f3
3 files changed
+87
No files matched your search
@@ -47,6 +47,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\_Lib\System.Data.SQLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
Generated
+13
@@ -32,6 +32,7 @@
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.btnShowLog = new System.Windows.Forms.Button();
|
||||
this.btnDownloadAll2 = new System.Windows.Forms.Button();
|
||||
this.btnTest = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnClose
|
||||
@@ -122,11 +123,22 @@
|
||||
this.btnDownloadAll2.UseVisualStyleBackColor = true;
|
||||
this.btnDownloadAll2.Click += new System.EventHandler(this.btnDownloadAll2_Click);
|
||||
//
|
||||
// btnTest
|
||||
//
|
||||
this.btnTest.Location = new System.Drawing.Point(187, 1);
|
||||
this.btnTest.Name = "btnTest";
|
||||
this.btnTest.Size = new System.Drawing.Size(97, 33);
|
||||
this.btnTest.TabIndex = 19;
|
||||
this.btnTest.Text = "Test";
|
||||
this.btnTest.UseVisualStyleBackColor = true;
|
||||
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
|
||||
//
|
||||
// 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.btnTest);
|
||||
this.Controls.Add(this.btnDownloadAll2);
|
||||
this.Controls.Add(this.btnShowLog);
|
||||
this.Controls.Add(this.btnImportLinks);
|
||||
@@ -152,5 +164,6 @@
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
private System.Windows.Forms.Button btnShowLog;
|
||||
private System.Windows.Forms.Button btnDownloadAll2;
|
||||
private System.Windows.Forms.Button btnTest;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,10 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Net;
|
||||
using static System.Windows.Forms.LinkLabel;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace A69WD {
|
||||
|
||||
@@ -88,5 +92,74 @@ namespace A69WD {
|
||||
private void btnDownloadAll2_Click(object sender, EventArgs e) { engine.Start(false); }
|
||||
|
||||
|
||||
|
||||
|
||||
#region Test download
|
||||
|
||||
private void btnTest_Click(object sender, EventArgs e) {
|
||||
////Run download file with multiple thread
|
||||
//string url = "https://www.annunci69.it/racconti-erotici/racconti_lista.php?genere=altro&pagina=103";
|
||||
//if (!string.IsNullOrEmpty(url)) {
|
||||
// Thread thread = new Thread(() =>
|
||||
// {
|
||||
// Uri uri = new Uri(url);
|
||||
// //string fileName = System.IO.Path.GetFileName(uri.AbsolutePath);
|
||||
// string fileName = System.IO.Path.Combine(Cfg.Settings.PathAnalizadedRaccFile, url.Replace("https://www.annunci69.it/racconti-erotici/", "A69_").Replace("/", "_").Replace(":", "_").Replace(@"\", "_"));
|
||||
// client.DownloadFileAsync(uri, @"C:\VMS\Prj\C#\A69WD\Test\Txt\Src\_A69_genere_altro_103.html");
|
||||
// });
|
||||
// thread.Start();
|
||||
//}
|
||||
|
||||
string url = "https://www.annunci69.it/racconti-erotici/racconti_lista.php?genere=altro&pagina=3";
|
||||
string fileName = @"C:\VMS\Prj\C#\A69WD\Test\Logs\_A69_genere_altro_3.html";
|
||||
|
||||
//// Test 1: Questo dà errore:
|
||||
//WebClient client;
|
||||
//client = new WebClient();
|
||||
//client.DownloadProgressChanged += Client_DownloadProgressChanged;
|
||||
//client.DownloadFileCompleted += Client_DownloadFileCompleted;
|
||||
////client.DownloadFile(url, fileName);
|
||||
//StringBuilder sb = new StringBuilder(client.DownloadString(url));
|
||||
//cTools.WriteTextFile(fileName, sb);
|
||||
//// Test 1
|
||||
|
||||
// Test
|
||||
WebClient client = new WebClient();
|
||||
//client.Headers["User-Agent"] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36";
|
||||
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("Accept-Encoding", "gzip, deflate, br");
|
||||
//client.Headers.Add("Connection", "keep-alive");
|
||||
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(url), fileName);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) {
|
||||
MessageBox.Show("Download complete !", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {
|
||||
////Update progress bar & label
|
||||
//Invoke(new MethodInvoker(delegate () {
|
||||
// progressBar.Minimum = 0;
|
||||
// double receive = double.Parse(e.BytesReceived.ToString());
|
||||
// double total = double.Parse(e.TotalBytesToReceive.ToString());
|
||||
// double percentage = receive / total * 100;
|
||||
// lblStatus.Text = $"Downloaded {string.Format("{0:0.##}", percentage)}%";
|
||||
// progressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
|
||||
//}));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}//class frmDownloader
|
||||
}//namespace A69WD
|
||||
Reference in new issue
Block a user