//Mimics the behaviour of System.IO.Directory.InternalGetFileDirectoryNames
        public static string[] InternalGetFileDirectoryNames(string path, string userPathOriginal, string searchPattern, bool includeFiles, bool includeDirs, SearchOption searchOption)
        {
            //TODO: Add SearchOption functionality
            //TODO: What is userPathOriginal?
            //TODO: Add SearchPattern functionality

            List <string> xFileAndDirectoryNames = new List <string>();

            //Validate input arguments
            if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
            {
                throw new ArgumentOutOfRangeException("searchOption");
            }

            searchPattern = searchPattern.TrimEnd(new char[0]);
            if (searchPattern.Length == 0)
            {
                return(new string[0]);
            }

            //Perform search in filesystem
            FilesystemEntry[] xEntries = VFSManager.GetDirectoryListing(path);

            foreach (FilesystemEntry xEntry in xEntries)
            {
                if (xEntry.IsDirectory && includeDirs)
                {
                    xFileAndDirectoryNames.Add(xEntry.Name);
                }
                else if (!xEntry.IsDirectory && includeFiles)
                {
                    xFileAndDirectoryNames.Add(xEntry.Name);
                }
            }

            return(xFileAndDirectoryNames.ToArray());
        }
Exemple #2
0
 static public void Init()
 {
     Console.WriteLine("    Init Virtual File System");
     VFSManager.Init();
 }