Skip to content

Commit

Permalink
Feature: Add support for Autodesk drive (#11148)
Browse files Browse the repository at this point in the history
  • Loading branch information
hecksmosis authored Feb 3, 2023
1 parent 2f4bce7 commit e9ec5ea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/Files.App/Helpers/CloudDrivesDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static async Task<IEnumerable<ICloudProvider>> DetectCloudDrives()
SafetyExtensions.IgnoreExceptions(DetectpCloudDrive, App.Logger),
SafetyExtensions.IgnoreExceptions(DetectNutstoreDrive, App.Logger),
SafetyExtensions.IgnoreExceptions(DetectSeadriveDrive, App.Logger),
SafetyExtensions.IgnoreExceptions(DetectAutodeskDrive, App.Logger),
};

await Task.WhenAll(tasks);
Expand Down Expand Up @@ -292,5 +293,33 @@ private static Task<IEnumerable<ICloudProvider>> DetectSeadriveDrive()

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

private static Task<IEnumerable<ICloudProvider>> DetectAutodeskDrive()
{
var results = new List<ICloudProvider>();
using var AutodeskKey = Registry.LocalMachine.OpenSubKey(@"Software\Autodesk\Desktop Connector");

if (AutodeskKey is not null)
{
string iconPath = Path.Combine(programFilesFolder, "Autodesk", "Desktop Connector", "DesktopConnector.Applications.Tray.exe");
var iconFile = Win32API.ExtractSelectedIconsFromDLL(iconPath, new List<int>() { 32512 }).FirstOrDefault();
var mainFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "DC");
var autodeskFolders = Directory.GetDirectories(mainFolder, "", SearchOption.AllDirectories);

foreach (var autodeskFolder in autodeskFolders)
{
var folderName = Path.GetFileName(autodeskFolder);
if (folderName is not null)
results.Add(new CloudProvider(CloudProviders.Autodesk)
{
Name = $"Autodesk - {Path.GetFileName(autodeskFolder)}",
SyncFolder = autodeskFolder,
IconData = iconFile?.IconData
});
}
}

return Task.FromResult<IEnumerable<ICloudProvider>>(results);
}
}
}
3 changes: 2 additions & 1 deletion src/Files.Shared/Cloud/CloudProviders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum CloudProviders
pCloud,
AdobeCreativeCloud,
Nutstore,
Seadrive
Seadrive,
Autodesk
}
}

0 comments on commit e9ec5ea

Please sign in to comment.