Creato classe x parametrizzare gest TAGS
This commit is contained in:
@@ -104,10 +104,32 @@ namespace MP.FileData.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// fixme todo !!! fix da conf file
|
||||
|
||||
// fare: lettura conf rule x recupero tag x singola macchina
|
||||
//$"\\b{fileName}" + @".{0,2}\([\w\d\s.]+\)";
|
||||
|
||||
Dictionary<string, string> confReplace = new Dictionary<string, string>();
|
||||
confReplace.Add("(", " ");
|
||||
confReplace.Add(")", " ");
|
||||
// hard coded + salvataggio conf x creare json
|
||||
SearchRules currRule = new SearchRules()
|
||||
{
|
||||
Name = "Commento Filename",
|
||||
Mode = SearchMode.StringOnFile,
|
||||
MaxChar2Search = 100,
|
||||
ReplaceCR = true,
|
||||
RegExPattern = "\\b{{fileName}}" + @".{0,2}\([\w\d\s.]+\)",
|
||||
RegExRepFileName = true,
|
||||
ExcludedTags = ".xls .xlsx",
|
||||
OutReplace = confReplace,
|
||||
OutExcludeFileName = true
|
||||
};
|
||||
|
||||
// salvo i NUOVI file
|
||||
if (fileNew != null && fileNew.Count > 0)
|
||||
{
|
||||
FileInsert(idxMacchina, fileNew, 0);
|
||||
FileInsert(idxMacchina, fileNew, 0, currRule);
|
||||
Log.Info($"CheckFileArchived S03 | insert {fileNew.Count} files");
|
||||
}
|
||||
// aggiorno i file modificati
|
||||
@@ -234,8 +256,9 @@ namespace MP.FileData.Controllers
|
||||
/// <param name="newFiles"></param>
|
||||
/// <param name="rev"></param>
|
||||
/// <returns></returns>
|
||||
public bool FileInsert(string idxMacchina, List<FileInfo> newFiles, int rev)
|
||||
public bool FileInsert(string idxMacchina, List<FileInfo> newFiles, int rev, SearchRules currRule)
|
||||
{
|
||||
// fare: lettura conf x macchina
|
||||
Log.Info($"FileInsert S01 per macchina {idxMacchina}: {newFiles.Count} files da valutare");
|
||||
bool answ = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
@@ -283,7 +306,7 @@ namespace MP.FileData.Controllers
|
||||
{
|
||||
code2search = item.FileStringContent;
|
||||
}
|
||||
Tags = TagsUtils.searchProgComment(item.Name, code2search, excludeTags);
|
||||
Tags = TagsUtils.searchProgComment(item.Name, code2search, currRule);
|
||||
|
||||
foreach (var tag in Tags)
|
||||
{
|
||||
@@ -339,8 +362,26 @@ namespace MP.FileData.Controllers
|
||||
var newFileInfo = new FileInfo(currFile.Path);
|
||||
listUpdate.Add(newFileInfo);
|
||||
|
||||
// fixme todo !!! fix da conf file
|
||||
Dictionary<string, string> confReplace = new Dictionary<string, string>();
|
||||
confReplace.Add("(", " ");
|
||||
confReplace.Add(")", " ");
|
||||
// hard coded + salvataggio conf x creare json
|
||||
SearchRules currRule = new SearchRules()
|
||||
{
|
||||
Name = "Commento Filename",
|
||||
Mode = SearchMode.StringOnFile,
|
||||
MaxChar2Search = 100,
|
||||
ReplaceCR = true,
|
||||
RegExPattern = "\\b{{fileName}}" + @".{0,2}\([\w\d\s.]+\)",
|
||||
RegExRepFileName = true,
|
||||
ExcludedTags = ".xls .xlsx",
|
||||
OutReplace = confReplace,
|
||||
OutExcludeFileName = true
|
||||
};
|
||||
|
||||
// inserisco come REVISIONE
|
||||
FileInsert(currFile.IdxMacchina, listUpdate, currFile.Rev + 1);
|
||||
FileInsert(currFile.IdxMacchina, listUpdate, currFile.Rev + 1, currRule);
|
||||
|
||||
// archivio vecchio file
|
||||
currFile.Active = false;
|
||||
|
||||
Reference in New Issue
Block a user