mirror of
https://github.com/wismna/ModernKeePassLib.git
synced 2025-10-03 15:40:20 -04:00
18 lines
517 B
C#
18 lines
517 B
C#
using System.IO;
|
|
using Windows.Storage.Streams;
|
|
|
|
namespace ModernKeePassLibPCL.Utility
|
|
{
|
|
public static class StreamExtensions
|
|
{
|
|
public static Stream AsStream(this IRandomAccessStream inputStream)
|
|
{
|
|
var reader = new DataReader(inputStream.GetInputStreamAt(0));
|
|
var bytes = new byte[inputStream.Size];
|
|
reader.LoadAsync((uint)inputStream.Size).GetResults();
|
|
reader.ReadBytes(bytes);
|
|
return new MemoryStream(bytes);
|
|
}
|
|
}
|
|
}
|