UWP

2016-06-29 7 views
0

내가 파일을 압축 해제하기 위해 노력하고있어에서 파일을 압축 해제,하지만 난 항상 경로에UWP

접근 한 방법 'C : \ 사용자 \ 코 소프 데니스 \ 다운로드 \ 12.epub가'거부 입니다.

나는 무엇을 했습니까?

await Task.Run(() => 
      { 
       ZipFile.ExtractToDirectory(file.Path, 
        ApplicationData.Current.LocalCacheFolder.Path + 
        string.Format(@"\{0}", file.Name.Replace(file.FileType, ""))); 
      }); 
+2

이다 여기에 읽기] (http://stackoverflow.com/questions/33082835/windows-10- : 나는이 문제를 해결하기 위해 곡선을 사용 유니버설 - 응용 - 파일 - 디렉토리 - 액세스) 폴더 및 디렉토리 당신이 액세스 할 수 있습니다. – Irfan

답변

2

내가 당신과 같은 문제가 발생 한 오랫동안 내 구글 UWP가 로컬 파일을 방문 할 경우, 파일에 액세스 할 경로를 통해 직접하지 보인다 발견, 당신은 파일을 사용할 필요가 픽업, 참조 : hele. 이 UWP 응용 프로그램에 액세스 권한 문제가

StorageFolder folder; 
folder = ApplicationData.Current.LocalFolder; 

//Open the file picker 
var _openFile = new FileOpenPicker(); 
_openFile.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; 
_openFile.ViewMode = PickerViewMode.List; 
_openFile.FileTypeFilter.Add(".zip"); 
StorageFile file = await _openFile.PickSingleFileAsync(); 

//Read the file stream 
Stream a = await file.OpenStreamForReadAsync(); 

//unzip 
ZipArchive archive = new ZipArchive(a); 
archive.ExtractToDirectory(folder.Path); 

ZipArchive Class