C:\Data\Users\DefApps\AppData\{APPID}\Local\shared\transfers\title=null3rd%20Prototype%20feat.%20Meg%20&%20Dia%20-%20Monster%20(Extended%20Mix%20Edit).mp3
This is the output from printing the files in the transfers folder as shown below.
string root = ApplicationData.Current.LocalFolder.Path;
StorageFolder localRoot = await StorageFolder.GetFolderFromPathAsync(root + @"\shared\transfers\");
IReadOnlyList<StorageFile> files;
files = await localRoot.GetFilesAsync(CommonFileQuery.DefaultQuery);
for (int l = 0; l < files.Count; l++)
{
System.Diagnostics.Debug.WriteLine(files[l].Path);
}
Then I am trying to move/copy the file to the root folder after the download completes.
Here is the file being moved/copied.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
var folder = ApplicationData.Current.LocalFolder;
if (isoStore.FileExists(App.ViewModel.DownloadQueue.ElementAt(i).FileName))
{
isoStore.DeleteFile(App.ViewModel.DownloadQueue.ElementAt(i).FileName);
}
try
{
if (isoStore.FileExists("/shared/transfers/" + App.ViewModel.DownloadQueue.ElementAt(i).FileName))
{
isoStore.CopyFile("/shared/transfers/" + App.ViewModel.DownloadQueue.ElementAt(i).FileName, App.ViewModel.DownloadQueue.ElementAt(i).FileName);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
}
The isoStore.CopyFile() method never executes though because isoStore says the file does not exist!
When you store the files into IsolatedStorage, did you make sure that you encoded the file path correctly? It looks like there are spaces in the file path, which may present a problem when reading and writing.
Take a look at the HttpUtility.UrlEncode method.