System.IO.IsolatedStorage.IsolatedStorageFile.GetDirectoryNames C# (CSharp) Method

GetDirectoryNames() public method

public GetDirectoryNames ( ) : string[]
return string[]
        public string[] GetDirectoryNames() { throw null; }
        public string[] GetDirectoryNames(string searchPattern) { throw null; }

Same methods

IsolatedStorageFile::GetDirectoryNames ( string searchPattern ) : string[]

Usage Example

Esempio n. 1
0
        //*******************************************************************************************
        //Enable this if you'd like to be able access the list from outside the class. All list
        //methods are commented out below and replaced with Debug.WriteLine.
        //Default implementation is to simply output the directories to the console (Debug.WriteLine)
        //so if it looks like nothing's happening, check the Output window :) - keyboardP
        // public static List<string> listDir = new List<string>();
        //********************************************************************************************
        //Use "*" as the pattern string in order to retrieve all files and directories
        public static void GetIsolatedStorageView(string pattern, IsolatedStorageFile storeFile)
        {
            string root = System.IO.Path.GetDirectoryName(pattern);

            if (root != "")
            {
                root += "/";
            }

            string[] directories = storeFile.GetDirectoryNames(pattern);
            //if the root directory has not FOLDERS, then the GetFiles() method won't be called.
            //the line below calls the GetFiles() method in this event so files are displayed
            //even if there are no folders
            //if (directories.Length == 0)
                GetFiles(root, "*", storeFile);

            for (int i = 0; i < directories.Length; i++)
            {
                string dir = directories[i] + "/";

                //Add this directory into the list
                // listDir.Add(root + directories[i]);

                //Write to output window
                Debug.WriteLine(root + directories[i]);

                //Get all the files from this directory
                GetFiles(root + directories[i], pattern, storeFile);

                //Continue to get the next directory
                GetIsolatedStorageView(root + dir + "*", storeFile);
            }
        }
All Usage Examples Of System.IO.IsolatedStorage.IsolatedStorageFile::GetDirectoryNames