New SQLite version
[pithos-ms-client] / trunk / Pithos.Core / Agents / PollAgent.cs
index c0c1d3c..99f8e81 100644 (file)
@@ -399,7 +399,7 @@ namespace Pithos.Core.Agents
                     {\r
                         if (gate.Failed)\r
                             continue;\r
-                        StatusKeeper.SetFileState(item.FullName, FileStatus.Conflict, FileOverlayStatus.Deleted);\r
+                        StatusKeeper.SetFileState(item.FullName, FileStatus.Conflict, FileOverlayStatus.Deleted,"Local file missing from server");\r
                     }\r
                 }\r
                 UpdateStatus(PithosStatus.HasConflicts);\r
@@ -438,7 +438,7 @@ namespace Pithos.Core.Agents
                         _lastSeen.TryRemove(item.FullName, out lastDate);\r
                         deletedFiles.Add(item);\r
                     }\r
-                    StatusKeeper.SetFileState(item.FullName, FileStatus.Deleted, FileOverlayStatus.Deleted);\r
+                    StatusKeeper.SetFileState(item.FullName, FileStatus.Deleted, FileOverlayStatus.Deleted, "File Deleted");\r
                 }\r
                 Log.InfoFormat("[{0}] files were deleted",deletedFiles.Count);\r
                 StatusNotification.NotifyForFiles(deletedFiles, String.Format("{0} files were deleted", deletedFiles.Count), TraceLevel.Info);\r
@@ -557,19 +557,22 @@ namespace Pithos.Core.Agents
                     Log.DebugFormat("[NEW INFO] {0}",objectInfo.Uri);\r
 \r
                 var relativePath = objectInfo.RelativeUrlToFilePath(accountInfo.UserName);\r
-                //If the object already exists, we probably have a conflict\r
+\r
+                //If the object already exists, we should check before uploading or downloading\r
                 if (fileAgent.Exists(relativePath))\r
                 {\r
-                    Log.DebugFormat("[SKIP EXISTING] {0}", objectInfo.Uri);\r
-                    //If a directory object already exists, we don't need to perform any other action                    \r
-                    var localFile = fileAgent.GetFileSystemInfo(relativePath);\r
-                    StatusKeeper.SetFileState(localFile.FullName, FileStatus.Conflict, FileOverlayStatus.Conflict);\r
+                    var localFile= fileAgent.GetFileSystemInfo(relativePath);\r
+                    var state = StatusKeeper.GetStateByFilePath(localFile.WithProperCapitalization().FullName);\r
+                    yield return new CloudAction(accountInfo, CloudActionType.MustSynch,\r
+                                                     localFile, objectInfo, state, accountInfo.BlockSize,\r
+                                                     accountInfo.BlockHash);                    \r
                 }\r
                 else\r
                 {\r
                     //Remote files should be downloaded\r
                     yield return new CloudDownloadAction(accountInfo, objectInfo);\r
                 }\r
+\r
             }\r
         }\r
 \r