From 7cf59b233dd240736db74140a62f7fceac0ed90f Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 28 Jul 2020 22:08:59 +0200 Subject: [PATCH] UpdMan initial commit --- NKC_WF/NKC_WF.csproj | 8 +++ NKC_WF/site/UpdMan.aspx | 46 +++++++++++++++ NKC_WF/site/UpdMan.aspx.cs | 91 +++++++++++++++++++++++++++++ NKC_WF/site/UpdMan.aspx.designer.cs | 44 ++++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 NKC_WF/site/UpdMan.aspx create mode 100644 NKC_WF/site/UpdMan.aspx.cs create mode 100644 NKC_WF/site/UpdMan.aspx.designer.cs diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index e47ad53..9b0739f 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -388,6 +388,7 @@ + @@ -838,6 +839,13 @@ UpdateVoc.aspx + + UpdMan.aspx + ASPXCodeBehind + + + UpdMan.aspx + Utility.aspx ASPXCodeBehind diff --git a/NKC_WF/site/UpdMan.aspx b/NKC_WF/site/UpdMan.aspx new file mode 100644 index 0000000..a30a0d0 --- /dev/null +++ b/NKC_WF/site/UpdMan.aspx @@ -0,0 +1,46 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/SiteContent.master" AutoEventWireup="true" CodeBehind="UpdMan.aspx.cs" Inherits="NKC_WF.site.UpdMan" %> + + + +
+
+
+
+

SteamWare's Updater

+
+
+
+
+
+

Gestione Update pacchetti - Ultime release applicazioni.

+
+
+
+
+

ALL

+
+
+ LATEST VERS +
+
+
+
+
+
+

NKC

+
+
+ <%: Version("NKC") %> +
+
+
+
+
+
+ +
+
+
+
+
+
diff --git a/NKC_WF/site/UpdMan.aspx.cs b/NKC_WF/site/UpdMan.aspx.cs new file mode 100644 index 0000000..0641978 --- /dev/null +++ b/NKC_WF/site/UpdMan.aspx.cs @@ -0,0 +1,91 @@ +using SteamWare; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.site +{ + public partial class UpdMan : BasePage + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + + /// + /// Eseguo download pacchetti secondo richeista + /// + /// + /// + protected void lbtDownload_Click(object sender, EventArgs e) + { + LinkButton lnk = (LinkButton)sender; + string caller = lnk.CommandArgument; + string resultsMsg = ""; + // in base al caller scarico il file installazione richiesto... + if (caller == null) + { + caller = "ALL"; + } + // ora verifico COSA devo scaricare... + if (!string.IsNullOrEmpty(updateUrl(caller))) + { + // se è ALL scarico tutti... + if (caller == "ALL") + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + int done = 0; + // scarico TUTTI... + done += UpdateMan.obj.downloadLatest(updateUrl("NKC"), localDownloadPath("NKC"), "NKC"); + stopWatch.Stop(); + // calcolo elapsed time come TimeSpan value. + TimeSpan ts = stopWatch.Elapsed; + resultsMsg = string.Format("OK: {0} Package downloaded, {1:0.000} sec", done, ts.TotalSeconds); + } + else + { + // scarico singolo target... + UpdateMan.obj.downloadLatest(updateUrl(caller), localDownloadPath(caller), caller); + resultsMsg = string.Format("OK: {0} DOWNLOADED | {1} --> {2}", caller, updateUrl(caller), localDownloadPath(caller)); + } + } + // aggiorno messaggio + lblOut.Text = resultsMsg; + } + + public string Version(object package) + { + string answ = "a.b.c.d"; + UpdateInfoEventArgs updArgs = new UpdateInfoEventArgs(); + // Recupero info ADM... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl(package.ToString())); + if (updArgs.IsUpdateAvailable) + { + answ = updArgs.CurrentVersion.ToString(); + } + return answ; + } + + /// + /// URLK stringa di UPDATE... + /// + protected string updateUrl(string package) + { + return string.Format("http://seriate.steamware.net:8083/SWS/{0}/{1}/manifest.xml", package, memLayer.ML.CRS("appVers")); + } + + /// + /// Path locale dove scaricare gli installer + /// + protected string localDownloadPath(string package) + { + return string.Format(@"{0}{1}\{2}", memLayer.ML.CRS("downloadPath"), package, memLayer.ML.CRS("appVers")); + } + } +} \ No newline at end of file diff --git a/NKC_WF/site/UpdMan.aspx.designer.cs b/NKC_WF/site/UpdMan.aspx.designer.cs new file mode 100644 index 0000000..bd5f722 --- /dev/null +++ b/NKC_WF/site/UpdMan.aspx.designer.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.site +{ + + + public partial class UpdMan + { + + /// + /// Controllo lbtDownloadAll. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtDownloadAll; + + /// + /// Controllo lbtDownloadCMSSC. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtDownloadCMSSC; + + /// + /// Controllo lblOut. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblOut; + } +}