9007a4df85
- inizio gestione display folder ODL - browse directory locale x documenti - da verificare metodo refresh modulo browse
66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.Data;
|
|
|
|
namespace MP.SPEC.Components
|
|
{
|
|
public partial class FolderBrowser
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public string LogicalPath { get; set; } = "";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected IConfiguration ConfMan { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Restituisce size calcolata
|
|
/// </summary>
|
|
/// <param name="origSize"></param>
|
|
/// <returns></returns>
|
|
protected string CalcSize(long origSize)
|
|
{
|
|
return MeasureUtils.SizeSuffix(origSize, 1);
|
|
}
|
|
|
|
protected string FileLink(string fName)
|
|
{
|
|
return $"RET_DATA/{LogicalPath}/{fName}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eseguo browsing directory...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected override void OnParametersSet()
|
|
{
|
|
// calcolo phisical path...
|
|
string BasePathOdlReturn = ConfMan.GetValue<string>("ServerConf:BasePathOdlReturn") ?? ConfMan.GetValue<string>("OptConf:BasePathOdlReturn") ?? "";
|
|
PhysicalPath = Path.Combine(BasePathOdlReturn, LogicalPath);
|
|
// controllo esista
|
|
if (Directory.Exists(PhysicalPath))
|
|
{
|
|
// recupero come DirectoryInfo x avere tutte le informazioni su nome, tipo, size...
|
|
DirectoryInfo dirInfo = new DirectoryInfo(PhysicalPath);
|
|
ListFiles = dirInfo.GetFiles().ToList();
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
private List<FileInfo> ListFiles { get; set; } = new List<FileInfo>();
|
|
private string PhysicalPath { get; set; } = "";
|
|
|
|
#endregion Private Properties
|
|
}
|
|
} |