我的程序处理用户指定的所有文件.最好将修改后的文件保留到源文件的目录中. StorageFolder.GetFolderFromPathAsync方法返回“拒绝访问”.
无法添加清单中的文件类型关联,因为处理完文件后会保留其扩展名.什么样的文件(有任何扩展名),用户选择说不可能.
发生错误的代码. @H_404_13@internal async static void SetFile(List<byte> byteArray,StorageFile file) { try { string path = Path.GetDirectoryName(file.Path); StorageFolder newFolder = await StorageFolder.GetFolderFromPathAsync(path); StorageFile newFile = await newFolder.CreateFileAsync(string.Format(@"crt{0}",Path.GetFileName(file.Name)),CreationCollisionOption.FailIfExists); Stream stream = await file.OpenStreamForWriteAsync(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(byteArray); writer.Flush(); } catch (Exception ex) { throw ex; } }
无法添加清单中的文件类型关联,因为处理完文件后会保留其扩展名.什么样的文件(有任何扩展名),用户选择说不可能.
发生错误的代码. @H_404_13@internal async static void SetFile(List<byte> byteArray,StorageFile file) { try { string path = Path.GetDirectoryName(file.Path); StorageFolder newFolder = await StorageFolder.GetFolderFromPathAsync(path); StorageFile newFile = await newFolder.CreateFileAsync(string.Format(@"crt{0}",Path.GetFileName(file.Name)),CreationCollisionOption.FailIfExists); Stream stream = await file.OpenStreamForWriteAsync(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(byteArray); writer.Flush(); } catch (Exception ex) { throw ex; } }
StorageFile文件 – 用户指定的文件.我正在尝试根据源文件的路径创建一个新文件夹.错误 – “拒绝访问”.要访问此文件夹,我必须注册我使用的文件扩展名.是不可能的.请告诉我,我们能解决这个问题吗?或者在我的案例中可以做些什么?
解决方法
据我所知,除非你继续使用保存选择器,否则你无法在PC中保存文件,如果是Windows应用商店应用.这就是为什么你可能会得到Access Denied错误.点击这里查看
File Access and Permissions.
另一方面,您可以在ApplicationData.LocalFolder中始终在专用于应用程序本身的系统位置保存文件.
您可以为应用设置其他功能,以便它可以访问可移动设备.
我不知道别人不是这些.