Fix for duplicates in selectivesync display code
authorpkanavos <pkanavos@gmail.com>
Sat, 28 Apr 2012 20:17:19 +0000 (23:17 +0300)
committerpkanavos <pkanavos@gmail.com>
Sat, 28 Apr 2012 20:17:19 +0000 (23:17 +0300)
Still needs cleanup

trunk/Pithos.Client.WPF.Test/NodeTest.cs
trunk/Pithos.Client.WPF.Test/Pithos.Client.WPF.Test.csproj
trunk/Pithos.Client.WPF.Test/json.txt [new file with mode: 0644]
trunk/Pithos.Client.WPF.Test/json2.txt [new file with mode: 0644]
trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs
trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs
trunk/Pithos.Client.WPF/Utils/EnumerableExtensions.cs

index e37d87a..3842eeb 100644 (file)
@@ -3,170 +3,288 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using NUnit.Framework;
+using Newtonsoft.Json;
 using Pithos.Client.WPF.SelectiveSynch;
 using Pithos.Client.WPF.Utils;
 using Pithos.Interfaces;
+using System.IO;
 
 namespace Pithos.Client.WPF.Test
 {
     [TestFixture]
-    class NodeTest
+    internal class NodeTest
     {
         [Test]
         public void TestIteration()
         {
-            var root = new Node<int>{Path = "Root",
-                                Children =
-                                    {
-                                        new Node<int> {Path = "Root/Path1",
-                                            Children =
-                                                {
-                                                    new Node<int>{Path="Root/Path1/Path11",
-                                                        Children=
-                                                            {
-                                                                new Node<int>{Path="Root/Path1/Path11/Path111",
-                                                                Children=
-                                                                    {
-                                                                        new Node<int>{Path="Root/Path1/Path11/Path111/File1"}        
-                                                                    }}
-                                                            }
-                                                    },
-                                                    new Node<int>{Path="Root/Path1/File2"}
-                                                }
-                                        },                                        
-                                    }
-                            };
+            var root = new Node<int>
+                           {
+                               Path = "Root",
+                               Children =
+                                   {
+                                       new Node<int>
+                                           {
+                                               Path = "Root/Path1",
+                                               Children =
+                                                   {
+                                                       new Node<int>
+                                                           {
+                                                               Path = "Root/Path1/Path11",
+                                                               Children =
+                                                                   {
+                                                                       new Node<int>
+                                                                           {
+                                                                               Path = "Root/Path1/Path11/Path111",
+                                                                               Children =
+                                                                                   {
+                                                                                       new Node<int>
+                                                                                           {
+                                                                                               Path =
+                                                                                                   "Root/Path1/Path11/Path111/File1"
+                                                                                           }
+                                                                                   }
+                                                                           }
+                                                                   }
+                                                           },
+                                                       new Node<int> {Path = "Root/Path1/File2"}
+                                                   }
+                                           },
+                                   }
+                           };
             Assert.That(root.Count(), Is.EqualTo(6));
         }
-        
+
         [Test]
         public void TestEquals()
         {
-            var target = new Node<int>{Path = "Root",
-                                Children =
-                                    {
-                                        new Node<int> {Path = "Root/Path1",
-                                            Children =
-                                                {
-                                                    new Node<int>{Path="Root/Path1/Path11",
-                                                        Children=
-                                                            {
-                                                                new Node<int>{Path="Root/Path1/Path11/Path111",
-                                                                Children=
-                                                                    {
-                                                                        new Node<int>{Path="Root/Path1/Path11/Path111/File1"}        
-                                                                    }}
-                                                            }
-                                                    },
-                                                    new Node<int>{Path="Root/Path1/File2"}
-                                                }
-                                        },                                        
-                                    }
-                            };
-            var source= new Node<int>{Path = "Root",
-                                Children =
-                                    {
-                                        new Node<int>{Path = "Root/Path1",
-                                            Children =
-                                                {
-                                                    new Node<int>{Path="Root/Path1/Path11",
-                                                        Children=
-                                                            {
-                                                                new Node<int>{Path="Root/Path1/Path11/Path111",
-                                                                Children=
-                                                                    {
-                                                                        new Node<int>{Path="Root/Path1/Path11/Path111/File1"}        
-                                                                    }}
-                                                            }
-                                                    },
-                                                    new Node<int>{Path="Root/Path1/File2"}
-                                                }
-                                        },                                        
-                                    }
-                            };
-            Assert.That(source.Equals(target), Is.True);            
+            var target = new Node<int>
+                             {
+                                 Path = "Root",
+                                 Children =
+                                     {
+                                         new Node<int>
+                                             {
+                                                 Path = "Root/Path1",
+                                                 Children =
+                                                     {
+                                                         new Node<int>
+                                                             {
+                                                                 Path = "Root/Path1/Path11",
+                                                                 Children =
+                                                                     {
+                                                                         new Node<int>
+                                                                             {
+                                                                                 Path = "Root/Path1/Path11/Path111",
+                                                                                 Children =
+                                                                                     {
+                                                                                         new Node<int>
+                                                                                             {
+                                                                                                 Path =
+                                                                                                     "Root/Path1/Path11/Path111/File1"
+                                                                                             }
+                                                                                     }
+                                                                             }
+                                                                     }
+                                                             },
+                                                         new Node<int> {Path = "Root/Path1/File2"}
+                                                     }
+                                             },
+                                     }
+                             };
+            var source = new Node<int>
+                             {
+                                 Path = "Root",
+                                 Children =
+                                     {
+                                         new Node<int>
+                                             {
+                                                 Path = "Root/Path1",
+                                                 Children =
+                                                     {
+                                                         new Node<int>
+                                                             {
+                                                                 Path = "Root/Path1/Path11",
+                                                                 Children =
+                                                                     {
+                                                                         new Node<int>
+                                                                             {
+                                                                                 Path = "Root/Path1/Path11/Path111",
+                                                                                 Children =
+                                                                                     {
+                                                                                         new Node<int>
+                                                                                             {
+                                                                                                 Path =
+                                                                                                     "Root/Path1/Path11/Path111/File1"
+                                                                                             }
+                                                                                     }
+                                                                             }
+                                                                     }
+                                                             },
+                                                         new Node<int> {Path = "Root/Path1/File2"}
+                                                     }
+                                             },
+                                     }
+                             };
+            Assert.That(source.Equals(target), Is.True);
         }
 
         [Test]
         public void TestToTree()
         {
-            var target = new Node<int>{Path = "Root",
-                                Children =
-                                    {
-                                        new Node<int>{Path = "Root/Path1",
-                                            Children =
-                                                {
-                                                    new Node<int>{Path="Root/Path1/File2"},
-                                                    new Node<int>{Path="Root/Path1/Path11",
-                                                        Children=
-                                                            {
-                                                                new Node<int>{Path="Root/Path1/Path11/Path111",
-                                                                Children=
-                                                                    {
-                                                                        new Node<int>{Path="Root/Path1/Path11/Path111/File1"}        
-                                                                    }}
-                                                            }
-                                                    },
-                                                }
-                                        },                                        
-                                    }
-                            };
-            var source= new[]
-                            {
-                                Tuple.Create("Root",0),
-                                Tuple.Create("Root/Path1",0),
-                                Tuple.Create("Root/Path1/Path11",0),
-                                Tuple.Create("Root/Path1/Path11/Path111",0),
-                                Tuple.Create("Root/Path1/Path11/Path111/File1",0),
-                                Tuple.Create("Root/Path1/File2",0)
-                            };
+            var target = new Node<int>
+                             {
+                                 Path = "Root",
+                                 Children =
+                                     {
+                                         new Node<int>
+                                             {
+                                                 Path = "Root/Path1",
+                                                 Children =
+                                                     {
+                                                         new Node<int> {Path = "Root/Path1/File2"},
+                                                         new Node<int>
+                                                             {
+                                                                 Path = "Root/Path1/Path11",
+                                                                 Children =
+                                                                     {
+                                                                         new Node<int>
+                                                                             {
+                                                                                 Path = "Root/Path1/Path11/Path111",
+                                                                                 Children =
+                                                                                     {
+                                                                                         new Node<int>
+                                                                                             {
+                                                                                                 Path =
+                                                                                                     "Root/Path1/Path11/Path111/File1"
+                                                                                             }
+                                                                                     }
+                                                                             }
+                                                                     }
+                                                             },
+                                                     }
+                                             },
+                                     }
+                             };
+            var source = new[]
+                             {
+                                 Tuple.Create("Root", 0),
+                                 Tuple.Create("Root/Path1", 0),
+                                 Tuple.Create("Root/Path1/Path11", 0),
+                                 Tuple.Create("Root/Path1/Path11/Path111", 0),
+                                 Tuple.Create("Root/Path1/Path11/Path111/File1", 0),
+                                 Tuple.Create("Root/Path1/File2", 0)
+                             };
+
+            Assert.That(source.ToTree(s => s.Item1, s => s.Item2).First().Equals(target), Is.True);
+        }
+
+        [Test]
 
-            Assert.That(source.ToTree(s=>s.Item1,s=>s.Item2).First().Equals(target), Is.True);
-        } [Test]
-        
         public void TestObjectInfoToTree()
         {
-            var target = new DirectoryRecord{ DisplayName= "Root",
-                                Directories =
-                                    {
-                                        new DirectoryRecord{DisplayName = "Root/DisplayName1",
-                                            Directories =
-                                                {
-                                                    new DirectoryRecord{DisplayName="Root/DisplayName1/File2"},
-                                                    new DirectoryRecord{DisplayName="Root/DisplayName1/DisplayName11",
-                                                        Directories=
-                                                            {
-                                                                new DirectoryRecord{DisplayName="Root/DisplayName1/DisplayName11/DisplayName111",
-                                                                Directories=
-                                                                    {
-                                                                        new DirectoryRecord{DisplayName="Root/DisplayName1/DisplayName11/DisplayName111/File1"}        
-                                                                    }}
-                                                            }
-                                                    },
-                                                }
-                                        },                                        
-                                    }
-                            };
+           
+            var account = "someaccount";
+            var container = "Root";
+            var source = new[]
+                             {
+                                 new ObjectInfo
+                                     {
+                                         Account = account,
+                                         Container = container,
+                                         Name = "Path1",
+                                         Content_Type = "application/directory"
+                                     },
+                                 new ObjectInfo
+                                     {
+                                         Account = account,
+                                         Container = container,
+                                         Name = "Path1/Path11",
+                                         Content_Type = "application/folder"
+                                     },
+                                 new ObjectInfo
+                                     {Account = account, Container = container, Name = "Path1/Path11/Path111"},
+                                 new ObjectInfo
+                                     {
+                                         Account = account,
+                                         Container = container,
+                                         Name = "Path1/Path11/Path111/File1",
+                                         Content_Type = "application/octet-stream"
+                                     },
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path1/File2"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path1/File3"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path1/File"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path2/File2"},                                 
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path2/Path21/File2"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "File02"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "File03"}
+                             };
+
+            var tree = source.ToTree();
+            var allNodes = (from DirectoryRecord root in tree
+                            from DirectoryRecord record in root
+                            select record).ToList();
+            Assert.That(allNodes.Count, Is.EqualTo(5));
+        }
+        public void InferFromPath()
+        {
+           
             var account = "someaccount";
             var container = "Root";
-            var source= new[]
-                            {
-                                new ObjectInfo{Account=account,Container=container,Name="Path1",Content_Type="application/directory"},
-                                new ObjectInfo{Account=account,Container=container,Name="Path1/Path11",Content_Type="application/folder"},
-                                new ObjectInfo{Account=account,Container=container,Name="Path1/Path11/Path111"},
-                                new ObjectInfo{Account=account,Container=container,Name="Path1/Path11/Path111/File1",Content_Type="application/octet-stream"},
-                                new ObjectInfo{Account=account,Container=container,Name="Path1/File2"},
-                                new ObjectInfo{Account=account,Container=container,Name="Path2/File2"},
-                                new ObjectInfo{Account=account,Container=container,Name="Path2/Path21/File2"},
-                                new ObjectInfo{Account=account,Container=container,Name="File02"},
-                                new ObjectInfo{Account=account,Container=container,Name="File03"}
-                            };
+            var source = new[]
+                             {                                
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path1/File2"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path1/File3"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path1/Path11/Path111/File3"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path2"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path2/Path21",Content_Type="application/directory"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path2/Path21/Path01",Content_Type="application/directory"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "Path2/Path21/File211"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "x2",Content_Type="application/directory"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "x2/x21",Content_Type="application/directory"},
+                                 new ObjectInfo {Account = account, Container = container, Name = "x2/x22",Content_Type="application/directory"},
+                             };
 
             var tree = source.ToTree();
             var allNodes = (from DirectoryRecord root in tree
                             from DirectoryRecord record in root
-                            select record).ToList();    
-            Assert.That(allNodes.Count,Is.EqualTo(5));
+                            select record).ToList();
+            //Root Nodes
+            Assert.That(tree.Count, Is.EqualTo(3));
+            //Total nodes
+            Assert.That(allNodes.Count, Is.EqualTo(9));
+
+            Assert.That(allNodes.Any(r=>r.DisplayName=="Path1"));
+            Assert.That(allNodes.Any(r => r.DisplayName == "Path11"));
+            Assert.That(allNodes.Any(r => r.DisplayName == "Path111"));
+            Assert.That(allNodes.Any(r => r.DisplayName == "Path2"));
+            Assert.That(allNodes.Any(r => r.DisplayName == "Path21"));
+        }   
+
+
+        [Test]
+        public void TestShared()
+        {
+            var content = File.ReadAllText("json.txt");
+            var items=JsonConvert.DeserializeObject<IList<ObjectInfo>>(content);
+            Assert.That(items.Count,Is.EqualTo(23));
+            var tree = items.ToTree();
+            var allNodes = (from DirectoryRecord root in tree
+                            from DirectoryRecord record in root
+                            select record).ToList();
+            Assert.That(allNodes.Count,Is.EqualTo(10));
+        }
+
+        [Test]
+        public void TestOwn()
+        {
+            var content = File.ReadAllText("json2.txt");
+            var items=JsonConvert.DeserializeObject<IList<ObjectInfo>>(content);
+            Assert.That(items.Count,Is.EqualTo(22));
+            var tree = items.ToTree();
+            var allNodes = (from DirectoryRecord root in tree
+                            from DirectoryRecord record in root
+                            select record).ToList();
+            Assert.That(allNodes.Count,Is.EqualTo(9));
         }
     }
 }
