Modified the uploader to add new directories to Selected Folders if Selective Sync...
authorpkanavos <pkanavos@gmail.com>
Wed, 23 May 2012 20:25:32 +0000 (23:25 +0300)
committerpkanavos <pkanavos@gmail.com>
Wed, 23 May 2012 20:25:32 +0000 (23:25 +0300)
trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs
trunk/Pithos.Core/Agents/SelectiveUris.cs
trunk/Pithos.Core/Agents/Uploader.cs
trunk/Pithos.Core/Agents/WorkflowAgent.cs
trunk/Pithos.sln

index bc46b2b..07e3c07 100644 (file)
@@ -56,7 +56,7 @@ using System.Windows;
 [assembly: AssemblyCopyright("Copyright © GRNet 2011-2012")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
-[assembly: AssemblyInformationalVersion("2012-05-15")]
+[assembly: AssemblyInformationalVersion("2012-05-22")]
 
 // Setting ComVisible to false makes the types in this assembly not visible 
 // to COM components.  If you need to access a type in this assembly from 
@@ -93,5 +93,5 @@ using System.Windows;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.7.20518.0")]
-[assembly: AssemblyFileVersionAttribute("0.7.20518.0")]
+[assembly: AssemblyVersion("0.7.20522.0")]
+[assembly: AssemblyFileVersionAttribute("0.7.20522.0")]
index db60ced..79a3f18 100644 (file)
@@ -2,6 +2,7 @@
 using System.Collections.Concurrent;\r
 using System.Collections.Generic;\r
 using System.ComponentModel.Composition;\r
+using System.Diagnostics.Contracts;\r
 using System.IO;\r
 using System.Linq;\r
 using System.Text;\r
@@ -18,6 +19,9 @@ namespace Pithos.Core.Agents
 \r
         private ConcurrentDictionary<Uri, List<string>> SelectivePaths { get; set; }\r
 \r
+        [Import]\r
+        public IPithosSettings Settings { get; set; }\r
+\r
         public Selectives()\r
         {\r
             SelectiveUris = new ConcurrentDictionary<Uri, List<Uri>>();\r
@@ -123,5 +127,18 @@ namespace Pithos.Core.Agents
             return own.Union(others).ToList();\r
         }\r
 \r
+        public void Save(AccountInfo account)\r
+        {\r
+            Contract.Requires(account!=null);\r
+            Contract.EndContractBlock();\r
+\r
+            var selections = SelectiveUris[account.AccountKey];\r
+            var accountSettings= Settings.Accounts.First(acc => acc.AccountKey == account.AccountKey);\r
+            accountSettings.SelectiveFolders.Clear();\r
+            accountSettings.SelectiveFolders.AddRange(selections.Select(uri => uri.ToString()).ToArray());\r
+            Settings.Save();   \r
+\r
+        }\r
+\r
     }\r
 }\r
index 59ddf66..5e2f158 100644 (file)
@@ -24,7 +24,6 @@ namespace Pithos.Core.Agents
         [Import]\r
         private IStatusKeeper StatusKeeper { get; set; }\r
 \r
-        \r
         public IStatusNotification StatusNotification { get; set; }\r
 \r
         \r
@@ -137,6 +136,14 @@ namespace Pithos.Core.Agents
                                     //Go on and create the directory\r
                                     await client.PutObject(account, cloudFile.Container, cloudFile.Name, fullFileName,\r
                                                          String.Empty, "application/directory");\r
+                                //If the upload is in response to a Folder create with Selective Sync enabled\r
+                                if (action.IsCreation)\r
+                                {\r
+                                    //Add the folder to the Selected URls\r
+                                    var selections = Selectives.SelectiveUris[accountInfo.AccountKey];\r
+                                    selections.Add(cloudFile.Uri);\r
+                                    Selectives.Save(accountInfo);\r
+                                }\r
                             }\r
                             else\r
                             {\r
index acc5560..f56afef 100644 (file)
@@ -108,9 +108,9 @@ namespace Pithos.Core.Agents
                         if (Log.IsDebugEnabled) Log.DebugFormat("Skipping {0}", state.FileName);
 
                         return CompletedTask<object>.Default;
-                    }                    
+                    }
 
-                    var info = Directory.Exists(state.Path) ? (FileSystemInfo)new DirectoryInfo(state.Path) : new FileInfo(state.Path);
+                    var info = FileInfoExtensions.FromPath(state.Path);// Directory.Exists(state.Path) ? (FileSystemInfo)new DirectoryInfo(state.Path) : new FileInfo(state.Path);
 
                     //Bypass deleted files, unless the status is Deleted
                     if (!info.Exists && state.Status != FileStatus.Deleted)
index 982c71a..0aea32e 100644 (file)
@@ -45,8 +45,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pithos.Client.WPF.Test", "P
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pithos.Interfaces.Test", "Pithos.Interfaces.Test\Pithos.Interfaces.Test.csproj", "{881F7260-CA40-40FD-AEEC-860B346DC2DC}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4netViewer", "log4netViewer\log4netViewer\log4netViewer.csproj", "{FF08C711-3DBC-4767-9600-CF68A64CFD55}"
-EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug All|Any CPU = Debug All|Any CPU
@@ -598,36 +596,6 @@ Global
                {881F7260-CA40-40FD-AEEC-860B346DC2DC}.Test|Mixed Platforms.Build.0 = Release|Any CPU
                {881F7260-CA40-40FD-AEEC-860B346DC2DC}.Test|x64.ActiveCfg = Release|Any CPU
                {881F7260-CA40-40FD-AEEC-860B346DC2DC}.Test|x86.ActiveCfg = Release|Any CPU
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug All|Any CPU.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug All|Mixed Platforms.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug All|Mixed Platforms.Build.0 = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug All|x64.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug All|x86.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug All|x86.Build.0 = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug|Any CPU.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug|Mixed Platforms.Build.0 = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug|x64.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug|x86.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Debug|x86.Build.0 = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Premium Debug|Any CPU.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Premium Debug|Mixed Platforms.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Premium Debug|Mixed Platforms.Build.0 = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Premium Debug|x64.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Premium Debug|x86.ActiveCfg = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Premium Debug|x86.Build.0 = Debug|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Release|Any CPU.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Release|Mixed Platforms.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Release|Mixed Platforms.Build.0 = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Release|x64.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Release|x86.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Release|x86.Build.0 = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Test|Any CPU.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Test|Mixed Platforms.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Test|Mixed Platforms.Build.0 = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Test|x64.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Test|x86.ActiveCfg = Release|x86
-               {FF08C711-3DBC-4767-9600-CF68A64CFD55}.Test|x86.Build.0 = Release|x86
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE