Merge branch 'release/FixPaginationAndConfig_01'
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Win32;
|
||||
using NLog;
|
||||
using System.Diagnostics;
|
||||
using System.IO.Compression;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EgwControlCenter.App
|
||||
@@ -15,6 +16,7 @@ namespace EgwControlCenter.App
|
||||
public BlazorForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
CheckUnzip();
|
||||
ServiceInit();
|
||||
CleanOldTrayIcons();
|
||||
InitBlazorView();
|
||||
@@ -76,8 +78,12 @@ namespace EgwControlCenter.App
|
||||
// uso processstartInfo x nascondere finestra
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
#if DEBUG
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Normal;
|
||||
#endif
|
||||
startInfo.CreateNoWindow = true;
|
||||
startInfo.FileName = extPath;
|
||||
ACService.SendRebooted(true);
|
||||
Process.Start(startInfo);
|
||||
}
|
||||
else
|
||||
@@ -175,16 +181,16 @@ namespace EgwControlCenter.App
|
||||
await Task.Delay(500);
|
||||
SendToTray();
|
||||
// eseguo task preliminari tipo invio reset effettuato + elenco conf...
|
||||
await Task.Delay(1000);
|
||||
await ACService.SendRebooted();
|
||||
await Task.Delay(100);
|
||||
await ACService.SendRebootedAsync(false);
|
||||
// ora invio info licenza (SE disponibili)
|
||||
await Task.Delay(1000);
|
||||
await Task.Delay(100);
|
||||
await ACService.SendLicInfo();
|
||||
// infine invio info conf (x editing successivo)
|
||||
await Task.Delay(1000);
|
||||
await Task.Delay(100);
|
||||
await ACService.SendConfTarget();
|
||||
// invio stats avvio
|
||||
await Task.Delay(1000);
|
||||
await Task.Delay(100);
|
||||
await ACService.SendStats();
|
||||
}
|
||||
|
||||
@@ -280,8 +286,10 @@ namespace EgwControlCenter.App
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
#if false
|
||||
CurrAssembly = Assembly.GetExecutingAssembly().GetName();
|
||||
Log.Trace($"EgalWare's AppControlCenter Init, v.{CurrAssembly.Version}");
|
||||
Log.Trace($"EgalWare's AppControlCenter Init, v.{CurrAssembly.Version}");
|
||||
#endif
|
||||
// sistemo grafica TRAY ICON
|
||||
SetupTrayIcon();
|
||||
CreateTrayMenu();
|
||||
@@ -375,6 +383,31 @@ namespace EgwControlCenter.App
|
||||
Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue eventuale unzip file risorse www
|
||||
/// </summary>
|
||||
private void CheckUnzip()
|
||||
{
|
||||
CurrAssembly = Assembly.GetExecutingAssembly().GetName();
|
||||
Log.Info($"EgalWare's AppControlCenter Init, v.{CurrAssembly.Version}");
|
||||
string exePath = Assembly.GetExecutingAssembly().Location;
|
||||
string appDir = Path.GetDirectoryName(exePath) ?? "";
|
||||
if (!string.IsNullOrEmpty(appDir))
|
||||
{
|
||||
string srcZip = Path.Combine(appDir, "wwwroot.zip");
|
||||
if ((File.Exists(srcZip)))
|
||||
{
|
||||
Log.Info($"Zip file found");
|
||||
// decomprimo
|
||||
ZipFile.ExtractToDirectory(srcZip, appDir, true);
|
||||
Log.Info($"Zip file extracted");
|
||||
// elimino zip
|
||||
File.Delete(srcZip);
|
||||
Log.Info($"Zip file removed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ServiceInit()
|
||||
{
|
||||
//init preliminare servizio controllo
|
||||
@@ -415,8 +448,9 @@ namespace EgwControlCenter.App
|
||||
// timer controlli da conf
|
||||
timerCheck.Interval = (ACService.RefreshPeriod * 1000);
|
||||
// timer statistiche a 30 min fisso x ora
|
||||
#if DEBUG
|
||||
timerStats.Interval = 1000 * 60 * 5;
|
||||
#if false
|
||||
#else
|
||||
timerStats.Interval = 1000 * 60 * 30;
|
||||
#endif
|
||||
// avvio timer
|
||||
@@ -487,14 +521,14 @@ namespace EgwControlCenter.App
|
||||
forceClose = true;
|
||||
Close();
|
||||
}
|
||||
else if (e.ClickedItem.Text.StartsWith("Reload"))
|
||||
{
|
||||
DoRestart(false);
|
||||
}
|
||||
else if (e.ClickedItem.Text.StartsWith("Restart"))
|
||||
{
|
||||
DoRestart(true);
|
||||
}
|
||||
else if (e.ClickedItem.Text.StartsWith("Reload"))
|
||||
{
|
||||
DoRestart(false);
|
||||
}
|
||||
else if (e.ClickedItem.Text.StartsWith("Show"))
|
||||
{
|
||||
Show();
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-0 d-flex">
|
||||
<div class="px-0">
|
||||
<h5>App Control Center</h5>
|
||||
<div class="px-0 py-0">
|
||||
<div class="mb-0 fw-bold text-uppercase">App Control Center</div>
|
||||
<small class="small mb-0"><i class="fa-solid fa-computer"></i> @ComputerName | <i class="fa-solid fa-user"></i> @($"{DomainName}\\{UserName}")</small>
|
||||
</div>
|
||||
@if (RemoteCallActive)
|
||||
{
|
||||
@@ -21,7 +22,7 @@
|
||||
<ProgressDisplay RefreshInterval="100" Title="@UpdateMsg" MaxVal="@maxVal" CurrVal="@currVal" NextVal="@nextVal" ExpTimeMSec="@expTimeMSec" DisplaySize="ProgressDisplay.ModalSize.Medium" ModalCss="card alert-primary" SlowLimit="0.4"></ProgressDisplay>
|
||||
</div>
|
||||
<div class="p-0 d-flex small">
|
||||
<div class="px-1 input-group input-group-sm">
|
||||
<div class="px-0 input-group input-group-sm">
|
||||
<span class="input-group-text py-0">
|
||||
<span class="form-check form-switch">
|
||||
<label class="form-check-label">Only Updates</label>
|
||||
@@ -29,8 +30,6 @@
|
||||
</span>
|
||||
</span>
|
||||
<button class="btn btn-sm btn-outline-success" @onclick="ForceCheck" title="Forza Verifica Immediata">Check Now <i class="fa-solid fa-rotate"></i></button>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-outline-primary" @onclick="ToggleSetup" title="Setup Controlli"><i class="fa-solid fa-angles-left"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -108,7 +107,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer py-0 align-middle">
|
||||
@if (totalCount > 5)
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
}
|
||||
|
||||
@@ -17,6 +17,19 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
|
||||
#region Public Methods
|
||||
|
||||
private string ComputerName
|
||||
{
|
||||
get => Environment.MachineName;
|
||||
}
|
||||
private string UserName
|
||||
{
|
||||
get => Environment.UserName;
|
||||
}
|
||||
private string DomainName
|
||||
{
|
||||
get => Environment.UserDomainName;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ACService.EA_StatusUpdated -= ACService_EA_StatusUpdated;
|
||||
@@ -76,6 +89,11 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
case CoreEnum.AppType.Cli:
|
||||
break;
|
||||
|
||||
case CoreEnum.AppType.EgwACC:
|
||||
// sollevo richiesta riavvio!
|
||||
ACService.RaiseRestartReq();
|
||||
break;
|
||||
|
||||
case CoreEnum.AppType.Machine:
|
||||
break;
|
||||
|
||||
@@ -83,43 +101,7 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
break;
|
||||
|
||||
case CoreEnum.AppType.WinApp:
|
||||
// esegue update delle app Iob-*
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
UpdateMsg = "Backup Config";
|
||||
currVal = 0;
|
||||
nextVal = 60;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 1);
|
||||
currStats.RecordExeData("Step01_Backup", sw.Elapsed);
|
||||
sw.Restart();
|
||||
|
||||
UpdateMsg = "Download update";
|
||||
currVal = 60;
|
||||
nextVal = 90;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 2);
|
||||
currStats.RecordExeData("Step02_Download", sw.Elapsed);
|
||||
sw.Restart();
|
||||
|
||||
UpdateMsg = "Unzip software";
|
||||
currVal = 90;
|
||||
nextVal = 96;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 3);
|
||||
currStats.RecordExeData("Step03_UnZip", sw.Elapsed);
|
||||
sw.Restart();
|
||||
|
||||
UpdateMsg = "Config Restore";
|
||||
currVal = 96;
|
||||
nextVal = 100;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 4);
|
||||
currStats.RecordExeData("Step04_Restore", sw.Elapsed);
|
||||
currStats.SaveToDisk();
|
||||
UpdateMsg = "Completed!";
|
||||
currVal = 100;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ExecWinAppUpdate(ReqApp);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -134,6 +116,53 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione step update x WinApp (tipicamente IOB-WIN-*)
|
||||
/// </summary>
|
||||
/// <param name="ReqApp"></param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecWinAppUpdate(VersStatusDTO ReqApp)
|
||||
{
|
||||
// esegue update delle app Iob-*
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
UpdateMsg = "Backup Config";
|
||||
currVal = 0;
|
||||
nextVal = 60;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 1);
|
||||
currStats.RecordExeData("Step01_Backup", sw.Elapsed);
|
||||
sw.Restart();
|
||||
|
||||
UpdateMsg = "Download update";
|
||||
currVal = 60;
|
||||
nextVal = 90;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 2);
|
||||
currStats.RecordExeData("Step02_Download", sw.Elapsed);
|
||||
sw.Restart();
|
||||
|
||||
UpdateMsg = "Unzip software";
|
||||
currVal = 90;
|
||||
nextVal = 96;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 3);
|
||||
currStats.RecordExeData("Step03_UnZip", sw.Elapsed);
|
||||
sw.Restart();
|
||||
|
||||
UpdateMsg = "Config Restore";
|
||||
currVal = 96;
|
||||
nextVal = 100;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ACService.IobWinUpdateStep(ReqApp, 4);
|
||||
currStats.RecordExeData("Step04_Restore", sw.Elapsed);
|
||||
currStats.SaveToDisk();
|
||||
UpdateMsg = "Completed!";
|
||||
currVal = 100;
|
||||
ACService.ReportStatusUpd();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async Task ForceCheck()
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<table class="table table-striped table-sm text-start shadow border mb-0">
|
||||
<thead>
|
||||
<tr class="bg-dark bg-gradient text-light">
|
||||
<th class="text-center" style="width: 2rem;"></th>
|
||||
<th class="align-middle px-3" style="width: 2rem;">#</th>
|
||||
<th>App Type</th>
|
||||
<th>Path</th>
|
||||
<th class="text-end" style="width: 3rem;">Enabled</th>
|
||||
@@ -83,12 +83,12 @@
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td class="text-center">@item.Idx</td>
|
||||
<td>@item.ApplicationType</td>
|
||||
<td class="align-middle px-3">@item.Idx</td>
|
||||
<td class="align-middle">@item.ApplicationType</td>
|
||||
<td>
|
||||
<input type="text" class="form-control form-control-sm" @bind="@item.BasePath" />
|
||||
<input type="text" class="form-control form-control-sm small" @bind="@item.BasePath" />
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<td class="text-end align-middle">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" @bind="@item.IsEnabled">
|
||||
</div>
|
||||
@@ -108,7 +108,7 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (PwdOk && totalCount > 5)
|
||||
@if (PwdOk && totalCount > numRecord)
|
||||
{
|
||||
<div class="card-footer py-0 align-middle">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
|
||||
@@ -189,6 +189,7 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
{
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords
|
||||
.OrderBy(x => x.Idx)
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"BasePath": "C:\\Steamware",
|
||||
"SearchPattern": "IOB-*.exe",
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": true,
|
||||
"UpdateEnabled": true
|
||||
},
|
||||
{
|
||||
"Idx": 2,
|
||||
@@ -41,6 +41,22 @@
|
||||
"SearchPattern": "*.ini",
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": false
|
||||
},
|
||||
{
|
||||
"Idx": 6,
|
||||
"ApplicationType": "EgwACC",
|
||||
"BasePath": "C:\\Steamware",
|
||||
"SearchPattern": "EgwControlCenterApp.exe",
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": true
|
||||
},
|
||||
{
|
||||
"Idx": 7,
|
||||
"ApplicationType": "WinApp",
|
||||
"BasePath": "C:\\Steamware",
|
||||
"SearchPattern": "d_cx.exe",
|
||||
"IsEnabled": false,
|
||||
"UpdateEnabled": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,16 +5,122 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.2.2501.2111</Version>
|
||||
<Configurations>Debug;Release;DEBUG_Local</Configurations>
|
||||
<Version>1.2.2504.0316</Version>
|
||||
<Configurations>Debug;Release;DEBUG_Local;DEBUG_remote</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
<Content Remove="wwwroot\css\app.css" />
|
||||
<Content Remove="wwwroot\css\app.less" />
|
||||
<Content Remove="wwwroot\css\bootstrap\bootstrap.min.css" />
|
||||
<Content Remove="wwwroot\css\bootstrap\bootstrap.min.css.map" />
|
||||
<Content Remove="wwwroot\css\fonts.css" />
|
||||
<Content Remove="wwwroot\css\fonts.less" />
|
||||
<Content Remove="wwwroot\favicon.ico" />
|
||||
<Content Remove="wwwroot\fonts\lato-v17-latin-regular.eot" />
|
||||
<Content Remove="wwwroot\fonts\lato-v17-latin-regular.svg" />
|
||||
<Content Remove="wwwroot\fonts\lato-v17-latin-regular.ttf" />
|
||||
<Content Remove="wwwroot\fonts\lato-v17-latin-regular.woff" />
|
||||
<Content Remove="wwwroot\fonts\lato-v17-latin-regular.woff2" />
|
||||
<Content Remove="wwwroot\fonts\roboto-condensed-v19-latin-regular.eot" />
|
||||
<Content Remove="wwwroot\fonts\roboto-condensed-v19-latin-regular.svg" />
|
||||
<Content Remove="wwwroot\fonts\roboto-condensed-v19-latin-regular.ttf" />
|
||||
<Content Remove="wwwroot\fonts\roboto-condensed-v19-latin-regular.woff" />
|
||||
<Content Remove="wwwroot\fonts\roboto-condensed-v19-latin-regular.woff2" />
|
||||
<Content Remove="wwwroot\fonts\roboto-v27-latin-regular.eot" />
|
||||
<Content Remove="wwwroot\fonts\roboto-v27-latin-regular.svg" />
|
||||
<Content Remove="wwwroot\fonts\roboto-v27-latin-regular.ttf" />
|
||||
<Content Remove="wwwroot\fonts\roboto-v27-latin-regular.woff" />
|
||||
<Content Remove="wwwroot\fonts\roboto-v27-latin-regular.woff2" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\all.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\all.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\brands.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\brands.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\fontawesome.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\fontawesome.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\regular.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\regular.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\solid.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\solid.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\svg-with-js.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\svg-with-js.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\v4-font-face.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\v4-font-face.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\v4-shims.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\v4-shims.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\v5-font-face.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\css\v5-font-face.min.css" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\sprites\brands.svg" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\sprites\regular.svg" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\sprites\solid.svg" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-brands-400.ttf" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-brands-400.woff2" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-regular-400.ttf" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-regular-400.woff2" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-solid-900.ttf" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-solid-900.woff2" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-v4compatibility.ttf" />
|
||||
<Content Remove="wwwroot\lib\font-awesome\webfonts\fa-v4compatibility.woff2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="logs\.placeholder" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="logs\.placeholder" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="compilerconfig.json" />
|
||||
<None Include="wwwroot\css\app.css" />
|
||||
<None Include="wwwroot\css\app.less" />
|
||||
<None Include="wwwroot\css\bootstrap\bootstrap.min.css" />
|
||||
<None Include="wwwroot\css\bootstrap\bootstrap.min.css.map" />
|
||||
<None Include="wwwroot\css\fonts.css" />
|
||||
<None Include="wwwroot\css\fonts.less" />
|
||||
<None Include="wwwroot\favicon.ico" />
|
||||
<None Include="wwwroot\fonts\lato-v17-latin-regular.eot" />
|
||||
<None Include="wwwroot\fonts\lato-v17-latin-regular.svg" />
|
||||
<None Include="wwwroot\fonts\lato-v17-latin-regular.ttf" />
|
||||
<None Include="wwwroot\fonts\lato-v17-latin-regular.woff" />
|
||||
<None Include="wwwroot\fonts\lato-v17-latin-regular.woff2" />
|
||||
<None Include="wwwroot\fonts\roboto-condensed-v19-latin-regular.eot" />
|
||||
<None Include="wwwroot\fonts\roboto-condensed-v19-latin-regular.svg" />
|
||||
<None Include="wwwroot\fonts\roboto-condensed-v19-latin-regular.ttf" />
|
||||
<None Include="wwwroot\fonts\roboto-condensed-v19-latin-regular.woff" />
|
||||
<None Include="wwwroot\fonts\roboto-condensed-v19-latin-regular.woff2" />
|
||||
<None Include="wwwroot\fonts\roboto-v27-latin-regular.eot" />
|
||||
<None Include="wwwroot\fonts\roboto-v27-latin-regular.svg" />
|
||||
<None Include="wwwroot\fonts\roboto-v27-latin-regular.ttf" />
|
||||
<None Include="wwwroot\fonts\roboto-v27-latin-regular.woff" />
|
||||
<None Include="wwwroot\fonts\roboto-v27-latin-regular.woff2" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\all.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\all.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\brands.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\brands.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\fontawesome.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\fontawesome.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\regular.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\regular.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\solid.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\solid.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\svg-with-js.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\svg-with-js.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\v4-font-face.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\v4-font-face.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\v4-shims.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\v4-shims.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\v5-font-face.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\css\v5-font-face.min.css" />
|
||||
<None Include="wwwroot\lib\font-awesome\sprites\brands.svg" />
|
||||
<None Include="wwwroot\lib\font-awesome\sprites\regular.svg" />
|
||||
<None Include="wwwroot\lib\font-awesome\sprites\solid.svg" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-brands-400.ttf" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-brands-400.woff2" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-regular-400.ttf" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-regular-400.woff2" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-solid-900.ttf" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-solid-900.woff2" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-v4compatibility.ttf" />
|
||||
<None Include="wwwroot\lib\font-awesome\webfonts\fa-v4compatibility.woff2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2501.1716" />
|
||||
@@ -49,6 +155,9 @@
|
||||
<None Update="pre-build.ps1">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="wwwroot.zip">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<variable name="logDir" value="${basedir}"/>
|
||||
<variable name="logDir" value="${basedir}/logs"/>
|
||||
<targets>
|
||||
<target xsi:type="File"
|
||||
name="f_base"
|
||||
@@ -33,7 +33,7 @@
|
||||
</targets>
|
||||
<rules>
|
||||
<!-- Logging Levels (Trace, Debug, Info, Warn, Error, Fatal)-->
|
||||
<logger name="*" minlevel="Trace" maxlevel="Warn" final="true" writeTo="f_base" />
|
||||
<logger name="*" minlevel="Info" maxlevel="Warn" final="true" writeTo="f_base" />
|
||||
<logger name="*" minlevel="Error" writeTo="f_error" />
|
||||
</rules>
|
||||
</nlog>
|
||||
|
||||
@@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>2111</ApplicationRevision>
|
||||
<ApplicationVersion>1.2.2501.2111</ApplicationVersion>
|
||||
<ApplicationRevision>0316</ApplicationRevision>
|
||||
<ApplicationVersion>1.2.2504.0316</ApplicationVersion>
|
||||
<BootstrapperEnabled>True</BootstrapperEnabled>
|
||||
<Configuration>Release</Configuration>
|
||||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
|
||||
@@ -47,6 +47,15 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<IncludeHash>true</IncludeHash>
|
||||
<FileType>File</FileType>
|
||||
</PublishFile>
|
||||
<PublishFile Include="Components\Compo\AuthChallengeMan.razor">
|
||||
<Group>
|
||||
</Group>
|
||||
<TargetPath>
|
||||
</TargetPath>
|
||||
<PublishState>Include</PublishState>
|
||||
<IncludeHash>true</IncludeHash>
|
||||
<FileType>File</FileType>
|
||||
</PublishFile>
|
||||
<PublishFile Include="Components\Compo\CmpFooter.razor">
|
||||
<Group>
|
||||
</Group>
|
||||
@@ -110,6 +119,15 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<IncludeHash>true</IncludeHash>
|
||||
<FileType>File</FileType>
|
||||
</PublishFile>
|
||||
<PublishFile Include="wwwroot.zip">
|
||||
<Group>
|
||||
</Group>
|
||||
<TargetPath>
|
||||
</TargetPath>
|
||||
<PublishState>Include</PublishState>
|
||||
<IncludeHash>true</IncludeHash>
|
||||
<FileType>File</FileType>
|
||||
</PublishFile>
|
||||
<PublishFile Include="_Imports.razor">
|
||||
<Group>
|
||||
</Group>
|
||||
@@ -127,7 +145,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.NetCore.DesktopRuntime.8.0.x64">
|
||||
<Install>true</Install>
|
||||
<ProductName>.NET Desktop Runtime 8.0.11 (x64)</ProductName>
|
||||
<ProductName>.NET Desktop Runtime 8.0.14 (x64)</ProductName>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.NetCore.DesktopRuntime.8.0.x86">
|
||||
<Install>true</Install>
|
||||
<ProductName>.NET Desktop Runtime 8.0.14 (x86)</ProductName>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"profiles": {
|
||||
"EgwControlCenter.App": {
|
||||
"commandName": "Project",
|
||||
"remoteDebugEnabled": false,
|
||||
"remoteDebugMachine": "10.74.83.32",
|
||||
"authenticationMode": "Windows"
|
||||
},
|
||||
"Remote": {
|
||||
"commandName": "Project",
|
||||
"workingDirectory": "C:\\Steamware\\EgwAppControlCenter\\",
|
||||
"remoteDebugEnabled": true,
|
||||
"remoteDebugMachine": "10.74.83.32",
|
||||
"authenticationMode": "Windows"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Binary file not shown.
@@ -413,7 +413,7 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
CloudCallActive = true;
|
||||
// in primis li segnala in running...
|
||||
await CurrCheck.TaskSetRunning(DeviceName, task2exe);
|
||||
await CurrCheck.TaskSetRunningAsync(DeviceName, task2exe);
|
||||
// imposto limite a scalare x i prox fast check avendo trovato task da eseguire...
|
||||
numFastCheck = RuntimeConfInt("CountNumFastCheck");
|
||||
Dictionary<string, string> taskResults = new Dictionary<string, string>();
|
||||
@@ -435,7 +435,7 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
}
|
||||
// invio risposta esito esecuzione finale
|
||||
await CurrCheck.TaskSetDone(DeviceName, taskResults);
|
||||
await CurrCheck.TaskSetDoneAsync(DeviceName, taskResults);
|
||||
sendStats = true;
|
||||
CloudCallActive = false;
|
||||
}
|
||||
@@ -515,6 +515,25 @@ namespace EgwControlCenter.Core
|
||||
StatsCollector.UpdateStat($"AppUpdate", sw.Elapsed);
|
||||
}
|
||||
|
||||
public void ReportStatusUpd()
|
||||
{
|
||||
if (EA_StatusUpdated != null)
|
||||
{
|
||||
#if false
|
||||
// controllo se almeno 1 app abbia update...
|
||||
foreach (var item in ListAppStatus)
|
||||
{
|
||||
if (item.HasUpdate)
|
||||
{
|
||||
EA_StatusUpdated?.Invoke();
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
EA_StatusUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetConf()
|
||||
{
|
||||
bool fatto = CurrCheck.ResetConf();
|
||||
@@ -548,7 +567,7 @@ namespace EgwControlCenter.Core
|
||||
var task2send = new Dictionary<string, string>();
|
||||
string rawConf = JsonConvert.SerializeObject(CurrCheck.CurrPatrolCont.TargetList);
|
||||
task2send.Add("TargetList", rawConf);
|
||||
await CurrCheck.TaskSetDone(DeviceName, task2send);
|
||||
await CurrCheck.TaskSetDoneAsync(DeviceName, task2send);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -565,22 +584,44 @@ namespace EgwControlCenter.Core
|
||||
// chiave: LicInfo
|
||||
licInfo.Add("LicInfo", rawData);
|
||||
// invio!
|
||||
await CurrCheck.TaskSetDone(DeviceName, licInfo);
|
||||
await CurrCheck.TaskSetDoneAsync(DeviceName, licInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia info di reboot effettuato (spostando da req/run a done...)
|
||||
/// Invia immediatamente info di reboot effettuato (spostando da req/run a done...)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task SendRebooted()
|
||||
public void SendRebooted(bool sendReboot)
|
||||
{
|
||||
// preparo un task di reboot da inviare
|
||||
var task2send = new Dictionary<string, string>();
|
||||
task2send.Add("ExecStart", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
await CurrCheck.TaskSetRunning(DeviceName, task2send);
|
||||
await Task.Delay(500);
|
||||
await CurrCheck.TaskSetDone(DeviceName, task2send);
|
||||
CurrCheck.TaskSetRunning(DeviceName, task2send);
|
||||
if (sendReboot)
|
||||
{
|
||||
// aggiungo anche rebooted...
|
||||
task2send.Add("RebootRequest", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
}
|
||||
CurrCheck.TaskSetDone(DeviceName, task2send);
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia info di reboot effettuato (spostando da req/run a done...)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task SendRebootedAsync(bool sendReboot)
|
||||
{
|
||||
// preparo un task di reboot da inviare
|
||||
var task2send = new Dictionary<string, string>();
|
||||
task2send.Add("ExecStart", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
await CurrCheck.TaskSetRunningAsync(DeviceName, task2send);
|
||||
await Task.Delay(50);
|
||||
if (sendReboot)
|
||||
{
|
||||
// aggiungo anche rebooted...
|
||||
task2send.Add("RebootRequest", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
}
|
||||
await CurrCheck.TaskSetDoneAsync(DeviceName, task2send);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -659,7 +700,7 @@ namespace EgwControlCenter.Core
|
||||
// chiave: LicInfo
|
||||
licInfo.Add("LicInfo", rawData);
|
||||
// invio!
|
||||
await CurrCheck.TaskSetDone(DeviceName, licInfo);
|
||||
await CurrCheck.TaskSetDoneAsync(DeviceName, licInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,7 +720,7 @@ namespace EgwControlCenter.Core
|
||||
// chiave: RunStats
|
||||
statsInfo.Add("RunStats", rawData);
|
||||
// invio!
|
||||
await CurrCheck.TaskSetDone(DeviceName, statsInfo);
|
||||
await CurrCheck.TaskSetDoneAsync(DeviceName, statsInfo);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -875,6 +916,14 @@ namespace EgwControlCenter.Core
|
||||
//case CoreEnum.EgwAccTask.AppSearch:
|
||||
// break;
|
||||
|
||||
case CoreEnum.EgwAccTask.BackupSendConf:
|
||||
Dictionary<string, string> bsRes = new Dictionary<string, string>();
|
||||
bsRes.Add("ExecStart", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
await IobConfZipUpload();
|
||||
sw.Stop();
|
||||
taskVal = JsonConvert.SerializeObject(bsRes);
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.DeviceInfoGet:
|
||||
Dictionary<string, string> currDevInfo = DeviceInfoDict();
|
||||
taskVal = JsonConvert.SerializeObject(currDevInfo);
|
||||
@@ -907,11 +956,7 @@ namespace EgwControlCenter.Core
|
||||
sw.Stop();
|
||||
// mando subito conferma esecuzione...
|
||||
taskVal = JsonConvert.SerializeObject(fuRes);
|
||||
// sollevo evento
|
||||
if (EA_RestartRequested != null)
|
||||
{
|
||||
EA_RestartRequested?.Invoke();
|
||||
}
|
||||
RaiseRestartReq();
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.OxyLicenseGet:
|
||||
@@ -955,6 +1000,56 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.TargetAppUpdate:
|
||||
// verifico se nel payload c'è valore dell'applciazione da aggiornare...
|
||||
if (string.IsNullOrEmpty(item.Value))
|
||||
{
|
||||
taskVal = "Error: missing CodApp";
|
||||
}
|
||||
else
|
||||
{
|
||||
CloudCallActive = true;
|
||||
// in primis chiamo aggiornamento stati release
|
||||
await DoFullCheckAsync(true);
|
||||
// il valore è il nome dell'app da aggiornare...
|
||||
string codAppReq = item.Value;
|
||||
// verifico da conf che la richiesta sia sensata (update x un app consentita...)
|
||||
var ReqApp = ListAppStatus.FirstOrDefault(x => x.CodApp == codAppReq);
|
||||
// se ho trovato...
|
||||
if (ReqApp != null)
|
||||
{
|
||||
//verifica ulteriore tipo app e con update... limitato a WinApp...
|
||||
if (ReqApp != null && ReqApp.ApplicationType == CoreEnum.AppType.WinApp && ReqApp.HasUpdate)
|
||||
{ // esegue update delle app Iob-*
|
||||
// "Backup Config"
|
||||
await IobWinUpdateStep(ReqApp, 1);
|
||||
|
||||
// "Download update";
|
||||
await IobWinUpdateStep(ReqApp, 2);
|
||||
|
||||
// "Unzip software";
|
||||
await IobWinUpdateStep(ReqApp, 3);
|
||||
|
||||
// "Config Restore";
|
||||
await IobWinUpdateStep(ReqApp, 4);
|
||||
|
||||
// update finale
|
||||
await DoFullCheckAsync(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"Update non permesso per {codAppReq}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"App non trovatao: {codAppReq}";
|
||||
}
|
||||
CloudCallActive = false;
|
||||
ReportStatusUpd();
|
||||
}
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.ND:
|
||||
default:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
@@ -972,6 +1067,18 @@ namespace EgwControlCenter.Core
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Solleva evento richiesta restart
|
||||
/// </summary>
|
||||
public void RaiseRestartReq()
|
||||
{
|
||||
// sollevo evento
|
||||
if (EA_RestartRequested != null)
|
||||
{
|
||||
EA_RestartRequested?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua un force kill dato nome processo
|
||||
/// </summary>
|
||||
@@ -991,18 +1098,30 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
if (!p.HasExited)
|
||||
{
|
||||
int closeWaitTime = waitForExitMsec * 8;
|
||||
// se è MAN --> aspetto + a lungo...
|
||||
if(nomeProc.Contains("IOB-MAN"))
|
||||
{
|
||||
closeWaitTime = closeWaitTime * 4;
|
||||
}
|
||||
p.CloseMainWindow();
|
||||
p.WaitForExit(closeWaitTime);
|
||||
}
|
||||
if (!p.HasExited)
|
||||
{
|
||||
Log.Error($"Process not Exited, 2nd try p.kill()");
|
||||
p.Kill();
|
||||
p.WaitForExit(waitForExitMsec);
|
||||
}
|
||||
if (!p.HasExited)
|
||||
{
|
||||
Log.Error($"Process not Killed, 2nd try p.kill()");
|
||||
Log.Error($"Process not Killed, 3nd try p.kill()");
|
||||
p.Kill();
|
||||
p.WaitForExit(waitForExitMsec * 2);
|
||||
}
|
||||
if (!p.HasExited)
|
||||
{
|
||||
Log.Error($"Process not Killed, 3th try p.kill()");
|
||||
Log.Error($"Process not Killed, 4th try p.kill()");
|
||||
p.Kill();
|
||||
}
|
||||
}
|
||||
@@ -1016,6 +1135,61 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua zip della folder di backup conf e la invia a LiMan
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task IobConfZipUpload()
|
||||
{
|
||||
// controllo che ci sia la firectory di partenza...
|
||||
string confDir = Path.Combine(backupDir, "Conf");
|
||||
if (Directory.Exists(confDir))
|
||||
{
|
||||
// preparo dir temporanea x zip
|
||||
string tempZip = Path.Combine(tempDir, "ConfCopy");
|
||||
if (Directory.Exists(tempZip))
|
||||
{
|
||||
Directory.Delete(tempZip, true);
|
||||
}
|
||||
Directory.CreateDirectory(tempZip);
|
||||
|
||||
// copio contenuto dir conf
|
||||
CopyDirectory(confDir, tempZip);
|
||||
|
||||
// preparo zip
|
||||
string zipPath = Path.Combine(tempDir, "IOB_Conf.zip");
|
||||
if (File.Exists(zipPath))
|
||||
{
|
||||
File.Delete(zipPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
string zipDir = Path.GetDirectoryName(zipPath) ?? "";
|
||||
if (!string.IsNullOrEmpty(zipDir))
|
||||
{
|
||||
if (!Directory.Exists(zipDir))
|
||||
{
|
||||
Directory.CreateDirectory(zipDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
await Task.Run(() =>
|
||||
{
|
||||
ZipFile.CreateFromDirectory(tempZip, zipPath, CompressionLevel.Optimal, false);
|
||||
});
|
||||
|
||||
// chiamo metodo x upload zip
|
||||
bool uploaded = await CurrCheck.UploadZipfile(AppKey, zipPath);
|
||||
|
||||
// elimino dir di appoggio
|
||||
if (Directory.Exists(tempZip))
|
||||
{
|
||||
Directory.Delete(tempZip, true);
|
||||
}
|
||||
}
|
||||
await Task.Delay(10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Step preliminare di backup conf e app corrente
|
||||
/// </summary>
|
||||
@@ -1037,12 +1211,14 @@ namespace EgwControlCenter.Core
|
||||
// step 1: backup configurazioni partendo da path applicazione...
|
||||
string srcDir = Path.Combine(appDir, "DATA", "CONF");
|
||||
string destDir = Path.Combine(backupDir, "Conf", reqApp.CodApp, "DATA", "CONF");
|
||||
// se MAN uso folder "accorciata"
|
||||
if (reqApp.CodApp == "IOB-MAN")
|
||||
|
||||
// verifico se esista la srcDir, altrimenti uso solo CONF...
|
||||
if (!Directory.Exists(srcDir))
|
||||
{
|
||||
srcDir = Path.Combine(appDir, "CONF");
|
||||
destDir = Path.Combine(backupDir, "Conf", reqApp.CodApp, "CONF");
|
||||
}
|
||||
|
||||
CopyDirectory(srcDir, destDir);
|
||||
|
||||
// step 2: kill processi
|
||||
@@ -1121,8 +1297,7 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
string srcDir = Path.Combine(appDir, "DATA", "CONF");
|
||||
string destDir = Path.Combine(backupDir, "Conf", reqApp.CodApp, "DATA", "CONF");
|
||||
// se MAN uso folder "accorciata"
|
||||
if (reqApp.CodApp == "IOB-MAN")
|
||||
if (!Directory.Exists(destDir))
|
||||
{
|
||||
srcDir = Path.Combine(appDir, "CONF");
|
||||
destDir = Path.Combine(backupDir, "Conf", reqApp.CodApp, "CONF");
|
||||
@@ -1172,22 +1347,6 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportStatusUpd()
|
||||
{
|
||||
if (EA_StatusUpdated != null)
|
||||
{
|
||||
// controllo se almeno 1 app abbia update...
|
||||
foreach (var item in ListAppStatus)
|
||||
{
|
||||
if (item.HasUpdate)
|
||||
{
|
||||
EA_StatusUpdated?.Invoke();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera parametro conf in Runtime di tipo Int
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace EgwControlCenter.Core
|
||||
Machine,
|
||||
WebApp,
|
||||
WinApp,
|
||||
LicenceApp
|
||||
LicenceApp,
|
||||
EgwACC
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,6 +35,11 @@ namespace EgwControlCenter.Core
|
||||
/// </summary>
|
||||
AppSearch,
|
||||
|
||||
/// <summary>
|
||||
/// Effettua backup ed invio cartella CONF delle app gestite x update
|
||||
/// </summary>
|
||||
BackupSendConf,
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta info device (analoghe a quelle del setup iniziale in Enroll)
|
||||
/// </summary>
|
||||
@@ -72,7 +78,12 @@ namespace EgwControlCenter.Core
|
||||
/// <summary>
|
||||
/// Upsert valori TargetList (gestiti in remoto)
|
||||
/// </summary>
|
||||
TargetListUpsert
|
||||
TargetListUpsert,
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorno di un applicazione richiamato da remoto
|
||||
/// </summary>
|
||||
TargetAppUpdate
|
||||
}
|
||||
|
||||
public enum TipoLicenza
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgwControlCenter.Core.DTO
|
||||
{
|
||||
public class UploadResultDTO
|
||||
{
|
||||
public bool Uploaded { get; set; }
|
||||
public string FileName { get; set; } = "";
|
||||
public string StoredFileName { get; set; } = "";
|
||||
public int ErrorCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -590,21 +590,44 @@ namespace EgwControlCenter.Core
|
||||
/// <param name="devName"></param>
|
||||
/// <param name="taskRes"></param
|
||||
/// <returns></returns>
|
||||
public async Task<string> TaskSetDone(string devName, Dictionary<string, string> taskRes)
|
||||
public string TaskSetDone(string devName, Dictionary<string, string> taskRes)
|
||||
{
|
||||
string answ = await TaskPostInfo(devName, taskRes, "done");
|
||||
string answ = TaskPostInfo(devName, taskRes, "done");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia un dizionario di task completato (x richieste o salvataggio da EgwACC)
|
||||
/// </summary>
|
||||
/// <param name="devName"></param>
|
||||
/// <param name="taskRes"></param
|
||||
/// <returns></returns>
|
||||
public async Task<string> TaskSetDoneAsync(string devName, Dictionary<string, string> taskRes)
|
||||
{
|
||||
string answ = await TaskPostInfoAsync(devName, taskRes, "done");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia un dizionario che dovrebbe comprendere tutte le richieste task 8da chiudere) + eventuali altri dati da salvare
|
||||
/// Invia un dizionario che dovrebbe comprendere tutte le richieste task (da chiudere) + eventuali altri dati da salvare
|
||||
/// </summary>
|
||||
/// <param name="devName"></param>
|
||||
/// <param name="taskRes"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> TaskSetRunning(string devName, Dictionary<string, string> taskRes)
|
||||
public async Task<string> TaskSetRunningAsync(string devName, Dictionary<string, string> taskRes)
|
||||
{
|
||||
string answ = await TaskPostInfo(devName, taskRes, "running");
|
||||
string answ = await TaskPostInfoAsync(devName, taskRes, "running");
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia un dizionario che dovrebbe comprendere tutte le richieste task (da chiudere) + eventuali altri dati da salvare
|
||||
/// </summary>
|
||||
/// <param name="devName"></param>
|
||||
/// <param name="taskRes"></param>
|
||||
/// <returns></returns>
|
||||
public string TaskSetRunning(string devName, Dictionary<string, string> taskRes)
|
||||
{
|
||||
string answ = TaskPostInfo(devName, taskRes, "running");
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -713,6 +736,11 @@ namespace EgwControlCenter.Core
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto assembly x ricavare info versione & co
|
||||
/// </summary>
|
||||
private System.Reflection.AssemblyName? CurrAssembly { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna (se necessario) lo stato degli oggetti da monitorare
|
||||
/// </summary>
|
||||
@@ -740,6 +768,33 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
switch (item.ApplicationType)
|
||||
{
|
||||
case CoreEnum.AppType.EgwACC:
|
||||
// si tratta dell'applicazione stessa...
|
||||
if (CurrAssembly != null && !string.IsNullOrEmpty(CurrAssembly.Name))
|
||||
{
|
||||
string codApp = CurrAssembly.Name ?? "EgwControlCenter.App";
|
||||
codApp = codApp.Replace(".exe", "");
|
||||
string versNum = $"{CurrAssembly.Version}";
|
||||
var myRelDto = new ReleaseDTO()
|
||||
{
|
||||
CodApp = codApp,
|
||||
CanInstall = true,
|
||||
IsActive = true,
|
||||
NumImp = 1,
|
||||
ReleaseDate = DateTime.Today,
|
||||
VersNum = versNum,
|
||||
VersText = versNum
|
||||
};
|
||||
newListStatus.Add(new TargetStatus()
|
||||
{
|
||||
CodApp = codApp,
|
||||
CurrLocal = myRelDto,
|
||||
LastUpdateLoc = DateTime.Now
|
||||
});
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case CoreEnum.AppType.Machine:
|
||||
// processo la folder indicata e cerco tutte le macchine contenute
|
||||
if (Directory.Exists(item.BasePath))
|
||||
@@ -1220,6 +1275,7 @@ namespace EgwControlCenter.Core
|
||||
/// <param name="confName"></param>
|
||||
private void InitObj(string appDir, string dataDir, string confName)
|
||||
{
|
||||
CurrAssembly = System.Reflection.Assembly.GetEntryAssembly().GetName();
|
||||
AppDir = appDir;
|
||||
DataDir = dataDir;
|
||||
ConfName = confName;
|
||||
@@ -1350,11 +1406,29 @@ namespace EgwControlCenter.Core
|
||||
var rawData = File.ReadAllText(ConfPath);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
bool needSave = rawData.IndexOf("CodImpiego") > 0;
|
||||
CurrPatrolCont = JsonConvert.DeserializeObject<PatrolSettings>(rawData) ?? new PatrolSettings();
|
||||
// verifico se ci sia la chiave x cercare EgwACC, altrimenti la aggiungo
|
||||
var recEgwACC = CurrPatrolCont.TargetList.FirstOrDefault(x => x.ApplicationType == CoreEnum.AppType.EgwACC);
|
||||
if (!rawData.Contains("EgwACC") || recEgwACC == null)
|
||||
{
|
||||
// aggiungo record e segno di dover salvare
|
||||
recEgwACC = new ControlTarget()
|
||||
{
|
||||
Idx = CurrPatrolCont.TargetList.Count + 1,
|
||||
ApplicationType = CoreEnum.AppType.EgwACC,
|
||||
BasePath = "C:\\Steamware",
|
||||
IsEnabled = true,
|
||||
SearchPattern = "EgwControlCenterApp.exe",
|
||||
UpdateEnabled = true
|
||||
};
|
||||
CurrPatrolCont.TargetList.Add(recEgwACC);
|
||||
needSave = true;
|
||||
}
|
||||
// imposto il veto dalla conf...
|
||||
AutoRefreshVeto = TimeSpan.FromMinutes(CurrPatrolCont.VetoCheckMinutes);
|
||||
// se il file raw contenesse la key "CodImpiego" sovrascrivo...
|
||||
if (rawData.IndexOf("CodImpiego") > 0)
|
||||
if (needSave)
|
||||
{
|
||||
SaveConfig();
|
||||
}
|
||||
@@ -1420,13 +1494,13 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo effettivo invio post info sul task
|
||||
/// Metodo effettivo invio post info sul task ASYNC
|
||||
/// </summary>
|
||||
/// <param name="devName"></param>
|
||||
/// <param name="taskRes"></param
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> TaskPostInfo(string devName, Dictionary<string, string> taskRes, string action)
|
||||
private async Task<string> TaskPostInfoAsync(string devName, Dictionary<string, string> taskRes, string action)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
@@ -1452,6 +1526,51 @@ namespace EgwControlCenter.Core
|
||||
answ = $"{currResp.Content}";
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"Errore in ricezione REST services TaskPostInfoAsync | action: {action} | statusCode{currResp.StatusCode} | content: {currResp.Content}");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in fase gestione REST services TaskPostInfoAsync | action: {action}{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo effettivo invio post info sul task SYNC
|
||||
/// </summary>
|
||||
/// <param name="devName"></param>
|
||||
/// <param name="taskRes"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
private string TaskPostInfo(string devName, Dictionary<string, string> taskRes, string action)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// preparo richiesta...
|
||||
TaskResultDTO currReq = new TaskResultDTO()
|
||||
{
|
||||
AppKey = CurrPatrolCont.AppKey,
|
||||
CodImp = CodImpiego,
|
||||
MastKey = "",
|
||||
DataPayload = taskRes
|
||||
};
|
||||
// client chiamate rest
|
||||
var client = new RestClient(restOptStd);
|
||||
// Chiamo il metodo!
|
||||
var actReq = new RestRequest($"/api/apptask/{action}/{devName}", Method.Post);
|
||||
string payload = JsonConvert.SerializeObject(currReq);
|
||||
actReq.AddJsonBody(payload);
|
||||
// effettuo vera chiamata
|
||||
var currResp = client.Post(actReq);
|
||||
if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null)
|
||||
{
|
||||
answ = $"{currResp.Content}";
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"Errore in ricezione REST services TaskPostInfo | action: {action} | statusCode{currResp.StatusCode} | content: {currResp.Content}");
|
||||
}
|
||||
@@ -1464,6 +1583,58 @@ namespace EgwControlCenter.Core
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue upload dello zipfile indicato per backup
|
||||
/// </summary>
|
||||
/// <param name="AppKey">Chiave univoca</param>
|
||||
/// <param name="ZipPath">Percorso file da caricare</param>
|
||||
internal async Task<bool> UploadZipfile(string AppKey, string ZipPath)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// client chiamate rest
|
||||
var client = new RestClient(restOptStd);
|
||||
// Chiamo il metodo!
|
||||
var actReq = new RestRequest($"/api/apptask/zipbackup", Method.Post);
|
||||
string sTrue = $"{true}";
|
||||
actReq.AddParameter("AppKey", CurrPatrolCont.AppKey);
|
||||
actReq.AddParameter("CodApp", CurrPatrolCont.CodApp);
|
||||
actReq.AddParameter("DoUnzip", sTrue);
|
||||
actReq.AddParameter("ForceApprov", sTrue);
|
||||
actReq.AddParameter("CodImp", CodImpiego);
|
||||
actReq.AddFile("ZipFile", ZipPath);
|
||||
// effettuo vera chiamata
|
||||
var currResp = await client.PostAsync<UploadResultDTO>(actReq);
|
||||
if (currResp != null)
|
||||
{
|
||||
answ = currResp.Uploaded;
|
||||
}
|
||||
#if false
|
||||
if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null)
|
||||
{
|
||||
// mi restituisce elenco attivazioni
|
||||
var currList = JsonConvert.DeserializeObject<List<AttivazioneDTO>>(currResp.Content);
|
||||
if (currList != null)
|
||||
{
|
||||
// se contiene anche la richiesta è ok...
|
||||
var recUpd = currList.FirstOrDefault(x => x.CodImpiego == CodImp && x.Chiave == AppKey);
|
||||
if (recUpd != null)
|
||||
{
|
||||
answ = recUpd;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in fase gestione REST services UploadZipfile{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -12,24 +12,31 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DEBUG_Local|Any CPU = DEBUG_Local|Any CPU
|
||||
DEBUG_remote|Any CPU = DEBUG_remote|Any CPU
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.DEBUG_Local|Any CPU.ActiveCfg = DEBUG_Local|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.DEBUG_Local|Any CPU.Build.0 = DEBUG_Local|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.DEBUG_Local|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.DEBUG_Local|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.DEBUG_remote|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.DEBUG_remote|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D30ACE10-49B2-4EA8-B16F-C2E8788EBA2A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.DEBUG_Local|Any CPU.ActiveCfg = DEBUG_Local|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.DEBUG_Local|Any CPU.Build.0 = DEBUG_Local|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.DEBUG_remote|Any CPU.ActiveCfg = DEBUG_remote|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.DEBUG_remote|Any CPU.Build.0 = DEBUG_remote|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D86ABFB-F09B-4E71-9185-0E727D630816}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D8D5F82-3E02-4B25-A69E-60969C22EBD3}.DEBUG_Local|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D8D5F82-3E02-4B25-A69E-60969C22EBD3}.DEBUG_Local|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D8D5F82-3E02-4B25-A69E-60969C22EBD3}.DEBUG_remote|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D8D5F82-3E02-4B25-A69E-60969C22EBD3}.DEBUG_remote|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D8D5F82-3E02-4B25-A69E-60969C22EBD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D8D5F82-3E02-4B25-A69E-60969C22EBD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D8D5F82-3E02-4B25-A69E-60969C22EBD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
Reference in New Issue
Block a user