public DataLakeStoreItem(FileStatusProperties property, string optionalPath = "") : base(property.AccessTime, property.BlockSize, property.ChildrenNum, property.Group, property.Length, property.ModificationTime, property.Owner, string.IsNullOrEmpty(optionalPath) ? property.PathSuffix : optionalPath, property.Permission, property.Type) { // create two new properties this.LastWriteTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds((long)this.ModificationTime).ToLocalTime(); this.Name = property.PathSuffix; }
/// <summary> /// Initializes a new instance of the <see cref="DataLakeStoreItem" /> class. /// </summary> /// <param name="property">The property.</param> /// <param name="optionalName">The optional name of the file or folder</param> /// <param name="optionalPath">The optional full path to the file or folder, excluding the file or folder name itself.</param> public DataLakeStoreItem(FileStatusProperties property, string optionalName = "", string optionalPath = "") : base(property.AccessTime, property.BlockSize, property.ChildrenNum, property.ExpirationTime, property.Group, property.Length, property.ModificationTime, property.Owner, string.IsNullOrEmpty(optionalName) ? property.PathSuffix : optionalName, property.Permission, property.Type) { // create two new properties try { this.LastWriteTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds((long)this.ModificationTime).ToLocalTime(); } catch(ArgumentOutOfRangeException) { if(this.ModificationTime < 0) { // set last write time to the min DateTime this.LastWriteTime = DateTime.MinValue; } else { this.LastWriteTime = DateTime.MaxValue; } } this.Name = property.PathSuffix; if(!string.IsNullOrEmpty(optionalPath)) { this.Path = System.IO.Path.Combine(optionalPath, property.PathSuffix).Replace('\\', '/'); } }
/// <summary> /// Initializes a new instance of the <see cref="DataLakeStoreItem" /> class. /// </summary> /// <param name="property">The property.</param> /// <param name="optionalName">The optional name of the file or folder</param> /// <param name="optionalPath">The optional full path to the file or folder, excluding the file or folder name itself.</param> public DataLakeStoreItem(FileStatusProperties property, string optionalName = "", string optionalPath = "") : base(property.AccessTime, property.BlockSize, property.ChildrenNum, property.ExpirationTime, property.Group, property.Length, property.ModificationTime, property.Owner, string.IsNullOrEmpty(optionalName) ? property.PathSuffix : optionalName, property.Permission, property.Type) { // create two new properties try { this.LastWriteTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds((long)this.ModificationTime).ToLocalTime(); } catch (ArgumentOutOfRangeException) { if (this.ModificationTime < 0) { // set last write time to the min DateTime this.LastWriteTime = DateTime.MinValue; } else { this.LastWriteTime = DateTime.MaxValue; } } this.Name = property.PathSuffix; if (!string.IsNullOrEmpty(optionalPath)) { this.Path = System.IO.Path.Combine(optionalPath, property.PathSuffix).Replace('\\', '/'); } }
private static BlobId ToBlobId(string path, FileStatusProperties properties) { if (properties.Type == FileType.FILE) { return(new BlobId(path, properties.PathSuffix, BlobItemKind.File)); } else { return(new BlobId(path, properties.PathSuffix, BlobItemKind.Folder)); } }
public FsFileStatus(FileStatusProperties fs) { this.ExpirationTime = FsUnixTime.TryParseDouble(fs.ExpirationTime); this.AccessTime = new FsUnixTime(fs.AccessTime.Value); this.ModificationTime = new FsUnixTime(fs.ModificationTime.Value); this.BlockSize = fs.BlockSize.Value; this.ChildrenNum = fs.ChildrenNum; this.Length = fs.Length.Value; this.Group = fs.Group; this.Owner = fs.Owner; this.PathSuffix = fs.PathSuffix; this.Permission = fs.Permission; this.Type = fs.Type.Value; }
public DataLakeStoreItem(FileStatusProperties property) { // copy over all initial properties this.PathSuffix = property.PathSuffix; this.BlockSize = property.BlockSize; this.ChildrenNum = property.ChildrenNum; this.FileId = property.FileId; this.Group = property.Group; this.Length = property.Length; this.ModificationTime = property.ModificationTime; this.Owner = property.Owner; this.Permission = property.Permission; this.AccessTime = property.AccessTime; this.Replication = property.Replication; this.Type = property.Type; // create two new properties this.LastWriteTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds(this.ModificationTime).ToLocalTime(); this.Name = this.PathSuffix; }
private static void GetFullFilePath(DataLakeStoreFileSystemManagementClient client, FileStatusProperties fileStatusProperties, List <string> finalFilePathList, string path) { string fullPath = String.Format("{0}/{1}", path, fileStatusProperties.PathSuffix); if (fileStatusProperties.Type == FileType.DIRECTORY) { FileStatusesResult fileStatusesResult = client.FileSystem.ListFileStatus(accountName, fullPath); foreach (FileStatusProperties fsProp in fileStatusesResult.FileStatuses.FileStatus) { GetFullFilePath(client, fsProp, finalFilePathList, fullPath); } } if (fileStatusProperties.Type == FileType.FILE) { if (finalFilePathList == null) { finalFilePathList = new List <string>(); } finalFilePathList.Add(fullPath); } }