Files
2025-12-09 18:31:31 +01:00

50 lines
1.4 KiB
C#

using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwCoreLib.Lux.Core
{
public class FileUtils
{
#region Public Methods
/// <summary>
/// Restituisce il contenuto del file salvato
/// </summary>
/// <param name="folderPath">Path completo (da share/base path + folder)</param>
/// <param name="secureName">Nome del file "obfuscated"</param>
/// <returns></returns>
public static string LoadFileContent(string folderPath, string secureName)
{
string answ = "";
if (!string.IsNullOrEmpty(folderPath))
{
try
{
// calcolo path file...
string filePath = Path.Combine(folderPath, secureName);
if (File.Exists(filePath))
{
answ = File.ReadAllText(filePath);
}
}
catch (Exception exc)
{
Log.Error($"Exception on LoadFileContent{Environment.NewLine}{exc}");
}
}
return answ;
}
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}