diff --git a/Src/A69WD/A69WD.csproj b/Src/A69WD/A69WD.csproj
index 2f3d3e8..db73f10 100644
--- a/Src/A69WD/A69WD.csproj
+++ b/Src/A69WD/A69WD.csproj
@@ -35,6 +35,10 @@
Tools.ico
+
+ False
+ ..\..\..\..\_Library\HtmlAgilityPack 1.11.37\Net40\HtmlAgilityPack.dll
+
@@ -53,7 +57,11 @@
+
+
+
+
Form
diff --git a/Src/A69WD/Net/ATLink.cs b/Src/A69WD/Net/ATLink.cs
index a5efc9f..eb7015f 100644
--- a/Src/A69WD/Net/ATLink.cs
+++ b/Src/A69WD/Net/ATLink.cs
@@ -4,6 +4,31 @@ using System.Linq;
using System.Text;
namespace A69WD.Net {
- class ATLink {
+
+
+ public class ATLink {
+
+ public string URL { get { return _url; } }
+ private string _url;
+
+ public string Dst { get { return _dst; } }
+ private string _dst;
+
+ public string Testo { get; set; }
+
+ public ATLinkState Status { get; set; }
+
+
+ public ATLink(string url, string fileName) { Initialize(url, fileName, ATLinkState.ToCheck); }
+
+ private void Initialize(string url, string fileName, ATLinkState status) {
+ this._url = url;
+ this._dst = fileName;
+ this.Testo = "";
+ this.Status = status;
+ }
+
+
+
}
}
diff --git a/Src/A69WD/Net/ATLinkState.cs b/Src/A69WD/Net/ATLinkState.cs
new file mode 100644
index 0000000..05a2f13
--- /dev/null
+++ b/Src/A69WD/Net/ATLinkState.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace A69WD.Net {
+
+ ///
+ /// Enumerazione di tutti i bossibili stati di un link:
+ ///
+ public enum ATLinkState {
+ ///
+ /// Indica un link che deve venir testato per capire se è o meno da downloadare
+ ///
+ ToCheck = 1,
+ ///
+ /// Indica un link che deve venir downloadato
+ ///
+ ToDownload = 2,
+ ///
+ /// Indica un ATLink che è in download
+ ///
+ OnDownload = 3,
+ ///
+ /// Indica un ATLink correttamente downloadato
+ ///
+ Donwloaded = 4,
+ ///
+ /// Indica un link che deve venir downloadato
+ ///
+ ToAnalize = 5,
+ ///
+ /// Indica un ATLink che è in analizzazione
+ ///
+ OnAnalize = 6,
+ ///
+ /// Indica un ATLink correttamente downloadato
+ ///
+ Analized = 7,
+ ///
+ /// Indica un ATLink in cui si è concluso il lavoro.
+ ///
+ End = 8,
+ ///
+ /// Indica un ATLink il cui download ha avuto un errore
+ ///
+ ErrorDownload = 9,
+ ///
+ /// Indica un ATLink la cui analisi ha avuto un errore
+ ///
+ ErrorAnalize = 10,
+ ///
+ /// Indica un ATLink il cui download è stato abortito
+ ///
+ AbortDownload = 11,
+ ///
+ /// Indica un ATLink la cui analisi è stata abortita
+ ///
+ AbortAnalize = 12,
+ ///
+ /// Indica un ATLink il cui download è stato cancellato
+ ///
+ CancelDownload = 13,
+ ///
+ /// Indica un ATLink la cui analisi è stata cancellata
+ ///
+ CancelAnalize = 14,
+ } // enum ATLinkState
+
+
+}
diff --git a/Src/A69WD/Net/DownloadClient.cs b/Src/A69WD/Net/DownloadClient.cs
index 59dbf0e..93211bb 100644
--- a/Src/A69WD/Net/DownloadClient.cs
+++ b/Src/A69WD/Net/DownloadClient.cs
@@ -3,7 +3,185 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.ComponentModel;
+using System.Net;
+using System.IO;
+
+
namespace A69WD.Net {
- class DownloadClient {
+
+ public class DownloadClient {
+
+ #region Fields: _backgroundWorker, Link
+
+ private BackgroundWorker _backgroundWorker = null;
+
+ public ATLink Link { get; set; }
+
+ #endregion
+
+
+ #region Eventi:
+
+ public event EventHandler Starting;
+ public event EventHandler Complete;
+ public event EventHandler Cancelled;
+ public event EventHandler Error;
+ public event EventHandler ProgressChanged;
+
+
+ #region Gestione emissione degli eventi per le classi che utilizzano il DownloadClient
+
+ ///
+ /// Attivo evento Starting
+ ///
+ private void RaiseEvent_Starting() {
+ EventHandler tmp = Starting;
+ if (null != tmp)
+ tmp(this, new RunWorkerCompletedEventArgs(0F, null, false));
+ }
+
+ ///
+ /// Attivo evento Complete
+ ///
+ private void RaiseEvent_Complete() {
+ //if ((this.Link.Status != ATLinkState.ErrorDownload) && (this.Link.Status != ATLinkState.CancelDownload)) {
+ // this.Link.Status = ATLinkState.Donwloaded;
+ EventHandler tmp = Complete;
+ if (null != tmp)
+ tmp(this, new RunWorkerCompletedEventArgs(100F, null, false));
+ //}
+ }
+
+ ///
+ /// Attivo l'evento Cancelled
+ ///
+ private void RaiseEvent_Cancelled() {
+ //this.Link.Status = ATLinkState.CancelDownload;
+ Logger.Error(string.Format("Error Code: 00281 - Cancellazione del download del link: {0}", this.Link.ToString()));
+ var copy = Cancelled;
+ if (null != copy) copy(this, new RunWorkerCompletedEventArgs(0F, null, true));
+ }
+
+ ///
+ /// Attivo l'evento Error
+ ///
+ private void RaiseEvent_Error(Exception error) {
+ //this.Link.Status = ATLinkState.ErrorDownload;
+ Logger.Error(string.Format("Error Code: 00282 - Errore durante il download del link: {0}", this.Link.ToString()));
+ var copy = Error;
+ if (null != copy) copy(this, new RunWorkerCompletedEventArgs(-1F, error, false));
+ }
+
+ ///
+ /// Attivo l'evento ProgressChanged
+ ///
+ private void RaiseEvent_ProgressChanged(Int32 progress) {
+ EventHandler copy = ProgressChanged;
+ if (null != copy)
+ copy(this, new System.ComponentModel.ProgressChangedEventArgs(progress, this));
+ }
+
+
+ #endregion
+
+ #endregion
+
+ public DownloadClient(ATLink link) { this.Link = link; }
+
+
+ ///
+ /// Avvia il download su un thread in background
+ ///
+ public void Start() {
+ //if (this.Link.Status == ATLinkState.ToDownload) {
+ // Preparo gli argomenti da passare al thread in background:
+ List