Merge branch 'release/IobManMultiClient_02'
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="appName" value="IOB-MAN" />
|
||||
<add key="FullConfFile" value="/CONF/IOB-MAN-CONFIG.json" />
|
||||
<add key="appNameExt" value="IOB-WIN-NEXT" />
|
||||
<!--<add key="appNameExt" value="IOB-WIN-PSER" />-->
|
||||
<add key="uiPeriod" value="100" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"SIMUL_04": "IOB-WIN-NEXT",
|
||||
"SIMUL_05": "IOB-WIN-NEXT"
|
||||
},
|
||||
"TargetConfig": {
|
||||
"ListTarget": {
|
||||
"IOB-WIN-NEXT": {
|
||||
"ExeName": "IOB-WIN-NEXT",
|
||||
"ExePath": "C:\\Steamware\\IOB-WIN-NEXT\\IOB-WIN-NEXT.exe",
|
||||
|
||||
@@ -197,6 +197,7 @@
|
||||
<Link>VersGen.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Enum.cs" />
|
||||
<Compile Include="IobManConfig.cs" />
|
||||
<Compile Include="TargetConfig.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="iobAdapt.cs" />
|
||||
@@ -245,7 +246,7 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="CONF\process-legacy.json" />
|
||||
<None Include="CONF\iob-man-config.json">
|
||||
<None Include="CONF\IOB-MAN-CONFIG.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="CONF\target.json">
|
||||
|
||||
Generated
+11
-9
@@ -95,10 +95,10 @@
|
||||
this.lblVers,
|
||||
this.tsProgBar,
|
||||
this.tsslNumProc});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 469);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 439);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(689, 22);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(929, 22);
|
||||
this.statusStrip1.TabIndex = 82;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
@@ -133,7 +133,7 @@
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(689, 31);
|
||||
this.panel1.Size = new System.Drawing.Size(929, 31);
|
||||
this.panel1.TabIndex = 83;
|
||||
//
|
||||
// menuStrip1
|
||||
@@ -144,7 +144,7 @@
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(689, 24);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(929, 24);
|
||||
this.menuStrip1.TabIndex = 82;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
@@ -218,7 +218,7 @@
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 1;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(689, 438);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(929, 408);
|
||||
this.tableLayoutPanel1.TabIndex = 85;
|
||||
//
|
||||
// panel2
|
||||
@@ -238,10 +238,10 @@
|
||||
this.panel2.Controls.Add(this.btnMinimizeAll);
|
||||
this.panel2.Controls.Add(this.btnMaximixeAll);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(571, 2);
|
||||
this.panel2.Location = new System.Drawing.Point(811, 2);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(116, 434);
|
||||
this.panel2.Size = new System.Drawing.Size(116, 404);
|
||||
this.panel2.TabIndex = 85;
|
||||
//
|
||||
// btnSendLog
|
||||
@@ -373,6 +373,7 @@
|
||||
//
|
||||
this.dgvManagedItems.AllowUserToAddRows = false;
|
||||
this.dgvManagedItems.AllowUserToDeleteRows = false;
|
||||
this.dgvManagedItems.AllowUserToResizeColumns = false;
|
||||
this.dgvManagedItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -382,7 +383,7 @@
|
||||
this.dgvManagedItems.Name = "dgvManagedItems";
|
||||
this.dgvManagedItems.ReadOnly = true;
|
||||
this.dgvManagedItems.RowHeadersWidth = 51;
|
||||
this.dgvManagedItems.Size = new System.Drawing.Size(563, 432);
|
||||
this.dgvManagedItems.Size = new System.Drawing.Size(803, 402);
|
||||
this.dgvManagedItems.TabIndex = 76;
|
||||
this.dgvManagedItems.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvManagedItems_CellDoubleClick);
|
||||
this.dgvManagedItems.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvManagedItems_CellFormatting);
|
||||
@@ -403,7 +404,7 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.ClientSize = new System.Drawing.Size(689, 491);
|
||||
this.ClientSize = new System.Drawing.Size(929, 461);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
@@ -414,6 +415,7 @@
|
||||
this.Name = "IOBManPanel";
|
||||
this.Text = "IOB MANAGER";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IOBManPanel_FormClosing);
|
||||
this.Shown += new System.EventHandler(this.IOBManPanel_Shown);
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
|
||||
+113
-20
@@ -1,3 +1,4 @@
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using RestSharp.Serializers.NewtonsoftJson;
|
||||
@@ -6,6 +7,7 @@ using SteamWare.IO;
|
||||
using SteamWare.Logger;
|
||||
using SteamWare.Scheduler;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
@@ -160,10 +162,15 @@ namespace IOB_MAN
|
||||
private readonly SynchronizationContext synchronizationContext;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto semaforico di lock
|
||||
/// Oggetto semaforico di lock x check threads
|
||||
/// </summary>
|
||||
private SemaphoreSlim _sync = new SemaphoreSlim(1);
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto semaforico di lock x UI
|
||||
/// </summary>
|
||||
private SemaphoreSlim _syncUI = new SemaphoreSlim(1);
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario ARGS (uno per child da avviare, nome IOB + tipo target EXE)
|
||||
/// </summary>
|
||||
@@ -606,7 +613,6 @@ namespace IOB_MAN
|
||||
checkRunning = true;
|
||||
// eseguo task!
|
||||
await Task.Run(() => checkRunningchild());
|
||||
//await Task.Run(() => checkRunningchild()).ConfigureAwait(false);
|
||||
updateStatus();
|
||||
checkRunning = false;
|
||||
}
|
||||
@@ -625,7 +631,7 @@ namespace IOB_MAN
|
||||
{
|
||||
IList<iobAdapt> allItems = (IList<iobAdapt>)ElencoIOB.List;
|
||||
bool needRem = false;
|
||||
List<Process> processList = new List<Process>();
|
||||
ConcurrentBag<Process> concList = new ConcurrentBag<Process>();
|
||||
|
||||
// 2024.12.16 chiamata parallela controllo processi
|
||||
// chiamo in parallelo la ricerca di tutti i TIPI di EXE gestiti...
|
||||
@@ -633,14 +639,20 @@ namespace IOB_MAN
|
||||
{
|
||||
// 2020.02.01 passato chiamata specifica x leggere in 1 sola volta elenco processi da nome
|
||||
var tempProcList = Process.GetProcessesByName(item.Key);
|
||||
foreach (var sProc in tempProcList)
|
||||
{
|
||||
concList.Add(sProc);
|
||||
}
|
||||
#if false
|
||||
processList.AddRange(tempProcList.ToList());
|
||||
#endif
|
||||
}
|
||||
);
|
||||
|
||||
// ciclo
|
||||
Parallel.ForEach(allItems, item =>
|
||||
{
|
||||
needRem = checkIstance(item, processList);
|
||||
needRem = checkIstance(item, concList.ToList());
|
||||
}
|
||||
);
|
||||
// aggiorno datagrid!
|
||||
@@ -959,18 +971,13 @@ namespace IOB_MAN
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
// You can show a context menu or perform other actions here
|
||||
ContextMenu contextMenu = new ContextMenu();
|
||||
contextMenu.MenuItems.Add(new MenuItem("Show LOG folder", IobFolderOpenLog));
|
||||
contextMenu.MenuItems.Add(new MenuItem("Show CONF folder", IobFolderOpenConf));
|
||||
contextMenu.MenuItems.Add(new MenuItem("Show APP folder", IobFolderOpenApp));
|
||||
contextMenu.Show(dgvManagedItems, dgvManagedItems.PointToClient(Cursor.Position));
|
||||
|
||||
dgvManagedItems.Rows[e.RowIndex].Selected = true;
|
||||
iobAdapt selIobRow = (iobAdapt)ElencoIOB[e.RowIndex];
|
||||
// salvo info riga selezionata...
|
||||
int pid = -1;
|
||||
if (e.RowIndex >= 0)
|
||||
{
|
||||
selCodIob = ((iobAdapt)ElencoIOB[e.RowIndex]).CodIOB;
|
||||
selCodIob = selIobRow.CodIOB;
|
||||
// cerco da conf...
|
||||
if (ArgsList.ContainsKey(selCodIob))
|
||||
{
|
||||
@@ -981,6 +988,15 @@ namespace IOB_MAN
|
||||
}
|
||||
}
|
||||
}
|
||||
// You can show a context menu or perform other actions here
|
||||
ContextMenu contextMenu = new ContextMenu();
|
||||
contextMenu.MenuItems.Add(new MenuItem("Show LOG folder", IobFolderOpenLog));
|
||||
contextMenu.MenuItems.Add(new MenuItem("Show CONF folder", IobFolderOpenConf));
|
||||
contextMenu.MenuItems.Add(new MenuItem("Show APP folder", IobFolderOpenApp));
|
||||
contextMenu.MenuItems.Add(new MenuItem("-"));
|
||||
contextMenu.MenuItems.Add(new MenuItem($"Close IOB {selCodIob}", IobCloseSel));
|
||||
contextMenu.MenuItems.Add(new MenuItem($"Restart IOB {selCodIob}", IobRestartSel));
|
||||
contextMenu.Show(dgvManagedItems, dgvManagedItems.PointToClient(Cursor.Position));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,7 +1021,6 @@ namespace IOB_MAN
|
||||
try
|
||||
{
|
||||
Task result = Task.Run(() => checkProcessStatusAsync());
|
||||
//Task result = Task.Run(() => checkProcessStatusAsync().ConfigureAwait(false));
|
||||
result.Wait();
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1081,6 +1096,13 @@ namespace IOB_MAN
|
||||
ElencoIOB.ListChanged += ElencoIOB_ListChanged;
|
||||
// collego tab a binding
|
||||
dgvManagedItems.DataSource = ElencoIOB;
|
||||
|
||||
// predispongo larghezze colonne
|
||||
dgvManagedItems.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dgvManagedItems.AutoResizeColumns();
|
||||
dgvManagedItems.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
|
||||
dgvManagedItems.AllowUserToResizeColumns = true;
|
||||
|
||||
utils.lgInfo("Timer started");
|
||||
if (utils.CRB("autoStartProc"))
|
||||
{
|
||||
@@ -1115,6 +1137,16 @@ namespace IOB_MAN
|
||||
});
|
||||
}
|
||||
|
||||
private void IobCloseSel(object sender, EventArgs e)
|
||||
{
|
||||
chiudiChildSel();
|
||||
// deselezioni...
|
||||
foreach (var item in dgvManagedItems.SelectedRows)
|
||||
{
|
||||
((DataGridViewRow)item).Selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void IobFolderOpenApp(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("explorer.exe", selIobTgtPath);
|
||||
@@ -1138,6 +1170,29 @@ namespace IOB_MAN
|
||||
closeTimers();
|
||||
}
|
||||
|
||||
private void IOBManPanel_Shown(object sender, EventArgs e)
|
||||
{
|
||||
// sistemo larghezze salvando e lasciando libero x utente
|
||||
foreach (DataGridViewColumn column in dgvManagedItems.Columns)
|
||||
{
|
||||
column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
|
||||
int colw = column.Width; //This is important, otherwise the following line will nullify your previous command
|
||||
column.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
|
||||
column.Width = colw; //This is important, otherwise the following line will nullify your previous command
|
||||
}
|
||||
}
|
||||
|
||||
private void IobRestartSel(object sender, EventArgs e)
|
||||
{
|
||||
chiudiChildSel();
|
||||
apriChildSel();
|
||||
// deselezioni...
|
||||
foreach (var item in dgvManagedItems.SelectedRows)
|
||||
{
|
||||
((DataGridViewRow)item).Selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Caricamento aprametri x lancio client apps
|
||||
/// </summary>
|
||||
@@ -1237,6 +1292,21 @@ namespace IOB_MAN
|
||||
string jsonData = JsonConvert.SerializeObject(ArgsList);
|
||||
File.WriteAllText(jsonFileName, jsonData);
|
||||
}
|
||||
|
||||
// 2024.12.17: salvo il file in formato nuovo... se non esiste...
|
||||
string fConfName = utils.CRS("FullConfFile");
|
||||
string jsonFName = $"{Application.StartupPath}{fConfName}";
|
||||
if(!File.Exists(jsonFName))
|
||||
{
|
||||
IobManConfig currIobManConf = new IobManConfig()
|
||||
{
|
||||
ListIOB = ArgsList,
|
||||
ListTarget=TargetList
|
||||
};
|
||||
// serializzo e salvo file!
|
||||
string jsonData = JsonConvert.SerializeObject(currIobManConf, Formatting.Indented);
|
||||
File.WriteAllText(jsonFName, jsonData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1250,8 +1320,30 @@ namespace IOB_MAN
|
||||
forceCheckPeriodMult = utils.CRI("forceCheckPeriodMult");
|
||||
ApiUrl = utils.CRS("ApiUrl");
|
||||
|
||||
// caricamento configurazione argomenti di avvio processi
|
||||
loadArgList();
|
||||
// 2024.12.17: verifico se ho il file unico...
|
||||
string fConfName = utils.CRS("FullConfFile");
|
||||
string jsonFName = $"{Application.StartupPath}{fConfName}";
|
||||
// verifico se esista il file richiesto
|
||||
if (File.Exists(jsonFName))
|
||||
{
|
||||
// leggo il file json
|
||||
using (StreamReader reader = new StreamReader(jsonFName))
|
||||
{
|
||||
string rawData = reader.ReadToEnd();
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
IobManConfig currIobManConf = JsonConvert.DeserializeObject<IobManConfig>(rawData);
|
||||
TargetList = currIobManConf.ListTarget;
|
||||
ArgsList = currIobManConf.ListIOB;
|
||||
}
|
||||
}
|
||||
}
|
||||
//altrimenti processo alla vecchia maniera...
|
||||
else
|
||||
{
|
||||
// caricamento configurazione argomenti di avvio processi
|
||||
loadArgList();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConfToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -1278,7 +1370,6 @@ namespace IOB_MAN
|
||||
try
|
||||
{
|
||||
Task result = Task.Run(() => checkProcessStatusAsync());
|
||||
//Task result = Task.Run(() => checkProcessStatusAsync().ConfigureAwait(false));
|
||||
result.Wait();
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1297,8 +1388,9 @@ namespace IOB_MAN
|
||||
{
|
||||
}
|
||||
|
||||
private void performBarAdvance()
|
||||
private async Task performBarAdvance()
|
||||
{
|
||||
await _syncUI.WaitAsync();
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
tsProgBar.PerformStep();
|
||||
@@ -1308,6 +1400,7 @@ namespace IOB_MAN
|
||||
}
|
||||
tsProgBar.Invalidate();
|
||||
}), "");
|
||||
_syncUI.Release();
|
||||
}
|
||||
|
||||
private void preInit()
|
||||
@@ -1316,8 +1409,8 @@ namespace IOB_MAN
|
||||
lblApp.Text = $"{ConfigurationManager.AppSettings.Get("appName")}";
|
||||
lblVers.Text = $" v.{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}";
|
||||
// init prog bar
|
||||
tsProgBar.Maximum = 100;
|
||||
tsProgBar.Step = 4;
|
||||
tsProgBar.Maximum = 40;
|
||||
tsProgBar.Step = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1547,7 +1640,7 @@ namespace IOB_MAN
|
||||
|
||||
private async Task updateProgBarAsync()
|
||||
{
|
||||
await Task.Run(() => performBarAdvance()).ConfigureAwait(false);
|
||||
await performBarAdvance();
|
||||
}
|
||||
|
||||
private void updateStatus()
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_MAN
|
||||
{
|
||||
public class IobManConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Dizionario degli IOB configurati col TIPO di target associato
|
||||
/// </summary>
|
||||
public Dictionary<string, string> ListIOB { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// dizionario dei target ammessi con relativa configurazione
|
||||
/// </summary>
|
||||
public Dictionary<string, TargetConfig> ListTarget{ get; set; } = new Dictionary<string, TargetConfig>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user