Extracted Authentication URL to application settings
authorPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 24 Aug 2011 18:38:59 +0000 (21:38 +0300)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 24 Aug 2011 18:38:59 +0000 (21:38 +0300)
trunk/Pithos.Client.WPF/Properties/Settings.Designer.cs
trunk/Pithos.Client.WPF/Properties/Settings.settings
trunk/Pithos.Client.WPF/TaskbarViewModel.cs
trunk/Pithos.Client.WPF/app.config
trunk/Pithos.Core/PithosMonitor.cs
trunk/Pithos.Interfaces/ICloudClient.cs
trunk/Pithos.Network/CloudFilesClient.cs
trunk/Pithos.Setup.x64/Pithos.Setup.x64.vdproj
trunk/Pithos.sln

index b7bd8c7..0f59544 100644 (file)
@@ -226,5 +226,23 @@ namespace Pithos.Client.WPF.Properties {
                 this["Accounts"] = value;
             }
         }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("https://pithos.dev.grnet.gr")]
+        public string PithosAuthenticationUrl {
+            get {
+                return ((string)(this["PithosAuthenticationUrl"]));
+            }
+        }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("https://auth.api.rackspacecloud.com")]
+        public string CloudfilesAuthenticationUrl {
+            get {
+                return ((string)(this["CloudfilesAuthenticationUrl"]));
+            }
+        }
     }
 }
index 59e0398..1a83a10 100644 (file)
           &lt;/ArrayOfAccountSettings&gt;
         </Value>
     </Setting>
+    <Setting Name="PithosAuthenticationUrl" Type="System.String" Scope="Application">
+      <Value Profile="(Default)">https://pithos.dev.grnet.gr</Value>
+    </Setting>
+    <Setting Name="CloudfilesAuthenticationUrl" Type="System.String" Scope="Application">
+      <Value Profile="(Default)">https://auth.api.rackspacecloud.com</Value>
+    </Setting>
   </Settings>
 </SettingsFile>
\ No newline at end of file
index c51a7e4..cacc37a 100644 (file)
@@ -48,6 +48,10 @@ namespace Pithos.Client.WPF
                 Monitor.UserName = account.AccountName;
                 Monitor.ApiKey = account.ApiKey;
                 Monitor.UsePithos = account.UsePithos;
+                var appSettings = Properties.Settings.Default;
+                Monitor.AuthenticationUrl = account.UsePithos
+                                                ? appSettings.PithosAuthenticationUrl
+                                                : appSettings.CloudfilesAuthenticationUrl;
                 Monitor.RootPath = Path.Combine(Settings.PithosPath, account.RootPath??"");
             }
 
index c78cbc2..e72c8a7 100644 (file)
       <setting name="PithosSite" serializeAs="String">
         <value>http://pithos.dev.grnet.gr/pithos.html</value>
       </setting>
+      <setting name="PithosAuthenticationUrl" serializeAs="String">
+        <value>https://pithos.dev.grnet.gr</value>
+      </setting>
+      <setting name="CloudfilesAuthenticationUrl" serializeAs="String">
+        <value>https://auth.api.rackspacecloud.com</value>
+      </setting>
     </Pithos.Client.WPF.Properties.Settings>
   </applicationSettings>
 </configuration>
\ No newline at end of file
index 27755f3..0652075 100644 (file)
@@ -101,6 +101,7 @@ namespace Pithos.Core
         private void EnsurePithosContainers()
         {
             CloudClient.UsePithos = this.UsePithos;
+            CloudClient.AuthenticationUrl = this.AuthenticationUrl;
             CloudClient.Authenticate(UserName, ApiKey);
 
             var pithosContainers = new[] {PithosContainer, TrashContainer};
@@ -111,6 +112,8 @@ namespace Pithos.Core
             }
         }
 
