public void SetField() { if (!string.IsNullOrEmpty(fullpath)) { if (itemtype == RemoteItemType.File) { var finfo = new FileInfo(ItemControl.GetLongFilename(fullpath)); modifiedDate = finfo.LastWriteTime; createdDate = finfo.CreationTime; accessDate = finfo.LastAccessTime; size = finfo.Length; } else { var dinfo = new DirectoryInfo(ItemControl.GetLongFilename(fullpath)); modifiedDate = dinfo.LastWriteTime; createdDate = dinfo.CreationTime; accessDate = dinfo.LastAccessTime; } } }
public LocalSystemItem(IRemoteServer server, FileSystemInfo file, params IRemoteItem[] parent) : base(server, parent) { if (!(parent?.Length > 0)) { isRoot = true; } fullpath = file?.FullName; fullpath = ItemControl.GetOrgFilename(fullpath); if (!string.IsNullOrEmpty(fullpath)) { itemtype = (file.Attributes.HasFlag(FileAttributes.Directory)) ? RemoteItemType.Folder : RemoteItemType.File; modifiedDate = file.LastWriteTime; createdDate = file.CreationTime; accessDate = file.LastAccessTime; if (itemtype == RemoteItemType.File) { try { var info = new FileInfo(file.FullName); size = info.Length; } catch { } } } else { itemtype = RemoteItemType.Folder; fullpath = ""; } if (isRoot) { SetParent(this); } }