// Copyright (c) 2026 Duplicati Inc. All rights reserved.
using Duplicati.Library.Interface;
using Duplicati.Library.Utility;
using Duplicati.Proprietary.LicenseChecker;
namespace Duplicati.Proprietary.LoaderHelper;
///
/// Shared list of statically linked source-provider modules
///
public static class SourceProviderModules
{
///
/// The list of all built-in source-provider modules
///
public static IReadOnlyList LicensedSourceProviderModules
{
get
{
// Safegard against errors during loading, e.g. missing libraries
try
{
return LicensedSourceProvidersLazy.Value;
}
catch
{
return Array.Empty();
}
}
}
///
/// Calculate list once and cache it
///
private static Lazy> LicensedSourceProvidersLazy = new(() =>
new ISourceProviderModule?[] {
LicenseHelper.IsOffice365Enabled ? new Office365.SourceProvider() : null,
LicenseHelper.IsGoogleWorkspaceEnabled ? new GoogleWorkspace.SourceProvider() : null,
new DiskImage.SourceProvider()
}
.WhereNotNull()
.ToList()
);
}