Revision 0ba85b0c trunk/Pithos.Core/Agents/SelectiveUris.cs

b/trunk/Pithos.Core/Agents/SelectiveUris.cs
2 2
using System.Collections.Concurrent;
3 3
using System.Collections.Generic;
4 4
using System.ComponentModel.Composition;
5
using System.Diagnostics.Contracts;
5 6
using System.IO;
6 7
using System.Linq;
7 8
using System.Text;
......
18 19

  
19 20
        private ConcurrentDictionary<Uri, List<string>> SelectivePaths { get; set; }
20 21

  
22
        [Import]
23
        public IPithosSettings Settings { get; set; }
24

  
21 25
        public Selectives()
22 26
        {
23 27
            SelectiveUris = new ConcurrentDictionary<Uri, List<Uri>>();
......
123 127
            return own.Union(others).ToList();
124 128
        }
125 129

  
130
        public void Save(AccountInfo account)
131
        {
132
            Contract.Requires(account!=null);
133
            Contract.EndContractBlock();
134

  
135
            var selections = SelectiveUris[account.AccountKey];
136
            var accountSettings= Settings.Accounts.First(acc => acc.AccountKey == account.AccountKey);
137
            accountSettings.SelectiveFolders.Clear();
138
            accountSettings.SelectiveFolders.AddRange(selections.Select(uri => uri.ToString()).ToArray());
139
            Settings.Save();   
140

  
141
        }
142

  
126 143
    }
127 144
}

Also available in: Unified diff