Ejemplo n.º 1
0
        private static string ValidateNotExistingPidl(ShellItemIdList pidl)
        {
            // this must be compatible with what we sent in TryParseItem method
            var stringPidl = KeyShellItemId.From(pidl?.Last?.Data, false) as StringKeyShellItemId;

            return(stringPidl?.Value);
        }
Ejemplo n.º 2
0
        // 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));
        }