Skip to content

Commit 0e15cdc

Browse files
Fix: Fixed issue where the LucidLink v3 Icon wasn't displayed (#17057)
1 parent 4022ab9 commit 0e15cdc

File tree

3 files changed

+15
-67
lines changed

3 files changed

+15
-67
lines changed

src/Files.App/Utils/Cloud/CloudDrivesDetector.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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");

src/Files.App/Utils/Cloud/Detector/CloudDetector.cs

Lines changed: 0 additions & 1 deletion
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
}

src/Files.App/Utils/Cloud/Detector/LucidLinkCloudDetector.cs

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)