public bool IsSpecDirectory(DirectorySpec spec, string dirPath) { if (spec.PathNameExcludes.Count > 0) { var relDir = RelativeDirectory(dirPath); var dirnames = DirectoryParts(relDir); if (dirnames.Length > 0) { for (int i = 0; i < dirnames.Length; i++) { if (spec.PathNameExcludes.Contains("\\" + dirnames[i])) { return(false); } } } } if (spec.PathRelativeExcludes.Count > 0) { var relDir = RelativeDirectory(dirPath); if (spec.PathRelativeExcludes.Contains(relDir)) { return(false); } } return(true); }
public SlynchyDirectoryTree(string name, string rootPath) { Spec = new DirectorySpec(); Name = name; RootDirectoryPath = rootPath; if (!String.IsNullOrEmpty(RootDirectoryPath)) { ScanTree(); } }
public SlynchyDirectory(DirectorySpec spec, string rootDirectory, SlynchyDirectory parent, string path) { Spec = spec; RootDirectory = rootDirectory; IsRoot = false; Info = new DirectoryInfo(path); GetDirectoryFiles(); //recursive directory and file object tree here GetSubDirectoryInfo(); }
public SlynchyDirectory(DirectorySpec spec, string rootDirectory, string directoryPath) { //This is the root directory Info, ParentDirectoryInfo is null Spec = spec; RootDirectory = rootDirectory; IsRoot = true; if (!String.IsNullOrEmpty(directoryPath)) { Info = new DirectoryInfo(directoryPath); GetDirectoryFiles(); //Start recursive directory and file object tree here GetSubDirectoryInfo(); //Made sure subdirectories and files of excluded directories are excluded ExcludeFilesInExcludedDirs(); } }
public bool IsSpecFile(DirectorySpec spec, SlynchyFile info) { if (spec.IncludedFileExtensions.Count > 0) { if (spec.IncludedFileExtensions.Contains(info.Info.Extension)) { return(true); } else { return(false); } } if (spec.FileNameExcludes.Count > 0) { if (spec.FileNameExcludes.Contains(info.Info.Name)) { return(false); } } if (spec.FilePathExcludes.Count > 0) { if (spec.FilePathExcludes.Contains(info.Info.FullName)) { return(false); } } if (spec.DirFileExcludes.Count > 0) { var relDir = RelativeDirectory(info.Info.DirectoryName); var relPathFile = Path.Combine(relDir, info.Info.Name); if (spec.DirFileExcludes.Contains(relPathFile)) { return(false); } } return(true); }