- Autocommit - 2022/09/22 09:48:33
This commit is contained in:
1 parent
89a92fd8a1
commit
edfeae72a6
1 file changed
+32
-2
@@ -8,6 +8,8 @@ using System.Security.Policy;
|
||||
using System.Net;
|
||||
using static System.Windows.Forms.LinkLabel;
|
||||
using System.ComponentModel;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using System.Collections;
|
||||
|
||||
namespace A69WD {
|
||||
|
||||
@@ -90,7 +92,7 @@ namespace A69WD {
|
||||
toDownload.Remove(lk);
|
||||
using (WebClient client = new WebClient()) {
|
||||
string fn = Path.Combine(Cfg.Settings.PathAnalizadedRaccFile, GetFileName(lk));
|
||||
client.Encoding = Encoding.ASCII;
|
||||
client.Encoding = Encoding.Unicode;
|
||||
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");
|
||||
@@ -99,13 +101,16 @@ namespace A69WD {
|
||||
//client.DownloadFile(new Uri(lk), fn);
|
||||
client.DownloadProgressChanged += Client_DownloadProgressChanged;
|
||||
client.DownloadFileCompleted += Client_DownloadFileCompleted;
|
||||
client.DownloadFileAsync(new Uri(lk), fn);
|
||||
client.DownloadDataCompleted += Client_DownloadDataCompleted;
|
||||
//client.DownloadFileAsync(new Uri(lk), fn);
|
||||
client.DownloadDataAsync(new Uri(lk));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool Stop() {
|
||||
switch (state) {
|
||||
case EngineStatusEnum.NotReady:
|
||||
@@ -429,6 +434,31 @@ namespace A69WD {
|
||||
}//lock
|
||||
|
||||
}
|
||||
private void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) {
|
||||
//System.Threading.AutoResetEvent waiter = (System.Threading.AutoResetEvent)e.UserState;
|
||||
|
||||
try {
|
||||
// If the request was not canceled and did not throw
|
||||
// an exception, display the resource.
|
||||
if (!e.Cancelled && e.Error == null) {
|
||||
byte[] data = (byte[])e.Result;
|
||||
string textData = System.Text.Encoding.Unicode.GetString(data);
|
||||
string FullFileName = @"C:\VMS\Prj\C#\A69WD\Test\Txt\Src\2022-09-22\A69_altroz.html";
|
||||
|
||||
//System.IO.StreamWriter sw = new System.IO.StreamWriter(FullFileName, false, Encoding.Unicode);
|
||||
//sw.Write(textData);
|
||||
//sw.Flush();
|
||||
//sw.Close();
|
||||
|
||||
using (var fs = new FileStream(FullFileName, FileMode.Create, FileAccess.Write)) {
|
||||
fs.Write(data, 0, data.Length);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
// Let the main application thread resume.
|
||||
//waiter.Set();
|
||||
}
|
||||
}
|
||||
|
||||
private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {
|
||||
////Update progress bar & label
|
||||
|
||||
Reference in new issue
Block a user