- correzione tag extraction
- correzione indentazione json
This commit is contained in:
Samuele Locatelli
2024-10-21 20:09:28 +02:00
parent 3623e0059f
commit 9fad86eb17
16 changed files with 137 additions and 98 deletions
+26 -12
View File
@@ -138,13 +138,27 @@ namespace MP.FileData.Controllers
{
fileList = fileListRaw.ToList();
}
Log.Trace($"CheckFileArchived S01 | file trovati: {fileList.Count()}");
Log.Debug($"CheckFileArchived S01 | file trovati: {fileList.Count()}");
List<FileInfo> fileNew = new List<FileInfo>();
List<FileModel> fileChecked = new List<FileModel>();
List<FileModel> fileMod = new List<FileModel>();
// recupera elenco file nel DB
var archivedFile = FileGetByPath(path, true);
List<FileModel> archivedFile = new List<FileModel>();
List<FileModel> foundFile = FileGetByPath(path, true);
// rimuovo eventuali file con estensioni escluse...
foreach (var fRec in foundFile)
{
if (!string.IsNullOrEmpty(fRec.Extension) && currRule.ExcludedFileExt.Contains(fRec.Extension))
{
Log.Trace($"CheckFileArchived S01.B: escluso {fRec.Name} | estensione {fRec.Extension}");
}
else
{
archivedFile.Add(fRec);
}
}
Log.Debug($"CheckFileArchived S01.C | Recuperati {archivedFile.Count()} da DB per confronto");
using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
{
// verifica i file
@@ -159,9 +173,9 @@ namespace MP.FileData.Controllers
{
// cerca nel DB...
FileModel currRecord = archivedFile
.Where(x => x.Active && x.Path == file.FullName)
.OrderByDescending(y => y.Rev)
.FirstOrDefault();
.Where(x => x.Active && x.Path == file.FullName)
.OrderByDescending(y => y.Rev)
.FirstOrDefault();
// se NON trova lo crea
if (currRecord == null)
{
@@ -389,7 +403,7 @@ namespace MP.FileData.Controllers
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
{
// converto
List<DatabaseModels.FileModel> newRec = newFiles.Select(o => new DatabaseModels.FileModel()
List<FileModel> newRec = newFiles.Select(o => new FileModel()
{
Active = true,
DiskStatus = FileState.Ok,
@@ -427,15 +441,15 @@ namespace MP.FileData.Controllers
// cerco codice tag da configurazione
if (currRule.Mode == SearchMode.StringOnFile)
{
Tags = TagsUtils.searchProgComment(fileName, item.FileStringContent, currRule);
Tags = TagsUtils.SearchProgComment(fileName, item.FileStringContent, currRule);
}
else if (currRule.Mode == SearchMode.TagListed)
{
Tags = TagsUtils.searchTagListed(fileName, item.FileStringContent, currRule);
Tags = TagsUtils.SearchTagListed(fileName, item.FileStringContent, currRule);
}
else
{
Tags = TagsUtils.searchPathName(item.Path, basePath, currRule);
Tags = TagsUtils.SearchPathName(item.Path, basePath, currRule);
}
foreach (var tag in Tags)
@@ -594,15 +608,15 @@ namespace MP.FileData.Controllers
// cerco codice tag da configurazione
if (currRule.Mode == SearchMode.StringOnFile)
{
Tags = TagsUtils.searchProgComment(fileName, item.FileStringContent, currRule);
Tags = TagsUtils.SearchProgComment(fileName, item.FileStringContent, currRule);
}
else if (currRule.Mode == SearchMode.TagListed)
{
Tags = TagsUtils.searchTagListed(fileName, item.FileStringContent, currRule);
Tags = TagsUtils.SearchTagListed(fileName, item.FileStringContent, currRule);
}
else
{
Tags = TagsUtils.searchPathName(item.Path, basePath, currRule);
Tags = TagsUtils.SearchPathName(item.Path, basePath, currRule);
}
foreach (var tag in Tags)