if (change.ChangeType == WatcherChangeTypes.Renamed)
{
var rename = (MovedEventArgs) change;
- _agent.Post(new WorkflowState
+ _agent.Post(new WorkflowState(change)
{
AccountInfo = AccountInfo,
OldPath = rename.OldFullPath,
});
}
else
- _agent.Post(new WorkflowState
+ _agent.Post(new WorkflowState(change)
{
AccountInfo = AccountInfo,
Path = change.FullPath,
public string CachePath { get; set; }
- private List<string> _selectivePaths = new List<string>();
+ /*private List<string> _selectivePaths = new List<string>();
public List<string> SelectivePaths
{
get { return _selectivePaths; }
set { _selectivePaths = value; }
}
+*/
+ public Selectives Selectives { get; set; }
public void Post(WorkflowState workflowState)
return true;
if (_ignoreFiles.ContainsKey(filePath.ToLower()))
return true;
-
+
+ //If selective sync is enabled, propagate folder events
+ if (Selectives.IsSelectiveEnabled(AccountInfo.AccountKey) && Directory.Exists(filePath))
+ return false;
//Ignore if selective synchronization is defined,
- return SelectivePaths.Count > 0
- //And the target file is not below any of the selective paths
- && !SelectivePaths.Any(filePath.IsAtOrDirectlyBelow);
+ //And the target file is not below any of the selective paths
+ return !Selectives.IsSelected(AccountInfo, filePath);
}
/* private static bool FoundInRoot(string filePath, string rootPath)
if (Directory.Exists(path))
return state;
-
var info = new FileInfo(path);
- StatusNotification.Notify(new StatusNotification(String.Format("Hashing [{0}]",info.Name)));
- var shortHash = info.ComputeShortHash();
-
- string merkleHash = info.CalculateHash(StatusKeeper.BlockSize,StatusKeeper.BlockHash);
- StatusKeeper.UpdateFileChecksum(path,shortHash, merkleHash);
+ using (StatusNotification.GetNotifier("Hashing {0}", "Finished Hashing {0}", info.Name))
+ {
- state.Hash = merkleHash;
- return state;
+ var shortHash = info.ComputeShortHash();
+
+ string merkleHash = info.CalculateHash(StatusKeeper.BlockSize, StatusKeeper.BlockHash);
+ StatusKeeper.UpdateFileChecksum(path, shortHash, merkleHash);
+
+ state.Hash = merkleHash;
+ return state;
+ }
}
//Does the file exist in the container's local folder?