{
if (change.ChangeType == WatcherChangeTypes.Renamed)
{
- var rename = (RenamedEventArgs) change;
- _agent.Post(new WorkflowState
+ var rename = (MovedEventArgs) change;
+ _agent.Post(new WorkflowState(change)
{
AccountInfo = AccountInfo,
OldPath = rename.OldFullPath,
- OldFileName = rename.OldName,
+ OldFileName = Path.GetFileName(rename.OldName),
Path = rename.FullPath,
- FileName = rename.Name,
+ FileName = Path.GetFileName(rename.Name),
TriggeringChange = rename.ChangeType
});
}
else
- _agent.Post(new WorkflowState
+ _agent.Post(new WorkflowState(change)
{
AccountInfo = AccountInfo,
Path = change.FullPath,
- FileName = change.Name,
+ FileName = Path.GetFileName(change.Name),
TriggeringChange = change.ChangeType
});
}
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?
public void Delete(string relativePath)
{
var absolutePath = Path.Combine(RootPath, relativePath).ToLower();
+ if (Log.IsDebugEnabled)
+ Log.DebugFormat("Deleting {0}", absolutePath);
if (File.Exists(absolutePath))
{
try