Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Duplicati/Library/Backend/Storj/StorjFile.cs')
-rw-r--r--Duplicati/Library/Backend/Storj/StorjFile.cs56
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..fa83c3907
--- /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.Storj
+{
+ public class StorjFile : IFileEntry
+ {
+ public static readonly string STORJ_LAST_ACCESS = "DUPLICATI:LAST-ACCESS";
+ public static readonly string STORJ_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 == STORJ_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 == STORJ_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;
+ }
+ }
+}