Files
duplicati/proprietary/LoaderHelper/RestoreDestinationProviderModules.cs
T
Kenneth Skovhede da246874ec Initial implementation of Google Workspace backup.
This is a WIP and still needs the restore part implemented.

Not all resources are fully tested but basic elements work.
2026-02-04 15:44:23 +01:00

46 lines
1.4 KiB
C#

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