Added functions to create a new FileSystemObjectModel from multiple files or certain files in a particular directory
This commit is contained in:
parent
cb8af8959c
commit
91c5613d6b
@ -41,6 +41,25 @@ namespace UniversalEditor.ObjectModels.FileSystem
|
||||
}
|
||||
}
|
||||
|
||||
public static FileSystemObjectModel FromFiles(string[] fileNames)
|
||||
{
|
||||
FileSystemObjectModel fsom = new FileSystemObjectModel();
|
||||
|
||||
foreach (string fileName in fileNames)
|
||||
{
|
||||
FileSystemObjectModel fsom1 = UniversalEditor.Common.Reflection.GetAvailableObjectModel<FileSystemObjectModel>(fileName);
|
||||
if (fsom1 == null) continue;
|
||||
|
||||
fsom1.CopyTo(fsom);
|
||||
}
|
||||
return fsom;
|
||||
}
|
||||
public static FileSystemObjectModel FromDirectory(string path, string searchPattern = "*.*", System.IO.SearchOption searchOption)
|
||||
{
|
||||
string[] files = System.IO.Directory.GetFiles(path, searchPattern, searchOption);
|
||||
return FromFiles(files);
|
||||
}
|
||||
|
||||
private File.FileCollection mvarFiles = new File.FileCollection();
|
||||
public File.FileCollection Files { get { return mvarFiles; } }
|
||||
private Folder.FolderCollection mvarFolders = new Folder.FolderCollection();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user