index b241911..2099060 100644 (file)
     <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\Libraries\Json40r2\Source\Src\Newtonsoft.Json\Newtonsoft.Json.csproj">
+      <Project>{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}</Project>
+      <Name>Newtonsoft.Json</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Pithos.Client.WPF\Pithos.Client.WPF.csproj">
       <Project>{4D9406A3-50ED-4672-BB97-A0B3EA4946FE}</Project>
       <Name>Pithos.Client.WPF</Name>
       <Name>Pithos.Interfaces</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="json.txt">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="json2.txt">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/trunk/Pithos.Client.WPF.Test/json.txt b/trunk/Pithos.Client.WPF.Test/json.txt
new file mode 100644 (file)
index 0000000..e8e9dd8
--- /dev/null
@@ -0,0 +1,23 @@
+[{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "The Five Dysfunctions of a Team", "bytes": 0, "x_object_sharing": "read=nkoziris@cslab.ece.ntua.gr; write=pkanavos@gmail.com,gpant@noc.grnet.gr,nkoziris@cslab.ece.ntua.gr", "x_object_version_timestamp": "1333996565.8442171", "x_object_uuid": "37a2b8c3-691b-4cbe-834e-950ccf4a3342", "last_modified": "2012-04-09T18:36:05.844217+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 25831, "x_object_modified_by": "sotirop@grnet.gr", "x_object_allowed_to": "write"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "The Five Dysfunctions of a Team/New Text Document.txt", "bytes": 0, "x_object_version_timestamp": "1335453799.160491", "x_object_uuid": "8301e0b6-9086-4833-9794-3129137c00f5", "last_modified": "2012-04-26T15:23:19.160491+00:00", "content_type": "application/octet-stream", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 44912, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "The Five Dysfunctions of a Team/PKHP.typemock", "bytes": 0, "x_object_version_timestamp": "1335454159.5943811", "x_object_uuid": "8896c408-af45-4e7e-ab5c-4cc3b2e7e36a", "last_modified": "2012-04-26T15:29:19.594381+00:00", "content_type": "application/octet-stream", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 44988, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "1f5e78989a5b5f6dd9d7772018fcc8de", "name": "The Five Dysfunctions of a Team/Pithos.IsolatorCache.user", "bytes": 172182, "x_object_version_timestamp": "1335454154.584305", "x_object_uuid": "fb63d5a3-21c2-4254-9958-f528e830e002", "last_modified": "2012-04-26T15:29:14.584305+00:00", "content_type": "application/octet-stream", "x_object_hash": "77e617d9241a90037432d7b644bed6bcde47f99eecf3a24aba4957814153e4b5", "x_object_version": 44984, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "17b4fe9ead6385776b17539299dcf4c9", "name": "The Five Dysfunctions of a Team/Pithos.licenseheader", "bytes": 1902, "x_object_version_timestamp": "1335454156.4192181", "x_object_uuid": "db8e5a22-9507-43aa-bca5-8050a06e090b", "last_modified": "2012-04-26T15:29:16.419218+00:00", "content_type": "application/octet-stream", "x_object_hash": "abcd937c4fb664be1bcee50416021358bf01d068d25b5cee7c776ce7294dd795", "x_object_version": 44985, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "216feabfa3474cec6cea3f008fccec40", "name": "The Five Dysfunctions of a Team/Pithos.sln.docstates", "bytes": 16390, "x_object_version_timestamp": "1335454157.570056", "x_object_uuid": "795838be-3904-452f-9cda-9a69aaf0fc84", "last_modified": "2012-04-26T15:29:17.570056+00:00", "content_type": "application/octet-stream", "x_object_hash": "39a1c2e9f48cba3aa8c00ee769ee0fb26282ae351abe7852910836e46521e774", "x_object_version": 44986, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "242fbe517505aa1b6102c67ad53aed63", "name": "The Five Dysfunctions of a Team/Pithos.sln.docstates.suo", "bytes": 32774, "x_object_version_timestamp": "1335454158.336906", "x_object_uuid": "c1f24d21-5870-414d-82d6-8b7376a1f533", "last_modified": "2012-04-26T15:29:18.336906+00:00", "content_type": "application/octet-stream", "x_object_hash": "3814be2a0a1a45c67afecc3f8752b5e2b854365c4e2995519ae126a522351b69", "x_object_version": 44987, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "fcc24d0b3c9b2e2459351c381c230502", "name": "The Five Dysfunctions of a Team/The Five Dysfunctions - Disc 01.mp3", "bytes": 31673775, "x_object_version_timestamp": "1335453791.43031", "x_object_uuid": "cc470900-2861-40d2-9405-1b58beaf7c8a", "last_modified": "2012-04-26T15:23:11.430310+00:00", "content_type": "application/octet-stream", "x_object_hash": "16ec3c2bfd27cfa297101111e11f4071ee5e61bcf2ba04c8e9f8f3520c1b2fdf", "x_object_version": 44908, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "306a00209cf794a85ee104bcd3706e32", "name": "The Five Dysfunctions of a Team/The Five Dysfunctions - Disc 02.mp3", "bytes": 31780875, "x_object_version_timestamp": "1335454162.3201411", "x_object_uuid": "d05398ac-6f9a-4255-a7c2-c045b313deca", "last_modified": "2012-04-26T15:29:22.320141+00:00", "content_type": "application/octet-stream", "x_object_hash": "eeb73ef44c6b4111d24cefc94565296b6bf4f964379a974680115607d803c92e", "x_object_version": 44989, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "d7916dc66200ca8fe4c33e85b678127c", "name": "The Five Dysfunctions of a Team/The Five Dysfunctions - Disc 03.mp3", "bytes": 30202095, "x_object_version_timestamp": "1335453794.643621", "x_object_uuid": "42685749-a85a-4fee-ab2d-198ec33162eb", "last_modified": "2012-04-26T15:23:14.643621+00:00", "content_type": "application/octet-stream", "x_object_hash": "7669d32c5fc6df443e8a7cd72356d3fb1c51ff126788407c5bba73f7e4f5e409", "x_object_version": 44909, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "0ba9b8b077f34d011dbe5bf4892a3cfe", "name": "The Five Dysfunctions of a Team/Torrent downloaded from Demonoid.me.txt", "bytes": 46, "x_object_version_timestamp": "1335453796.744961", "x_object_uuid": "f5c8b5d5-0e12-4b4d-b16a-a586c039a56c", "last_modified": "2012-04-26T15:23:16.744961+00:00", "content_type": "application/octet-stream", "x_object_hash": "b58f7ef046b4c50d0a0785b80bf0bbcdbc926ebd05d30d1f08fba8da3453dcd9", "x_object_version": 44910, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "8cac345a729e7aa7652a8bbedcd5c7e3", "name": "The Five Dysfunctions of a Team/fsadfasd.txt", "bytes": 9, "x_object_version_timestamp": "1335453797.6788149", "x_object_uuid": "785cc2ea-c510-46aa-bf08-8aaac3c13886", "last_modified": "2012-04-26T15:23:17.678815+00:00", "content_type": "application/octet-stream", "x_object_hash": "d9f6d0a8d2f9e606ccbf742578940f631308fa8c30300e9ee91595e3f61dd6e3", "x_object_version": 44911, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "48d945eaec8461bcf76bba8f91a53d55", "name": "The Five Dysfunctions of a Team/uninstall.cmd", "bytes": 24, "x_object_version_timestamp": "1335454165.728456", "x_object_uuid": "c57b8c85-7448-430f-9342-c6e62a5ead2c", "last_modified": "2012-04-26T15:29:25.728456+00:00", "content_type": "application/octet-stream", "x_object_hash": "0142a887cf037a7a70f3ecef6da8c8bba2d9fcbda4e6468e99bbc8799089ee54", "x_object_version": 44990, "x_object_modified_by": "nkoziris@cslab.ece.ntua.gr"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac", "bytes": 0, "x_object_sharing": "read=ggpanta@gmail.com,pkanavos@gmail.com", "x_object_version_timestamp": "1335446285.402041", "x_object_uuid": "9c2d7a41-15b7-4391-a5fc-2978705dbb35", "last_modified": "2012-04-26T13:18:05.402041+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 44725, "x_object_modified_by": "sotirop@grnet.gr", "x_object_allowed_to": "read"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac/sdlmame0143u8-x86_64", "bytes": 0, "x_object_sharing": "read=ggpanta@gmail.com,pkanavos@gmail.com", "x_object_version_timestamp": "1335450831.053812", "x_object_uuid": "486b4bbe-b6ad-4490-a895-4b5db8ad920d", "last_modified": "2012-04-26T14:33:51.053812+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 44863, "x_object_modified_by": "sotirop@grnet.gr", "x_object_allowed_to": "read"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac/sdlmame0143u8-x86_64/artwork", "bytes": 0, "x_object_sharing": "read=ggpanta@gmail.com,pkanavos@gmail.com", "x_object_version_timestamp": "1334837051.5794179", "x_object_uuid": "3e210dc2-c213-4281-b890-7ef76ad48e6f", "last_modified": "2012-04-19T12:04:11.579418+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 30986, "x_object_modified_by": "sotirop@grnet.gr", "x_object_allowed_to": "read"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac/sdlmame0143u8-x86_64/docs", "bytes": 0, "x_object_version_timestamp": "1334837052.161983", "x_object_uuid": "b98fc31c-9253-4773-967f-e4bdd3524973", "last_modified": "2012-04-19T12:04:12.161983+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 30988, "x_object_modified_by": "sotirop@grnet.gr"},
+{"hash": "87d794681ddcf8008f0bb8b1b1414b91", "name": "mame for mac/sdlmame0143u8-x86_64/docs/cfg/___empty.cfg", "bytes": 176, "x_object_version_timestamp": "1334837062.852783", "x_object_uuid": "81a21031-ba75-47ab-9d06-366eab261042", "last_modified": "2012-04-19T12:04:22.852783+00:00", "content_type": "application/octet-stream", "x_object_hash": "af10f2de3aab790672796113e5d2d90bd3ea90122df661a39741e5caafbdc127", "x_object_version": 31012, "x_object_modified_by": "sotirop@grnet.gr"},
+{"hash": "c77251b45534d0de1a49c4a2be6dd0eb", "name": "mame for mac/sdlmame0143u8-x86_64/docs/cfg/default.cfg", "bytes": 175, "x_object_version_timestamp": "1334837063.8580279", "x_object_uuid": "75dab043-33ad-4a4f-ba89-56d3bd5770a0", "last_modified": "2012-04-19T12:04:23.858028+00:00", "content_type": "application/octet-stream", "x_object_hash": "15f60e1e15f6724d611e7d49c612271acecc1954025a7aa88dd3e2655617ff1c", "x_object_version": 31015, "x_object_modified_by": "sotirop@grnet.gr"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac/sdlmame0143u8-x86_64/hash", "bytes": 0, "x_object_version_timestamp": "1334837052.759517", "x_object_uuid": "e88fcceb-7d0c-4575-ad9d-1a397aa8de5c", "last_modified": "2012-04-19T12:04:12.759517+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 30990, "x_object_modified_by": "sotirop@grnet.gr"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac/sdlmame0143u8-x86_64/hlsl", "bytes": 0, "x_object_version_timestamp": "1334837053.3437901", "x_object_uuid": "7acce0bc-cc83-4028-97c8-e3a5c7989bd1", "last_modified": "2012-04-19T12:04:13.343790+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 30991, "x_object_modified_by": "sotirop@grnet.gr"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac/sdlmame0143u8-x86_64/nvram", "bytes": 0, "x_object_version_timestamp": "1335451012.067204", "x_object_uuid": "a3638e91-f6b4-4f5a-8800-6f93eaf9ec08", "last_modified": "2012-04-26T14:36:52.067204+00:00", "content_type": "application/folder", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 44864, "x_object_modified_by": "sotirop@grnet.gr"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "mame for mac/sdlmame0143u8-x86_64/nvram/shinobi", "bytes": 0, "x_object_version_timestamp": "1334837054.2124529", "x_object_uuid": "e27aa8b0-48cf-42b0-8b22-cae3c0eb0f62", "last_modified": "2012-04-19T12:04:14.212453+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 30993, "x_object_modified_by": "sotirop@grnet.gr"}]
\ No newline at end of file
diff --git a/trunk/Pithos.Client.WPF.Test/json2.txt b/trunk/Pithos.Client.WPF.Test/json2.txt
new file mode 100644 (file)
index 0000000..f11eee0
--- /dev/null
@@ -0,0 +1,22 @@
+[{"hash": "3cabcd6f9617b20ccfcd58be75381b42", "name": "Async-CTP-v3.exe", "bytes": 23154072, "x_object_sharing": "read=gpant@noc.grnet.gr; write=gpant@noc.grnet.gr", "x_object_version_timestamp": "1335435470.016273", "x_object_uuid": "4d16a706-f284-44fc-8068-ea52a4962f28", "last_modified": "2012-04-26T10:17:50.016273+00:00", "content_type": "application/octet-stream", "x_object_hash": "e69d97ba5714a164d461058a361bf0cb529ce76c82178282eb7cc453ec023b23", "x_object_version": 44464, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "c8593779bf7a48c095ce55e5ce9324a9", "name": "Caspiel_Wing.png", "bytes": 5908, "x_object_version_timestamp": "1335553183.0370381", "x_object_uuid": "a9df53d5-41f9-4e10-aadd-c937d1399eee", "last_modified": "2012-04-27T18:59:43.037038+00:00", "content_type": "application/octet-stream", "x_object_hash": "18c7fe0127fb431929d90212ede0034e99dba607897c397a03e80330546a49b9", "x_object_version": 45133, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "0b35bf92d5f32f0fd92fe44d97515b06", "name": "DSLs_in_Boo-_Domain-_v1_PUBLISH.pdf", "bytes": 8907309, "x_object_version_timestamp": "1335610037.901391", "x_object_uuid": "8bbc3648-6f17-4c8c-978c-1dd932481464", "last_modified": "2012-04-28T10:47:17.901391+00:00", "content_type": "application/octet-stream", "x_object_hash": "feb1048bcf24c6d8fd622209757c478c37b100e3771fbc94b9b8eb36a0a3b949", "x_object_version": 45134, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "8d9bc9a566b081d0bef9bb7b73ee57a1", "name": "Git-1.7.9-preview20120201.exe", "bytes": 15067506, "x_object_sharing": "read=gpant@noc.grnet.gr; write=gpant@noc.grnet.gr", "x_object_version_timestamp": "1335435471.866606", "x_object_uuid": "3b533092-cbfc-4d58-b848-5d8b212ae7bf", "last_modified": "2012-04-26T10:17:51.866606+00:00", "content_type": "application/octet-stream", "x_object_hash": "dcc92b3f0a4ca457a74b7953e4b90402f594574e815476c9f6f58dad1a02c7db", "x_object_version": 44466, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "0b129a228c895ee34fa30288a665c758", "name": "ReSharperSetup.6.1.1000.82.msi", "bytes": 37593088, "x_object_version_timestamp": "1335610040.5397921", "x_object_uuid": "c3307f22-8a70-4ab4-bde5-aab2937b0723", "last_modified": "2012-04-28T10:47:20.539792+00:00", "content_type": "application/octet-stream", "x_object_hash": "393242ea32049602be9b3294f73b4bbd57a5becf816ea07664040d8c5f037187", "x_object_version": 45135, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "Test6.txt", "bytes": 0, "x_object_version_timestamp": "1335610042.3749681", "x_object_uuid": "5c66fe0f-a61f-41c8-b747-0e7dd72a6aa5", "last_modified": "2012-04-28T10:47:22.374968+00:00", "content_type": "application/octet-stream", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 45136, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "71908380e34bae80e0972ff10fe0c488", "name": "TortoiseGit-1.7.7.0-64bit.msi", "bytes": 18436096, "x_object_version_timestamp": "1335610043.5019619", "x_object_uuid": "e661ca62-8ee7-49d9-8a62-a566e42b048f", "last_modified": "2012-04-28T10:47:23.501962+00:00", "content_type": "application/octet-stream", "x_object_hash": "c6e68226bb408211f0d7f73ee160afc53f70f7427bdb54d0c41a367f001bef51", "x_object_version": 45137, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "a5c58c85964705516b908c3f593800cb", "name": "TypemockIsolatorSuite7.0.2.msi", "bytes": 22573056, "x_object_version_timestamp": "1335610045.2540691", "x_object_uuid": "a185c980-1ff9-4b87-8b92-6184791abc13", "last_modified": "2012-04-28T10:47:25.254069+00:00", "content_type": "application/octet-stream", "x_object_hash": "dc1d24f1da9f3e808e592897230402c0cfa5b7bd4015040c2ac94db19f79ee53", "x_object_version": 45138, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "712d59355055a21f4e632a2254101a70", "name": "the-definitive-antlr-reference_p4_0.mobi", "bytes": 1474919, "x_object_version_timestamp": "1335610046.901387", "x_object_uuid": "707de99d-2a17-472c-a7ef-7731ee03820a", "last_modified": "2012-04-28T10:47:26.901387+00:00", "content_type": "application/octet-stream", "x_object_hash": "3e1c89a31cc20871e5b4fecffc29caeb202f5cbbfcc8e42afc748b657dc8545a", "x_object_version": 45139, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "4017e6a4dba1a0a60a033675f9c306d9", "name": "the-definitive-antlr-reference_p4_0.pdf", "bytes": 3470665, "x_object_version_timestamp": "1335610047.7778151", "x_object_uuid": "d036ff71-cc1e-4932-bfe7-11908be25505", "last_modified": "2012-04-28T10:47:27.777815+00:00", "content_type": "application/octet-stream", "x_object_hash": "abd76a1bc9105e3db82b86d9bf84756d0453586eb3f1c58412c0bdfbacd10b0d", "x_object_version": 45140, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "6a7d2be85f3e50835ea0441d75b741d1", "name": "wfxbap.zip", "bytes": 45549, "x_object_version_timestamp": "1335610048.532187", "x_object_uuid": "c1c73800-bc18-403a-b961-433deee6979b", "last_modified": "2012-04-28T10:47:28.532187+00:00", "content_type": "application/octet-stream", "x_object_hash": "52075e5fc1d9ee7cd496e2c32fed2eebfad4230329169695aa6d028b5267c98b", "x_object_version": 45141, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x1", "bytes": 0, "x_object_version_timestamp": "1331919797.4864161", "x_object_uuid": "d7e33576-c69d-4077-927e-82b948a23d67", "last_modified": "2012-03-16T17:43:17.486416+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 1873, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x2", "bytes": 0, "x_object_version_timestamp": "1332256948.8610981", "x_object_uuid": "14dc7839-09c6-4d20-bc3a-5c2cd170cd04", "last_modified": "2012-03-20T15:22:28.861098+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 3741, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x2/x21", "bytes": 0, "x_object_version_timestamp": "1332256970.4401901", "x_object_uuid": "8797d9b1-9395-4880-9fab-f512d1396268", "last_modified": "2012-03-20T15:22:50.440190+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 3743, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x2/x22", "bytes": 0, "x_object_version_timestamp": "1332256975.84391", "x_object_uuid": "980da495-8c47-4a2c-b990-b55645997496", "last_modified": "2012-03-20T15:22:55.843910+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 3744, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x3", "bytes": 0, "x_object_version_timestamp": "1332256953.9535971", "x_object_uuid": "2d53c7d9-069c-4971-9900-56149dd0607a", "last_modified": "2012-03-20T15:22:33.953597+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 3742, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "cac92727c33bec0a79965c61bbb1c82f", "name": "x3/7z920-x64.msi", "bytes": 1376768, "x_object_version_timestamp": "1335610049.738184", "x_object_uuid": "de78110a-c5d7-4ff4-b7be-95eaff0b2a8c", "last_modified": "2012-04-28T10:47:29.738184+00:00", "content_type": "application/octet-stream", "x_object_hash": "ebc2542700b978eb7bed0d3da371ccde502d07e6614d2419514b2d634b950b23", "x_object_version": 45142, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "11c561ff59b54240efb4d03ad129f254", "name": "x3/Greek.isl", "bytes": 18244, "x_object_version_timestamp": "1335610050.5365579", "x_object_uuid": "8ab41a76-d72e-4fd4-86aa-1f7c00bc1843", "last_modified": "2012-04-28T10:47:30.536558+00:00", "content_type": "application/octet-stream", "x_object_hash": "5571a8fecd4ae3755e336cecfb961266c2411a1456c71668a49332f79865d4ae", "x_object_version": 45143, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x3/x31", "bytes": 0, "x_object_version_timestamp": "1332256981.1848941", "x_object_uuid": "1b164b11-a2ba-4df0-ac00-340551022cd7", "last_modified": "2012-03-20T15:23:01.184894+00:00", "content_type": "application/directory", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 3745, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x4", "bytes": 0, "x_object_version_timestamp": "1335509266.2317851", "x_object_uuid": "9e509b3c-c601-481b-b5af-398892ab48d2", "last_modified": "2012-04-27T06:47:46.231785+00:00", "content_type": "application/octet-stream", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 45049, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x5", "bytes": 0, "x_object_version_timestamp": "1332258867.1309741", "x_object_uuid": "b32efa2e-67d6-4b7a-8b3c-19dee8f486ac", "last_modified": "2012-03-20T15:54:27.130974+00:00", "content_type": "application/directory; charset=UTF-8", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 3771, "x_object_modified_by": "pkanavos@gmail.com"},
+{"hash": "d41d8cd98f00b204e9800998ecf8427e", "name": "x6", "bytes": 0, "x_object_version_timestamp": "1332259259.5396609", "x_object_uuid": "9596d4e1-857d-439a-a96b-ab7ac531192f", "last_modified": "2012-03-20T16:00:59.539661+00:00", "content_type": "application/directory; charset=UTF-8", "x_object_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x_object_version": 3789, "x_object_modified_by": "pkanavos@gmail.com"}]
\ No newline at end of file
index abd3781..555aa92 100644 (file)
@@ -43,6 +43,7 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Specialized;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Text;
@@ -53,6 +54,7 @@ using Pithos.Interfaces;
 
 namespace Pithos.Client.WPF.SelectiveSynch
 {
+    [DebuggerDisplay("{Uri} : {IsChecked}")]
     public class DirectoryRecord :PropertyChangedBase, IEnumerable<DirectoryRecord>
     {
         private ObjectInfo _objectInfo;
index 0aca1a0..8d8583a 100644 (file)
@@ -104,7 +104,8 @@ namespace Pithos.Client.WPF.SelectiveSynch
             client.Authenticate();
             
 
-            var dirs = from container in client.ListContainers(AccountName)                       
+            var dirs = from container in client.ListContainers(AccountName)  
+                       where container.Name != "trash"
                        select new DirectoryRecord
                                   {
                                       DisplayName = container.Name,
index 68b178f..7c3f15c 100644 (file)
@@ -95,8 +95,12 @@ namespace Pithos.Client.WPF.Utils
                 //Calculate the parent path
                 var parentPath = GetParentPath(path);
                 var parentName = GetParentPath(item.Name);
-                DirectoryRecord parent;
-                DirectoryRecord newNode;
+                DirectoryRecord parent;                
+
+
+                //First ensure that the parent items exist
+
+                var parts = item.Name.Split('/');
 
                 //Dont't add files
                 if (!item.IsDirectory)
@@ -113,24 +117,67 @@ namespace Pithos.Client.WPF.Utils
                         continue;
                     //Otherwise we need to add it, because it is missing from the list
                     //Store each item using its current path
-                    newNode = new DirectoryRecord { DisplayName = parentPath.Split('/').Last(), 
-                        ObjectInfo = new ObjectInfo{Account=item.Account,Container=item.Container,Name=parentPath,Content_Type="application/directory"}};
+                    //Since this is not a directory, we won't add the item itself
+                    AddParentNodes(lookups, rootNodes, parts, item);
                 }
                 else
                 {
+                    AddParentNodes(lookups, rootNodes, parts, item);
+
                     //Store each item using its current path
-                    newNode = new DirectoryRecord {DisplayName = item.Name.Split('/').Last(), ObjectInfo = item};
+                    var newNode = new DirectoryRecord {DisplayName = parts.Last(), ObjectInfo = item};
+                    AddNode(rootNodes, lookups, newNode);
                 }
-                AddNode(rootNodes, parentPath, path, lookups, newNode);
+                
             }
             return rootNodes;
         }
 
-        private static void AddNode(List<DirectoryRecord> rootNodes, string parentPath, string path, Dictionary<string, DirectoryRecord> lookups, DirectoryRecord newNode)
+        private static void AddParentNodes(Dictionary<string, DirectoryRecord> lookups, List<DirectoryRecord> rootNodes, string[] parts, ObjectInfo item)
+        {
+            for (int i = 0; i < parts.Length - 1; i++)
+            {
+                var nodeName = String.Join("/", parts, 0, i + 1);
+                var storageUri = GetStorageUri(item);
+                var nodeKey = String.Format("{0}/{1}/{2}/{3}", storageUri, item.Account,item.Container, nodeName);
+                //If the node was already addeds, skip
+                if (lookups.ContainsKey(nodeKey))
+                    continue;
+                var newNode = new DirectoryRecord
+                                  {
+                                      DisplayName = parts[i],
+                                      ObjectInfo = new ObjectInfo
+                                                       {
+                                                           Account = item.Account,
+                                                           Container = item.Container,
+                                                           Name = nodeName,
+                                                           StorageUri=item.StorageUri,
+                                                           Content_Type = "application/directory"
+                                                       }
+                                  };
+                AddNode(rootNodes, lookups, newNode);
+            }
+        }
+
+        private static string GetStorageUri(ObjectInfo item)
+        {
+            var storageParts = item.StorageUri.ToString().Split('/');
+            var accountUri = String.Join("/", storageParts, 0, storageParts.Length - 1);
+            return accountUri;
+        }
+
+        private static void AddNode(List<DirectoryRecord> rootNodes, Dictionary<string, DirectoryRecord> lookups, DirectoryRecord newNode)
         {
             DirectoryRecord parent;
+            var path = newNode.ObjectInfo.Uri.ToString();
+            var parentPath = GetParentPath(path);
             lookups[path] = newNode;
 
+            //If the record is a directory, we need to add it no matter what
+
+            //If it is a file, we need to check that its parent node exists
+            //If the parent node doesn't exist, we need to add a node for it.
+            //We need to add nodes for all parents recursively,in case they don't exist
 
             //Does a parent item exist? 
             if (lookups.TryGetValue(parentPath, out parent))