Modifiche x ottimizzare download solo pacchetti disponibili

This commit is contained in:
Samuele E. Locatelli
2017-11-08 15:05:57 +01:00
parent 04b4c6d0a1
commit 949117bde0
2 changed files with 87 additions and 26 deletions
+75 -14
View File
@@ -65,13 +65,73 @@ namespace MP.Controllers
{
ViewBag.Title = "MoonPro";
ViewBag.Message = "Ultime release applicazioni";
// Recupero ultime versioni applicazioni...
ViewBag.VersMpAdmin = "x.x.x.a";
ViewBag.VersMpIO = "x.x.x.b";
ViewBag.VersMpLand = "x.x.x.c";
ViewBag.VersMpMon = "x.x.x.d";
ViewBag.VersMpSite = "x.x.x.e";
ViewBag.VersMpTab = "x.x.x.f";
UpdateInfoEventArgs updArgs = new UpdateInfoEventArgs();
// Recupero info ADM...
updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("ADM"));
if (updArgs.IsUpdateAvailable)
{
ViewBag.VersMpAdmin = updArgs.CurrentVersion;
}
else
{
ViewBag.VersMpAdmin = "ND";
ViewBag.AdmDisabled = "disabled";
}
// Recupero info IO...
updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("IO"));
if (updArgs.IsUpdateAvailable)
{
ViewBag.VersMpIO = updArgs.CurrentVersion;
}
else
{
ViewBag.VersMpIO = "ND";
ViewBag.IODisabled = "disabled";
}
// Recupero info LAND...
updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("LAND"));
if (updArgs.IsUpdateAvailable)
{
ViewBag.VersMpLand = updArgs.CurrentVersion;
}
else
{
ViewBag.VersMpLand = "ND";
ViewBag.LandDisabled = "disabled";
}
// Recupero info MON...
updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("MON"));
if (updArgs.IsUpdateAvailable)
{
ViewBag.VersMpMon = updArgs.CurrentVersion;
}
else
{
ViewBag.VersMpMon = "ND";
ViewBag.MonDisabled = "disabled";
}
// Recupero info SITE...
updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("SITE"));
if (updArgs.IsUpdateAvailable)
{
ViewBag.VersMpSite = updArgs.CurrentVersion;
}
else
{
ViewBag.VersMpSite = "ND";
ViewBag.SiteDisabled = "disabled";
}
// Recupero info TAB...
updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("TAB"));
if (updArgs.IsUpdateAvailable)
{
ViewBag.VersMpTab = updArgs.CurrentVersion;
}
else
{
ViewBag.VersMpTab = "ND";
ViewBag.TabDisabled = "disabled";
}
// salvo risultati...
ViewBag.Results = results;
// VIEW!
@@ -95,17 +155,18 @@ namespace MP.Controllers
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
int done = 0;
// scarico TUTTI...
UpdateMan.obj.downloadLatest(updateUrl("ADM"), localDownloadPath("ADM"));
UpdateMan.obj.downloadLatest(updateUrl("IO"), localDownloadPath("IO"));
UpdateMan.obj.downloadLatest(updateUrl("LAND"), localDownloadPath("LAND"));
UpdateMan.obj.downloadLatest(updateUrl("MON"), localDownloadPath("MON"));
UpdateMan.obj.downloadLatest(updateUrl("SITE"), localDownloadPath("SITE"));
UpdateMan.obj.downloadLatest(updateUrl("TAB"), localDownloadPath("TAB"));
done += UpdateMan.obj.downloadLatest(updateUrl("ADM"), localDownloadPath("ADM"));
done += UpdateMan.obj.downloadLatest(updateUrl("IO"), localDownloadPath("IO"));
done += UpdateMan.obj.downloadLatest(updateUrl("LAND"), localDownloadPath("LAND"));
done += UpdateMan.obj.downloadLatest(updateUrl("MON"), localDownloadPath("MON"));
done += UpdateMan.obj.downloadLatest(updateUrl("SITE"), localDownloadPath("SITE"));
done += UpdateMan.obj.downloadLatest(updateUrl("TAB"), localDownloadPath("TAB"));
stopWatch.Stop();
// calcolo elapsed time come TimeSpan value.
TimeSpan ts = stopWatch.Elapsed;
resultsMsg = string.Format("OK: {0} DOWNLOADED, {1:0.000} sec", caller, ts.TotalSeconds);
resultsMsg = string.Format("OK: {0} Package downloaded, {1:0.000} sec", done, ts.TotalSeconds);
}
else
{