Cant get list of files from a folder (even though the folder and files are created with the same app)
Ok so each character rolled with my app gets saved as an html file in a folder i create on the sdcard called RpgApp
the code to do this is
private async Task saveToHtmlCharacter(string name)
StorageFolder externalDevices = Windows.Storage.KnownFolders.RemovableDevices;
StorageFolder sdcard = (await externalDevices.GetFoldersAsync()).FirstOrDefault(); //Windows.Storage.ApplicationData.Current.LocalFolder;
var dataFolder = await sdcard.CreateFolderAsync("RpgApp",
CreationCollisionOption.OpenIfExists);
var file = await dataFolder.CreateFileAsync(name+".html",
CreationCollisionOption.ReplaceExisting);
using (StreamWriter writer = new StreamWriter(await file.OpenStreamForWriteAsync()))
writer.WriteLine("<html><head><title>Character File for " + z.charNameFirst + " " + z.charNameSecond + "</title></head><body>");
//trimed for the post
now this as i say works perfectly and i can confirm that the files show up in the "RpgApp"folder
now the next step is to have the app read the names of each of those html files and create a seperate button for each one named for the filename and with the filename as content (later i will link them up to load the html file they are named for in a webbrowser
panal)
here is the code that *should* do that
private async Task readFiles()
z.test.Clear();
StorageFolder externalDevices = Windows.Storage.KnownFolders.RemovableDevices;
StorageFolder folder = (await externalDevices.GetFolderAsync("RpgApp"));
IReadOnlyList<StorageFile> fileList = await folder.GetFilesAsync();
//z.test.Add("dummy");
foreach (StorageFile file in fileList)
z.test.Add(file.Name);
public async void buttonTest()
await readFiles();
CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
foreach (string name in z.test)
Button button1 = new Button();
button1.Height = 75;
button1.Content = name;
button1.Name = name;
testStackPanal.Children.Add(button1);
now i say should as what i get is an error of "A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.ni.dll" (2 of them in fact one after another)
more detailed error is at http://pastebin.com/3hBaZLQ9
now i went through checking line after line to find the error and line that causes it is:
StorageFolder folder = (await externalDevices.GetFolderAsync("RpgApp"));
in the readFiles method
i checked to make sure the case is right etc and its spot on, that IS the folder name, and remember my app creates that folder and creates the files that are inside that folder (and only files my app creates are in that folder) so it should have access
im 100% stuck its taken me all day to get the files to save and now i cant get them to list correctly
I have tested the button creation function with fake list data and that worked fine, as i say the error is when i tell it to look at the folder it created
all help most greatfully recieved
this was actually solved for me on another forum thread
async Task<bool> continueToReadAllFiles(StorageFolder folder)
if (folder == null)
return false;
if (folder.Name.Equals("RpgApp", StringComparison.CurrentCultureIgnoreCase))
var files = await folder.GetFilesAsync();
foreach (var file in files)
test.Add(file.Name);
return false;
var folders = await folder.GetFoldersAsync();
foreach (var child in folders)
if (!await continueToReadAllFiles(child))
return false;
return true;
public async void buttonTest()
test.Clear();
StorageFolder externalDevices = Windows.Storage.KnownFolders.RemovableDevices;
var folders = await externalDevices.GetFoldersAsync();
foreach (var folder in folders)
if (!await continueToReadAllFiles(folder))
break;
//.... commented out
...now i say solved this is more a workaround...but it works.
I would love to know why we cant just scan the RpgApp folder instead of having to scan the whole dc card and disregard all thats not in the RpgApp folder
Similar Messages
-
My desktop C drive is full HD of 1 TB, I would like to move the current iTunes master file to an external 4TB drive and then iTunes stick with the external drive
Could this be done, if yes how to do it?
Thank you for your help
HenriIf it's the same as with a PC, the procedure would be to:
(a) Plug in the new external drive,
(b) Set your iTunes preferences such that the iTunes Music Folder is on the new drive,
(c) Use the iTunes "Consolidate Library" utility to copy your library to the new location.
(d) When the transfer is complete, check "Get Info" on some songs to verify their location.
The original files will remain on the old drive, so you'll have a way to recover should there be a problem. You may need to manually copy any iPhone/Touch Apps to the new drive since I'm not sure those are transferred with the Consolidate utility. -
so i cant get sir on my iphone 4..even though i downloaded ios6, so i cant get sir on my iphone 4..even though i downloaded ios6
Siri is available only on the iPhone 4s. iOS6 does not "add" Siri to an iPhone 4.
-
I am trying to transfer music files from one PC to another using homeshare and although I can view the music as a shared folder I cannot initiate the "import" process. I have iTunes 11.0.1.12 on both computers so the help screenshots do not help as such
Then stop trying to use HomeShare and use one of the other options listed in the document from which your question was posted.
-
My Lightroom kepps stopping just after being loaded. My Lightroom is 5.4 64 bits installed on a Dell PC with Windows 8.1(upgraded from 8). I have uninstalled Lightroom and re-installed it with the same result. What could be the problem?
Try resetting your preference file next: http://www.lightroomforums.net/showthread.php?14226-Resetting-(or-Trashing-)-the-Lightroom -Preferences-file
It survives an uninstall/reinstall. -
I just purchased an AppleTV and am trying to connect AirPlay with my mac (2012 model) In 'system preferences > displays' an airplay menu is listed but it says 'no device detected'. My AppleTV and macbook are connected to the same network. Any suggestions why it is not working?
Troubleshoot the network as that is likely what is causing the issue.
Also, temporarily disable the firewall on the Mac and disable IPV6 on the computer. -
I installed Adobe FlashPlayer version 13.0 however I am getting an error message "Plug in error". Can anybody provide an answer. I already uninstall the version and install it again with the same results. Thanks.
Adobe admits to a Flash problem here:
http://forums.adobe.com/message/6285851#6285851
YOu can apply the fix they show and tehn wait for them to fix the problem -
How to view the input and output layouts created in the planning folder?
Hi all,
How to view the input and output layouts created in the planning folder in the bw 3.5?
Thanks
PoojaHi,
You can refer to this link. How to create planning folder and executing the planning folder.
http://help.sap.com/saphelp_nw04/Helpdata/EN/5d/7c4b52691011d4b2f00050dadfb23f/frameset.htm
Hope this helps -
What files and directories are shipped with the Oracle Agent ?
Hi:
- Could someone please outline the intent of all the files
and directories that are shipped with the Oracle agent?
- I think this was documented somewhere but I cannot
recall where I saw this previously.
- Another question: if I wanted to add a logfile for my plug-in
(for debugging/troubleshooting)
under which directory should this logfile be placed ?
Thanks
Johnhttp://download.oracle.com/docs/cd/B19306_01/em.102/b40002/structure.htm#i1028189 should help you understand the directory structure of OEM Agent.
-
I have a Canon 70D and my old lightroom3 will not download raw files even though I have downloaded DNG 8.5 on my iMac. how can I overcome this problem?
theovanderveen wrote:
I was being lazy and hoping that Adobe might have created some sort of patch which would allow me to import directly from my camera to lightroom
Neither Adobe, nor any other company that produces a Raw converter, ever retrospectively adds new camera support to old (obsolete) versions of their software. -
Could anyone tell me what to do to solve the problem. I updated FCPX to 10.9 and the program keeps on crash every time I try to read files stored in my LaCie hard drive. And the program also keeps on crash every time I try to import files from my SDXC cards.
I have solved the problem. Once the update is done, you need to launch FCPX, and go to File, then "update all events and projects". It will solve the problem and everything works fine.
-
???
There is no stock answer.....the time to transfer depends on computer speed, amount of data...and so on.
I set my computer to never sleep when I am migrating data.
Barry -
when i open firefox it immediately goes to the bottom tool bar and keeps running. a new home page then opens and i cant close the one at the bottom because there is no icon. these hidden pages keep playing old youtube song and another one with adds running. how do i close these pages please? also if i minimise firefox to go onto say, email, i cant retrieve it and have to then open another home page. argggghhhhhhhh. help please. thanks and have a great, 'quiet' day. beth
This issue can be caused by an extension that isn't working properly.
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes -
Wait- do even though it says ios 6 is compatable with the itouch, we won't get Siri?
Cuz idk
Not all different iOS devices will get SIri via iOS 6. The iPhone 4S already has Siri and only the iPad 3 gets Siri via iOS 5.
-
sometimes fire fox will start talking again, most of the time it take a reboot to fix it, as it may set there spinning, for hours, and i do not have time to fool with it, and a reboot is a pain
Hi,
Do you have this problem with the ethernet and wireless connection ?
Did you installed any windows updated on your Windows 8.1 ?
A+
HK.
Hicham KADIRI | Just Another IT Guy
Maybe you are looking for
-
SLiM crashes X on switch to console, prevents resume
i'm facing something of a mystery, here. when i switch to a virtual console ( <ctrl>+<alt>+f{1-9} ) after logging into a desktop session via slim, the x session crashes and i'm presented with a new slim login screen. i first noticed this while (final
-
Podcast subscriptions no longer download
Since a few days ago, my subscribed video podcasts like "Ellen in a minute" and "Meet the Press" have stopped downloading. Now matter how many times I try to "get" the missing episodes the download never starts and then times out. The store otherwise
-
I have a new computer. How do I transfer my itunes library to the new computer?
I have a new computer. How do I transfer my itunes library to the new computer?
-
hi, i've recently switched from blackberry to the iphone 4 and was curious to how i quit apps? on my blackberry i know that if i keep anything running in the background e.g. mail, browser and not formally 'close' it, it will slow down my bb. does iph
-
I've uploaded a photo which was 72 dpi and my tools aren't responding as fast as they normally do. AI works fine but photoshop is slow. I have paid for the monthly subscription