diff options
Diffstat (limited to 'Duplicati/Library/Backend/Storj/StorjFile.cs')
-rw-r--r-- | Duplicati/Library/Backend/Storj/StorjFile.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Duplicati/Library/Backend/Storj/StorjFile.cs b/Duplicati/Library/Backend/Storj/StorjFile.cs new file mode 100644 index 000000000..7815f6c56 --- /dev/null +++ b/Duplicati/Library/Backend/Storj/StorjFile.cs @@ -0,0 +1,56 @@ +using Duplicati.Library.Interface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Duplicati.Library.Backend.Tardigrade +{ + public class StorjFile : IFileEntry + { + public static readonly string TARDIGRADE_LAST_ACCESS = "DUPLICATI:LAST-ACCESS"; + public static readonly string TARDIGRADE_LAST_MODIFICATION = "DUPLICATI:LAST-MODIFICATION"; + public bool IsFolder { get; set; } + + public DateTime LastAccess { get; set; } + + public DateTime LastModification { get; set; } + + public string Name { get; set; } + + public long Size { get; set; } + + public StorjFile() + { + + } + + public StorjFile(uplink.NET.Models.Object tardigradeObject) + { + IsFolder = tardigradeObject.IsPrefix; + var lastAccess = tardigradeObject.CustomMetaData.Entries.Where(e => e.Key == TARDIGRADE_LAST_ACCESS).FirstOrDefault(); + if (lastAccess != null && !string.IsNullOrEmpty(lastAccess.Value)) + { + LastAccess = DateTime.Parse(lastAccess.Value); + } + else + { + LastAccess = DateTime.MinValue; + } + + var lastMod = tardigradeObject.CustomMetaData.Entries.Where(e => e.Key == TARDIGRADE_LAST_MODIFICATION).FirstOrDefault(); + if (lastMod != null && !string.IsNullOrEmpty(lastMod.Value)) + { + LastModification = DateTime.Parse(lastMod.Value); + } + else + { + LastModification = DateTime.MinValue; + } + + Name = tardigradeObject.Key; + Size = tardigradeObject.SystemMetaData.ContentLength; + } + } +} |