Exemplo n.º 1
0
        //actual constructor work, but hidden to not be used accidently in a stupid way
        private SessionState(SessionStateGlobal sessionStateGlobal, SessionState parent)
        {
            SessionStateGlobal = sessionStateGlobal;

            var parentAliasScope    = parent == null ? null : parent._aliasScope;
            var parentFunctionScope = parent == null ? null : parent._functionScope;
            var parentVariableScope = parent == null ? null : parent._variableScope;
            var parentDriveScope    = parent == null ? null : parent._driveScope;
            var parentModuleScope   = parent == null ? null : parent._moduleScope;
            var parentCmdletScope   = parent == null ? null : parent._cmdletScope;

            _aliasScope    = new SessionStateScope <AliasInfo>(this, parentAliasScope, SessionStateCategory.Alias);
            _functionScope = new SessionStateScope <FunctionInfo>(this, parentFunctionScope, SessionStateCategory.Function);
            _variableScope = new SessionStateScope <PSVariable>(this, parentVariableScope, SessionStateCategory.Variable);
            _driveScope    = new SessionStateScope <PSDriveInfo>(this, parentDriveScope, SessionStateCategory.Drive);
            _moduleScope   = new SessionStateScope <PSModuleInfo>(this, parentModuleScope, SessionStateCategory.Module);
            _cmdletScope   = new SessionStateScope <CmdletInfo>(this, parentCmdletScope, SessionStateCategory.Cmdlet);

            IsScriptScope = false;
            Function      = new FunctionIntrinsics(_functionScope);
            Alias         = new AliasIntrinsics(_aliasScope);

            Drive         = new DriveManagementIntrinsics(_driveScope);
            Path          = new PathIntrinsics(this);
            PSVariable    = new PSVariableIntrinsics(_variableScope);
            LoadedModules = new ModuleIntrinsics(_moduleScope);
            Cmdlet        = new CmdletIntrinsics(_cmdletScope);
        }
Exemplo n.º 2
0
 // internal
 internal SessionState(SessionStateGlobal sessionState)
 {
     SessionStateGlobal = sessionState;
     Drive      = new DriveManagementIntrinsics(sessionState);
     Path       = new PathIntrinsics(sessionState);
     Provider   = new CmdletProviderManagementIntrinsics(sessionState);
     PSVariable = new PSVariableIntrinsics(sessionState);
 }
Exemplo n.º 3
0
        //actual constructor work, but hidden to not be used accidently in a stupid way
        private SessionState(SessionStateGlobal sessionStateGlobal, SessionStateScope <FunctionInfo> functions,
                             SessionStateScope <PSVariable> variables, SessionStateScope <PSDriveInfo> drives,
                             SessionStateScope <AliasInfo> aliases)
        {
            SessionStateGlobal = sessionStateGlobal;

            _aliasScope    = new SessionStateScope <AliasInfo>(aliases, SessionStateCategory.Alias);
            _functionScope = new SessionStateScope <FunctionInfo>(functions, SessionStateCategory.Function);
            _variableScope = new SessionStateScope <PSVariable>(variables, SessionStateCategory.Variable);
            _driveScope    = new SessionStateScope <PSDriveInfo>(drives, SessionStateCategory.Drive);

            IsScriptScope = false;
            Function      = new FunctionIntrinsics(this, _functionScope);
            Alias         = new AliasIntrinsics(this, _aliasScope);

            Drive      = new DriveManagementIntrinsics(this, _driveScope);
            Path       = new PathIntrinsics(SessionStateGlobal);
            Provider   = new CmdletProviderManagementIntrinsics(SessionStateGlobal);
            PSVariable = new PSVariableIntrinsics(this, _variableScope);
        }
 internal CmdletProviderManagementIntrinsics(SessionStateGlobal sessionState)
 {
     _sessionState      = sessionState;
     _providers         = new Dictionary <string, List <ProviderInfo> >(StringComparer.CurrentCultureIgnoreCase);
     _providerInstances = new Dictionary <ProviderInfo, CmdletProvider>();
 }
Exemplo n.º 5
0
 // creates a session state with a new (global) scope
 internal SessionState(SessionStateGlobal sessionStateGlobal)
     : this(sessionStateGlobal, null)
 {
 }
Exemplo n.º 6
0
 internal PathIntrinsics(SessionStateGlobal sessionState)
 {
     _sessionState = sessionState;
 }
Exemplo n.º 7
0
 internal DriveManagementIntrinsics(SessionStateGlobal sessionState)
 {
     _sessionState = sessionState;
 }
Exemplo n.º 8
0
 // creates a session state with a new (glovbal) scope
 internal SessionState(SessionStateGlobal sessionStateGlobal)
     : this(sessionStateGlobal, null, null, null, null)
 {
     defaultInit();
 }
Exemplo n.º 9
0
 internal PSVariableIntrinsics(SessionStateGlobal sessionState)
 {
     _sessionState = sessionState;
 }
Exemplo n.º 10
0
 internal CmdletProviderManagementIntrinsics(SessionStateGlobal sessionState)
 {
     _sessionState = sessionState;
 }
Exemplo n.º 11
0
 internal PathIntrinsics(SessionState sessionState)
 {
     _sessionState       = sessionState;
     _sessionStateGlobal = sessionState.SessionStateGlobal;
 }