How can i include an external file in a XBAP application? For example a .dat file where i need to extract some data from? I want everything to happen inside the .xbap file, is that possible?
Asked
Active
Viewed 412 times
2 Answers
1
byte[] ba = Properties.Resources.yourfilename;
//set Build Action to Resource and Rebuild
using (var compressedStream = new MemoryStream(ba))
using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
using (var resultStream = new MemoryStream())
{
zipStream.CopyTo(resultStream);
ba1 = resultStream.ToArray();
}

Petroff
- 21
- 2
-
1Welcome to stackoverflow! It's always better to provide a short description for a sample code to improve the post accuracy :) – Picrofo Software Oct 21 '12 at 22:13
0
You can add the .dat as a resource to the project then during runtime extract using a stream and save to a file on temp folder

Tony
- 16,527
- 15
- 80
- 134