diff --git a/Lux.Report.Data/Services/FileService.cs b/Lux.Report.Data/Services/FileService.cs index 62aedec3..fe484f20 100644 --- a/Lux.Report.Data/Services/FileService.cs +++ b/Lux.Report.Data/Services/FileService.cs @@ -23,7 +23,8 @@ namespace Lux.Report.Data.Services #region Public Methods - public int CountFile(string folderPath, string pattern) + /// + public int CountFile(string folderPath, string pattern, bool hideDot) { int answ = 0; if (!string.IsNullOrEmpty(folderPath)) @@ -34,13 +35,44 @@ namespace Lux.Report.Data.Services if (Directory.Exists(dirPath)) { var fFound = Directory.GetFiles(dirPath, pattern); - answ = fFound.Count(); + if (hideDot) + { + answ = fFound + .Where(path => !Path.GetFileName(path).StartsWith(".")) + .Count(); + } + else + { + answ = fFound.Count(); + } } } return answ; } - public List ListFile(string folderPath, string pattern) + public bool FileCopy(string origPath, string destPath) + { + bool done = false; + + string fullPathFrom = Path.Combine(basePath, origPath); + if (File.Exists(fullPathFrom)) + { + string fullPathTo = Path.Combine(basePath, destPath); + File.Copy(fullPathFrom, fullPathTo, true); + done = File.Exists(fullPathTo); + } + return done; + } + + public bool FileExists(string filePath) + { + // calcolo path file... + string fullPath = Path.Combine(basePath, filePath); + return File.Exists(fullPath); + } + + /// + public List ListFile(string folderPath, string pattern, bool hideDot) { List answ = new(); if (!string.IsNullOrEmpty(folderPath)) @@ -50,7 +82,17 @@ namespace Lux.Report.Data.Services // se esiste... if (Directory.Exists(dirPath)) { - answ = Directory.GetFiles(dirPath, pattern).ToList(); + var rawList = Directory.GetFiles(dirPath, pattern).ToList(); + if (hideDot) + { + answ = rawList + .Where(path => !Path.GetFileName(path).StartsWith(".")) + .ToList(); + } + else + { + answ = rawList; + } } } return answ; diff --git a/Lux.Report.Data/Services/IFileService.cs b/Lux.Report.Data/Services/IFileService.cs index 2bc80911..78849dd7 100644 --- a/Lux.Report.Data/Services/IFileService.cs +++ b/Lux.Report.Data/Services/IFileService.cs @@ -13,23 +13,40 @@ namespace Lux.Report.Data.Services { #region Public Methods - /// /// Esegue conteggio file trovati in folder richiesta dato pattern /// /// Cartella di riferimento /// Pattern ricerca + /// Nasconde i "dotfile" (file nascosti che iniziano per .) /// Num file trovati - int CountFile(string folderPath, string pattern); + int CountFile(string folderPath, string pattern, bool hideDot); + /// + /// Duplica un file dato path origine + destinazione (verificando esista origine) + /// + /// + /// + /// + bool FileCopy(string origPath, string destPath); + + /// + /// Verifica esistenza file richiesto + /// + /// + /// + bool FileExists(string filePath); /// /// Elenco file trovati in folder richiesta dato pattern /// /// Cartella di riferimento /// Pattern ricerca + /// Nasconde i "dotfile" (file nascosti che iniziano per .) /// Elenco file trovati - List ListFile(string folderPath, string pattern); + List ListFile(string folderPath, string pattern, bool hideDot); + + #endregion Public Methods ///// ///// Salva contenuto file (sincrono) @@ -57,7 +74,5 @@ namespace Lux.Report.Data.Services ///// Stream contenitore dati ///// True se salvato con successo //Task SaveFileStreamAsync(string folderPath, string pattern, Stream contentStream); - - #endregion Public Methods } -} +} \ No newline at end of file diff --git a/Lux.Report.Manager/Components/Compo/RepoFileList.razor b/Lux.Report.Manager/Components/Compo/RepoFileList.razor index 865355e5..94845bb9 100644 --- a/Lux.Report.Manager/Components/Compo/RepoFileList.razor +++ b/Lux.Report.Manager/Components/Compo/RepoFileList.razor @@ -1,13 +1,17 @@ -@CurrReport.Name +
- @*
Elenco
*@ -