Exemplo n.º 1
0
        protected virtual void ProcessDirectory(string path, ModelNode parent)
        {
            parent.AddModuleFiles(
                Directory.EnumerateFiles(path)
                    .Select(fileName =>
                        new ModuleFileDefinition
                        {
                            FileName = Path.GetFileName(fileName),
                            Content = File.ReadAllBytes(fileName)
                        }));

            foreach (string name in Directory.EnumerateDirectories(path))
            {
                string folderName = name;
                parent.AddFolder(
                    new FolderDefinition { Name = name.Remove(0, name.LastIndexOf('\\') + 1) },
                    folder => ProcessDirectory(folderName, folder));
            }
        }