Revision 92f18b56

b/trunk/Pithos.Core/Agents/CollectionExtensions.cs
55 55
    /// </summary>
56 56
    public static class CollectionExtensions
57 57
    {
58
        public static IEnumerable<T> Replace<T>(this IEnumerable<T> list,Func<T,bool> match, Func<T,IEnumerable<T>> replace)
58
        public static IEnumerable<T> Replace<T>(this IEnumerable<T> list,Func<T,bool> match, Func<T,IEnumerable<T>> generate)
59 59
        {
60 60
            foreach (var item in list)
61 61
            {
62 62
                if (match(item))
63
                    foreach (var newItem in replace(item))
63
                    foreach (var newItem in generate(item))
64 64
                    {
65 65
                        yield return newItem;
66 66
                    }
b/trunk/Pithos.Core/Agents/PollAgent.cs
255 255
*/
256 256

  
257 257
                        var cleanRemotes = (from info in remoteObjects.Union(sharedObjects)
258
                                            let name = info.Name
258
                                            let name = info.Name??""
259 259
                                            where !name.EndsWith(".ignore", StringComparison.InvariantCultureIgnoreCase) &&
260 260
                                                  !name.StartsWith(FolderConstants.CacheFolder + "/",
261 261
                                                                   StringComparison.InvariantCultureIgnoreCase)
b/trunk/Pithos.Core/Agents/SnapshotDifferencer.cs
81 81
                return this;
82 82
            }
83 83

  
84

  
85
            //The previous values that correspond to a NoModification object
86
            //have the same account, container and possibly the same folder
87
            Func<ObjectInfo, ObjectInfo, bool> correspondsTo = (info, noMod) => 
88
                info.Account == noMod.Account
89
                && info.Container == noMod.Container
90
                && (noMod.Name == null || info.Name.StartsWith(noMod.Name));
91

  
84 92
            //Replace any NoModification entries with previous values that have
85 93
            //the same account, container and possibly, folder
86 94
            _current=list.Replace(
87 95
                info => info is NoModificationInfo, 
88
                noMod => from info in _previous
89
                        where 
90
                            info.Account==noMod.Account 
91
                            && info.Container==noMod.Container 
92
                            //If the NoModification specifies a folder, use it to match items below this folder
93
                            && (noMod.Name==null || info.Name.StartsWith(noMod.Name))
94
                        select info);
96
                noMod => _previous.Where(info => correspondsTo(info, noMod)))
97
                .ToList();
95 98

  
96 99
            return this;
97 100
        }
b/trunk/Pithos.Network/NoModificationInfo.cs
33 33
        {
34 34
            Name = folder + '/';
35 35
        }
36

  
36 37
    }
37 38
}

Also available in: Unified diff