1
+ using Files . App . Shell ;
1
2
using Files . Shared . Cloud ;
2
3
using Files . Shared . Extensions ;
3
4
using Microsoft . Win32 ;
@@ -21,6 +22,7 @@ public static async Task<IEnumerable<ICloudProvider>> DetectCloudDrives()
21
22
SafetyExtensions . IgnoreExceptions ( DetectSharepoint , App . Logger ) ,
22
23
SafetyExtensions . IgnoreExceptions ( DetectGenericCloudDrive , App . Logger ) ,
23
24
SafetyExtensions . IgnoreExceptions ( DetectYandexDisk , App . Logger ) ,
25
+ SafetyExtensions . IgnoreExceptions ( DetectpCloudDrive , App . Logger ) ,
24
26
} ;
25
27
26
28
await Task . WhenAll ( tasks ) ;
@@ -199,5 +201,27 @@ private static Task<IEnumerable<ICloudProvider>> DetectSharepoint()
199
201
200
202
return Task . FromResult < IEnumerable < ICloudProvider > > ( sharepointAccounts ) ;
201
203
}
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
+ }
202
226
}
203
227
}
0 commit comments