|
6 | 6 | using Microsoft.UI.Xaml.Controls; |
7 | 7 | using Microsoft.UI.Xaml.Media.Imaging; |
8 | 8 | using Windows.Storage; |
| 9 | +using Windows.Storage.Provider; |
9 | 10 | using Windows.Storage.Streams; |
10 | 11 | using ByteSize = ByteSizeLib.ByteSize; |
11 | 12 |
|
@@ -278,7 +279,37 @@ public async Task UpdatePropertiesAsync() |
278 | 279 | { |
279 | 280 | try |
280 | 281 | { |
281 | | - var properties = await Root.Properties.RetrievePropertiesAsync(["System.FreeSpace", "System.Capacity", "System.Volume.FileSystem"]) |
| 282 | + |
| 283 | + // Double check version |
| 284 | + //IDictionary<string, object>? properties = null; |
| 285 | + //bool propsAssigned = false; |
| 286 | + //if (string.IsNullOrEmpty(Root.Path) && Path.StartsWith(@"\\?\", StringComparison.Ordinal)) |
| 287 | + //{ |
| 288 | + // var systemFolder = ; |
| 289 | + // if (systemFolder != null) |
| 290 | + // { |
| 291 | + // properties = await systemFolder.Properties.RetrievePropertiesAsync(["System.FreeSpace", "System.Capacity", "System.Volume.FileSystem"]) |
| 292 | + // .AsTask().WithTimeoutAsync(TimeSpan.FromSeconds(5)); |
| 293 | + // propsAssigned = properties is not null; |
| 294 | + // } |
| 295 | + //} |
| 296 | + |
| 297 | + //if (!propsAssigned) |
| 298 | + //{ |
| 299 | + // properties = await Root.Properties.RetrievePropertiesAsync(["System.FreeSpace", "System.Capacity", "System.Volume.FileSystem"]) |
| 300 | + // .AsTask().WithTimeoutAsync(TimeSpan.FromSeconds(5)); |
| 301 | + //} |
| 302 | + //---------------------------------------------- |
| 303 | + |
| 304 | + var propertiesSource = Root; |
| 305 | + if (string.IsNullOrEmpty(Root.Path) && |
| 306 | + Path.StartsWith(@"\\?\", StringComparison.Ordinal) && |
| 307 | + (await Root.GetFoldersAsync())[0] is StorageFolder systemFolder) |
| 308 | + { |
| 309 | + propertiesSource = systemFolder; |
| 310 | + } |
| 311 | + |
| 312 | + var properties = await propertiesSource.Properties.RetrievePropertiesAsync(["System.FreeSpace", "System.Capacity", "System.Volume.FileSystem"]) |
282 | 313 | .AsTask().WithTimeoutAsync(TimeSpan.FromSeconds(5)); |
283 | 314 |
|
284 | 315 | if (properties is not null && properties["System.Capacity"] is not null && properties["System.FreeSpace"] is not null) |
|
0 commit comments