Revision cbefd298 trunk/Pithos.Core/Agents/SelectiveUris.cs

b/trunk/Pithos.Core/Agents/SelectiveUris.cs
24 24
            SelectivePaths = new ConcurrentDictionary<Uri, List<string>>();
25 25
        }
26 26

  
27
        readonly Dictionary<Uri, bool> _selectiveEnabled = new Dictionary<Uri, bool>();
28

  
29
/*
30
        public void SetIsSelectiveEnabled(AccountInfo account,bool value)
31
        {
32
            _selectiveEnabled[account.AccountKey]=value;
33
        }
34
*/
35

  
36
        public void SetIsSelectiveEnabled(Uri accountKey,bool value)
37
        {
38
            _selectiveEnabled[accountKey]=value;
39
        }
40
/*
41

  
42
        public bool IsSelectiveEnabled(AccountInfo account)
43
        {
44
            bool isEnabled;
45
            _selectiveEnabled.TryGetValue(account.AccountKey, out isEnabled);
46
            return isEnabled;
47
        }
48
*/
49

  
50
        public bool IsSelectiveEnabled(Uri accountKey)
51
        {
52
            bool isEnabled;
53
            _selectiveEnabled.TryGetValue(accountKey, out isEnabled);
54
            return isEnabled;
55
        }
56

  
57

  
27 58
        public void SetSelectedUris(AccountInfo account,List<Uri> uris)
28 59
        {
29 60
            SelectiveUris[account.AccountKey] = uris;
......
32 63

  
33 64
        public bool IsSelected(ObjectInfo info)
34 65
        {
66
            //Shared folders should NOT be synced if selective syncing is disabled
67
            var isShared = info.IsShared;
68
            var selectiveEnabled = IsSelectiveEnabled(info.AccountKey);
69
            if (!selectiveEnabled)
70
                return !isShared;
71

  
35 72
            List<Uri> filterUris;
36 73
            return !SelectiveUris.TryGetValue(info.AccountKey, out filterUris) 
37 74
                || filterUris.Count ==0
......
40 77

  
41 78
        public bool IsSelected(AccountInfo account,FileSystemInfo info)
42 79
        {
80
            if (info is DirectoryInfo)
81
                return true;
43 82
            return IsSelected(account,info.FullName);
44 83
        }
45 84

  
46 85
        public bool IsSelected(AccountInfo account, string fullPath)
47 86
        {
87
            if (Directory.Exists(fullPath))
88
                return true;
89

  
90
            //Shared folders should NOT be synced if selective syncing is disabled
91
            var isShared = fullPath.IsSharedTo(account);
92
            var selectiveEnabled = IsSelectiveEnabled(account.AccountKey);
93
            if (!selectiveEnabled)
94
                return !isShared;
95

  
48 96
            List<string> paths;
49 97
            return !SelectivePaths.TryGetValue(account.AccountKey, out paths)
50 98
                || paths.Count == 0

Also available in: Unified diff