Skip to content

Commit 31c2847

Browse files
integrated lucid link cloud drive detection into the method DetectGenericCloudDrive
1 parent e7eb815 commit 31c2847

File tree

3 files changed

+16
-68
lines changed

3 files changed

+16
-68
lines changed

Diff for: src/Files.App/Utils/Cloud/CloudDrivesDetector.cs

+16-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ 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+
foreach(var subKeyName in namespaceKey?.GetSubKeyNames() ?? [])
6565
{
6666
using var clsidSubKey = SafetyExtensions.IgnoreExceptions(() => clsidKey?.OpenSubKey(subKeyName));
6767
if (clsidSubKey is not null && (int?)clsidSubKey.GetValue("System.IsPinnedToNameSpaceTree") is 1)
@@ -90,6 +90,7 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
9090
"ownCloud" => CloudProviders.ownCloud,
9191
"ProtonDrive" => CloudProviders.ProtonDrive,
9292
"kDrive" => CloudProviders.kDrive,
93+
"Lucid" => CloudProviders.LucidLink,
9394
_ => null,
9495
};
9596

@@ -99,6 +100,7 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
99100
var nextCloudValue = (string?)namespaceSubKey?.GetValue(string.Empty);
100101
var ownCloudValue = (string?)clsidSubKey?.GetValue(string.Empty);
101102
var kDriveValue = (string?)clsidSubKey?.GetValue(string.Empty);
103+
var lucidLinkValue = (string?)clsidSubKey?.GetValue(string.Empty);
102104

103105
using var defaultIconKey = clsidSubKey?.OpenSubKey(@"DefaultIcon");
104106
var iconPath = (string?)defaultIconKey?.GetValue(string.Empty);
@@ -116,21 +118,29 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
116118
CloudProviders.ownCloud => !string.IsNullOrEmpty(ownCloudValue) ? ownCloudValue : "ownCloud",
117119
CloudProviders.ProtonDrive => $"Proton Drive",
118120
CloudProviders.kDrive => !string.IsNullOrEmpty(kDriveValue) ? kDriveValue : "kDrive",
121+
CloudProviders.LucidLink => !string.IsNullOrEmpty(lucidLinkValue) ? lucidLinkValue : "lucidLink",
119122
_ => null
120123
},
121124
SyncFolder = syncedFolder,
122-
IconData = cloudProvider switch
123-
{
124-
CloudProviders.ProtonDrive => Win32Helper.ExtractSelectedIconsFromDLL(iconPath, new List<int>() { 32512 }).FirstOrDefault()?.IconData,
125-
_ => null
126-
}
125+
IconData = GetIconData(iconPath)
127126
});
128127
}
129128
}
130129

131130
return Task.FromResult<IEnumerable<ICloudProvider>>(results);
132131
}
133132

133+
private static byte[]? GetIconData(string iconPath)
134+
{
135+
if (string.IsNullOrEmpty(iconPath) || !File.Exists(iconPath))
136+
return null;
137+
138+
if (iconPath.EndsWith(".dll") || iconPath.EndsWith(".exe"))
139+
return Win32Helper.ExtractSelectedIconsFromDLL(iconPath, new List<int>() { 32512 }).FirstOrDefault()?.IconData;
140+
141+
return File.ReadAllBytes(iconPath);
142+
}
143+
134144
private static Task<IEnumerable<ICloudProvider>> DetectOneDrive()
135145
{
136146
using var oneDriveAccountsKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\OneDrive\Accounts");

Diff for: src/Files.App/Utils/Cloud/Detector/CloudDetector.cs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ private static IEnumerable<ICloudDetector> EnumerateDetectors()
3333
yield return new BoxCloudDetector();
3434
yield return new GenericCloudDetector();
3535
yield return new SynologyDriveCloudDetector();
36-
yield return new LucidLinkCloudDetector();
3736
}
3837
}
3938
}

Diff for: src/Files.App/Utils/Cloud/Detector/LucidLinkCloudDetector.cs

-61
This file was deleted.

0 commit comments

Comments
 (0)