This is a WIP and still needs the restore part implemented. Not all resources are fully tested but basic elements work.
20 lines
774 B
C#
20 lines
774 B
C#
// Copyright (c) 2026 Duplicati Inc. All rights reserved.
|
|
|
|
using Duplicati.Library.Common.IO;
|
|
using Google.Apis.Calendar.v3.Data;
|
|
using System.Text.Json;
|
|
|
|
namespace Duplicati.Proprietary.GoogleWorkspace.SourceItems;
|
|
|
|
internal class CalendarMetadataSourceEntry(string parentPath, CalendarListEntry calendar)
|
|
: StreamResourceEntryBase(SystemIO.IO_OS.PathCombine(parentPath, "metadata.json"), DateTime.UnixEpoch, DateTime.UnixEpoch)
|
|
{
|
|
public override long Size => -1;
|
|
|
|
public override Task<Stream> OpenRead(CancellationToken cancellationToken)
|
|
{
|
|
var json = JsonSerializer.Serialize(calendar, new JsonSerializerOptions { WriteIndented = true });
|
|
return Task.FromResult<Stream>(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
|
|
}
|
|
}
|