@@ -94,19 +94,24 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(
94
94
95
95
public override async Task GetSpecialPropertiesAsync ( )
96
96
{
97
+ // Check if item is on device (not online)
98
+ var isOnDevice = Item . SyncStatusUI . SyncStatus is not CloudDriveSyncStatus . FileOnline and not CloudDriveSyncStatus . FolderOnline ;
99
+
100
+ // Set basic file attributes
97
101
ViewModel . IsReadOnly = Win32Helper . HasFileAttribute ( Item . ItemPath , System . IO . FileAttributes . ReadOnly ) ;
98
102
ViewModel . IsHidden = Win32Helper . HasFileAttribute ( Item . ItemPath , System . IO . FileAttributes . Hidden ) ;
99
103
ViewModel . CanCompressContent = Win32Helper . CanCompressContent ( Item . ItemPath ) ;
100
- ViewModel . IsContentCompressed = Win32Helper . HasFileAttribute ( Item . ItemPath , System . IO . FileAttributes . Compressed ) ;
101
-
102
104
ViewModel . ItemSizeVisibility = true ;
103
105
ViewModel . ItemSize = Item . FileSizeBytes . ToLongSizeString ( ) ;
104
106
105
- // Only load the size for items on the device
106
- if ( Item . SyncStatusUI . SyncStatus is not CloudDriveSyncStatus . FileOnline and not CloudDriveSyncStatus . FolderOnline )
107
- ViewModel . ItemSizeOnDisk = Win32Helper . GetFileSizeOnDisk ( Item . ItemPath ) ? . ToLongSizeString ( ) ??
108
- string . Empty ;
107
+ // Only check the compressed attribute and size on disk for items on the device
108
+ if ( isOnDevice )
109
+ {
110
+ ViewModel . IsContentCompressed = Win32Helper . HasFileAttribute ( Item . ItemPath , System . IO . FileAttributes . Compressed ) ;
111
+ ViewModel . ItemSizeOnDisk = Win32Helper . GetFileSizeOnDisk ( Item . ItemPath ) ? . ToLongSizeString ( ) ?? string . Empty ;
112
+ }
109
113
114
+ // Load icon
110
115
var result = await FileThumbnailHelper . GetIconAsync (
111
116
Item . ItemPath ,
112
117
Constants . ShellIconSizes . ExtraLarge ,
@@ -120,17 +125,20 @@ public override async Task GetSpecialPropertiesAsync()
120
125
ViewModel . LoadFileIcon = true ;
121
126
}
122
127
128
+ // Handle shortcut properties
123
129
if ( Item . IsShortcut )
124
130
{
125
131
ViewModel . ItemCreatedTimestampReal = Item . ItemDateCreatedReal ;
126
132
ViewModel . ItemAccessedTimestampReal = Item . ItemDateAccessedReal ;
133
+
127
134
if ( Item . IsLinkItem || string . IsNullOrWhiteSpace ( ( ( IShortcutItem ) Item ) . TargetPath ) )
128
135
{
129
136
// Can't show any other property
130
137
return ;
131
138
}
132
139
}
133
140
141
+ // Get file for further processing
134
142
string filePath = ( Item as IShortcutItem ) ? . TargetPath ?? Item . ItemPath ;
135
143
BaseStorageFile file = await AppInstance . ShellViewModel . GetFileFromPathAsync ( filePath ) ;
136
144
@@ -142,15 +150,18 @@ public override async Task GetSpecialPropertiesAsync()
142
150
if ( Item . IsShortcut )
143
151
return ;
144
152
145
- if ( Item . SyncStatusUI . SyncStatus is not CloudDriveSyncStatus . FileOnline and not CloudDriveSyncStatus . FolderOnline )
146
- if ( FileExtensionHelpers . IsBrowsableZipFile ( Item . FileExtension , out _ ) )
147
- if ( await ZipStorageFolder . FromPathAsync ( Item . ItemPath ) is ZipStorageFolder zipFolder )
148
- {
149
- var uncompressedSize = await zipFolder . GetUncompressedSize ( ) ;
150
- ViewModel . UncompressedItemSize = uncompressedSize . ToLongSizeString ( ) ;
151
- ViewModel . UncompressedItemSizeBytes = uncompressedSize ;
152
- }
153
+ // Load uncompressed size for browsable zip files on device
154
+ if ( isOnDevice && FileExtensionHelpers . IsBrowsableZipFile ( Item . FileExtension , out _ ) )
155
+ {
156
+ if ( await ZipStorageFolder . FromPathAsync ( Item . ItemPath ) is ZipStorageFolder zipFolder )
157
+ {
158
+ var uncompressedSize = await zipFolder . GetUncompressedSize ( ) ;
159
+ ViewModel . UncompressedItemSize = uncompressedSize . ToLongSizeString ( ) ;
160
+ ViewModel . UncompressedItemSizeBytes = uncompressedSize ;
161
+ }
162
+ }
153
163
164
+ // Get other properties if available
154
165
if ( file . Properties is not null )
155
166
GetOtherPropertiesAsync ( file . Properties ) ;
156
167
}
0 commit comments