public PhysicalFolder(ShellFolder parent, ShellItemId fileSystemId, string fileSystemPath) : base(parent, fileSystemId, fileSystemPath) { CanDelete = true; // this enables the "New" menus Attributes |= SFGAO.SFGAO_STORAGEANCESTOR | SFGAO.SFGAO_STORAGE; }
public MyShellItem(ShellFolder parent, ShellItemId fileSystemId, string fileSystemPath) : base(parent, fileSystemId, fileSystemPath) { CanDelete = true; CanMove = true; CanCopy = true; //ReadPropertiesFromShell = true; }
/// <summary> /// Initializes a new instance of the <see cref="OnDemandFolder"/> class. /// We just add the same sync status column. /// </summary> /// <param name="parent">The parent.</param> /// <param name="info">The information.</param> public OnDemandFolder(ShellFolder parent, ShellItemId fileSystemId, string fileSystemPath) : base(parent, fileSystemId, fileSystemPath) { // since this is a FileSystem oriented NSE, we let base properties pass through ReadPropertiesFromShell = true; /// We just add the sync status column. AddColumn(Props.System.StorageProviderUIStatus, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); }
public override ShellItem GetItem(ShellItemId id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var tuple = RootFolder.ParseItemId(id); if (tuple == null) { return(null); // not ours } using (var key = OpenKey(false)) { if (key != null) { switch (tuple.Item1) { case true: // key/folder using (var subKey = key.OpenSubKey(tuple.Item2, false)) { if (subKey != null) { return(new RegistryKeyFolder(this, tuple.Item2)); } } break; case false: // value/item var value = key.GetValue(tuple.Item2); if (value != null) { return(new RegistryValueItem(this, tuple.Item2)); } break; } // either the type type (folder vs value) doesn't correspond, or we're parsing some external string so fallback on our parser return(GetItem(tuple.Item2)); } } return(null); }
public override ShellItem GetItem(ShellItemId id) { var item = base.GetItem(id); if (item != null) { return(item); } // this is for Common Dialog Save As support // here, we check it's a non-existing item that we may have built in GetItem(string displayName) if (id.TryGetFileSystemName(out var fileName)) { return(new MyShellItem(this, new FileInfo(Path.Combine(FileSystemPath, fileName)))); } return(null); }
// this is a necessary ShellBoost override for better performance (direct access instead of implicit call to EnumItems) // https://www.shellboost.com/Doc/Developer-s-Guide/Items-enumeration public override ShellItem GetItem(ShellItemId id) { var guidPidl = KeyShellItemId.From(id.Data, false) as GuidKeyShellItemId; if (guidPidl == null) { return(null); } if (guidPidl.Value == Guid.Empty) { return(Root); } var apiItem = WebApi.GetAsync(guidPidl.Value).Result; return(ShellItemFromApi(apiItem)); }
public static Tuple <bool?, string> ParseItemId(ShellItemId id) { var name = (KeyShellItemId.From(id?.Data, false) as StringKeyShellItemId)?.Value; if (string.IsNullOrEmpty(name)) { return(null); } if (name.StartsWith("V\\")) { return(new Tuple <bool?, string>(false, name.Substring(2))); } if (name.StartsWith("K\\")) { return(new Tuple <bool?, string>(true, name.Substring(2))); } return(new Tuple <bool?, string>(null, name)); }
public override bool Equals(object obj) { ShellItemId other = obj as ShellItemId; if (other == null) { return(false); } byte[] v1 = Value; byte[] v2 = other.Value; if (v1.Length != v2.Length) { return(false); } for (int i = 0; i < v1.Length; i++) { if (v1 != v2) { return(false); } } return(true); }
public MyShellFolder(ShellFolder parent, ShellItemId fileSystemId, string fileSystemPath) : base(parent, fileSystemId, fileSystemPath) { CanDelete = true; }
protected override ShellItem CreateFileSystemFolder(ShellItemId fileSystemId, string fileSystemPath) => new MyShellFolder(this, fileSystemId, fileSystemPath);
protected override ShellItem CreateFileSystemItem(ShellItemId fileSystemId, string fileSystemPath) => new OnDemandItem(this, fileSystemId, fileSystemPath);
/// <summary> /// Initializes a new instance of the <see cref="OnDemandItem"/> class. /// </summary> /// <param name="parent">The parent folder.</param> /// <param name="info">The file.</param> public OnDemandItem(ShellFolder parent, ShellItemId fileSystemId, string fileSystemPath) : base(parent, fileSystemId, fileSystemPath) { // since this is a FileSystem oriented NSE, we let base properties pass through ReadPropertiesFromShell = true; }
public IdList(ShellItemId relativeId) : this(new ShellItemId[] { relativeId }) { }