- Autocommit - 2021/10/27 13:01:11
This commit is contained in:
1 parent
ae8d3b0dce
commit
fd2da1a3af
5 files changed
+229
-56
No files matched your search
@@ -140,6 +140,104 @@ namespace A69WD {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int LoadData(List<string> allLinks, List<string> toDownload, List<string> downloaded, List<string> racLinks) {
|
||||||
|
object obj = new Object();
|
||||||
|
lock (obj) {
|
||||||
|
int Res = 0;
|
||||||
|
try {
|
||||||
|
|
||||||
|
System.Data.SQLite.SQLiteCommand cmd = new SQLiteCommand("SELECT [URL], [Tipo], [Status], [LastUp] FROM [LinksLog] WHERE [Tipo]='Rac' AND [Status]<>4", cn); // Donwloaded = 4
|
||||||
|
SQLiteDataReader rdr = cmd.ExecuteReader();
|
||||||
|
while (rdr.Read()) {
|
||||||
|
string url = rdr["URL"] as string;
|
||||||
|
allLinks.Add(url);
|
||||||
|
toDownload.Add(url);
|
||||||
|
racLinks.Add(url);
|
||||||
|
Res++;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.Log(new object[] { "Error Code: DB07003", "Errore in Data.DBTools.LoadData()", ex });
|
||||||
|
if (Res > 0) Res = -1 * Res;
|
||||||
|
}
|
||||||
|
return Res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SaveData(List<string> allLinks, List<string> toDownload, List<string> downloaded, List<string> racLinks) {
|
||||||
|
object obj = new Object();
|
||||||
|
lock (obj) {
|
||||||
|
int Res = 0;
|
||||||
|
try {
|
||||||
|
foreach (string link in racLinks) { LinkLogUpdtate(link, cA69Engine.LinkType(link), eLinkState.ToDownload); }
|
||||||
|
foreach (string link in toDownload) { LinkLogUpdtate(link, cA69Engine.LinkType(link), eLinkState.ToDownload); }
|
||||||
|
foreach (string link in downloaded) { LinkLogUpdtate(link, cA69Engine.LinkType(link), eLinkState.Donwloaded); }
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.Log(new object[] { "Error Code: DB07003", "Errore in Data.DBTools.LoadData()", ex });
|
||||||
|
if (Res > 0) Res = -1 * Res;
|
||||||
|
}
|
||||||
|
return Res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private bool LinkLogUpdtate(string url, string tip, eLinkState st) {
|
||||||
|
// object obj = new Object();
|
||||||
|
// lock (obj) {
|
||||||
|
// Cancello riga (se non presente, non fa nulla)
|
||||||
|
// Inserisco riga
|
||||||
|
bool Res = false;
|
||||||
|
try {
|
||||||
|
// Cancello il link anche se non presente
|
||||||
|
System.Data.SQLite.SQLiteCommand cmd = new SQLiteCommand(string.Format("DELETE FROM [LinksLog] WHERE [URL]='{0}'", url), cn);
|
||||||
|
int res = cmd.ExecuteNonQuery();
|
||||||
|
cmd = null;
|
||||||
|
// Inserisco il link come se fosse nuovo
|
||||||
|
cmd = new System.Data.SQLite.SQLiteCommand();
|
||||||
|
cmd.Connection = cn;
|
||||||
|
cmd.CommandText = "INSERT INTO LinksLog (URL,Tipo,Status,LastUp)VALUES (@URL,@Tipo,@Status,@LastUp)";
|
||||||
|
cmd.CommandType = System.Data.CommandType.Text;
|
||||||
|
System.Data.SQLite.SQLiteParameter param = new System.Data.SQLite.SQLiteParameter();
|
||||||
|
param.ParameterName = "@URL";
|
||||||
|
param.DbType = global::System.Data.DbType.String;
|
||||||
|
param.SourceColumn = "URL";
|
||||||
|
cmd.Parameters.Add(param);
|
||||||
|
param = new System.Data.SQLite.SQLiteParameter();
|
||||||
|
param.ParameterName = "@Tipo";
|
||||||
|
param.DbType = global::System.Data.DbType.String;
|
||||||
|
param.SourceColumn = "Tipo";
|
||||||
|
cmd.Parameters.Add(param);
|
||||||
|
param = new System.Data.SQLite.SQLiteParameter();
|
||||||
|
param.ParameterName = "@Status";
|
||||||
|
param.DbType = global::System.Data.DbType.Int32;
|
||||||
|
param.SourceColumn = "Status";
|
||||||
|
cmd.Parameters.Add(param);
|
||||||
|
param = new System.Data.SQLite.SQLiteParameter();
|
||||||
|
param.ParameterName = "@LastUp";
|
||||||
|
param.DbType = global::System.Data.DbType.DateTime;
|
||||||
|
param.SourceColumn = "LastUp";
|
||||||
|
cmd.Parameters.Add(param);
|
||||||
|
cmd.Parameters[0].Value = url;
|
||||||
|
cmd.Parameters[1].Value = tip;
|
||||||
|
cmd.Parameters[2].Value = st;
|
||||||
|
//if (InsertDate) { cmd.Parameters[3].Value = DateTime.Now; } else { cmd.Parameters[3].Value = DateTime.MaxValue; }
|
||||||
|
cmd.Parameters[3].Value = DateTime.Now;
|
||||||
|
res = cmd.ExecuteNonQuery();
|
||||||
|
if (res != 1) {
|
||||||
|
Logger.Log(new object[] { "Error Code: DB06010", string.Format("DBTools.LinkLogUpdtate({0})={1}", url, res) });
|
||||||
|
Res = false;
|
||||||
|
} else {
|
||||||
|
Res = true;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.Log(new object[] { "Error Code: DB06001", string.Format("DBTools.LinkLogUpdtate({0})", url), ex });
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
//if ((cn != null) && (cn.State != System.Data.ConnectionState.Closed)) cn.Close();
|
||||||
|
}
|
||||||
|
return Res;
|
||||||
|
// } // lock (obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
///// <summary>
|
||||||
///// Ricava dal DB tutti i dati
|
///// Ricava dal DB tutti i dati
|
||||||
///// </summary>
|
///// </summary>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace A69WD {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enumerazione di tutti i bossibili stati di un link:
|
/// Enumerazione di tutti i bossibili stati di un link:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ATLinkState {
|
public enum eLinkState {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indica un link che deve venir testato per capire se è o meno da downloadare
|
/// Indica un link che deve venir testato per capire se è o meno da downloadare
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -65,6 +65,6 @@ namespace A69WD {
|
|||||||
///// Indica un ATLink la cui analisi è stata cancellata
|
///// Indica un ATLink la cui analisi è stata cancellata
|
||||||
///// </summary>
|
///// </summary>
|
||||||
//CancelAnalize = 14,
|
//CancelAnalize = 14,
|
||||||
} // enum ATLinkState
|
} // enum eLinkState
|
||||||
|
|
||||||
}//namespace A69WD
|
}//namespace A69WD
|
||||||
+104
-26
@@ -11,13 +11,13 @@ namespace A69WD {
|
|||||||
public class cA69Engine {
|
public class cA69Engine {
|
||||||
|
|
||||||
|
|
||||||
#region Property: State, Tipologie, BASE_URL, BASE_LINK_IDX, BASE_LINK_RAC
|
#region Property: State, NumDownload, Tipologie, BASE_URL, BASE_LINK_IDX, BASE_LINK_RAC
|
||||||
|
|
||||||
public EngineStatusEnum State { get { return state; } }
|
public EngineStatusEnum State { get { return state; } }
|
||||||
|
|
||||||
public int NumDownload { get { return downloaded.Count; } }
|
public int NumDownload { get { return downloaded.Count; } }
|
||||||
|
|
||||||
string[] Tipologie = { "altro", "bdsm", "gay", "incesto", "lesbo", "orge", "prime", "scambio", "tradimenti", "trans", "trio" };
|
static string[] Tipologie = { "altro", "bdsm", "gay", "incesto", "lesbo", "orge", "prime", "scambio", "tradimenti", "trans", "trio" };
|
||||||
|
|
||||||
const string BASE_URL = "https://www.annunci69.it/racconti-erotici/{Tip}.html";
|
const string BASE_URL = "https://www.annunci69.it/racconti-erotici/{Tip}.html";
|
||||||
const string BASE_LINK_IDX = "https://www.annunci69.it/racconti-erotici/racconti_lista.php";
|
const string BASE_LINK_IDX = "https://www.annunci69.it/racconti-erotici/racconti_lista.php";
|
||||||
@@ -26,7 +26,7 @@ namespace A69WD {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Fields: allLinks, toDownload, downloaded, racLinks, dtStartTime, aborting, downRac, state, wb
|
#region Fields: allLinks, toDownload, downloaded, racLinks, dtStartTime, downRac, state, wb
|
||||||
|
|
||||||
List<string> allLinks = null;
|
List<string> allLinks = null;
|
||||||
List<string> toDownload = null;
|
List<string> toDownload = null;
|
||||||
@@ -35,7 +35,6 @@ namespace A69WD {
|
|||||||
|
|
||||||
DateTime dtStartTime;
|
DateTime dtStartTime;
|
||||||
|
|
||||||
bool aborting = false;
|
|
||||||
bool downRac = false;
|
bool downRac = false;
|
||||||
|
|
||||||
EngineStatusEnum state = EngineStatusEnum.NotReady;
|
EngineStatusEnum state = EngineStatusEnum.NotReady;
|
||||||
@@ -48,17 +47,24 @@ namespace A69WD {
|
|||||||
#region Costruttore e distruttore
|
#region Costruttore e distruttore
|
||||||
|
|
||||||
public cA69Engine(WebBrowser WB) {
|
public cA69Engine(WebBrowser WB) {
|
||||||
// Inizializzo gli archivi (dai file in memoria)
|
try {
|
||||||
allLinks = new List<string>();
|
// Inizializzo gli archivi (dai file in memoria)
|
||||||
toDownload = new List<string>();
|
allLinks = new List<string>();
|
||||||
downloaded = new List<string>();
|
toDownload = new List<string>();
|
||||||
racLinks = new List<string>();
|
downloaded = new List<string>();
|
||||||
wb = WB;
|
racLinks = new List<string>();
|
||||||
wb.DocumentCompleted += Wb_DocumentCompleted;
|
int res = App.DB.LoadData(allLinks, toDownload, downloaded, racLinks);
|
||||||
// Per ora non serializzo gli archivi e quindi carico le pagine iniziali delle 11 tipologie:
|
RaiseEvent_Updating("Ricaricati " + res.ToString("000") + " link di racconti da scaricare");
|
||||||
foreach (string tipologia in Tipologie) {
|
wb = WB;
|
||||||
toDownload.Add(BASE_URL.Replace("{Tip}", tipologia));
|
wb.DocumentCompleted += Wb_DocumentCompleted;
|
||||||
allLinks.Add(BASE_URL.Replace("{Tip}", tipologia));
|
// Per ora non serializzo gli archivi e quindi carico le pagine iniziali delle 11 tipologie:
|
||||||
|
foreach (string tipologia in Tipologie) {
|
||||||
|
toDownload.Add(BASE_URL.Replace("{Tip}", tipologia));
|
||||||
|
allLinks.Add(BASE_URL.Replace("{Tip}", tipologia));
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.Log(new object[] { "Error Code: ER02220", "Errore in cA69Engine()", ex });
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
state = EngineStatusEnum.StandBy;
|
state = EngineStatusEnum.StandBy;
|
||||||
}
|
}
|
||||||
@@ -74,7 +80,7 @@ namespace A69WD {
|
|||||||
dtStartTime = DateTime.Now;
|
dtStartTime = DateTime.Now;
|
||||||
downRac = DownRac;
|
downRac = DownRac;
|
||||||
|
|
||||||
UpdateST("Inizio lo scrap dei link dei racconti");
|
RaiseEvent_Updating("Inizio lo scrap dei link dei racconti");
|
||||||
|
|
||||||
state = EngineStatusEnum.Starting;
|
state = EngineStatusEnum.Starting;
|
||||||
|
|
||||||
@@ -89,12 +95,45 @@ namespace A69WD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Stop() {
|
public void Stop() {
|
||||||
|
state = EngineStatusEnum.Stopping;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region Eventi:
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Evento che indica un cambiamento di stato nell'AnalizeManager
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<EngineEventArgs> Updating;
|
||||||
|
|
||||||
|
|
||||||
|
#region Generazione degli eventi dell'engine verso le classi chiamanti:
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attiva l'evento che segnala un cambiamento di stato nel engine (per esempio, terminato il download di un singolo file)
|
||||||
|
/// </summary>
|
||||||
|
void RaiseEvent_Updating(string msg, int tot, int toDown, int down) {
|
||||||
|
EventHandler<EngineEventArgs> tmp = Updating;
|
||||||
|
if (null != tmp) tmp(this, new EngineEventArgs(msg, tot, toDown, down));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attiva l'evento che segnala un cambiamento di stato nel engine (per esempio, terminato il download di un singolo file)
|
||||||
|
/// </summary>
|
||||||
|
void RaiseEvent_Updating(string msg) {
|
||||||
|
EventHandler<EngineEventArgs> tmp = Updating;
|
||||||
|
if (null != tmp) tmp(this, new EngineEventArgs(msg, allLinks.Count, toDownload.Count, downloaded.Count));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
|
private void Wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
|
||||||
object obj = new Object();
|
object obj = new Object();
|
||||||
@@ -107,7 +146,7 @@ namespace A69WD {
|
|||||||
string link = wb.Url.ToString();
|
string link = wb.Url.ToString();
|
||||||
|
|
||||||
// aggiorno UI
|
// aggiorno UI
|
||||||
UpdateST(wb.Name + " - Donwloaded: " + link);
|
RaiseEvent_Updating(wb.Name + " - Donwloaded: " + link);
|
||||||
|
|
||||||
// Se pagina è un racconto, lo salvo
|
// Se pagina è un racconto, lo salvo
|
||||||
if (IsRacLink(link)) {
|
if (IsRacLink(link)) {
|
||||||
@@ -162,6 +201,8 @@ namespace A69WD {
|
|||||||
|
|
||||||
|
|
||||||
private void SaveState() {
|
private void SaveState() {
|
||||||
|
int res = App.DB.SaveData(allLinks, toDownload, downloaded, racLinks);
|
||||||
|
|
||||||
StringBuilder sb;
|
StringBuilder sb;
|
||||||
|
|
||||||
// Finito download, salvo gli archivi:
|
// Finito download, salvo gli archivi:
|
||||||
@@ -192,22 +233,23 @@ namespace A69WD {
|
|||||||
cTools.WriteTextFile(Path.Combine(Cfg.Settings.PathAnalizadedIndexFile, string.Format("_A69_RacLinks_{0}.tes", dt)), sb);
|
cTools.WriteTextFile(Path.Combine(Cfg.Settings.PathAnalizadedIndexFile, string.Format("_A69_RacLinks_{0}.tes", dt)), sb);
|
||||||
|
|
||||||
// avviso utente:
|
// avviso utente:
|
||||||
UpdateST(string.Format("Finito il download in {0}", DateTime.Now - dtStartTime));
|
RaiseEvent_Updating(string.Format("Finito il download in {0}", DateTime.Now - dtStartTime));
|
||||||
|
|
||||||
state = EngineStatusEnum.Stopped;
|
state = EngineStatusEnum.Stopped;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void UpdateST(string Msg) {
|
|
||||||
//lblST.Text = string.Format("{0} - {1} - {2}", DateTime.Now.ToString("HH:mm:ss"), cnt.ToString("0000"), Msg);
|
|
||||||
}
|
|
||||||
private string GetFileName(string url) { return url.Replace("https://www.annunci69.it/racconti-erotici/", "A69_").Replace("/", "_").Replace(":", "_").Replace(@"\", "_"); }
|
private string GetFileName(string url) { return url.Replace("https://www.annunci69.it/racconti-erotici/", "A69_").Replace("/", "_").Replace(":", "_").Replace(@"\", "_"); }
|
||||||
private bool IsIdxLink(string link) { return link.StartsWith(BASE_LINK_IDX); }
|
static private bool IsIdxLink(string link) { return link.StartsWith(BASE_LINK_IDX); }
|
||||||
private bool IsRacLink(string link) { foreach (string tip in Tipologie) { if (link.StartsWith(BASE_LINK_RAC + tip + "/")) return true; } return false; }
|
static private bool IsRacLink(string link) { foreach (string tip in Tipologie) { if (link.StartsWith(BASE_LINK_RAC + tip + "/")) return true; } return false; }
|
||||||
|
|
||||||
|
static public string LinkType(string link) {
|
||||||
|
if (IsIdxLink(link)) return "Idx";
|
||||||
|
if (IsRacLink(link)) return "Rac";
|
||||||
|
//return "Unknown";
|
||||||
|
return "Unk";
|
||||||
|
}
|
||||||
|
|
||||||
}//class cA69Engine
|
}//class cA69Engine
|
||||||
|
|
||||||
@@ -230,4 +272,40 @@ namespace A69WD {
|
|||||||
Stopped = 5,
|
Stopped = 5,
|
||||||
} // enum EngineStatusEnum
|
} // enum EngineStatusEnum
|
||||||
|
|
||||||
|
|
||||||
|
public class EngineEventArgs : EventArgs {
|
||||||
|
|
||||||
|
|
||||||
|
#region Property and Fields:
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Numero di file da analizzare, in totale
|
||||||
|
/// </summary>
|
||||||
|
public int NTot { get { return nTot; } }
|
||||||
|
private int nTot;
|
||||||
|
|
||||||
|
public int NtoDown { get { return ntoDown; } }
|
||||||
|
private int ntoDown;
|
||||||
|
|
||||||
|
public int NDown { get { return nDown; } }
|
||||||
|
private int nDown;
|
||||||
|
|
||||||
|
public string Message { get { return message; } }
|
||||||
|
private string message;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public EngineEventArgs(string Message, int NTot, int NtoDown, int NDown) {
|
||||||
|
this.nTot = NTot;
|
||||||
|
this.ntoDown = NtoDown;
|
||||||
|
this.nDown = NDown;
|
||||||
|
this.message = Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // class EngineEventArgs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//namespace A69WD
|
}//namespace A69WD
|
||||||
Generated
-28
@@ -23,8 +23,6 @@
|
|||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.btbPath = new System.Windows.Forms.Button();
|
|
||||||
this.tbPath = new System.Windows.Forms.TextBox();
|
|
||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.btnHide = new System.Windows.Forms.Button();
|
this.btnHide = new System.Windows.Forms.Button();
|
||||||
this.btnDownloadAll = new System.Windows.Forms.Button();
|
this.btnDownloadAll = new System.Windows.Forms.Button();
|
||||||
@@ -33,26 +31,6 @@
|
|||||||
this.btnDownloadLink = new System.Windows.Forms.Button();
|
this.btnDownloadLink = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btbPath
|
|
||||||
//
|
|
||||||
this.btbPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.btbPath.Location = new System.Drawing.Point(-39, 53);
|
|
||||||
this.btbPath.Name = "btbPath";
|
|
||||||
this.btbPath.Size = new System.Drawing.Size(20, 20);
|
|
||||||
this.btbPath.TabIndex = 17;
|
|
||||||
this.btbPath.Text = ".";
|
|
||||||
this.btbPath.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// tbPath
|
|
||||||
//
|
|
||||||
this.tbPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.tbPath.Location = new System.Drawing.Point(132, 54);
|
|
||||||
this.tbPath.Name = "tbPath";
|
|
||||||
this.tbPath.Size = new System.Drawing.Size(0, 20);
|
|
||||||
this.tbPath.TabIndex = 16;
|
|
||||||
this.tbPath.Text = "C:\\Temporary\\A69WD\\Dst\\";
|
|
||||||
//
|
|
||||||
// btnClose
|
// btnClose
|
||||||
//
|
//
|
||||||
this.btnClose.Location = new System.Drawing.Point(381, 12);
|
this.btnClose.Location = new System.Drawing.Point(381, 12);
|
||||||
@@ -121,8 +99,6 @@
|
|||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(504, 74);
|
this.ClientSize = new System.Drawing.Size(504, 74);
|
||||||
this.Controls.Add(this.btbPath);
|
|
||||||
this.Controls.Add(this.tbPath);
|
|
||||||
this.Controls.Add(this.btnClose);
|
this.Controls.Add(this.btnClose);
|
||||||
this.Controls.Add(this.btnHide);
|
this.Controls.Add(this.btnHide);
|
||||||
this.Controls.Add(this.btnDownloadAll);
|
this.Controls.Add(this.btnDownloadAll);
|
||||||
@@ -133,14 +109,10 @@
|
|||||||
this.Name = "frmDownloader";
|
this.Name = "frmDownloader";
|
||||||
this.Text = "frmDownloader";
|
this.Text = "frmDownloader";
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Button btbPath;
|
|
||||||
private System.Windows.Forms.TextBox tbPath;
|
|
||||||
private System.Windows.Forms.Button btnClose;
|
private System.Windows.Forms.Button btnClose;
|
||||||
private System.Windows.Forms.Button btnHide;
|
private System.Windows.Forms.Button btnHide;
|
||||||
private System.Windows.Forms.Button btnDownloadAll;
|
private System.Windows.Forms.Button btnDownloadAll;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace A69WD {
|
|||||||
public frmDownloader() {
|
public frmDownloader() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
engine = new cA69Engine(this.wb1);
|
engine = new cA69Engine(this.wb1);
|
||||||
|
engine.Updating += Engine_Updating;
|
||||||
}
|
}
|
||||||
|
|
||||||
cA69Engine engine = null;
|
cA69Engine engine = null;
|
||||||
@@ -40,6 +41,30 @@ namespace A69WD {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Gestione eventi dal engine
|
||||||
|
|
||||||
|
private void Engine_Updating(object sender, EngineEventArgs e) { EngineUpdatingStatus(e.Message, e.NTot, e.NtoDown, e.NDown); }
|
||||||
|
|
||||||
|
delegate void EngineUpdatingStatusCallback(string Message, int NTot, int NtoDown, int NDown);
|
||||||
|
private void EngineUpdatingStatus(string Message, int NTot, int NtoDown, int NDown) {
|
||||||
|
try {
|
||||||
|
// InvokeRequired required compares the thread ID of the
|
||||||
|
// calling thread to the thread ID of the creating thread.
|
||||||
|
// If these threads are different, it returns true.
|
||||||
|
if (lblST.InvokeRequired) {
|
||||||
|
EngineUpdatingStatusCallback callBack = new EngineUpdatingStatusCallback(EngineUpdatingStatus);
|
||||||
|
this.Invoke(callBack, new object[] { Message, NTot, NtoDown, NDown });
|
||||||
|
} else {
|
||||||
|
lblST.Text = string.Format("{4} - {3} | {2} | {1} - {0}", Message, NTot, NtoDown, NDown, DateTime.Now.ToString("HH:mm:ss"));
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.Log(new object[] { "Error Code: ER05553", "Errore in EngineUpdatingStatus():", ex });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//class frmDownloader
|
}//class frmDownloader
|
||||||
|
|||||||
Reference in new issue
Block a user