示例#1
0
        /// <summary>
        /// Overridden method to get the item from a path.
        /// </summary>
        /// <param name="path">The drive path.</param>
        protected override void GetItem(string path)
        {
            NtDirectoryEntry entry = GetItemFromPath(path);

            if (entry == null)
            {
                return;
            }
            WriteItemObject(entry, NTPathToPS(BuildDrivePath(GetRelativePath(PSPathToNT(path)))), entry.IsDirectory);
        }
示例#2
0
        void IPropertyCmdletProvider.GetProperty(string path, Collection <string> providerSpecificPickList)
        {
            NtDirectoryEntry entry = GetItemFromPath(path);

            if (entry == null)
            {
                return;
            }

            if (entry is NtKeyEntry key && key.ValueCount > 0)
            {
                var patterns = providerSpecificPickList.Select(s => new WildcardPattern(s, WildcardOptions.IgnoreCase)).ToArray();

                foreach (var val in key.Values)
                {
                    if (patterns.Length == 0 || patterns.Any(p => p.IsMatch(val.Name)))
                    {
                        WritePropertyObject(val, path);
                    }
                }
            }
        }