GetFileAgent moved to FileAgent.cs
authorPanagiotis Kanavos <pkanavos@gmail.com>
Tue, 21 Feb 2012 10:01:48 +0000 (12:01 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Tue, 21 Feb 2012 10:01:48 +0000 (12:01 +0200)
trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs
trunk/Pithos.Core/Agents/FileAgent.cs
trunk/Pithos.Core/Agents/PollAgent.cs

index fdd997a..010aa18 100644 (file)
@@ -94,4 +94,4 @@ using System.Windows;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("0.1.0.0")]
-[assembly: AssemblyFileVersionAttribute("0.1.20217.2055")]
+[assembly: AssemblyFileVersionAttribute("0.1.20220.2042")]
index c93a029..f7c4b5b 100644 (file)
@@ -373,14 +373,14 @@ namespace Pithos.Core.Agents
 
 
         private Dictionary<WatcherChangeTypes, FileStatus> _statusDict = new Dictionary<WatcherChangeTypes, FileStatus>
-        {
+                                                                             {
             {WatcherChangeTypes.Created,FileStatus.Created},
             {WatcherChangeTypes.Changed,FileStatus.Modified},
             {WatcherChangeTypes.Deleted,FileStatus.Deleted},
             {WatcherChangeTypes.Renamed,FileStatus.Renamed}
         };
 
-        private Dictionary<string,string> _ignoreFiles=new Dictionary<string, string>();
+        private Dictionary<string, string> _ignoreFiles=new Dictionary<string, string>();
 
         private WorkflowState UpdateFileStatus(WorkflowState state)
         {
@@ -483,6 +483,17 @@ namespace Pithos.Core.Agents
             return false;
         }
 
+        public static FileAgent GetFileAgent(AccountInfo accountInfo)
+        {
+            return GetFileAgent(accountInfo.AccountPath);
+        }
+
+        public static FileAgent GetFileAgent(string rootPath)
+        {
+            return AgentLocator<FileAgent>.Get(rootPath.ToLower());
+        }
+
+
         public FileSystemInfo GetFileSystemInfo(string relativePath)
         {
             if (String.IsNullOrWhiteSpace(relativePath))
index 89635e9..cb4b3bc 100644 (file)
@@ -333,7 +333,7 @@ namespace Pithos.Core.Agents
                 foreach (var objectInfo in cloudFiles)\r
                 {\r
                     var relativePath = objectInfo.RelativeUrlToFilePath(accountInfo.UserName);\r
-                    var item = GetFileAgent(accountInfo).GetFileSystemInfo(relativePath);\r
+                    var item = FileAgent.GetFileAgent(accountInfo).GetFileSystemInfo(relativePath);\r
                     if (item.Exists)\r
                     {\r
                         if ((item.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)\r
@@ -359,7 +359,7 @@ namespace Pithos.Core.Agents
             if (changes == null)\r
                 throw new ArgumentNullException();\r
             Contract.EndContractBlock();\r
-            var fileAgent = GetFileAgent(accountInfo);\r
+            var fileAgent = FileAgent.GetFileAgent(accountInfo);\r
 \r
             //In order to avoid multiple iterations over the files, we iterate only once\r
             //over the remote files\r
@@ -397,7 +397,7 @@ namespace Pithos.Core.Agents
             if (creates == null)\r
                 throw new ArgumentNullException();\r
             Contract.EndContractBlock();\r
-            var fileAgent = GetFileAgent(accountInfo);\r
+            var fileAgent = FileAgent.GetFileAgent(accountInfo);\r
 \r
             //In order to avoid multiple iterations over the files, we iterate only once\r
             //over the remote files\r
@@ -420,14 +420,9 @@ namespace Pithos.Core.Agents
             }\r
         }\r
 \r
-        private static FileAgent GetFileAgent(AccountInfo accountInfo)\r
-        {\r
-            return AgentLocator<FileAgent>.Get(accountInfo.AccountPath);\r
-        }\r
-\r
         private void ProcessTrashedFiles(AccountInfo accountInfo, IEnumerable<ObjectInfo> trashObjects)\r
         {\r
-            var fileAgent = GetFileAgent(accountInfo);\r
+            var fileAgent = FileAgent.GetFileAgent(accountInfo);\r
             foreach (var trashObject in trashObjects)\r
             {\r
                 var barePath = trashObject.RelativeUrlToFilePath(accountInfo.UserName);\r
@@ -456,6 +451,5 @@ namespace Pithos.Core.Agents
                 Directory.CreateDirectory(path);\r
             }\r
         }\r
-\r
     }\r
 }\r