@@ -94,19 +94,28 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(
9494
9595 public override async Task GetSpecialPropertiesAsync ( )
9696 {
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
97101 ViewModel . IsReadOnly = Win32Helper . HasFileAttribute ( Item . ItemPath , System . IO . FileAttributes . ReadOnly ) ;
98102 ViewModel . IsHidden = Win32Helper . HasFileAttribute ( Item . ItemPath , System . IO . FileAttributes . Hidden ) ;
99103 ViewModel . CanCompressContent = Win32Helper . CanCompressContent ( Item . ItemPath ) ;
100- ViewModel . IsContentCompressed = Win32Helper . HasFileAttribute ( Item . ItemPath , System . IO . FileAttributes . Compressed ) ;
101-
102104 ViewModel . ItemSizeVisibility = true ;
103105 ViewModel . ItemSize = Item . FileSizeBytes . ToLongSizeString ( ) ;
104106
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+ }
113+ else
114+ {
115+ ViewModel . IsContentCompressed = false ;
116+ }
109117
118+ // Load icon
110119 var result = await FileThumbnailHelper . GetIconAsync (
111120 Item . ItemPath ,
112121 Constants . ShellIconSizes . ExtraLarge ,
@@ -120,17 +129,20 @@ public override async Task GetSpecialPropertiesAsync()
120129 ViewModel . LoadFileIcon = true ;
121130 }
122131
132+ // Handle shortcut properties
123133 if ( Item . IsShortcut )
124134 {
125135 ViewModel . ItemCreatedTimestampReal = Item . ItemDateCreatedReal ;
126136 ViewModel . ItemAccessedTimestampReal = Item . ItemDateAccessedReal ;
137+
127138 if ( Item . IsLinkItem || string . IsNullOrWhiteSpace ( ( ( IShortcutItem ) Item ) . TargetPath ) )
128139 {
129140 // Can't show any other property
130141 return ;
131142 }
132143 }
133144
145+ // Get file for further processing
134146 string filePath = ( Item as IShortcutItem ) ? . TargetPath ?? Item . ItemPath ;
135147 BaseStorageFile file = await AppInstance . ShellViewModel . GetFileFromPathAsync ( filePath ) ;
136148
@@ -142,15 +154,18 @@ public override async Task GetSpecialPropertiesAsync()
142154 if ( Item . IsShortcut )
143155 return ;
144156
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- }
157+ // Load uncompressed size for browsable zip files on device
158+ if ( isOnDevice && FileExtensionHelpers . IsBrowsableZipFile ( Item . FileExtension , out _ ) )
159+ {
160+ if ( await ZipStorageFolder . FromPathAsync ( Item . ItemPath ) is ZipStorageFolder zipFolder )
161+ {
162+ var uncompressedSize = await zipFolder . GetUncompressedSize ( ) ;
163+ ViewModel . UncompressedItemSize = uncompressedSize . ToLongSizeString ( ) ;
164+ ViewModel . UncompressedItemSizeBytes = uncompressedSize ;
165+ }
166+ }
153167
168+ // Get other properties if available
154169 if ( file . Properties is not null )
155170 GetOtherPropertiesAsync ( file . Properties ) ;
156171 }
0 commit comments