コード例 #1
0
ファイル: FileManager.cs プロジェクト: JoHwanhee/FileSearcher
        private void Load(Component parentComponent, string currentFolderName)
        {
            try
            {
                DirectoryInfo currentDirectoryInfo = new DirectoryInfo(currentFolderName);
                Folder        currentFolder        = new Folder(currentDirectoryInfo);

                foreach (var direcotory in Directory.GetDirectories(currentFolderName))
                {
                    DirectoryInfo directoryInfo = new DirectoryInfo(direcotory);
                    Load(currentFolder, directoryInfo.FullName);
                }

                foreach (var file in currentDirectoryInfo.GetFiles())
                {
                    currentFolder.AddChlid(new File(file));
                }

                parentComponent.AddChlid(currentFolder);
            }
            catch (Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }
        }