/// <summary> /// Sets file information /// </summary> private void SetFileInfoValues(string path) { FileName.SetText(FileItem.GetFitName(System.IO.Path.GetFileName(path), Width), false); string FileSizeText = ""; string dateCreated = ""; string dateModified = ""; string lastAccess = ""; string directory = ""; if (Directory.Exists(path)) { DirectoryInfo di = new DirectoryInfo(path); dateCreated = di.CreationTime.ToString(DATE_FORMAT); dateModified = di.LastWriteTime.ToString(DATE_FORMAT); lastAccess = di.LastAccessTime.ToString(DATE_FORMAT); directory = di.Parent == null ? di.Root.Name : di.Parent.FullName; } if (File.Exists(path)) { FileInfo fi = new FileInfo(path); FileSizeText = fi.Length.ToString("#,#"); dateCreated = fi.CreationTime.ToString(DATE_FORMAT); dateModified = fi.LastWriteTime.ToString(DATE_FORMAT); lastAccess = fi.LastAccessTime.ToString(DATE_FORMAT); directory = fi.DirectoryName; } FileSize.SetText(FileSizeText, false); FileDateCreated.SetText(dateCreated, false); FileDateModified.SetText(dateModified, false); FileLastAccessTime.SetText(lastAccess, false); FilePath.SetText(directory, false); }