// 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 restore-destination-provider modules /// public static class RestoreDestinationProviderModules { /// /// The list of all built-in restore-destination-provider modules /// public static IReadOnlyList LicensedRestoreDestinationProviderModules { get { // Safegard against errors during loading, e.g. missing libraries try { return LicensedRestoreDestinationProvidersLazy.Value; } catch { return Array.Empty(); } } } /// /// Calculate list once and cache it /// private static readonly Lazy> LicensedRestoreDestinationProvidersLazy = new(() => new IRestoreDestinationProviderModule?[] { LicenseHelper.IsOffice365Enabled ? new Office365.RestoreProvider() : null, LicenseHelper.IsGoogleWorkspaceEnabled ? new GoogleWorkspace.RestoreProvider() : null, new DiskImage.RestoreProvider() } .WhereNotNull() .ToList() ); }