1+ using Files . App . Shell ;
12using Files . Shared . Cloud ;
23using Files . Shared . Extensions ;
34using Microsoft . Win32 ;
@@ -21,6 +22,7 @@ public static async Task<IEnumerable<ICloudProvider>> DetectCloudDrives()
2122 SafetyExtensions . IgnoreExceptions ( DetectSharepoint , App . Logger ) ,
2223 SafetyExtensions . IgnoreExceptions ( DetectGenericCloudDrive , App . Logger ) ,
2324 SafetyExtensions . IgnoreExceptions ( DetectYandexDisk , App . Logger ) ,
25+ SafetyExtensions . IgnoreExceptions ( DetectpCloudDrive , App . Logger ) ,
2426 } ;
2527
2628 await Task . WhenAll ( tasks ) ;
@@ -199,5 +201,27 @@ private static Task<IEnumerable<ICloudProvider>> DetectSharepoint()
199201
200202 return Task . FromResult < IEnumerable < ICloudProvider > > ( sharepointAccounts ) ;
201203 }
204+
205+ private static Task < IEnumerable < ICloudProvider > > DetectpCloudDrive ( )
206+ {
207+ var results = new List < ICloudProvider > ( ) ;
208+ using var pCloudDriveKey = Registry . CurrentUser . OpenSubKey ( @"SOFTWARE\pCloud" ) ;
209+
210+ var syncedFolder = ( string ) pCloudDriveKey ? . GetValue ( "SyncDrive" ) ;
211+ if ( syncedFolder is not null )
212+ {
213+ string iconPath = Path . Combine ( Environment . GetEnvironmentVariable ( "ProgramFiles" ) , "pCloud Drive" , "pCloud.exe" ) ;
214+ var iconFile = Win32API . ExtractSelectedIconsFromDLL ( iconPath , new List < int > ( ) { 32512 } , 32 ) . FirstOrDefault ( ) ;
215+
216+ results . Add ( new CloudProvider ( CloudProviders . pCloud )
217+ {
218+ Name = $ "pCloud Drive",
219+ SyncFolder = syncedFolder ,
220+ IconData = iconFile ? . IconData
221+ } ) ;
222+ }
223+
224+ return Task . FromResult < IEnumerable < ICloudProvider > > ( results ) ;
225+ }
202226 }
203227}
0 commit comments