+ //Server unchanged?\r
+ if (tuple.S == tuple.L)\r
+ {\r
+ //The FileAgent selective sync checks for new root folder files\r
+ if (!agent.Ignore(localFilePath))\r
+ {\r
+ if ((tuple.C == null || !localInfo.Exists) && tuple.ObjectInfo != null)\r
+ {\r
+ //deleteObjectFromServer()\r
+ DeleteCloudFile(accountInfo, tuple);\r
+ //updateRecord( Remove L, S) \r
+ }\r
+ else\r
+ {\r
+ //uploadLocalObject() // Result: S = C, L = S \r
+ var progress = new Progress<HashProgress>(d =>\r
+ StatusNotification.Notify(new StatusNotification(String.Format("Merkle Hashing for Upload {0:p} of {1}", d.Percentage, localInfo.Name))));\r
+\r
+ //Is it an unselected root folder\r
+ var isCreation = isUnselectedRootFolder ||//or a new folder under a selected parent?\r
+ (localInfo is DirectoryInfo && Selectives.IsSelected(accountInfo, localInfo) && tuple.FileState == null && tuple.ObjectInfo == null);\r
+\r
+\r
+ //Is this a result of a FILE move with no modifications? Then try to move it,\r
+ //to avoid an expensive hash\r
+ if (!await MoveForLocalMove(accountInfo, tuple))\r
+ {\r
+ await UploadLocalFile(accountInfo, tuple, token, isCreation, localInfo,processedPaths, progress).ConfigureAwait(false);\r
+ }\r
+\r
+ //updateRecord( S = C )\r
+ //State updated by the uploader\r
+ \r
+ if (isCreation )\r
+ { \r
+ ProcessChildren(accountInfo, tuple, agent, moves,processedPaths,token);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (tuple.C == tuple.S)\r
+ {\r
+ // (Identical Changes) Result: L = S\r
+ //doNothing()\r
+ \r
+ //Don't update anything for nonexistend server files\r
+ if (tuple.S != null)\r
+ {\r
+ //Detect server moves\r
+ var targetPath = MoveForServerMove(accountInfo, tuple);\r
+ if (targetPath != null)\r
+ {\r
+ Debug.Assert(tuple.Merkle != null);\r
+ StatusKeeper.StoreInfo(targetPath, tuple.ObjectInfo, tuple.Merkle);\r
+\r
+ AddOwnFolderToSelectives(accountInfo, tuple, targetPath);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ //At this point, C==S==NULL and we have a stale state (L)\r
+ //Log the stale tuple for investigation\r
+ Log.WarnFormat("Stale tuple detected FilePathPath:[{0}], State:[{1}], LocalFile:[{2}]", tuple.FilePath, tuple.FileState, tuple.FileInfo);\r
+\r
+ //And remove it\r
+ if (!String.IsNullOrWhiteSpace(tuple.FilePath))\r
+ StatusKeeper.ClearFileStatus(tuple.FilePath);\r
+ }\r