Revision 1c9bbe2c trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs
b/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs | ||
---|---|---|
150 | 150 |
|
151 | 151 |
var localFolders = SelectiveExtensions.LocalFolders(AccountName, Account.RootPath,client.StorageUrl.AbsoluteUri); |
152 | 152 |
|
153 |
<<<<<<< HEAD |
|
154 | 153 |
AppendToTree(localFolders, rootItem); |
155 |
======= |
|
156 |
foreach (var folder in localFolders) |
|
157 |
{ |
|
158 |
//If this folder is not included in the server folders |
|
159 |
if (!rootItem.Directories.Any(dir => dir.Uri == folder.Uri)) |
|
160 |
{ |
|
161 |
//we need to add it |
|
162 |
//Find the best parent |
|
163 |
|
|
164 |
//One way to do this, is to break the the Uri to its parts |
|
165 |
//and try to find a parent using progressively fewer parts |
|
166 |
var parts = folder.Uri.AbsoluteUri.Split('/'); |
|
167 |
for (var i = parts.Length - 1; i > 0; i--) |
|
168 |
{ |
|
169 |
var parentUrl = String.Join("/",parts.Splice(0, i)); |
|
170 |
var parentUri = new Uri(parentUrl); |
|
171 |
|
|
172 |
var parent = rootItem.Directories.FirstOrDefault(dir => dir.Uri == parentUri); |
|
173 |
if (parent != null) |
|
174 |
{ |
|
175 |
parent.Directories.Add(folder); |
|
176 |
break; |
|
177 |
} |
|
178 |
} |
|
179 |
} |
|
180 |
} |
|
181 |
>>>>>>> 2313b22d680c12277646ac923c3954b91f25d5f6 |
|
182 | 154 |
|
183 | 155 |
//For each local folder that doesn't exist in the server nodes |
184 | 156 |
//find the best matching parent and add the folder below it. |
Also available in: Unified diff