예제 #1
0
        public static bool CopyFolder(string source, string destination)
        {
            bool result;

            try
            {
                if (destination[destination.Length - 1] != Path.DirectorySeparatorChar)
                {
                    destination += Path.DirectorySeparatorChar;
                }
                if (!Directory.Exists(destination))
                {
                    Directory.CreateDirectory(destination);
                }
                string[] fileSystemEntries = Directory.GetFileSystemEntries(source);
                string[] array             = fileSystemEntries;
                for (int i = 0; i < array.Length; i++)
                {
                    string text = array[i];
                    if (Directory.Exists(text))
                    {
                        FileSystemManager.CopyFolder(text, destination + Path.GetFileName(text));
                    }
                    else
                    {
                        File.Copy(text, destination + Path.GetFileName(text), true);
                    }
                }
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
예제 #2
0
 public static List <FileSystemItem> GetItems()
 {
     return(FileSystemManager.GetItems(FileSystemManager.strRootFolder));
 }