-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIcsWriter.cs
52 lines (47 loc) · 1.4 KB
/
IcsWriter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#region ENBREA.ICS - Copyright (C) STÜBER SYSTEMS GmbH
/*
* ENBREA.ICS
*
* Copyright (C) STÜBER SYSTEMS GmbH
*
* Licensed under the MIT License, Version 2.0.
*
*/
#endregion
using System.IO;
using System.Threading.Tasks;
namespace Enbrea.Ics
{
/// <summary>
/// Serializes a <see cref="IcsCalendar"> instances to a given stream
/// </summary>
public class IcsWriter
{
private TextWriter _textWriter;
/// <summary>
/// Initializes a new instance of the <see cref="IcsWriter"/> class.
/// </summary>
/// <param name="textWriter">The text writer to be used.</param>
public IcsWriter(TextWriter textWriter)
{
_textWriter = textWriter;
}
/// <summary>
/// Serializes an iCalender instance.
/// </summary>
/// <param name="calendar">The iCalender instance</param>
public void Write(IcsCalendar calendar)
{
calendar.WriteContent(_textWriter);
}
/// <summary>
/// Serializes an iCalender instance.
/// </summary>
/// <param name="calendar">The iCalender instance</param>
/// <returns>A task that represents the asynchronous write operation.</returns>
public async Task WriteAsync(IcsCalendar calendar)
{
await calendar.WriteContentAsync(_textWriter);
}
}
}