示例#1
0
        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);
            }
        }
示例#2
0
        // 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();
        }
示例#3
0
 protected override ShellFolder GetFolderAsRoot(ShellItemIdList idl)
 {
     if (_root == null)
     {
         _root = new WebShellFolder(idl);
     }
     return(_root);
 }