There seems to be no way ...as far as I can tell... to get around the IInputStream() returning a stream of Type: System.IO.NetFxToWinRtStreamAdapter.InputStream
I wrote the following method to manually copy the bytes into a new stream, using only the Windows.Storage.Stream types. The WebView has no complaints and everything works fine
private async Task<IInputStream> GetInputStreamFromIOStream(System.IO.Stream stream, long fileSize)
{
try
{
BinaryReader binReader = new BinaryReader(stream);
byte[] byteArr = binReader.ReadBytes((int)fileSize);
var iMS = new InMemoryRandomAccessStream();
var imsOutputStream = iMS.GetOutputStreamAt(0);
DataWriter dataWriter = new DataWriter(imsOutputStream);
dataWriter.WriteBytes(byteArr);
await dataWriter.StoreAsync();
await imsOutputStream.FlushAsync();
return iMS.GetInputStreamAt(0);
}
catch(Exception ex)
{
//Error Handling here
return null;
}
}
Implemented in the following way for those interested:
sourceFile = await current.GetItemAsync("zipfileHere.zip") as StorageFile;
Stream zipStream = await sourceFile.OpenStreamForReadAsync();
ZipArchive archive = new ZipArchive(zipStream, ZipArchiveMode.Read);
ZipArchiveEntry contentFile = archive.GetEntry(archivePathVar);
if (contentFile == null)
throw new Exception("Invalid archive entry");
else
{
try
{
var zipASize = contentFile.Length;
IInputStream stream = await GetInputStreamFromIOStream(contentFile.Open(), zipASize);
return stream;
}
catch (Exception ex)
{
//Some error handling here
}
}