@@ -47,19 +47,24 @@ public Registrar(ILog log, IEnumerable<(string Name, Guid Guid, bool AlwaysRegis
4747 /// </summary>
4848 /// <param name="displayName">Human readable display name.</param>
4949 /// <param name="iconPath">Path to the drive ico file.</param>
50+ /// <param name="customColumns">
51+ /// A dictionary where the key represents the column ID (an integer) and the value represents the display name of the column (a string).
52+ /// These columns will appear in Windows File Explorer and can display additional metadata for files and folders,
53+ /// such as lock owner, lock expiration date, or custom identifiers.
54+ /// </param>
5055 /// <remarks>
5156 /// In the case of a packaged installer (msix) call this method during first program start.
5257 /// In the case of a regular installer (msi) call this method during installation.
5358 /// </remarks>
54- public async Task < StorageProviderSyncRootInfo > RegisterSyncRootAsync ( string syncRootId , string userFileSystemRootPath , string remotestorageRootPath , string displayName , string iconPath )
59+ public async Task < StorageProviderSyncRootInfo > RegisterSyncRootAsync ( string syncRootId , string userFileSystemRootPath , string remotestorageRootPath , string displayName , string iconPath , Dictionary < int , string > ? customColumns )
5560 {
5661 StorageProviderSyncRootInfo syncRoot = null ;
5762 if ( ! await IsRegisteredAsync ( userFileSystemRootPath ) )
5863 {
5964 Log . Info ( $ "\n \n Registering sync root.") ;
6065 Directory . CreateDirectory ( userFileSystemRootPath ) ;
6166
62- syncRoot = await RegisterAsync ( syncRootId , userFileSystemRootPath , remotestorageRootPath , displayName , iconPath ) ;
67+ syncRoot = await RegisterAsync ( syncRootId , userFileSystemRootPath , remotestorageRootPath , displayName , iconPath , customColumns ) ;
6368 }
6469 else
6570 {
@@ -293,19 +298,23 @@ private void UnregisterShellExtensions()
293298 /// <param name="remoteStoragePath">Remote storage path. It will be stored inide the sync root to distinguish between sync roots when mounting a new remote storage.</param>
294299 /// <param name="displayName">Human readable display name.</param>
295300 /// <param name="iconPath">Path to the drive ico file.</param>
296- /// <param name="providerID">Provider ID will be stored in sync root to find if this sync root belongs to this application.</param>
301+ /// <param name="customColumns">
302+ /// A dictionary where the key represents the column ID (an integer) and the value represents the display name of the column (a string).
303+ /// These columns will appear in Windows File Explorer and can display additional metadata for files and folders,
304+ /// such as lock owner, lock expiration date, or custom identifiers.
305+ /// </param>
297306 /// <remarks>
298307 /// In the case of a packaged installer (msix) call this method during first program start.
299308 /// In the case of a regular installer (msi) call this method during installation.
300309 /// </remarks>
301- private static async Task < StorageProviderSyncRootInfo > RegisterAsync ( string syncRootId , string path , string remoteStoragePath , string displayName , string iconPath )
310+ private static async Task < StorageProviderSyncRootInfo > RegisterAsync ( string syncRootId , string path , string remoteStoragePath , string displayName , string iconPath , Dictionary < int , string > ? customColumns )
302311 {
303312 StorageProviderSyncRootInfo storageInfo = new StorageProviderSyncRootInfo ( ) ;
304313 storageInfo . Path = await StorageFolder . GetFolderFromPathAsync ( path ) ;
305314 storageInfo . Id = syncRootId ;
306315 storageInfo . DisplayNameResource = displayName ;
307316 storageInfo . IconResource = iconPath ;
308- storageInfo . Version = System . Reflection . Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version . ToString ( ) ;
317+ storageInfo . Version = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version . ToString ( ) ;
309318 storageInfo . RecycleBinUri = new Uri ( "https://userfilesystem.com/recyclebin" ) ;
310319 storageInfo . SetRemoteStoragePath ( remoteStoragePath ) ;
311320 //storageInfo.ProviderId = providerID; // Provider ID is not returned by StorageProviderSyncRootManager.GetCurrentSyncRoots()
@@ -324,14 +333,14 @@ private static async Task<StorageProviderSyncRootInfo> RegisterAsync(string sync
324333 // Adds columns to Windows File Manager.
325334 // Show/hide columns in the "More..." context menu on the columns header in Windows Explorer.
326335 var proDefinitions = storageInfo . StorageProviderItemPropertyDefinitions ;
327- proDefinitions . Add ( new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Owner" , Id = ( int ) CustomColumnIds . LockOwnerIcon } ) ;
328- proDefinitions . Add ( new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Scope" , Id = ( int ) CustomColumnIds . LockScope } ) ;
329- proDefinitions . Add ( new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Expires" , Id = ( int ) CustomColumnIds . LockExpirationDate } ) ;
330- proDefinitions . Add ( new StorageProviderItemPropertyDefinition { DisplayNameResource = "Content ETag" , Id = ( int ) CustomColumnIds . ContentETag } ) ;
331- proDefinitions . Add ( new StorageProviderItemPropertyDefinition { DisplayNameResource = "Metadata ETag" , Id = ( int ) CustomColumnIds . MetadataETag } ) ;
332- proDefinitions . Add ( new StorageProviderItemPropertyDefinition { DisplayNameResource = "ID" , Id = ( int ) CustomColumnIds . Id } ) ;
333-
334-
336+ if ( customColumns != null )
337+ {
338+ foreach ( var column in customColumns )
339+ {
340+ proDefinitions . Add ( new StorageProviderItemPropertyDefinition { DisplayNameResource = column . Value , Id = column . Key } ) ;
341+ }
342+ }
343+
335344 ValidateStorageProviderSyncRootInfo ( storageInfo ) ;
336345
337346 StorageProviderSyncRootManager . Register ( storageInfo ) ;
0 commit comments