public DelimonDirectoryInfoWrapper(string fullName) { _instance = new Delimon.Win32.IO.DirectoryInfo(fullName); }
public DelimonDirectoryInfoWrapper(MyRecursionHelpers helpers, DirectoryInfo instance) { _helpers = helpers; _instance = instance; }
public DelimonDirectoryInfoWrapper(System.IO.DirectoryInfo instance) { _instance = new Delimon.Win32.IO.DirectoryInfo(instance.FullName); }
/// <summary> /// Parse the FileSystemName and retrieve a FileDataInfo or DirectoryDataInfo /// with DestinyPath as destPath param. /// </summary> /// <param name="FileSystemName"></param> /// <param name="destPath"></param> /// <returns></returns> public static DataInfo Parse(string fileSystemName, string destinyPath) { var resultingDestinyPath = Path.Combine(destinyPath, Path.GetFileName(fileSystemName)); var di = new Delimon.Win32.IO.DirectoryInfo(fileSystemName); //If is directory if (Alphaleonis.Win32.Filesystem.Directory.Exists(fileSystemName)) { if (resultingDestinyPath == fileSystemName) { resultingDestinyPath += " - Copy"; for (int i = 1; DestinyPathsNames.Contains(resultingDestinyPath) || Directory.Exists(resultingDestinyPath); i++) { resultingDestinyPath += i.ToString(); } } return(new DirectoryDataInfo { SourceDirectoryLength = Path.GetDirectoryName(fileSystemName).Length, Destiny = destinyPath, FullName = fileSystemName, DestinyPath = resultingDestinyPath, FileAttributes = di.Attributes }); } //if is a file else if (Alphaleonis.Win32.Filesystem.File.Exists(fileSystemName)) { if (resultingDestinyPath == fileSystemName) { var ext = System.IO.Path.GetExtension(fileSystemName); var extLess = resultingDestinyPath.Remove(resultingDestinyPath.Length - 4, 4); resultingDestinyPath = string.Format("{0} - Copy{1}", extLess, ext); for (int i = 1; DestinyPathsNames.Contains(resultingDestinyPath) || File.Exists(resultingDestinyPath); i++) { extLess = resultingDestinyPath.Remove(resultingDestinyPath.Length - 4, 4); resultingDestinyPath = string.Format("{0}_{1}{2}", extLess, i, ext); } } var finfo = new FileInfo(fileSystemName); //Delimon.Win32.IO.File.GetCreationTime(fileSystemName); var res = new FileDataInfo { SourceDirectoryLength = Path.GetDirectoryName(fileSystemName).Length, Destiny = destinyPath, FullName = fileSystemName, Name = finfo.Name, DestinyDirectoryPath = destinyPath, DestinyPath = resultingDestinyPath, Size = finfo.Length, FileAttributes = finfo.Attributes, CreationTime = finfo.CreationTime, LastAccessTime = finfo.LastAccessTime, LastWriteTime = finfo.LastWriteTime }; return(res); } //This filesystem do not exist throw new FileSystemNotExistException(fileSystemName); }