TransferPathDto
class TransferPathDto
using Newtonsoft.Json;
namespace Relativity.Transfer.Dto
{
[JsonObject(MemberSerialization.OptIn, IsReference = false)]
internal class TransferPathDto
{
[JsonProperty(PropertyName = "bytes")]
public long Bytes { get; set; }
[JsonProperty(PropertyName = "direction")]
public TransferDirection Direction { get; set; }
[JsonProperty(PropertyName = "order")]
public int Order { get; set; }
[JsonProperty(PropertyName = "path-attributes")]
public TransferPathAttributes PathAttributes { get; set; }
[JsonProperty(PropertyName = "source-path")]
public string SourcePath { get; set; }
[JsonProperty(PropertyName = "source-path-id")]
public long? SourcePathId { get; set; }
[JsonProperty(PropertyName = "tag")]
public string Tag { get; set; }
[JsonProperty(PropertyName = "target-path")]
public string TargetPath { get; set; }
[JsonProperty(PropertyName = "target-filename")]
public string TargetFileName { get; set; }
public TransferPathDto()
{
Bytes = 0;
Direction = TransferDirection.Upload;
Order = 0;
PathAttributes = (TransferPathAttributes)0;
SourcePath = null;
SourcePathId = null;
Tag = null;
TargetFileName = null;
TargetPath = null;
}
public static TransferPathDto ConvertToDto(TransferPath path)
{
return new TransferPathDto {
Bytes = path.Bytes,
Direction = path.Direction,
Order = path.Order,
PathAttributes = path.PathAttributes,
SourcePath = path.SourcePath,
SourcePathId = path.SourcePathId,
Tag = path.Tag?.ToString(),
TargetFileName = path.TargetFileName,
TargetPath = path.TargetPath
};
}
public static TransferPath ConvertToPath(TransferPathDto dto)
{
return new TransferPath {
Bytes = dto.Bytes,
Direction = dto.Direction,
Order = dto.Order,
PathAttributes = dto.PathAttributes,
SourcePath = dto.SourcePath,
SourcePathId = dto.SourcePathId,
Tag = dto.Tag,
TargetFileName = dto.TargetFileName,
TargetPath = dto.TargetPath
};
}
}
}