Simplified SnapshotDifferencer.cs
authorPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 13 Feb 2012 21:40:29 +0000 (23:40 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 13 Feb 2012 21:40:29 +0000 (23:40 +0200)
trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs
trunk/Pithos.Core/Agents/NetworkAgent.cs
trunk/Pithos.Core/Agents/SnapshotDifferencer.cs
trunk/Pithos.Core/Pithos.Core.csproj

index ab55d1b..e39e5b3 100644 (file)
@@ -53,4 +53,4 @@ using System.Windows;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("0.1.0.0")]
-[assembly: AssemblyFileVersionAttribute("0.1.20209.1999")]
+[assembly: AssemblyFileVersionAttribute("0.1.20213.1894")]
index b55c52b..e3f2923 100644 (file)
@@ -610,16 +610,8 @@ namespace Pithos.Core.Agents
                                                             StringComparison.InvariantCultureIgnoreCase)
                                      select info).ToList();
 
-                        //TODO: Introduced state here, must remove somehow
-                        //Must move all this elsewhere
-                        SnapshotDifferencer differencer;
-                        if (!_differencers.TryGetValue(accountInfo.UserName,out differencer))
-                        {
-                            differencer = new SnapshotDifferencer();
-                            _differencers[accountInfo.UserName] = differencer;
-                        }
-                        differencer.Post(cleanRemotes);                        
-
+                        var differencer = _differencer.PostSnapshot(accountInfo, cleanRemotes);
+                        
                         ProcessDeletedFiles(accountInfo, differencer.Deleted, pollTime);
 
                         //Create a list of actions from the remote files
@@ -655,8 +647,7 @@ namespace Pithos.Core.Agents
             }
         }
 
-
-        Dictionary<string, SnapshotDifferencer> _differencers= new Dictionary<string, SnapshotDifferencer>();
+        AccountsDifferencer _differencer= new AccountsDifferencer();
 
 /*
         Dictionary<string, List<ObjectInfo>> _currentSnapshot = new Dictionary<string, List<ObjectInfo>>();
index 17e59a1..6c77715 100644 (file)
@@ -5,6 +5,7 @@
 // -----------------------------------------------------------------------\r
 \r
 using Pithos.Interfaces;\r
+using Pithos.Network;\r
 \r
 namespace Pithos.Core.Agents\r
 {\r
@@ -75,4 +76,24 @@ namespace Pithos.Core.Agents
             }\r
         }\r
     }\r
+\r
+    public class AccountsDifferencer\r
+    {\r
+        Dictionary<string, SnapshotDifferencer> _differencers = new Dictionary<string, SnapshotDifferencer>();\r
+\r
+        public Dictionary<string, SnapshotDifferencer> Differencers { get { return _differencers; } }\r
+\r
+        public SnapshotDifferencer PostSnapshot(AccountInfo accountInfo, List<ObjectInfo> cleanRemotes)\r
+        {\r
+            SnapshotDifferencer differencer;\r
+            if (!_differencers.TryGetValue(accountInfo.UserName, out differencer))\r
+            {\r
+                differencer = new SnapshotDifferencer();\r
+                _differencers[accountInfo.UserName] = differencer;\r
+            }\r
+            differencer.Post(cleanRemotes);\r
+            return differencer;\r
+        }\r
+\r
+    }\r
 }\r
index fbc984c..960c336 100644 (file)
   <ItemGroup>
     <Compile Include="Agents\Agent.cs" />
     <Compile Include="Agents\AgentLocator.cs" />
+    <Compile Include="Agents\AsyncManualResetEvent.cs" />
     <Compile Include="Agents\BlockUpdater.cs" />
     <Compile Include="Agents\CloudTransferAction.cs" />
     <Compile Include="Agents\CollectionExtensions.cs" />