Thursday, June 28, 2012

Windows 8 Release Preview – back to earth

Hurray, we got a workaround for the problem of the previous blog. This works:

IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);

for (ulong i = 0; i < stream.Size; i++)
{
    stream.Seek(i);

    byte[] data = new byte[1];

    await stream.ReadAsync(data.AsBuffer(), 1, InputStreamOptions.None);

    if (stream.Position > stream.Size)
    {
       // Never happens, which is as expected.

    }

}

The credits for finding this go to Gionata from paperlit.com. Thanks!

Note that the main difference appears to be:

IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);

As opposed to:

Stream stream = await file.OpenStreamForReadAsync();

Weird, eh? One would say that both expressions are basically synonymous.

Well, this means back to work, were it not for the summer holidays…

Author: Marco Kesseler

2 comments:

  1. Are you still working on the Win8 version of PDFRasterizer.NET ? Any approximative release date ? Thanks

    ReplyDelete
    Replies
    1. We have just released a PDFRasterizer.NET 4.0 Beta that includes a WinRT edition. To join the beta group, send a request to sales@tallcomponents.com.

      Delete