-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathStringReader.cs
25 lines (23 loc) · 877 Bytes
/
StringReader.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
using AsyncWindowsClipboard.Clipboard;
using AsyncWindowsClipboard.Modifiers.Readers.Base;
namespace AsyncWindowsClipboard.Modifiers.Readers
{
/// <summary>
/// Reads a <see cref="string" /> text from an <see cref="IClipboardReadingContext" />.
/// </summary>
/// <seealso cref="IClipboardReadingContext" />
internal class StringReader : ClipboardReaderBase<string>
{
public override bool Exists(IClipboardReadingContext context)
{
return context.IsContentTypeOf(ClipboardDataType.UnicodeLittleEndianText);
}
public override string Read(IClipboardReadingContext context)
{
var reader = Factory.Get<UnicodeBytesReader>();
var unicodeBytes = reader.Read(context);
var result = TextService.GetString(unicodeBytes);
return result;
}
}
}