+        public string AuthenticationUrl { get; set; }
+
         private Uri ProxyFromSettings()
         {            
             if (Settings.UseManualProxy)
@@ -224,6 +227,7 @@ namespace Pithos.Core
             try
             {
                 CloudClient.UsePithos = this.UsePithos;
+                CloudClient.AuthenticationUrl = this.AuthenticationUrl;
                 CloudClient.Authenticate(UserName, ApiKey);
 
                 StartListening(RootPath);
@@ -493,9 +497,17 @@ namespace Pithos.Core
         {
             if (state.Skip)
                 return state;
-            string path = state.Path;
+            string path = state.Path.ToLower();            
             string fileName = Path.GetFileName(path);
 
+            //Bypass deleted files, unless the status is Deleted
+            if (!(File.Exists(path) || state.Status == FileStatus.Deleted))
+            {
+                state.Skip = true;
+                this.StatusKeeper.RemoveFileOverlayStatus(path);
+                return state;
+            }
+
             switch(state.Status)
             {
                 case FileStatus.Created:
index 4c76c71..cbd5c24 100644 (file)
@@ -19,8 +19,9 @@ namespace Pithos.Interfaces
         Uri Proxy { get; set; }
         double DownloadPercentLimit { get; set; }
         double UploadPercentLimit { get; set; }
+        string AuthenticationUrl { get; set; }
+
 
-        
         IList<ContainerInfo> ListContainers();
         IList<ObjectInfo> ListObjects(string container);
         IList<ObjectInfo> ListObjects(string container, string folder); 
@@ -52,6 +53,8 @@ namespace Pithos.Interfaces
         public double DownloadPercentLimit { get; set; }
         public double UploadPercentLimit { get; set; }
 
+        public string AuthenticationUrl { get; set; }
+
         public bool UsePithos { get; set; }
 
         public void Authenticate(string userName, string apiKey)
index 11ab9da..b41d62b 100644 (file)
@@ -23,8 +23,6 @@ namespace Pithos.Network
     [Export(typeof(ICloudClient))]
     public class CloudFilesClient:ICloudClient
     {
-        string _rackSpaceAuthUrl = "https://auth.api.rackspacecloud.com";
-        private string _pithosAuthUrl = "https://pithos.dev.grnet.gr";
 
         private RestClient _client;
         private readonly TimeSpan _shortTimeout = TimeSpan.FromSeconds(10);
@@ -38,11 +36,9 @@ namespace Pithos.Network
 
         public double DownloadPercentLimit { get; set; }
         public double UploadPercentLimit { get; set; }
-        
-        public string AuthUrl
-        {
-            get { return UsePithos ? _pithosAuthUrl : _rackSpaceAuthUrl; }
-        }
+
+        public string AuthenticationUrl { get; set; }
+
  
         public string VersionPath
         {
@@ -71,13 +67,13 @@ namespace Pithos.Network
             if (UsePithos)
             {
                 Token = ApiKey;
-                string storageUrl = String.Format("{0}/{1}/{2}", AuthUrl, VersionPath, UserName);
+                string storageUrl = String.Format("{0}/{1}/{2}", AuthenticationUrl, VersionPath, UserName);
                 StorageUrl = new Uri(storageUrl);
             }
             else
             {
 
-                string authUrl = String.Format("{0}/{1}", AuthUrl, VersionPath);
+                string authUrl = String.Format("{0}/{1}", AuthenticationUrl, VersionPath);
                 var authClient = new RestClient {Path = authUrl, Proxy = proxy};                
 
                 authClient.AddHeader("X-Auth-User", UserName);
index 32e9118..4d5e40c 100644 (file)
         "Name" = "8:Microsoft Visual Studio"
         "ProductName" = "8:Pithos"
         "ProductCode" = "8:{6DF108D9-D8FB-4438-9B83-A06A272FF56D}"
-        "PackageCode" = "8:{9A7D1522-2F63-4DCE-B974-6185A1FC6DA4}"
+        "PackageCode" = "8:{FE169482-E9D7-4D7B-BD3D-0101348C3EBF}"
         "UpgradeCode" = "8:{9D7BB283-458F-4124-A847-E42AFC9D5514}"
         "AspNetVersion" = "8:4.0.30319.0"
         "RestartWWWService" = "11:FALSE"
index 69469fa..2884c1e 100644 (file)
@@ -198,6 +198,7 @@ Global
                {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Test|Mixed Platforms.Build.0 = Test|Any CPU
                {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Test|x86.ActiveCfg = Test|Any CPU
                {4D9406A3-50ED-4672-BB97-A0B3EA4946FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {4D9406A3-50ED-4672-BB97-A0B3EA4946FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {4D9406A3-50ED-4672-BB97-A0B3EA4946FE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
                {4D9406A3-50ED-4672-BB97-A0B3EA4946FE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
                {4D9406A3-50ED-4672-BB97-A0B3EA4946FE}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -243,6 +244,7 @@ Global
                {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Test|Mixed Platforms.Build.0 = Release|Any CPU
                {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Test|x86.ActiveCfg = Release|Any CPU
                {C6251981-3C49-404B-BB5B-9732887388D2}.Debug|Any CPU.ActiveCfg = Debug
+               {C6251981-3C49-404B-BB5B-9732887388D2}.Debug|Any CPU.Build.0 = Debug
                {C6251981-3C49-404B-BB5B-9732887388D2}.Debug|Mixed Platforms.ActiveCfg = Debug
                {C6251981-3C49-404B-BB5B-9732887388D2}.Debug|x86.ActiveCfg = Debug
                {C6251981-3C49-404B-BB5B-9732887388D2}.Release|Any CPU.ActiveCfg = Release