/// <summary> /// Returns the date and time the specified file or directory was last written to. /// </summary> /// <param name="path">Path to file.</param> public override DateTime GetLastWriteTime(string path) { if (!this.Exists(path)) { throw GetFileNotFoundException(path); } IS3ObjectInfo info = S3ObjectFactory.GetInfo(path); if (Provider.ObjectExists(info)) { return(S3ObjectInfoProvider.GetStringDateTime(info.GetMetadata(S3ObjectInfoProvider.LAST_WRITE_TIME))); } return(System.IO.File.GetLastAccessTime(path)); }
/// <summary>Sets values from System.IO.FileInfo to this file info</summary> private void InitCMSValues() { if (this.mSystemInfo != null) { this.mExtension = this.mSystemInfo.Extension; this.mFullName = this.mSystemInfo.FullName; this.mName = this.mSystemInfo.Name; this.mExists = this.mSystemInfo.Exists; this.LastWriteTime = this.mSystemInfo.LastWriteTime; this.CreationTime = this.mSystemInfo.CreationTime; this.IsReadOnly = this.mSystemInfo.IsReadOnly; this.Attributes = (CMS.IO.FileAttributes) this.mSystemInfo.Attributes; if (this.mExists) { this.mLength = this.mSystemInfo.Length; } if (this.mDirectory == null) { this.mDirectory = new DirectoryInfo(this.mSystemInfo.Directory.FullName); } this.mDirectory.CreationTime = this.mSystemInfo.Directory.CreationTime; this.mDirectory.Exists = this.mSystemInfo.Directory.Exists; this.mDirectory.FullName = this.mSystemInfo.Directory.FullName; this.mDirectory.LastWriteTime = this.mSystemInfo.Directory.LastWriteTime; this.mDirectory.Name = this.mSystemInfo.Directory.Name; } else { if (this.mExists) { this.mLastWriteTime = S3ObjectInfoProvider.GetStringDateTime(this.obj.GetMetadata(S3ObjectInfoProvider.LAST_WRITE_TIME)); this.mCreationTime = S3ObjectInfoProvider.GetStringDateTime(this.obj.GetMetadata(S3ObjectInfoProvider.CREATION_TIME)); this.mAttributes = (CMS.IO.FileAttributes)ValidationHelper.GetInteger((object)this.obj.GetMetadata(S3ObjectInfoProvider.CREATION_TIME), ValidationHelper.GetInteger((object)CMS.IO.FileAttributes.Normal, 0, (CultureInfo)null), (CultureInfo)null); this.mLength = this.obj.Length; } else { this.LastWriteTime = DateTimeHelper.ZERO_TIME; this.CreationTime = DateTimeHelper.ZERO_TIME; this.mAttributes = CMS.IO.FileAttributes.Normal; } this.mDirectory = new DirectoryInfo(CMS.IO.Path.GetDirectoryName(this.FullName)); } }