using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Diagnostics.Contracts;
+using System.IO;
using System.Linq;
using System.Net;
using System.Text;
_policies.CollectionChanged += (sender, evt) => { PoliciesChanged = true; };
*/
+ var name = Path.GetFileName(localFolderName);
+ DisplayName = String.Format("{0} Container Properties", name);
+
Shell = shell;
ContainerName = localFolderName;
container.ContinueWith(t =>{
private bool Ignore(string filePath)
{
- //Ignore all first-level directories and files (ie at the container folders level)
- if (FoundBelowRoot(filePath, RootPath,1))
+ if (IgnorePaths(filePath)) 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,
+ //And the target file is not below any of the selective paths
+ return !Selectives.IsSelected(AccountInfo, filePath);
+ }
+
+ private bool IgnorePaths(string filePath)
+ {
+//Ignore all first-level directories and files (ie at the container folders level)
+ if (FoundBelowRoot(filePath, RootPath, 1))
return true;
//Ignore first-level items under the "others" folder (ie at the accounts folders level).
var othersPath = Path.Combine(RootPath, FolderConstants.OthersFolder);
- if (FoundBelowRoot(filePath, othersPath,1))
+ if (FoundBelowRoot(filePath, othersPath, 1))
return true;
//Ignore second-level (container) folders under the "others" folder (ie at the container folders level).
- if (FoundBelowRoot(filePath, othersPath,2))
- return true;
+ if (FoundBelowRoot(filePath, othersPath, 2))
+ return true;
//Ignore anything happening in the cache path
return true;
if (_ignoreFiles.ContainsKey(filePath.ToLower()))
return true;
-
- //Ignore if selective synchronization is defined,
- //And the target file is not below any of the selective paths
- return !Selectives.IsSelected(AccountInfo, filePath);
+ return false;
}
/* private static bool FoundInRoot(string filePath, string rootPath)
{
var oldFullPath = e.OldFullPath;
var fullPath = e.FullPath;
- if (Ignore(oldFullPath) || Ignore(fullPath))
+
+ //If the source path is one of the ignored folders, ignore
+ if (IgnorePaths(oldFullPath))
+ return;
+
+ //Ignore takes into account Selective Sync
+ if (Ignore(fullPath))
return;
_eventIdleBatch.Post(e);