From: pkanavos Date: Tue, 24 Apr 2012 19:22:41 +0000 (+0300) Subject: Fixed handling for Content_Type "application/folder" in SelectiveSync and other locations X-Git-Url: https://code.grnet.gr/git/pithos-ms-client/commitdiff_plain/268bec7f0c945b230da1107d25a683b5479ef8b7 Fixed handling for Content_Type "application/folder" in SelectiveSync and other locations --- diff --git a/trunk/Pithos.Client.WPF/Diagnostics/log4netForwarder.cs b/trunk/Pithos.Client.WPF/Diagnostics/log4netForwarder.cs index a706898..670c975 100644 --- a/trunk/Pithos.Client.WPF/Diagnostics/log4netForwarder.cs +++ b/trunk/Pithos.Client.WPF/Diagnostics/log4netForwarder.cs @@ -93,9 +93,6 @@ namespace Pithos.Client.WPF.Diagnostics { try { - var stack = new StackTrace(); - var type = stack.GetFrame(0).GetMethod().DeclaringType; - var log = LogManager.GetLogger(source); var level = GetLevel(eventType); TaskEx.Run(()=>log.Logger.Log(GetType(), level, message, null)); diff --git a/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs b/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs index 496f4a6..6283711 100644 --- a/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs +++ b/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs @@ -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.20424.0")] -[assembly: AssemblyFileVersionAttribute("0.7.20424.0")] +[assembly: AssemblyVersion("0.7.20424.1")] +[assembly: AssemblyFileVersionAttribute("0.7.20424.1")] diff --git a/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs b/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs index dd1cc21..cae3de2 100644 --- a/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs +++ b/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs @@ -53,8 +53,7 @@ using Pithos.Interfaces; namespace Pithos.Client.WPF.SelectiveSynch { class SelectiveSynchViewModel:Screen - { - private const string DirectoryType = "application/directory"; + { private readonly IEventAggregator _events ; @@ -105,7 +104,7 @@ namespace Pithos.Client.WPF.SelectiveSynch DisplayName = container.Name, Uri=new Uri(client.StorageUrl,String.Format(@"{0}/{1}",Account.AccountName, container.Name)), Directories = (from dir in client.ListObjects(_monitor.UserName, container.Name) - where dir.Content_Type == DirectoryType + where dir.IsDirectory select dir).ToTree() }; var ownFolders = dirs.ToList(); @@ -121,7 +120,7 @@ namespace Pithos.Client.WPF.SelectiveSynch DisplayName=container.Name, Uri = new Uri(client.StorageUrl, "../" + account.name + "/" + container.Name), Directories=(from folder in client.ListObjects(account.name,container.Name) - where folder.Content_Type==DirectoryType + where folder.IsDirectory select folder).ToTree() }).ToList() }; diff --git a/trunk/Pithos.Client.WPF/app.config b/trunk/Pithos.Client.WPF/app.config index de2b4a7..30b6f8d 100644 --- a/trunk/Pithos.Client.WPF/app.config +++ b/trunk/Pithos.Client.WPF/app.config @@ -28,7 +28,7 @@ - + diff --git a/trunk/Pithos.Core/Agents/NetworkAgent.cs b/trunk/Pithos.Core/Agents/NetworkAgent.cs index 0bdddd1..6a54c93 100644 --- a/trunk/Pithos.Core/Agents/NetworkAgent.cs +++ b/trunk/Pithos.Core/Agents/NetworkAgent.cs @@ -331,10 +331,16 @@ namespace Pithos.Core.Agents var downloadPath = action.LocalFile.GetProperCapitalization(); var cloudHash = cloudFile.Hash.ToLower(); - var previousCloudHash = cloudFile.PreviousHash.ToLower(); + var previousCloudHash = cloudFile.PreviousHash == null?null: cloudFile.PreviousHash.ToLower(); var localHash = action.TreeHash.Value.TopHash.ToHashString();// LocalHash.Value.ToLower(); //var topHash = action.TopHash.Value.ToLower(); + if(cloudFile.IsDirectory && action.LocalFile is DirectoryInfo) + { + Log.InfoFormat("Skipping folder {0} , exists in server", downloadPath); + return; + } + //At this point we know that an object has changed on the server and that a local //file already exists. We need to decide whether the file has only changed on //the server or there is a conflicting change on the client. diff --git a/trunk/Pithos.Core/Agents/PollAgent.cs b/trunk/Pithos.Core/Agents/PollAgent.cs index 99f8e81..3483559 100644 --- a/trunk/Pithos.Core/Agents/PollAgent.cs +++ b/trunk/Pithos.Core/Agents/PollAgent.cs @@ -469,7 +469,7 @@ namespace Pithos.Core.Agents { var localFile = fileAgent.GetFileSystemInfo(relativePath); //We don't need to sync directories - if (objectInfo.Content_Type == @"application/directory" && localFile is DirectoryInfo) + if (objectInfo.IsDirectory && localFile is DirectoryInfo) continue; using (new SessionScope(FlushAction.Never)) { diff --git a/trunk/Pithos.Core/LocalFileComparer.cs b/trunk/Pithos.Core/LocalFileComparer.cs index 5a13de8..2006f3f 100644 --- a/trunk/Pithos.Core/LocalFileComparer.cs +++ b/trunk/Pithos.Core/LocalFileComparer.cs @@ -24,7 +24,7 @@ namespace Pithos.Core if (!x.CloudFile.Hash.Equals(y.CloudFile.Hash)) return false; //All directories have the same hash. Compare them using their names instead - if (x.CloudFile.Content_Type == y.CloudFile.Content_Type && x.CloudFile.Content_Type == "application/directory") + if (x.CloudFile.Content_Type == y.CloudFile.Content_Type && x.CloudFile.IsDirectory) { return (x.CloudFile.Name == y.CloudFile.Name); } @@ -44,7 +44,7 @@ namespace Pithos.Core if (obj.CloudFile != null) { //All directories have the same hash code. Use their name's hash code instead - hash2 = obj.CloudFile.Content_Type == "application/directory" + hash2 = obj.CloudFile.IsDirectory ? obj.CloudFile.Name.GetHashCode() : (obj.CloudFile.Hash ?? obj.CloudFile.Name ?? "").GetHashCode(); } diff --git a/trunk/Pithos.Network.Test/CloudFilesClientTest.cs b/trunk/Pithos.Network.Test/CloudFilesClientTest.cs index aa06f08..9cb7e1d 100644 --- a/trunk/Pithos.Network.Test/CloudFilesClientTest.cs +++ b/trunk/Pithos.Network.Test/CloudFilesClientTest.cs @@ -71,9 +71,9 @@ namespace Pithos.Network.Test var pithos=containers.First(c => c.Name == "pithos"); - var directories=client.ListObjects(account,"pithos","").Where(info=>info.Content_Type=="application/directory"); + var directories=client.ListObjects(account,"pithos","").Where(info=>info.IsDirectory); Assert.That(directories,!Is.Empty); - Assert.IsTrue(directories.All(info=>info.Content_Type=="application/directory")); + Assert.IsTrue(directories.All(info=>info.IsDirectory)); }