我正在处理isolatedstoragefile
我需要从isolatedstoragefile
复制xml文件,然后我需要读取xml文件。
我在行myIsolatedStorage.CopyFile();
中收到错误,该行需要xml文件的路径,该文件位于我的公共文件夹中。设置路径后,它会抛出另一个异常
不允许
代码:
private async void CopyDatabase()
{
bool isDatabaseExisting = false;
try
{
StorageFolder InstallationFolder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Common");
StorageFile file = await InstallationFolder.GetFileAsync("Notification.txt");
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
myIsolatedStorage.CopyFile("Notification.txt","Notification.txt",bool "abc.txt");
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
isDatabaseExisting = true;
}
catch
{
isDatabaseExisting = false;
}
if (!isDatabaseExisting)
{
StorageFolder InstallationFolder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Common");
StorageFile file = await InstallationFolder.GetFileAsync("Notification.xml");
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
myIsolatedStorage.CopyFile(file.DisplayName, file.DisplayName);
}
}