Merge branch 'release/AddCHeckLicEgt_01'
This commit is contained in:
+15
-2
@@ -35,6 +35,8 @@
|
||||
trayMenu = new ContextMenuStrip(components);
|
||||
timerCheck = new System.Windows.Forms.Timer(components);
|
||||
timerTask = new System.Windows.Forms.Timer(components);
|
||||
timer1 = new System.Windows.Forms.Timer(components);
|
||||
timerStats = new System.Windows.Forms.Timer(components);
|
||||
SuspendLayout();
|
||||
//
|
||||
// blazorWebView1
|
||||
@@ -42,7 +44,7 @@
|
||||
blazorWebView1.Dock = DockStyle.Fill;
|
||||
blazorWebView1.Location = new Point(0, 0);
|
||||
blazorWebView1.Name = "blazorWebView1";
|
||||
blazorWebView1.Size = new Size(620, 370);
|
||||
blazorWebView1.Size = new Size(644, 441);
|
||||
blazorWebView1.StartPath = "/";
|
||||
blazorWebView1.TabIndex = 0;
|
||||
//
|
||||
@@ -72,11 +74,20 @@
|
||||
timerTask.Interval = 1000;
|
||||
timerTask.Tick += timerTask_Tick;
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
timer1.Interval = 1000;
|
||||
//
|
||||
// timerStats
|
||||
//
|
||||
timerStats.Interval = 600000;
|
||||
timerStats.Tick += timerStats_Tick;
|
||||
//
|
||||
// BlazorForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(620, 370);
|
||||
ClientSize = new Size(644, 441);
|
||||
Controls.Add(blazorWebView1);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
MaximizeBox = false;
|
||||
@@ -96,5 +107,7 @@
|
||||
private ContextMenuStrip trayMenu;
|
||||
private System.Windows.Forms.Timer timerCheck;
|
||||
private System.Windows.Forms.Timer timerTask;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Timer timerStats;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace EgwControlCenter.App
|
||||
/// </summary>
|
||||
private DateTime lastMsqShown { get; set; } = DateTime.MinValue;
|
||||
|
||||
private Size lastSize { get; set; } = new Size(636, 409);
|
||||
private Size lastSize { get; set; } = new Size(660, 480);
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -73,7 +73,12 @@ namespace EgwControlCenter.App
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string startDir = Path.GetDirectoryName(assembly.Location)!;
|
||||
string extPath = Path.Combine(startDir, "libs", "EgwAccRestarter.exe");
|
||||
Process.Start(extPath);
|
||||
// uso processstartInfo x nascondere finestra
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
startInfo.CreateNoWindow = true;
|
||||
startInfo.FileName = extPath;
|
||||
Process.Start(startInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,14 +163,36 @@ namespace EgwControlCenter.App
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evento completamento caricamento app
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void BlazorForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
SetPosition();
|
||||
// aspetto e poi mando a tray...
|
||||
await Task.Delay(500);
|
||||
SendToTray();
|
||||
// eseguo task preliminari tipo invio reset effettuato + elenco conf...
|
||||
await Task.Delay(1000);
|
||||
await ACService.SendRebooted();
|
||||
// ora invio info licenza (SE disponibili)
|
||||
await Task.Delay(1000);
|
||||
await ACService.SendLicInfo();
|
||||
// infine invio info conf (x editing successivo)
|
||||
await Task.Delay(1000);
|
||||
await ACService.SendConfTarget();
|
||||
// invio stats avvio
|
||||
await Task.Delay(1000);
|
||||
await ACService.SendStats();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evento post resize
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void BlazorForm_Resize(object sender, EventArgs e)
|
||||
{
|
||||
CheckFormVisibility();
|
||||
@@ -229,8 +256,8 @@ namespace EgwControlCenter.App
|
||||
trayMenu.Items.Clear();
|
||||
// aggiungo azioni con tasto DX
|
||||
trayMenu.Items.Add("Show EgalWare ACC");
|
||||
trayMenu.Items.Add("Reload EgalWare ACC");
|
||||
trayMenu.Items.Add("Restart EgalWare ACC");
|
||||
trayMenu.Items.Add("Reload Config");
|
||||
trayMenu.Items.Add("Restart And update");
|
||||
trayMenu.Items.Add("Close EgalWare ACC");
|
||||
}
|
||||
|
||||
@@ -253,7 +280,7 @@ namespace EgwControlCenter.App
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
CurrAssembly = System.Reflection.Assembly.GetExecutingAssembly().GetName();
|
||||
CurrAssembly = Assembly.GetExecutingAssembly().GetName();
|
||||
Log.Trace($"EgalWare's AppControlCenter Init, v.{CurrAssembly.Version}");
|
||||
// sistemo grafica TRAY ICON
|
||||
SetupTrayIcon();
|
||||
@@ -339,7 +366,7 @@ namespace EgwControlCenter.App
|
||||
notifyIcon1.BalloonTipClicked += NotifyIcon1_BalloonTipClicked;
|
||||
notifyIcon1.Visible = true;
|
||||
// mostro notifica... SE abilitata
|
||||
if (ACService.EnableNotify)
|
||||
if (ACService != null && ACService.EnableNotify)
|
||||
{
|
||||
notifyIcon1.ShowBalloonTip(100);
|
||||
}
|
||||
@@ -385,12 +412,24 @@ namespace EgwControlCenter.App
|
||||
|
||||
private void StartTimer()
|
||||
{
|
||||
// timer controlli da conf
|
||||
timerCheck.Interval = (ACService.RefreshPeriod * 1000);
|
||||
// sistemo timer
|
||||
// timer statistiche a 30 min fisso x ora
|
||||
timerStats.Interval = 1000 * 60 * 5;
|
||||
#if false
|
||||
timerStats.Interval = 1000 * 60 * 30;
|
||||
#endif
|
||||
// avvio timer
|
||||
timerCheck.Start();
|
||||
timerTask.Start();
|
||||
timerStats.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione task di verifica stato app
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void timerCheck_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// fermo task...
|
||||
@@ -402,7 +441,24 @@ namespace EgwControlCenter.App
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Timer task (3 sec base)
|
||||
/// Gestione timer statistiche
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void timerStats_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// fermo task...
|
||||
timerStats.Stop();
|
||||
// esegue controllo task
|
||||
await ACService.SendStats();
|
||||
await ACService.SendLicInfo();
|
||||
await ACService.SendConfTarget();
|
||||
// riavvio task x evitare sovrapposizioni in debug
|
||||
timerStats.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Timer task (1 sec base)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
@@ -296,6 +296,12 @@
|
||||
<metadata name="timerTask.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>351, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>351, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timerStats.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>439, 17</value>
|
||||
</metadata>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
|
||||
@@ -136,8 +136,11 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
|
||||
protected async Task ForceCheck()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = new List<VersStatusDTO>();
|
||||
await ACService.DoFullCheckAsync(true);
|
||||
await ACService.DoTaskCheckAsync(true);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
|
||||
@@ -62,10 +62,12 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
ACService.ResetConf();
|
||||
}
|
||||
|
||||
protected void DoSave()
|
||||
protected async Task DoSave()
|
||||
{
|
||||
ACService.DoSaveConfig();
|
||||
ACService.DoReloadConfig();
|
||||
// invio update in remoto
|
||||
await ACService.SendConfTarget();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
|
||||
@@ -11,32 +11,36 @@
|
||||
"BasePath": "C:\\Steamware",
|
||||
"SearchPattern": "IOB-*.exe",
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": true
|
||||
"UpdateEnabled": true,
|
||||
},
|
||||
{
|
||||
"Idx": 2,
|
||||
"ApplicationType": "Machine",
|
||||
"BasePath": "C:\\EgtData\\Machines",
|
||||
"IsEnabled": true
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": false
|
||||
},
|
||||
{
|
||||
"Idx": 3,
|
||||
"ApplicationType": "Machine",
|
||||
"BasePath": "C:\\TechnoEssetre7\\EgalTech\\EgtCAM5\\Machines",
|
||||
"IsEnabled": true
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": false
|
||||
},
|
||||
{
|
||||
"Idx": 4,
|
||||
"ApplicationType": "Machine",
|
||||
"BasePath": "C:\\Testing\\Machines",
|
||||
"IsEnabled": true
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": false
|
||||
},
|
||||
{
|
||||
"Idx": 5,
|
||||
"ApplicationType": "LicenceApp",
|
||||
"BasePath": "C:\\EgtData",
|
||||
"SearchPattern": "*.ini",
|
||||
"IsEnabled": true
|
||||
"IsEnabled": true,
|
||||
"UpdateEnabled": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.2.2501.2016</Version>
|
||||
<Version>1.2.2501.2111</Version>
|
||||
<Configurations>Debug;Release;DEBUG_Local</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>2016</ApplicationRevision>
|
||||
<ApplicationVersion>1.2.2501.2016</ApplicationVersion>
|
||||
<ApplicationRevision>2111</ApplicationRevision>
|
||||
<ApplicationVersion>1.2.2501.2111</ApplicationVersion>
|
||||
<BootstrapperEnabled>True</BootstrapperEnabled>
|
||||
<Configuration>Release</Configuration>
|
||||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
try
|
||||
{
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string startDir = Path.GetDirectoryName(assembly.Location)!;
|
||||
mainAssembly = Assembly.GetCallingAssembly();
|
||||
string startDir = Path.GetDirectoryName(mainAssembly.Location)!;
|
||||
ConfDir = startDir;
|
||||
CodImpiego = SLicManager.CodImpiego();
|
||||
// setup RuntimConf (da gestire anche con set remoto...)
|
||||
@@ -291,6 +291,7 @@ namespace EgwControlCenter.Core
|
||||
CloudCallActive = false;
|
||||
return tVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata verifica attivazioni
|
||||
/// </summary>
|
||||
@@ -395,6 +396,7 @@ namespace EgwControlCenter.Core
|
||||
public async Task DoTaskCheckAsync(bool doForce)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
DateTime adesso = DateTime.Now;
|
||||
bool sendStats = false;
|
||||
if (vetoTaskCheck < adesso || doForce || numFastCheck > 0)
|
||||
@@ -409,6 +411,7 @@ namespace EgwControlCenter.Core
|
||||
var task2exe = await CurrCheck.TaskGetReq(DeviceName);
|
||||
if (task2exe != null && task2exe.Count > 0)
|
||||
{
|
||||
CloudCallActive = true;
|
||||
// in primis li segnala in running...
|
||||
await CurrCheck.TaskSetRunning(DeviceName, task2exe);
|
||||
// imposto limite a scalare x i prox fast check avendo trovato task da eseguire...
|
||||
@@ -434,6 +437,7 @@ namespace EgwControlCenter.Core
|
||||
// invio risposta esito esecuzione finale
|
||||
await CurrCheck.TaskSetDone(DeviceName, taskResults);
|
||||
sendStats = true;
|
||||
CloudCallActive = false;
|
||||
}
|
||||
// imposto veto controlli task
|
||||
vetoTaskCheck = adesso.AddSeconds(vetoSec);
|
||||
@@ -534,14 +538,67 @@ namespace EgwControlCenter.Core
|
||||
ReportConfigUpd();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia info configurazione (directory)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task SendConfTarget()
|
||||
{
|
||||
// preparo un task di conf da inviare
|
||||
var task2send = new Dictionary<string, string>();
|
||||
string rawConf = JsonConvert.SerializeObject(CurrCheck.CurrPatrolCont.TargetList);
|
||||
task2send.Add("TargetList", rawConf);
|
||||
await CurrCheck.TaskSetDone(DeviceName, task2send);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia info licenza (se disponibili)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task SendLicInfo()
|
||||
{
|
||||
if (CurrCheck.LicenceFilesDict.Count > 0)
|
||||
{
|
||||
// serializzo risultato
|
||||
string rawData = JsonConvert.SerializeObject(CurrCheck.LicenceFilesDict);
|
||||
Dictionary<string, string> licInfo = new Dictionary<string, string>();
|
||||
// chiave: LicInfo
|
||||
licInfo.Add("LicInfo", rawData);
|
||||
// invio!
|
||||
await CurrCheck.TaskSetDone(DeviceName, licInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia info di reboot effettuato (spostando da req/run a done...)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task SendRebooted()
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia info satats preliminari
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task SendStats()
|
||||
{
|
||||
// invio statistiche esecuzione...
|
||||
await DoSendRunStats();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string DeviceName = "";
|
||||
|
||||
protected UpdateMan updateMan = new UpdateMan();
|
||||
|
||||
protected UpdateMan updateManAuth = new UpdateMan("SWDownloader", "viaD@nte16");
|
||||
|
||||
#endregion Protected Fields
|
||||
@@ -599,7 +656,7 @@ namespace EgwControlCenter.Core
|
||||
// serializzo risultato
|
||||
string rawData = JsonConvert.SerializeObject(CurrCheck.LicenceFilesDict);
|
||||
Dictionary<string, string> licInfo = new Dictionary<string, string>();
|
||||
// chiave: LicInfo
|
||||
// chiave: LicInfo
|
||||
licInfo.Add("LicInfo", rawData);
|
||||
// invio!
|
||||
await CurrCheck.TaskSetDone(DeviceName, licInfo);
|
||||
@@ -613,10 +670,13 @@ namespace EgwControlCenter.Core
|
||||
protected async Task DoSendRunStats()
|
||||
{
|
||||
// recupero statistiche
|
||||
var statsData = StatsCollector.CurrentInfo();
|
||||
Dictionary<string, string> statsData = StatsCollector.CurrentInfo();
|
||||
// aggiungo versione alle statistiche
|
||||
statsData.Add("Version", $"{mainAssembly.GetName().Version}");
|
||||
//serializzo
|
||||
string rawData = JsonConvert.SerializeObject(statsData);
|
||||
Dictionary<string, string> statsInfo = new Dictionary<string, string>();
|
||||
// chiave: RunStats
|
||||
// chiave: RunStats
|
||||
statsInfo.Add("RunStats", rawData);
|
||||
// invio!
|
||||
await CurrCheck.TaskSetDone(DeviceName, statsInfo);
|
||||
@@ -641,6 +701,8 @@ namespace EgwControlCenter.Core
|
||||
/// </summary>
|
||||
private DateTime lastCheckDone = DateTime.Today.AddMonths(-1);
|
||||
|
||||
private Assembly mainAssembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
/// <summary>
|
||||
/// Numero di controlli fast (5 sec medi) dei task prima di tornare alla gestione lenta (2 min)
|
||||
/// </summary>
|
||||
@@ -815,25 +877,23 @@ namespace EgwControlCenter.Core
|
||||
|
||||
case CoreEnum.EgwAccTask.DeviceInfoGet:
|
||||
Dictionary<string, string> currDevInfo = DeviceInfoDict();
|
||||
taskVal = JsonConvert.SerializeObject(currDevInfo, Formatting.Indented);
|
||||
taskVal = JsonConvert.SerializeObject(currDevInfo);
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.ForceCheck:
|
||||
Dictionary<string, string> fcDetail = new Dictionary<string, string>();
|
||||
fcDetail.Add("ExecStart", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
Dictionary<string, string> fcRes = new Dictionary<string, string>();
|
||||
fcRes.Add("ExecStart", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
await DoFullCheckAsync(true);
|
||||
sw.Stop();
|
||||
fcDetail.Add("Completed", $"App Check done in {sw.Elapsed.TotalMilliseconds:N0}ms");
|
||||
taskVal = JsonConvert.SerializeObject(fcDetail, Formatting.Indented);
|
||||
fcRes.Add("Completed", $"App Check done in {sw.Elapsed.TotalMilliseconds:N0}ms");
|
||||
taskVal = JsonConvert.SerializeObject(fcRes);
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.ForceReload:
|
||||
Dictionary<string, string> fcReload = new Dictionary<string, string>();
|
||||
fcReload.Add("ExecReload", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
Dictionary<string, string> frRes = new Dictionary<string, string>();
|
||||
frRes.Add("ExecReload", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
sw.Stop();
|
||||
// mando subito conferma esecuzione...
|
||||
fcReload.Add("ExecReload", $"Reload Requested...");
|
||||
taskVal = JsonConvert.SerializeObject(fcReload, Formatting.Indented);
|
||||
taskVal = JsonConvert.SerializeObject(frRes);
|
||||
// sollevo evento
|
||||
if (EA_ReloadRequested != null)
|
||||
{
|
||||
@@ -842,11 +902,11 @@ namespace EgwControlCenter.Core
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.ForceUpdate:
|
||||
Dictionary<string, string> fcUpdate = new Dictionary<string, string>();
|
||||
fcUpdate.Add("ExecStart", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
Dictionary<string, string> fuRes = new Dictionary<string, string>();
|
||||
fuRes.Add("ExecStart", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
sw.Stop();
|
||||
// mando subito conferma esecuzione...
|
||||
taskVal = JsonConvert.SerializeObject(fcUpdate, Formatting.Indented);
|
||||
taskVal = JsonConvert.SerializeObject(fuRes);
|
||||
// sollevo evento
|
||||
if (EA_RestartRequested != null)
|
||||
{
|
||||
@@ -855,7 +915,12 @@ namespace EgwControlCenter.Core
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.OxyLicenseGet:
|
||||
Dictionary<string, string> olgRes = new Dictionary<string, string>();
|
||||
await DoSendLicInfo();
|
||||
sw.Stop();
|
||||
// mando subito conferma esecuzione...
|
||||
olgRes.Add("LicInfoCompleted", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
taskVal = JsonConvert.SerializeObject(olgRes);
|
||||
break;
|
||||
|
||||
//case CoreEnum.EgwAccTask.ParamDictReset:
|
||||
@@ -864,6 +929,32 @@ namespace EgwControlCenter.Core
|
||||
//case CoreEnum.EgwAccTask.ParamUpsert:
|
||||
// break;
|
||||
|
||||
case CoreEnum.EgwAccTask.TargetListUpsert:
|
||||
// verifico se nel payload c'è la configurazione VALIDA...
|
||||
if (string.IsNullOrEmpty(item.Value))
|
||||
{
|
||||
taskVal = "Error: empty Payload";
|
||||
}
|
||||
else
|
||||
{
|
||||
// provo a deserializzare oggetto
|
||||
var newTargetList = JsonConvert.DeserializeObject<List<ControlTarget>>(item.Value);
|
||||
if (newTargetList == null || newTargetList.Count == 0)
|
||||
{
|
||||
taskVal = "Error: empty List";
|
||||
}
|
||||
else
|
||||
{
|
||||
// se valido sovrascrivo e salvo!
|
||||
CurrCheck.CurrPatrolCont.TargetList = newTargetList;
|
||||
CurrCheck.SaveConfig();
|
||||
// ... invio versione aggiornata
|
||||
await Task.Delay(100);
|
||||
await SendConfTarget();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CoreEnum.EgwAccTask.ND:
|
||||
default:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace EgwControlCenter.Core
|
||||
/// <summary>
|
||||
/// Elenco tipi di azioni che si possono chiedere ad EgwACC
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum EgwAccTask
|
||||
{
|
||||
/// <summary>
|
||||
@@ -66,7 +67,12 @@ namespace EgwControlCenter.Core
|
||||
/// <summary>
|
||||
/// Upsert di parametri operativi (gestiti in remoto)
|
||||
/// </summary>
|
||||
ParamUpsert
|
||||
ParamUpsert,
|
||||
|
||||
/// <summary>
|
||||
/// Upsert valori TargetList (gestiti in remoto)
|
||||
/// </summary>
|
||||
TargetListUpsert
|
||||
}
|
||||
|
||||
public enum TipoLicenza
|
||||
|
||||
@@ -105,6 +105,11 @@ namespace EgwControlCenter.Core
|
||||
/// </summary>
|
||||
public PatrolSettings CurrPatrolCont { get; set; } = new PatrolSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario files licenze trovati
|
||||
/// </summary>
|
||||
public Dictionary<string, string> LicenceFilesDict { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco degli oggetti stato dei programmi monitorati
|
||||
/// </summary>
|
||||
@@ -579,6 +584,18 @@ namespace EgwControlCenter.Core
|
||||
return taskReq;
|
||||
}
|
||||
|
||||
/// <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> TaskSetDone(string devName, Dictionary<string, string> taskRes)
|
||||
{
|
||||
string answ = await TaskPostInfo(devName, taskRes, "done");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia un dizionario che dovrebbe comprendere tutte le richieste task 8da chiudere) + eventuali altri dati da salvare
|
||||
/// </summary>
|
||||
@@ -592,60 +609,108 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo effettivo invio post info sul task
|
||||
/// Aggiorna info files licenza (se configurato e se trovate)
|
||||
/// </summary>
|
||||
/// <param name="devName"></param>
|
||||
/// <param name="taskRes"></param
|
||||
/// <param name="action"></param>
|
||||
/// <param name="doRefresh"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> TaskPostInfo(string devName, Dictionary<string, string> taskRes, string action)
|
||||
public bool UpdateLicenceInfo()
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
/*-------------------------------------------
|
||||
* Ricerca licenze: algoritmo
|
||||
* - parte da un percorso di base
|
||||
* - cerca x ogni cartella la sottocartella /Config/ i files *.ini
|
||||
* - prende i files che contengono "Licence="
|
||||
* - considera solo i file con valore valido x Licence
|
||||
* - prende il relativo file *.lic indicato (stessa folder)
|
||||
* - legge e riporta intero contenuto nel record dizionario:
|
||||
* - chiave = percorso file *.lic
|
||||
* - valore = contenuto file
|
||||
*-------------------------------------------*/
|
||||
|
||||
bool fatto = false;
|
||||
// nuovo obj licenze...
|
||||
Dictionary<string, string> newLicDict = new Dictionary<string, string>();
|
||||
// ciclo SOLO gli oggetti licenza info
|
||||
var licTgt = CurrPatrolCont
|
||||
.TargetList
|
||||
.Where(x => x.ApplicationType == CoreEnum.AppType.LicenceApp)
|
||||
.ToList();
|
||||
int numFound = 0;
|
||||
foreach (var item in licTgt)
|
||||
{
|
||||
// preparo richiesta...
|
||||
TaskResultDTO currReq = new TaskResultDTO()
|
||||
try
|
||||
{
|
||||
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 = await client.PostAsync(actReq);
|
||||
if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null)
|
||||
{
|
||||
answ = $"{currResp.Content}";
|
||||
// verifico contenuto secondo tipo
|
||||
if (item != null && item.IsEnabled)
|
||||
{
|
||||
// processo la folder indicata e cerco tutte le macchine contenute
|
||||
if (Directory.Exists(item.BasePath))
|
||||
{
|
||||
// recupero elenco sottodirectory = possibili conf applicativi
|
||||
var dirList = Directory.GetDirectories(item.BasePath);
|
||||
// ciclo x cercare i files...
|
||||
foreach (var currDir in dirList)
|
||||
{
|
||||
string prgName = Path.GetFileName(currDir);
|
||||
// compongo ricerca della cartella Config dentro la folder target
|
||||
string confPath = Path.Combine(currDir, "Config");
|
||||
// verifico se esiste directory...
|
||||
if (Directory.Exists(confPath))
|
||||
{
|
||||
// cerco se ci sia un file di quelli richiesti...
|
||||
var fileFound = Directory.GetFiles(confPath, item.SearchPattern);
|
||||
if (fileFound != null && fileFound.Count() > 0)
|
||||
{
|
||||
// ciclo su tutti i file candidati...
|
||||
foreach (var file in fileFound)
|
||||
{
|
||||
// vincolo dei soli file con nome uguale alla folder ancestor...
|
||||
string iniName = Path.GetFileName(file);
|
||||
if (iniName.ToLower().StartsWith($"{prgName.ToLower()}."))
|
||||
{
|
||||
string licName = LicSearchFileName(file);
|
||||
if (!string.IsNullOrEmpty(licName))
|
||||
{
|
||||
var contDir = Path.GetDirectoryName(file);
|
||||
if (!string.IsNullOrEmpty(contDir))
|
||||
{
|
||||
string licPath = Path.Combine(contDir, licName);
|
||||
if (File.Exists(licPath))
|
||||
{
|
||||
// leggo il contenuto e salvo...
|
||||
var licContent = File.ReadAllText(licPath);
|
||||
if (!newLicDict.ContainsKey(licPath))
|
||||
{
|
||||
newLicDict.Add(licPath, licContent);
|
||||
numFound++;
|
||||
}
|
||||
else
|
||||
{
|
||||
newLicDict[licPath] = licContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in ricezione REST services TaskPostInfo | action: {action} | statusCode{currResp.StatusCode} | content: {currResp.Content}");
|
||||
Log.Error($"Eccezione in UpdateLicenceInfo{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in fase gestione REST services TaskPostInfo | action: {action}{Environment.NewLine}{exc}");
|
||||
}
|
||||
// aggiorno obj...
|
||||
LicenceFilesDict = newLicDict;
|
||||
// salvo info licenze...
|
||||
SaveLicDict();
|
||||
fatto = numFound > 0;
|
||||
|
||||
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> TaskSetDone(string devName, Dictionary<string, string> taskRes)
|
||||
{
|
||||
string answ = await TaskPostInfo(devName, taskRes, "done");
|
||||
return answ;
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -675,7 +740,6 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
switch (item.ApplicationType)
|
||||
{
|
||||
|
||||
case CoreEnum.AppType.Machine:
|
||||
// processo la folder indicata e cerco tutte le macchine contenute
|
||||
if (Directory.Exists(item.BasePath))
|
||||
@@ -786,145 +850,6 @@ namespace EgwControlCenter.Core
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna info files licenza (se configurato e se trovate)
|
||||
/// </summary>
|
||||
/// <param name="doRefresh"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateLicenceInfo()
|
||||
{
|
||||
/*-------------------------------------------
|
||||
* Ricerca licenze: algoritmo
|
||||
* - parte da un percorso di base
|
||||
* - cerca x ogni cartella la sottocartella /Config/ i files *.ini
|
||||
* - prende i files che contengono "Licence="
|
||||
* - considera solo i file con valore valido x Licence
|
||||
* - prende il relativo file *.lic indicato (stessa folder)
|
||||
* - legge e riporta intero contenuto nel record dizionario:
|
||||
* - chiave = percorso file *.lic
|
||||
* - valore = contenuto file
|
||||
*-------------------------------------------*/
|
||||
|
||||
bool fatto = false;
|
||||
// nuovo obj licenze...
|
||||
Dictionary<string, string> newLicDict = new Dictionary<string, string>();
|
||||
// ciclo SOLO gli oggetti licenza info
|
||||
var licTgt = CurrPatrolCont
|
||||
.TargetList
|
||||
.Where(x => x.ApplicationType == CoreEnum.AppType.LicenceApp)
|
||||
.ToList();
|
||||
int numFound = 0;
|
||||
foreach (var item in licTgt)
|
||||
{
|
||||
try
|
||||
{
|
||||
// verifico contenuto secondo tipo
|
||||
if (item != null && item.IsEnabled)
|
||||
{
|
||||
// processo la folder indicata e cerco tutte le macchine contenute
|
||||
if (Directory.Exists(item.BasePath))
|
||||
{
|
||||
// recupero elenco sottodirectory = possibili conf applicativi
|
||||
var dirList = Directory.GetDirectories(item.BasePath);
|
||||
// ciclo e cerco i file mlde...
|
||||
foreach (var currDir in dirList)
|
||||
{
|
||||
// compongo ricerca della cartella Config dentro la folder target
|
||||
string confPath = Path.Combine(currDir, "Config");
|
||||
// verifico se esiste directory...
|
||||
if (Directory.Exists(confPath))
|
||||
{
|
||||
// cerco se ci sia un file mlde...
|
||||
var fileFound = Directory.GetFiles(confPath, item.SearchPattern);
|
||||
if (fileFound != null && fileFound.Count() > 0)
|
||||
{
|
||||
// ciclo su tutti i file candidati...
|
||||
foreach (var file in fileFound)
|
||||
{
|
||||
string licName = LicSearchFileName(file);
|
||||
if (!string.IsNullOrEmpty(licName))
|
||||
{
|
||||
var contDir = Path.GetDirectoryName(file);
|
||||
if (!string.IsNullOrEmpty(contDir))
|
||||
{
|
||||
string licPath = Path.Combine(contDir, licName);
|
||||
if (File.Exists(licPath))
|
||||
{
|
||||
numFound++;
|
||||
// leggo il contenuto e salvo...
|
||||
var licContent = File.ReadAllText(licPath);
|
||||
if (!newLicDict.ContainsKey(licPath))
|
||||
{
|
||||
newLicDict.Add(licPath, licContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
newLicDict[licPath] = licContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in UpdateLicenceInfo{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
// aggiorno obj...
|
||||
LicenceFilesDict = newLicDict;
|
||||
// salvo info licenze...
|
||||
SaveLicDict();
|
||||
fatto = numFound > 0;
|
||||
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa il file ini (se esistente) cercando file licenza e se lo trova restituisce il nome del file...
|
||||
/// </summary>
|
||||
/// <param name="iniPath">File ini da processare</param>
|
||||
/// <param name="maxLines">max num di linee da verificare</param>
|
||||
/// <returns></returns>
|
||||
private string LicSearchFileName(string iniPath, int maxLines = 20)
|
||||
{
|
||||
string answ = "";
|
||||
string licToken = "Licence=";
|
||||
if (File.Exists(iniPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(iniPath))
|
||||
{
|
||||
for (int i = 0; i < maxLines; i++)
|
||||
{
|
||||
if (reader.EndOfStream)
|
||||
break;
|
||||
|
||||
var line = reader.ReadLine();
|
||||
if (!string.IsNullOrEmpty(line))
|
||||
{
|
||||
if (line.Contains(licToken))
|
||||
{
|
||||
answ = line.Replace(licToken, "").Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Error during LicSearchFileName: {Environment.NewLine}{ex}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
@@ -940,11 +865,6 @@ namespace EgwControlCenter.Core
|
||||
/// </summary>
|
||||
protected List<TargetStatus> ListStatus { get; set; } = new List<TargetStatus>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario files licenze trovati
|
||||
/// </summary>
|
||||
public Dictionary<string, string> LicenceFilesDict { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Fields
|
||||
@@ -989,7 +909,9 @@ namespace EgwControlCenter.Core
|
||||
private string CodImpiego { get; set; } = "";
|
||||
|
||||
private string ConfName { get; set; } = "";
|
||||
|
||||
private Dictionary<string, ReleaseDTO> CriticalRelCurrent { get; set; } = new Dictionary<string, ReleaseDTO>();
|
||||
|
||||
private string DataDir { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
@@ -1001,8 +923,20 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
|
||||
private string ERName { get; set; } = "EnrollReq.json";
|
||||
private string LSName { get; set; } = "LastStatus.json";
|
||||
|
||||
/// <summary>
|
||||
/// Path file salvataggio LicenceInfo
|
||||
/// </summary>
|
||||
private string LicInfoPath
|
||||
{
|
||||
get => Path.Combine(DataDir, LIName);
|
||||
//get => Path.Combine(ApplicationDeployment.CurrentDeployment.DataDirectory, LSName);
|
||||
}
|
||||
|
||||
private string LIName { get; set; } = "LicInfo.json";
|
||||
|
||||
private string LSName { get; set; } = "LastStatus.json";
|
||||
|
||||
private SubLicManager SLicManager { get; set; } = new SubLicManager();
|
||||
|
||||
/// <summary>
|
||||
@@ -1012,14 +946,6 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
get => Path.Combine(DataDir, LSName);
|
||||
}
|
||||
/// <summary>
|
||||
/// Path file salvataggio LicenceInfo
|
||||
/// </summary>
|
||||
private string LicInfoPath
|
||||
{
|
||||
get => Path.Combine(DataDir, LIName);
|
||||
//get => Path.Combine(ApplicationDeployment.CurrentDeployment.DataDirectory, LSName);
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -1311,6 +1237,46 @@ namespace EgwControlCenter.Core
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa il file ini (se esistente) cercando file licenza e se lo trova restituisce il nome del file...
|
||||
/// </summary>
|
||||
/// <param name="iniPath">File ini da processare</param>
|
||||
/// <param name="maxLines">max num di linee da verificare</param>
|
||||
/// <returns></returns>
|
||||
private string LicSearchFileName(string iniPath, int maxLines = 20)
|
||||
{
|
||||
string answ = "";
|
||||
string licToken = "Licence=";
|
||||
if (File.Exists(iniPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(iniPath))
|
||||
{
|
||||
for (int i = 0; i < maxLines; i++)
|
||||
{
|
||||
if (reader.EndOfStream)
|
||||
break;
|
||||
|
||||
var line = reader.ReadLine();
|
||||
if (!string.IsNullOrEmpty(line))
|
||||
{
|
||||
if (line.Contains(licToken))
|
||||
{
|
||||
answ = line.Replace(licToken, "").Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Error during LicSearchFileName: {Environment.NewLine}{ex}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera oggetto releaseDTO da file indicato
|
||||
/// </summary>
|
||||
@@ -1403,6 +1369,27 @@ namespace EgwControlCenter.Core
|
||||
ListStatus = JsonConvert.DeserializeObject<List<TargetStatus>>(rawData) ?? new List<TargetStatus>();
|
||||
}
|
||||
}
|
||||
// cerco se presente file licInfo e lo ricarico...
|
||||
if (File.Exists(LicInfoPath))
|
||||
{
|
||||
var rawData = File.ReadAllText(LicInfoPath);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
LicenceFilesDict = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData) ?? new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua salvataggio obj status
|
||||
/// </summary>
|
||||
private void SaveLicDict()
|
||||
{
|
||||
var rawData = JsonConvert.SerializeObject(LicenceFilesDict, Formatting.Indented);
|
||||
if (rawData != null && rawData.Length > 2)
|
||||
{
|
||||
File.WriteAllText(LicInfoPath, rawData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1433,15 +1420,48 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua salvataggio obj status
|
||||
/// Metodo effettivo invio post info sul task
|
||||
/// </summary>
|
||||
private void SaveLicDict()
|
||||
/// <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)
|
||||
{
|
||||
var rawData = JsonConvert.SerializeObject(LicenceFilesDict, Formatting.Indented);
|
||||
if (rawData != null && rawData.Length > 2)
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
File.WriteAllText(LicInfoPath, rawData);
|
||||
// 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 = await client.PostAsync(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}");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in fase gestione REST services TaskPostInfo | action: {action}{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -47,8 +47,6 @@ namespace EgwControlCenter.Core
|
||||
public static Dictionary<string, string> CurrentInfo()
|
||||
{
|
||||
Dictionary<string, string> result = new Dictionary<string, string>();
|
||||
// in primis metto uptime
|
||||
result.Add("Uptime", UptimeCurr);
|
||||
// ciclo sugli oggetti calcolando durate e ultima call
|
||||
foreach (var item in Counter)
|
||||
{
|
||||
@@ -56,7 +54,9 @@ namespace EgwControlCenter.Core
|
||||
result.Add(item.Key, sRec);
|
||||
result.Add($"{item.Key}Last", $"{LastCall[item.Key]:yyyy-MM-dd HH:mm:ss}");
|
||||
}
|
||||
|
||||
// infine metto stata avvio e uptime
|
||||
result.Add("Startup", $"{StartTime:yyyy-MM-dd HH:mm:ss}");
|
||||
result.Add("Uptime", UptimeCurr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -69,13 +69,6 @@ namespace EgwControlCenter.Core
|
||||
Counter = new ConcurrentDictionary<string, long>();
|
||||
Duration = new ConcurrentDictionary<string, TimeSpan>();
|
||||
LastCall = new ConcurrentDictionary<string, DateTime>();
|
||||
#if false
|
||||
foreach (var value in Counter)
|
||||
{
|
||||
Duration[value.Key] = new TimeSpan(0);
|
||||
Counter[value.Key] = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,15 +142,15 @@ namespace EgwControlCenter.Core
|
||||
// formatto secondo durata
|
||||
if (ts.Milliseconds < 1)
|
||||
{
|
||||
answ = $"{ts.TotalMilliseconds:N3} ms";
|
||||
answ = $"{ts.TotalMilliseconds:N3} ns";
|
||||
}
|
||||
if (ts.TotalSeconds < 1)
|
||||
else if (ts.TotalSeconds < 1)
|
||||
{
|
||||
answ = $"{ts.TotalMilliseconds:N3} ms";
|
||||
answ = $"{ts.TotalMilliseconds:N1} ms";
|
||||
}
|
||||
else if (ts.TotalSeconds < 300)
|
||||
{
|
||||
answ = $"{ts.TotalSeconds:N3} sec";
|
||||
answ = $"{ts.TotalSeconds:N1} sec";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user