Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
WinRT: removed some now-unnecessary file loading code
  • Loading branch information
DavidLudwig committed Feb 3, 2013
1 parent 3570931 commit 96b3321
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/video/windowsrt/DirectXHelper.h
Expand Up @@ -14,28 +14,4 @@ namespace DX
throw Platform::Exception::CreateException(hr);
}
}

// Function that reads from a binary file asynchronously.
inline Concurrency::task<Platform::Array<byte>^> ReadDataAsync(Platform::String^ filename)
{
using namespace Windows::Storage;
using namespace Concurrency;

auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation;

return create_task(folder->GetFileAsync(filename)).then([] (StorageFile^ file)
{
return file->OpenReadAsync();
}).then([] (Streams::IRandomAccessStreamWithContentType^ stream)
{
unsigned int bufferSize = static_cast<unsigned int>(stream->Size);
auto fileBuffer = ref new Streams::Buffer(bufferSize);
return stream->ReadAsync(fileBuffer, bufferSize, Streams::InputStreamOptions::None);
}).then([] (Streams::IBuffer^ fileBuffer) -> Platform::Array<byte>^
{
auto fileData = ref new Platform::Array<byte>(fileBuffer->Length);
Streams::DataReader::FromBuffer(fileBuffer)->ReadBytes(fileData);
return fileData;
});
}
}

0 comments on commit 96b3321

Please sign in to comment.