I have problem with handling files passed to my application in OnFileActivated()
. First, I've registred specific file extention in Package.appminifest
of my application, so after tap into specific file my application starts and run OnFileActivated function.
In my case file is archive zipped with System.IO.Compression.ZipArchive
, but I think it's not crutial here. Beggining of my function looks as follow:
protected override async void OnFileActivated(FileActivatedEventArgs args) {
base.OnFileActivated(args);
var file = args.Files[0];
using (var archive = ZipFile.OpenRead(file.Path)) {
...
As some of you can expect I get an error when I'm trying to access file in last line. I also tried different solutions as copying file into local folder and then access it, but also without luck.
Question Is there any way to do such thing? Or maybe I'm doing it completely wrong way?
Using the
Path
property will not be useful for a brokered file (such as you get from Activation). Use the constructor that takes aStream
instead.Here is the correct answer:
I haven't noticed before that
ZipArchive
have constructor which takes stream as a parameter.