Replaced Merkle hash with MD5 for change checking
[pithos-ms-client] / trunk / Pithos.Core / FileState.cs
index 08e71f8..3995cac 100644 (file)
@@ -72,6 +72,10 @@ namespace Pithos.Core
         public Guid Id { get; set; }
 
         
+        //[Property(Unique = true, UniqueKey = "IX_FileState_ObjectID")]
+        [Property]
+        public string ObjectID { get; set; }
+
         [Property(Unique = true, UniqueKey = "IX_FileState_FilePath")]
         public string FilePath { get; set; }
 
@@ -81,6 +85,9 @@ namespace Pithos.Core
         [Property]
         public FileStatus FileStatus { get; set; }
 
+        [Property]
+        public string ConflictReason { get; set; }
+
         private string _checksum;
 
         /// <summary>
@@ -428,9 +435,10 @@ namespace Pithos.Core
                             }, null);
         }
 
-        public static FileState CreateFor(FileSystemInfo info)
+        public static FileState CreateFor(FileSystemInfo info,IStatusNotification notification)
         {
-            Contract.Requires(info!=null);
+            if(info==null)
+                throw new ArgumentNullException("info");
             Contract.EndContractBlock();
             
             if (info is DirectoryInfo)
@@ -443,8 +451,8 @@ namespace Pithos.Core
                     Id = Guid.NewGuid()
                 };
 
-
-            var shortHash = ((FileInfo)info).ComputeShortHash();
+            
+            var shortHash = ((FileInfo)info).ComputeShortHash(notification);
             var fileState = new FileState
                                 {
                                     FilePath = info.FullName,