using EgwCoreLib.Lux.Data; using Microsoft.AspNetCore.Components; using NLog; namespace Lux.UI.Components { public class BaseComp { /// /// Restituisce il contenuto del file salvato /// /// /// /// private string LoadFileContent(string folderPath, string secureName) { string answ = ""; if (!string.IsNullOrEmpty(folderPath)) { try { // calcolo path file... string filePath = Path.Combine(basePath, folderPath, secureName); if (File.Exists(filePath)) { answ = File.ReadAllText(filePath); } } catch (Exception exc) { Log.Error($"Exception on LoadFileContent{Environment.NewLine}{exc}"); } } return answ; } private static Logger Log = LogManager.GetCurrentClassLogger(); /// /// Base path x network share files /// private string basePath = "unsafe_uploads"; private void ConfInit() { basePath = Config.GetValue("ServerConf:FileSharePath") ?? "unsafe_uploads"; } [Inject] protected IConfiguration Config { get; set; } = null!; } }