public static void CreateLocalDirIfNotExists(string dirPath) { if (!String.Equals(string.Empty, dirPath) && !LongPathDirectoryExtension.Exists(dirPath)) { LongPathDirectoryExtension.CreateDirectory(dirPath); } }
private void BuildDirNode(string dirPath, DirNode parent, bool handleSMBAttributes) { dirPath = AppendDirectorySeparator(dirPath); DateTimeOffset?creationTime = null; DateTimeOffset?lastWriteTime = null; FileAttributes?fileAttributes = null; #if DOTNET5_4 LongPathFileExtension.GetFileProperties(dirPath, out creationTime, out lastWriteTime, out fileAttributes, true); #else LongPathFileExtension.GetFileProperties(dirPath, out creationTime, out lastWriteTime, out fileAttributes); #endif parent.CreationTime = creationTime; parent.LastWriteTime = lastWriteTime; foreach (var fileInfo in LongPathDirectoryExtension.GetFiles(dirPath)) { FileNode fileNode = new FileNode(fileInfo.Remove(0, dirPath.Length)); this.BuildFileNode(fileInfo, fileNode, handleSMBAttributes); parent.AddFileNode(fileNode); } foreach (var subDirInfo in LongPathDirectoryExtension.GetDirectories(dirPath)) { DirNode subDirNode = new DirNode(subDirInfo.Remove(0, dirPath.Length)); this.BuildDirNode(subDirInfo, subDirNode, handleSMBAttributes); parent.AddDirNode(subDirNode); } }
private void BuildDirNode(string dirPath, DirNode parent) { dirPath = AppendDirectorySeparator(dirPath); foreach (var fileInfo in LongPathDirectoryExtension.GetFiles(dirPath)) { FileNode fileNode = new FileNode(fileInfo.Remove(0, dirPath.Length)); this.BuildFileNode(fileInfo, fileNode); parent.AddFileNode(fileNode); } foreach (var subDirInfo in LongPathDirectoryExtension.GetDirectories(dirPath)) { DirNode subDirNode = new DirNode(subDirInfo.Remove(0, dirPath.Length)); this.BuildDirNode(subDirInfo, subDirNode); parent.AddDirNode(subDirNode); } }
public override DMLibDataInfo GetTransferDataInfo(string rootDir) { #if DOTNET5_4 DirectoryInfo rootDirInfo = new DirectoryInfo(Path.Combine(this.BasePath, rootDir)); if (!rootDirInfo.Exists) { return(null); } #else string rootDirInfo = rootDir; if (rootDir.Length == 0) { rootDirInfo = LongPathExtension.Combine(this.BasePath, rootDir); } if (!LongPathDirectoryExtension.Exists(rootDirInfo)) { return(null); } #endif DMLibDataInfo dataInfo = new DMLibDataInfo(rootDir); this.BuildDirNode(rootDirInfo, dataInfo.RootNode); return(dataInfo); }
public DMLibDataInfo GetTransferDataInfo(string rootDir, bool handleSMBAttributes, PreserveSMBPermissions getSMBPermissions) { #if DOTNET5_4 DirectoryInfo rootDirInfo = new DirectoryInfo(Path.Combine(this.BasePath, rootDir)); if (!rootDirInfo.Exists) { return(null); } #else string rootDirInfo = rootDir; if (rootDir.Length == 0) { rootDirInfo = LongPathExtension.Combine(this.BasePath, rootDir); } if (!LongPathDirectoryExtension.Exists(rootDirInfo)) { return(null); } #endif DMLibDataInfo dataInfo = new DMLibDataInfo(rootDir); this.BuildDirNode(rootDirInfo, dataInfo.RootNode, handleSMBAttributes, getSMBPermissions); return(dataInfo); }