Files
monorepo/LCU.API.Internal.FTP/LCU.Api.Internal.FTPLib/Models/SftpUploadFileRequest.cs
T
2026-03-24 15:28:37 -05:00

62 lines
2.1 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using LCU.Library.Internal.ApiResponse.Models;
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
using LCU.Library.Internal.FileOperationsModels.Shared;
using System.ComponentModel;
namespace LCU.Api.Internal.FTPLib.Models
{
public class SftpUploadFileRequest : ReturnResponse
{
[Required]
public SessionInformation SessionInformation { get; set; }
[Required]
public string LocalFilePath { get; set; }
[Required]
public string LocalFileName { get; set; }
[Required]
public string RemoteFilePath { get; set; }
public DynamicNameSetting DynamicNameSetting { get; set; }
[DefaultValue(false)]
public bool SucceedOnEmpty { get; set; } = false;
[DefaultValue(true)]
public bool ResumeSupportStateOn { get; set; } = true;
[NotMapped]
public string FinalLocalFileName
{
get
{
if (string.IsNullOrWhiteSpace(LocalFileName))
{
return LocalFileName;
}
return DynamicNameBuilder.BuildDynamicName(LocalFileName, DynamicNameSetting);
}
}
public DynamicNameSetting DynamicRemotePathSetting { get; set; }
public DynamicNameSetting DynamicLocalPathSetting { get; set; }
[NotMapped]
public string FinalRemoteFilePath
{
get
{
var remoteFilePath = RemoteFilePath.EndsWith("/") ? RemoteFilePath : $"{RemoteFilePath}/";
return DynamicNameBuilder.BuildDynamicName(remoteFilePath, DynamicRemotePathSetting);
}
}
[NotMapped]
public string FinalLocalFilePath
{
get
{
var localFilePath = LocalFilePath.EndsWith("\\") ? LocalFilePath : $"{LocalFilePath}\\";
return DynamicNameBuilder.BuildDynamicName(localFilePath, DynamicLocalPathSetting);
}
}
}
}