Ejemplo n.º 1
0
        public static string[] getFiles(string directory, bool recursively = false)
        {
            if (string.IsNullOrEmpty(directory))
            {
                throw new ArgumentNullException("directory");
            }

            string[] files = null;

            if (recursively)
            {
                List <string> list = new List <string>(1);
                TezFilePath.getFilesRecursively(directory, ref list);
                files = list.ToArray();
            }
            else
            {
                files = Directory.GetFiles(directory);
            }

            for (int i = 0; i < files.Length; i++)
            {
                files[i] = TezFilePath.cleanPath(files[i]);
            }

            return(files);
        }
Ejemplo n.º 2
0
        public static string[] getDirs(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("directory");
            }

            var dirs = Directory.GetDirectories(path);

            for (int i = 0; i < dirs.Length; i++)
            {
                dirs[i] = TezFilePath.cleanPath(dirs[i]);
            }

            return(dirs);
        }
Ejemplo n.º 3
0
        private static void getFilesRecursively(string directory, ref List <string> container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            string[] files = Directory.GetFiles(directory);
            container.Capacity += files.Length;
            container.AddRange(files);

            string[] directories = Directory.GetDirectories(directory);
            for (int i = 0; i < directories.Length; i++)
            {
                TezFilePath.getFilesRecursively(directories[i], ref container);
            }
        }