namespace Pithos.Core.Agents
{
- [Export]
+// [Export]
public class FileAgent
{
Agent<WorkflowState> _agent;
private FileSystemWatcher _watcher;
- [Import]
+ //[Import]
public IStatusKeeper StatusKeeper { get; set; }
- [Import]
+ //[Import]
public IPithosWorkflow Workflow { get; set; }
- [Import]
+ //[Import]
public WorkflowAgent WorkflowAgent { get; set; }
private AccountInfo AccountInfo { get; set; }
}
catch (Exception exc)
{
- Log.WarnFormat("Error occured while indexing{0. The file will be skipped}\n{1}", state.Path, exc);
+ Log.WarnFormat("Error occured while indexing{0}. The file will be skipped\n{1}",
+ state.Path, exc);
}
return CompletedTask<object>.Default;
}
-
-/*
- private Task Process(Task<WorkflowState> action)
- {
- return action.ContinueWith(t => Process(t.Result));
- }
-*/
-
-
public bool Pause
{
get { return _watcher == null || !_watcher.EnableRaisingEvents; }
}
}
- public string FragmentsPath { get; set; }
+ public string CachePath { get; set; }
+
+ private List<string> _selectivePaths = new List<string>();
+ public List<string> SelectivePaths
+ {
+ get { return _selectivePaths; }
+ set { _selectivePaths = value; }
+ }
+
public void Post(WorkflowState workflowState)
{
private bool Ignore(string filePath)
{
- if (filePath.StartsWith(FragmentsPath))
+ if (filePath.StartsWith(CachePath))
return true;
if (_ignoreFiles.ContainsKey(filePath.ToLower()))
return true;
//Post a Change message for all events except rename
void OnFileEvent(object sender, FileSystemEventArgs e)
{
- //Ignore events that affect the Fragments folder
+ //Ignore events that affect the cache folder
var filePath = e.FullPath;
if (Ignore(filePath))
return;
- _agent.Post(new WorkflowState(AccountInfo) { Path = filePath, FileName = e.Name, TriggeringChange = e.ChangeType });
+ if (Directory.Exists(filePath))
+ return;
+ _agent.Post(new WorkflowState{AccountInfo=AccountInfo, Path = filePath, FileName = e.Name, TriggeringChange = e.ChangeType });
}
if (Ignore(oldFullPath) || Ignore(fullPath))
return;
- _agent.Post(new WorkflowState(AccountInfo)
+ _agent.Post(new WorkflowState
{
+ AccountInfo=AccountInfo,
OldPath = oldFullPath,
OldFileName = e.OldName,
Path = fullPath,