Ancora riorganizzazione classi e servizi

This commit is contained in:
Samuele Locatelli
2026-05-21 18:55:29 +02:00
parent 648e03c52e
commit 243b863d9c
16 changed files with 43 additions and 36 deletions
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IOB_UT_NEXT
namespace IOB_UT_NEXT.Config
{
public class GenActConf
{
@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IOB_UT_NEXT.Config
namespace IOB_UT_NEXT.Config.Special
{
/// <summary>
/// Implementazione di riferimento x un file di configurazione x esecuzione task tramite EgwCApp
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IOB_UT_NEXT
namespace IOB_UT_NEXT.Config.Special
{
public class FtpActConf : GenActConf
{
+8 -9
View File
@@ -176,7 +176,7 @@
<Compile Include="Config\Base\TCDataDto.cs" />
<Compile Include="Config\Base\TimersDto.cs" />
<Compile Include="Config\EnumConf.cs" />
<Compile Include="Config\ExtToolConf.cs" />
<Compile Include="Config\Special\ExtToolConf.cs" />
<Compile Include="Config\IobConfTree.cs" />
<Compile Include="Config\Mem\MemAreaDto.cs" />
<Compile Include="Config\Special\ActionDto.cs" />
@@ -188,17 +188,17 @@
<Compile Include="Config\Special\StepActionDto.cs" />
<Compile Include="DataModel\Fimat.cs" />
<Compile Include="DataModel\UstdData.cs" />
<Compile Include="DataQueue.cs" />
<Compile Include="FileProcMan.cs" />
<Compile Include="Services\Data\DataQueue.cs" />
<Compile Include="Services\Files\FileProcMan.cs" />
<Compile Include="DataModel\FluxData.cs" />
<Compile Include="FtpActConf.cs" />
<Compile Include="GenActConf.cs" />
<Compile Include="Config\Special\FtpActConf.cs" />
<Compile Include="Config\GenActConf.cs" />
<Compile Include="IniFile.cs" />
<Compile Include="IntConditionCheck.cs" />
<Compile Include="BitConditionCheck.cs" />
<Compile Include="CustomObj.cs" />
<Compile Include="DataExport.cs" />
<Compile Include="Eurom63.cs" />
<Compile Include="Services\Data\DataExport.cs" />
<Compile Include="Services\Files\Eurom63.cs" />
<Compile Include="iobRefreshedEventArgs.cs" />
<Compile Include="IobWinStatus.cs" />
<Compile Include="Iob\BaseObj.cs" />
@@ -217,7 +217,7 @@
<Compile Include="baseUtils.cs" />
<Compile Include="BinaryUtils.cs" />
<Compile Include="Enums.cs" />
<Compile Include="fileMover.cs" />
<Compile Include="Services\Files\FileMover.cs" />
<Compile Include="Logging.cs" />
<Compile Include="Objects.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -251,7 +251,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Services\Core\" />
<Folder Include="Services\Files\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.ValueTuple.4.6.2\build\net471\System.ValueTuple.targets" Condition="Exists('..\packages\System.ValueTuple.4.6.2\build\net471\System.ValueTuple.targets')" />
+1
View File
@@ -1,4 +1,5 @@
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Services.Data;
using NLog;
using System;
using System.Collections.Generic;
+3 -1
View File
@@ -1,4 +1,6 @@
using MapoSDK;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Config.Special;
using MapoSDK;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace IOB_UT_NEXT
namespace IOB_UT_NEXT.Services.Data
{
public class DataExport
{
@@ -4,7 +4,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace IOB_UT_NEXT
namespace IOB_UT_NEXT.Services.Data
{
/// <summary>
/// Classe gestione code, a seconda della conf come LIST redis o come concurrent queue in memoria
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace IOB_UT_NEXT
namespace IOB_UT_NEXT.Services.Files
{
/// <summary>
/// Classe di helper per metodi Euromap63 tramite File Exchange
@@ -6,19 +6,19 @@ using System.Linq;
using System.Net;
using System.Reflection;
namespace IOB_UT_NEXT
namespace IOB_UT_NEXT.Services.Files
{
/// <summary>
/// Accesso in lettura e scrittura al filesystem per gestione files upload e download
/// </summary>
public class fileMover
public class FileMover
{
#region Public Fields
/// <summary>
/// versione statica (singleton) del'oggetto fileMover
/// versione statica (singleton) del'oggetto FileMover
/// </summary>
public static fileMover obj = new fileMover();
public static FileMover obj = new FileMover();
/// <summary>
/// oggetto WebClient
@@ -34,7 +34,7 @@ namespace IOB_UT_NEXT
/// </summary>
/// <param name="_path"></param>
/// <param name="_log">non serve +... x retrocompatibilit...</param>
public fileMover(string _path, string _log)
public FileMover(string _path, string _log)
{
setDirs(_path);
WebCli = new WebClient();
@@ -43,7 +43,7 @@ namespace IOB_UT_NEXT
/// <summary>
/// metodo di avvio empty
/// </summary>
public fileMover()
public FileMover()
{
WebCli = new WebClient();
}
@@ -3,7 +3,7 @@ using System;
using System.Diagnostics;
using System.IO;
namespace IOB_UT_NEXT
namespace IOB_UT_NEXT.Services.Files
{
public class FileProcMan
{
+11 -10
View File
@@ -1,3 +1,4 @@
using IOB_UT_NEXT.Services.Files;
using NLog;
using RestSharp;
using System;
@@ -412,12 +413,12 @@ namespace IOB_UT_NEXT
public static void shrinkDir(string dirPath)
{
// obj filemover...
fileMover.obj.setDirectory(dirPath);
float dirSizeMb = fileMover.obj.totalMb();
FileMover.obj.setDirectory(dirPath);
float dirSizeMb = FileMover.obj.totalMb();
lg.Info("Inizio shrinkDir LOG folder: {0} Mb", dirSizeMb);
// ottengo elenco files *.txt
FileInfo[] _fis = fileMover.obj.elencoFiles_FI("*.log");
FileInfo[] _fis = FileMover.obj.elencoFiles_FI("*.log");
int numDdMax = 2;
try
{
@@ -429,17 +430,17 @@ namespace IOB_UT_NEXT
{
if (_file.LastWriteTime < DateTime.Now.AddDays(-1)) // zippo files + vecchi di 2 gg...
{
fileMover.obj.zippaSingoloFile(_file);
FileMover.obj.zippaSingoloFile(_file);
// cancello l'originale...
fileMover.obj.eliminaFile(_file);
FileMover.obj.eliminaFile(_file);
}
}
// inizio con eliminare file + vecchi della data indicata...
int maxLogDays = CRI("maxLogDays");
fileMover.obj.deleteOlderThan(maxLogDays);
FileMover.obj.deleteOlderThan(maxLogDays);
// ora controllo SE sia superata la dim max della directory --> in tal caso cancello dal
// + vecchio...
dirSizeMb = fileMover.obj.totalMb();
dirSizeMb = FileMover.obj.totalMb();
int maxLogDirSize = CRI("maxLogDirSize");
int maxTry = 100;
// controllo se serva eliminare...
@@ -448,11 +449,11 @@ namespace IOB_UT_NEXT
lg.Info("Continuo shrinkDir LOG folder: {0} Mb --> ELIMINAZIONE FILES", dirSizeMb);
while (dirSizeMb > maxLogDirSize)
{
fileMover.obj.deleteOldest();
FileMover.obj.deleteOldest();
maxTry--;
if (maxTry > 0)
{
dirSizeMb = fileMover.obj.totalMb();
dirSizeMb = FileMover.obj.totalMb();
}
else
{
@@ -460,7 +461,7 @@ namespace IOB_UT_NEXT
dirSizeMb = maxLogDirSize - 1;
}
}
dirSizeMb = fileMover.obj.totalMb();
dirSizeMb = FileMover.obj.totalMb();
lg.Info("Completata shrinkDir LOG folder: {0} Mb", dirSizeMb);
}
}
+2 -1
View File
@@ -1,6 +1,7 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Config.Base;
using IOB_UT_NEXT.Services.Files;
using IOB_UT_NEXT.Services.Networking;
using MapoSDK;
using Newtonsoft.Json;
@@ -1963,7 +1964,7 @@ namespace IOB_WIN_FORM
// out di cosa faccio...
displayTaskAndLog($"[STARTUP] Loading ConfFile: {iniConfFile}");
var appVers = Assembly.GetExecutingAssembly().GetName().Version;
string path = fileMover.GetExecutingDirectoryName(); // Directory.GetCurrentDirectory();
string path = FileMover.GetExecutingDirectoryName(); // Directory.GetCurrentDirectory();
string fileName = Path.GetFileName(iniConfFile).Replace(".ini", ".iob");
string dirPath = Path.Combine(path, "DATA", "CONF_RUN");
// verifica directory
+2 -1
View File
@@ -2,6 +2,7 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Services.Data;
using IOB_UT_NEXT.Services.Files;
using IOB_UT_NEXT.Services.Networking;
using MapoSDK;
using MathNet.Numerics.Statistics;
@@ -8879,7 +8880,7 @@ namespace IOB_WIN_FORM.Iob
bool fatto = false;
if (Directory.Exists(folderPath))
{
fatto = fileMover.zippaDirectory(folderPath, zipName);
fatto = FileMover.zippaDirectory(folderPath, zipName);
// se sent elimino vecchia directory...
if (fatto)
{
+1
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Services.Data;
using MapoSDK;
using System;
using System.Diagnostics;
+2 -1
View File
@@ -1,5 +1,6 @@
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Services.Files;
using IOB_UT_NEXT.Services.Networking;
using MapoSDK;
using MathNet.Numerics.Distributions;
@@ -845,7 +846,7 @@ namespace IOB_WIN_FORM
// salvo!
foreach (var item in objFiles.fileList)
{
fileMover.obj.salvaFileString(utils.confDir, item.fileName, item.content);
FileMover.obj.salvaFileString(utils.confDir, item.fileName, item.content);
}
displayTaskAndLog("Download conf files aggiornati");
}