@@ -47,19 +47,24 @@ public Registrar(ILog log, IEnumerable<(string Name, Guid Guid, bool AlwaysRegis
47
47
/// </summary>
48
48
/// <param name="displayName">Human readable display name.</param>
49
49
/// <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>
50
55
/// <remarks>
51
56
/// In the case of a packaged installer (msix) call this method during first program start.
52
57
/// In the case of a regular installer (msi) call this method during installation.
53
58
/// </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 )
55
60
{
56
61
StorageProviderSyncRootInfo syncRoot = null ;
57
62
if ( ! await IsRegisteredAsync ( userFileSystemRootPath ) )
58
63
{
59
64
Log . Info ( $ "\n \n Registering sync root.") ;
60
65
Directory . CreateDirectory ( userFileSystemRootPath ) ;
61
66
62
- syncRoot = await RegisterAsync ( syncRootId , userFileSystemRootPath , remotestorageRootPath , displayName , iconPath ) ;
67
+ syncRoot = await RegisterAsync ( syncRootId , userFileSystemRootPath , remotestorageRootPath , displayName , iconPath , customColumns ) ;
63
68
}
64
69
else
65
70
{
@@ -293,19 +298,23 @@ private void UnregisterShellExtensions()
293
298
/// <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>
294
299
/// <param name="displayName">Human readable display name.</param>
295
300
/// <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>
297
306
/// <remarks>
298
307
/// In the case of a packaged installer (msix) call this method during first program start.
299
308
/// In the case of a regular installer (msi) call this method during installation.
300
309
/// </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 )
302
311
{
303
312
StorageProviderSyncRootInfo storageInfo = new StorageProviderSyncRootInfo ( ) ;
304
313
storageInfo . Path = await StorageFolder . GetFolderFromPathAsync ( path ) ;
305
314
storageInfo . Id = syncRootId ;
306
315
storageInfo . DisplayNameResource = displayName ;
307
316
storageInfo . IconResource = iconPath ;
308
- storageInfo . Version = System . Reflection . Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version . ToString ( ) ;
317
+ storageInfo . Version = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version . ToString ( ) ;
309
318
storageInfo . RecycleBinUri = new Uri ( "https://userfilesystem.com/recyclebin" ) ;
310
319
storageInfo . SetRemoteStoragePath ( remoteStoragePath ) ;
311
320
//storageInfo.ProviderId = providerID; // Provider ID is not returned by StorageProviderSyncRootManager.GetCurrentSyncRoots()
@@ -324,14 +333,14 @@ private static async Task<StorageProviderSyncRootInfo> RegisterAsync(string sync
324
333
// Adds columns to Windows File Manager.
325
334
// Show/hide columns in the "More..." context menu on the columns header in Windows Explorer.
326
335
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
+
335
344
ValidateStorageProviderSyncRootInfo ( storageInfo ) ;
336
345
337
346
StorageProviderSyncRootManager . Register ( storageInfo ) ;
0 commit comments