5

如何获取 WPF 应用程序的隔离存储文件的完全限定路径?

4

2 回答 2

8

您可以使用反射来做到这一点,如链接的论坛帖子所示:

IsolatedStorageFileStream oStream =
    new IsolatedStorageFileStream(ISOLATED_FILE_NAME, FileMode.Create, isoStore);

// Get the physical path using reflection

String filePath = oStream.GetType().GetField("m_FullPath",
     BindingFlags.Instance | BindingFlags.NonPublic).GetValue(oStream).ToString();
Console.WriteLine(filePath);
于 2010-09-23T18:37:56.153 回答
0

在 Windows 10 移动版上,独立存储路径等于Windows.Storage.ApplicationData.Current.LocalFolder.

如果您知道隔离存储中的相对文件路径,则可以使用它System.IO.Path.Combine()来创建完整路径。

您可以使用IsolatedStorageFile.GetUserStoreForApplication().GetFileNames()列出隔离存储中的所有文件。

于 2015-10-29T14:42:20.603 回答