internal PSModuleInfo( string name, string path, ExecutionContext context, SessionState sessionState) { this._context = context; if (path != null) { string resolvedPath = ModuleCmdletBase.GetResolvedPath(path, this._context); this._path = resolvedPath == null ? path : resolvedPath; } this._name = name != null || this._path == null ? name : ModuleIntrinsics.GetModuleName(this._path); this._sessionState = sessionState; if (sessionState == null) { return; } sessionState.Internal.Module = this; }
internal PSModuleInfo(string name, string path, ExecutionContext context, System.Management.Automation.SessionState sessionState) { this._name = string.Empty; this._path = string.Empty; this._description = string.Empty; this._version = new System.Version(0, 0); this._detectedFunctionExports = new List <string>(); this._detectedWorkflowExports = new List <string>(); this._detectedCmdletExports = new List <string>(); this._compiledExports = new List <CmdletInfo>(); this._fileList = new List <string>(); this._moduleList = new Collection <object>(); this._nestedModules = new List <PSModuleInfo>(); this._scripts = new List <string>(); this._requiredAssemblies = new Collection <string>(); this._requiredModules = new List <PSModuleInfo>(); this._requiredModulesSpecification = new List <ModuleSpecification>(); this._detectedAliasExports = new Dictionary <string, string>(); this._exportedFormatFiles = new ReadOnlyCollection <string>(new List <string>()); this._exportedTypeFiles = new ReadOnlyCollection <string>(new List <string>()); if (path != null) { string resolvedPath = ModuleCmdletBase.GetResolvedPath(path, context); this._path = resolvedPath ?? path; } this._sessionState = sessionState; if (sessionState != null) { sessionState.Internal.Module = this; } if (name == null) { this._name = ModuleIntrinsics.GetModuleName(this._path); } else { this._name = name; } }