Skip to content

Commit 3d7169e

Browse files
authored
Feature: Add pCloud to the cloud drive section (#10801)
1 parent 3b5ab67 commit 3d7169e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Files.App/Helpers/CloudDrivesDetector.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Files.App.Shell;
12
using Files.Shared.Cloud;
23
using Files.Shared.Extensions;
34
using 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
}

src/Files.Shared/Cloud/CloudProviders.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ public enum CloudProviders
1414
Box,
1515
Jottacloud,
1616
SynologyDrive,
17+
pCloud
1718
}
1819
}

0 commit comments

Comments
 (0)