Selective Sync fixes
[pithos-ms-client] / trunk / Pithos.Core / Agents / WorkflowAgent.cs
index 5ff697e..b53691a 100644 (file)
@@ -73,6 +73,12 @@ namespace Pithos.Core.Agents
         [System.ComponentModel.Composition.Import]
         public IPithosSettings Settings { get; set; }
 
+        private List<string> _selectivePaths = new List<string>();
+        public List<string> SelectivePaths
+        {
+            get { return _selectivePaths; }
+            set { _selectivePaths = value; }
+        }
 
         public WorkflowAgent()
         {
@@ -245,7 +251,8 @@ namespace Pithos.Core.Agents
                 var pendingStates = pendingEntries
                     .Select(state => new WorkflowState(account, state))
                     .ToList();
-
+                
+                                
                 if (Log.IsDebugEnabled)
                     Log.DebugFormat("Found {0} interrupted files", pendingStates.Count);
 
@@ -266,6 +273,17 @@ namespace Pithos.Core.Agents
                 return;*/
             //TODO: Need to handle folder renames            
 
+            //If there are selective sync paths defined
+            if (SelectivePaths.Count > 0
+                //And the target file is not below any of the selective paths
+                && !SelectivePaths.Any(workflowState.Path.IsAtOrDirectlyBelow))
+            //abort the post
+            {
+                Log.InfoFormat("File skipped, not under a selected folder [{0}] ",workflowState.Path);
+                return;
+            }
+
+
             Debug.Assert(workflowState.Path.StartsWith(workflowState.AccountInfo.AccountPath, StringComparison.InvariantCultureIgnoreCase), "File from wrong account posted");
 
             _agent.Post(workflowState);