c# - How do you get a flat listing of all files in IsolatedStorage? -


I need to get a list of all the files in the given IsolatedStorage folder. The isolatedStorage root contains sub folders and these Need to be included in the list.

General System. IoO classes can not be used with IsolatedStorage.

This is who I came with - it works but I would be interested to see that What are the better options:

 using the  system. Colllections.Generic; Using System.IO; Using System.IO.IsolatedStorage; Using System.Linq; Public Static Class IsolatedStorageFileExtensions {/// & lt; Summary & gt; /// The list of all files in different networks is found repeatedly /// & lt; / Summary & gt; /// & lt; Comment & gt; Based on & lt; See cref = "http://dotnetperls.com/recursively-find-files" /> gt; & Lt; / Remark & ​​gt; /// & lt; Param name = "isolated storage file" & gt; & Lt; / Param & gt; /// & lt; Returns & gt; & Lt; / Returns & gt; Public static list & lt; String & gt; GetAllFilePaths (This isolatedStorageFile isolatedStorageFile) {// Results file list in store results results list & lt; String & gt; Results = New list & lt; String & gt; (); // Store a stack of our directories stack & lt; String & gt; Stack = new stack & lt; String & gt; (); // initial directory string initial directory = "*"; Stack.Push (initialDirectory); // There are directories to continue while issuing (Stack.Count & gt; 0) {// Top Directory String DIR = Go Stack. Pop (); String directory; If (DIR == "*") {directoryPath = "*"; } Else {directoryPath = dir + @ "\ *"; } // In order to result in all the files in this directory, enter the ins Insert Directory = Different Storage File.GetFilename (DirectShop) .Oolist & lt; String & gt; (); & Lt; String & gt; FilesInCurrentDirectoryWithFolderName = New list & lt; String & gt; (); // File name prefix with first name file name (Internet directory in file string file in files) {filesInCurrentDirectoryWithFolderName.Add (Path.Combine (dir, file)); } result. AddRange (fileInteriorReferenceistFoolerName); // Add all directories on this directory foreach (string directory isolatedStorageFile.GetDirectoryNames (directoryPath)) {stack.Push (directoryName); }} Return result; }}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -