public VariableScopeItemSearcher(
     SessionStateInternal sessionState,
     ScopedItemLookupPath lookupPath,
     CommandOrigin origin)
     : base(sessionState, lookupPath)
 {
     this._origin = origin;
 }
        protected override bool GetScopeItem(
            SessionStateScope scope,
            ScopedItemLookupPath name,
            out PSDriveInfo drive)
        {
            bool flag = true;

            drive = scope.GetDrive(name.LookupPath.NamespaceID);
            if (drive == (PSDriveInfo)null)
            {
                flag = false;
            }
            return(flag);
        }
        protected override bool GetScopeItem(
            SessionStateScope scope,
            ScopedItemLookupPath name,
            out PSVariable variable)
        {
            bool flag = true;

            variable = scope.GetVariable(name.LookupPath.ToString(), this._origin);
            if (variable == null || variable.IsPrivate && scope != this.sessionState.CurrentScope)
            {
                flag = false;
            }
            return(flag);
        }
Esempio n. 4
0
        protected override bool GetScopeItem(
            SessionStateScope scope,
            ScopedItemLookupPath name,
            out AliasInfo alias)
        {
            bool flag = true;

            alias = scope.GetAlias(name.ToString());
            if (alias == null || (alias.Options & ScopedItemOptions.Private) != ScopedItemOptions.None && scope != this.sessionState.CurrentScope)
            {
                flag = false;
            }
            return(flag);
        }
 internal ScopedItemLookupPath(ScopedItemLookupPath silp, bool isLocal)
 {
     if (isLocal)
     {
         this.isUnqualified = false;
         this.isLocalLookup = true;
     }
     else
     {
         this.isUnqualified = silp.isUnqualified;
     }
     this.isGlobalLookup  = silp.IsGlobal;
     this.isPrivateLookup = silp.isPrivateLookup;
     this.isScopedItem    = silp.isScopedItem;
     this.isScriptLookup  = silp.isScriptLookup;
     this.modifiedPath    = silp.modifiedPath;
     this.userPath        = silp.userPath;
 }
Esempio n. 6
0
        protected override bool GetScopeItem(
            SessionStateScope scope,
            ScopedItemLookupPath path,
            out FunctionInfo script)
        {
            bool flag = true;

            this.name = path.ToString();
            if (path.IsScopedItem)
            {
                this.name = path.LookupPath.NamespaceSpecificString;
            }
            script = scope.GetFunction(this.name);
            if (script != null)
            {
                if ((!(script is FilterInfo filterInfo) ? (script.Options & ScopedItemOptions.Private) != ScopedItemOptions.None : (filterInfo.Options & ScopedItemOptions.Private) != ScopedItemOptions.None) && scope != this.sessionState.CurrentScope)
                {
                    flag = false;
                }
                else
                {
                    SessionState.ThrowIfNotVisible(this._origin, (object)script);
                }
            }
 public DriveScopeItemSearcher(
     SessionStateInternal sessionState,
     ScopedItemLookupPath lookupPath)
     : base(sessionState, lookupPath)
 {
 }