@@ -61,7 +61,9 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
6161 using var namespaceKey = Registry . CurrentUser . OpenSubKey ( @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace" ) ;
6262 using var syncRootManagerKey = Registry . LocalMachine . OpenSubKey ( @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager" ) ;
6363
64- foreach ( var subKeyName in namespaceKey ? . GetSubKeyNames ( ) ?? [ ] )
64+ var namespaceKeys = namespaceKey ? . GetSubKeyNames ( ) ?? [ ] ;
65+
66+ foreach ( var subKeyName in namespaceKeys )
6567 {
6668 using var clsidSubKey = SafetyExtensions . IgnoreExceptions ( ( ) => clsidKey ? . OpenSubKey ( subKeyName ) ) ;
6769 if ( clsidSubKey is not null && ( int ? ) clsidSubKey . GetValue ( "System.IsPinnedToNameSpaceTree" ) is 1 )
@@ -90,6 +92,7 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
9092 "ownCloud" => CloudProviders . ownCloud ,
9193 "ProtonDrive" => CloudProviders . ProtonDrive ,
9294 "kDrive" => CloudProviders . kDrive ,
95+ "Lucid" => CloudProviders . LucidLink ,
9396 _ => null ,
9497 } ;
9598
@@ -99,6 +102,7 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
99102 var nextCloudValue = ( string ? ) namespaceSubKey ? . GetValue ( string . Empty ) ;
100103 var ownCloudValue = ( string ? ) clsidSubKey ? . GetValue ( string . Empty ) ;
101104 var kDriveValue = ( string ? ) clsidSubKey ? . GetValue ( string . Empty ) ;
105+ var lucidLinkValue = ( string ? ) clsidSubKey ? . GetValue ( string . Empty ) ;
102106
103107 using var defaultIconKey = clsidSubKey ? . OpenSubKey ( @"DefaultIcon" ) ;
104108 var iconPath = ( string ? ) defaultIconKey ? . GetValue ( string . Empty ) ;
@@ -116,21 +120,29 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
116120 CloudProviders . ownCloud => ! string . IsNullOrEmpty ( ownCloudValue ) ? ownCloudValue : "ownCloud" ,
117121 CloudProviders . ProtonDrive => $ "Proton Drive",
118122 CloudProviders . kDrive => ! string . IsNullOrEmpty ( kDriveValue ) ? kDriveValue : "kDrive" ,
123+ CloudProviders . LucidLink => ! string . IsNullOrEmpty ( lucidLinkValue ) ? lucidLinkValue : "lucidLink" ,
119124 _ => null
120125 } ,
121126 SyncFolder = syncedFolder ,
122- IconData = cloudProvider switch
123- {
124- CloudProviders . ProtonDrive => Win32Helper . ExtractSelectedIconsFromDLL ( iconPath , new List < int > ( ) { 32512 } ) . FirstOrDefault ( ) ? . IconData ,
125- _ => null
126- }
127+ IconData = GetIconData ( iconPath )
127128 } ) ;
128129 }
129130 }
130131
131132 return Task . FromResult < IEnumerable < ICloudProvider > > ( results ) ;
132133 }
133134
135+ private static byte [ ] ? GetIconData ( string iconPath )
136+ {
137+ if ( string . IsNullOrEmpty ( iconPath ) || ! File . Exists ( iconPath ) )
138+ return null ;
139+
140+ if ( iconPath . EndsWith ( ".dll" ) || iconPath . EndsWith ( ".exe" ) )
141+ return Win32Helper . ExtractSelectedIconsFromDLL ( iconPath , new List < int > ( ) { 32512 } ) . FirstOrDefault ( ) ? . IconData ;
142+
143+ return File . ReadAllBytes ( iconPath ) ;
144+ }
145+
134146 private static Task < IEnumerable < ICloudProvider > > DetectOneDrive ( )
135147 {
136148 using var oneDriveAccountsKey = Registry . CurrentUser . OpenSubKey ( @"SOFTWARE\Microsoft\OneDrive\Accounts" ) ;
0 commit comments