public string GetFileInfo(IFileInfoProvider provider, string columnName, ShellItem item) { string retVal = string.Empty; ShellAPI.STATSTG info = provider.GetFileInfo(); switch (columnName) { case "Size": #region Size { retVal = GetSizeString(info.cbSize); } #endregion break; case "Date Created": #region Date Created { DateTime dateTime = ShellAPI.FileTimeToDateTime(info.ctime); string time = dateTime.ToLongTimeString(); retVal = string.Format("{0} {1}", dateTime.ToShortDateString(), time.Remove(time.Length - 3, 3)); } #endregion break; case "Date Modified": #region Date Modified { DateTime dateTime = ShellAPI.FileTimeToDateTime(info.mtime); string time = dateTime.ToLongTimeString(); retVal = string.Format("{0} {1}", dateTime.ToShortDateString(), time.Remove(time.Length - 3, 3)); } #endregion break; } return(retVal); }
public string GetFolderInfo(IDirInfoProvider provider, string columnName, ShellItem item) { string retVal = string.Empty; if (columnName != "Size" && !item.IsSystemFolder && !item.IsDisk && item.IsFileSystem) { ShellAPI.STATSTG info = provider.GetDirInfo(); switch (columnName) { case "Date Created": #region Date Created { DateTime dateTime = ShellAPI.FileTimeToDateTime(info.ctime); string time = dateTime.ToLongTimeString(); retVal = string.Format("{0} {1}", dateTime.ToShortDateString(), time.Remove(time.Length - 3, 3)); } #endregion break; case "Date Modified": #region Date Modified { DateTime dateTime = ShellAPI.FileTimeToDateTime(info.mtime); string time = dateTime.ToLongTimeString(); retVal = string.Format("{0} {1}", dateTime.ToShortDateString(), time.Remove(time.Length - 3, 3)); } #endregion break; } } return(retVal); }