public WebShellItem(WebShellFolder parent, WebItem apiItem) : base(parent, new GuidKeyShellItemId(apiItem.Id)) { ApiItem = apiItem; ItemType = IOUtilities.PathGetExtension(apiItem.Name); DisplayName = apiItem.Name; DateCreated = apiItem.CreationTimeUtc.ToLocalTime(); DateModified = apiItem.LastWriteTimeUtc.ToLocalTime(); DateAccessed = apiItem.LastAccessTimeUtc.ToLocalTime(); Size = apiItem.Length; CanCopy = true; CanDelete = true; CanLink = true; CanMove = true; CanPaste = true; CanRename = true; IsHidden = apiItem.IsHidden; // this is a "physical" shell item if (parent.IsRoot) { FileSystemPath = Path.Combine(WebApi.LocalDirectory.FullName, apiItem.Name); } else { FileSystemPath = Path.Combine(parent.FileSystemPath, apiItem.Name); } }
// child folder public WebShellFolder(WebShellFolder parent, WebItem apiItem) : base(parent, new GuidKeyShellItemId(apiItem.Id)) { // this is reserved for non-root folders if (apiItem.Id == Guid.Empty) { throw new InvalidOperationException(); } ApiItem = apiItem; DisplayName = apiItem.Name; DateCreated = apiItem.CreationTimeUtc.ToLocalTime(); DateModified = apiItem.LastWriteTimeUtc.ToLocalTime(); DateAccessed = apiItem.LastAccessTimeUtc.ToLocalTime(); CanDelete = true; CanLink = true; CanPaste = true; CanRename = true; IsHidden = apiItem.IsHidden; // for some reason, this is necessary to support "New" menu Attributes |= SFGAO.SFGAO_STORAGE; // this is a "physical" shell item FileSystemPath = Path.Combine(parent.FileSystemPath ?? WebApi.LocalDirectory.FullName, apiItem.Name); DefineExtraColumns(); }
protected override ShellFolder GetFolderAsRoot(ShellItemIdList idl) { if (_root == null) { _root = new WebShellFolder(idl); } return(_root); }