mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove the no longer used RunspaceConfigurationEntry types (#8424)
This commit is contained in:
@@ -980,7 +980,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
FormatAndTypeDataHelper.ThrowExceptionOnError("ErrorsUpdatingFormats",
|
||||
null,
|
||||
entries,
|
||||
RunspaceConfigurationCategory.Formats);
|
||||
FormatAndTypeDataHelper.Category.Formats);
|
||||
}
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
|
||||
@@ -137,15 +137,6 @@ namespace System.Management.Automation
|
||||
discoveryTracer.ShowHeaders = false;
|
||||
}
|
||||
|
||||
private void AddCmdletToCache(CmdletConfigurationEntry entry)
|
||||
{
|
||||
if (!IsSpecialCmdlet(entry.ImplementingType))
|
||||
{
|
||||
CmdletInfo newCmdletInfo = NewCmdletInfo(entry, SessionStateEntryVisibility.Public);
|
||||
AddCmdletInfoToCache(newCmdletInfo.Name, newCmdletInfo, isGlobal: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the cmdlet is a cmdlet that shouldn't be in the discovery list.
|
||||
/// </summary>
|
||||
@@ -163,13 +154,6 @@ namespace System.Management.Automation
|
||||
return implementingType == typeof(OutLineOutputCommand) || implementingType == typeof(FormatDefaultCommand);
|
||||
}
|
||||
|
||||
private CmdletInfo NewCmdletInfo(CmdletConfigurationEntry entry, SessionStateEntryVisibility visibility)
|
||||
{
|
||||
CmdletInfo ci = new CmdletInfo(entry.Name, entry.ImplementingType, entry.HelpFileName, entry.PSSnapIn, Context);
|
||||
ci.Visibility = visibility;
|
||||
return ci;
|
||||
}
|
||||
|
||||
private CmdletInfo NewCmdletInfo(SessionStateCmdletEntry entry)
|
||||
{
|
||||
return NewCmdletInfo(entry, Context);
|
||||
@@ -1555,49 +1539,6 @@ namespace System.Management.Automation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a cmdlet from the cmdlet cache.
|
||||
/// </summary>
|
||||
/// <param name="entry">
|
||||
/// The configuration entry for the cmdlet which is being removed.
|
||||
/// </param>
|
||||
private void RemoveCmdletFromCache(CmdletConfigurationEntry entry)
|
||||
{
|
||||
IDictionary<string, List<CmdletInfo>> cmdletTable = Context.EngineSessionState.GetCmdletTable();
|
||||
List<CmdletInfo> cacheEntry;
|
||||
if (cmdletTable.TryGetValue(entry.Name, out cacheEntry))
|
||||
{
|
||||
int removalIndex = GetCmdletRemovalIndex(cacheEntry, entry.PSSnapIn == null ? String.Empty : entry.PSSnapIn.Name);
|
||||
|
||||
if (removalIndex >= 0)
|
||||
{
|
||||
string name = cacheEntry[removalIndex].Name;
|
||||
cacheEntry.RemoveAt(removalIndex);
|
||||
Context.EngineSessionState.RemoveCmdlet(name, removalIndex, true);
|
||||
}
|
||||
|
||||
// Remove the entry from the cache if there are no more cmdlets
|
||||
if (cacheEntry.Count == 0)
|
||||
{
|
||||
Context.EngineSessionState.RemoveCmdletEntry(entry.Name, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetCmdletRemovalIndex(List<CmdletInfo> cacheEntry, string PSSnapin)
|
||||
{
|
||||
int removalIndex = -1;
|
||||
for (int index = 0; index < cacheEntry.Count; ++index)
|
||||
{
|
||||
if (String.Equals(cacheEntry[index].ModuleName, PSSnapin, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
removalIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return removalIndex;
|
||||
}
|
||||
|
||||
internal ExecutionContext Context { get; }
|
||||
|
||||
internal static PSModuleAutoLoadingPreference GetCommandDiscoveryPreference(ExecutionContext context, VariablePath variablePath, string environmentVariable)
|
||||
|
||||
@@ -1,529 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma warning disable 1634, 1691
|
||||
#pragma warning disable 56506
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum for describing different kind information that can be configured in runspace configuration.
|
||||
/// </summary>
|
||||
internal enum RunspaceConfigurationCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// Cmdlets
|
||||
/// </summary>
|
||||
Cmdlets,
|
||||
|
||||
/// <summary>
|
||||
/// Providers
|
||||
/// </summary>
|
||||
Providers,
|
||||
|
||||
/// <summary>
|
||||
/// Assemblies
|
||||
/// </summary>
|
||||
Assemblies,
|
||||
|
||||
/// <summary>
|
||||
/// Scripts
|
||||
/// </summary>
|
||||
Scripts,
|
||||
|
||||
/// <summary>
|
||||
/// Initialization scripts
|
||||
/// </summary>
|
||||
InitializationScripts,
|
||||
|
||||
/// <summary>
|
||||
/// Types
|
||||
/// </summary>
|
||||
Types,
|
||||
|
||||
/// <summary>
|
||||
/// Formats
|
||||
/// </summary>
|
||||
Formats,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Define class for runspace configuration entry.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This abstract class is to be derived internally by Monad for different
|
||||
/// runspace configuration entries only. Developers should not derive from
|
||||
/// this class.
|
||||
/// </remarks>
|
||||
internal abstract class RunspaceConfigurationEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Initiate an instance of runspace configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name for the runspace configuration entry</param>
|
||||
/// <!--
|
||||
/// This is meant to be called by derived class only. It doesn't make sense to
|
||||
/// directly create an instance of this class.
|
||||
/// -->
|
||||
protected RunspaceConfigurationEntry(string name)
|
||||
{
|
||||
if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(name.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("name");
|
||||
}
|
||||
|
||||
Name = name.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance of runspace configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name for the runspace configuration entry</param>
|
||||
/// <param name="psSnapin">The name of the PSSnapin the entry comes from.</param>
|
||||
/// <!--
|
||||
/// This is meant to be called by derived class only. It doesn't make sense to
|
||||
/// directly create an instance of this class.
|
||||
/// -->
|
||||
internal RunspaceConfigurationEntry(string name, PSSnapInInfo psSnapin)
|
||||
{
|
||||
if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(name.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("name");
|
||||
}
|
||||
|
||||
Name = name.Trim();
|
||||
|
||||
if (psSnapin == null)
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("psSnapin");
|
||||
}
|
||||
|
||||
PSSnapIn = psSnapin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets name of configuration entry
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets name of PSSnapin that this configuration entry belongs to.
|
||||
/// </summary>
|
||||
public PSSnapInInfo PSSnapIn { get; } = null;
|
||||
|
||||
internal bool _builtIn = false;
|
||||
/// <summary>
|
||||
/// Get whether this entry is a built-in entry.
|
||||
/// </summary>
|
||||
public bool BuiltIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return _builtIn;
|
||||
}
|
||||
}
|
||||
|
||||
internal UpdateAction _action = UpdateAction.None;
|
||||
internal UpdateAction Action
|
||||
{
|
||||
get
|
||||
{
|
||||
return _action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines class for type configuration entry.
|
||||
/// </summary>
|
||||
internal sealed class TypeConfigurationEntry : RunspaceConfigurationEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Initiate an instance for type configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the type configuration entry</param>
|
||||
/// <param name="fileName">File name that contains the types configuration information.</param>
|
||||
/// <exception cref="ArgumentException">when <paramref name="fileName"/> is null or empty</exception>
|
||||
public TypeConfigurationEntry(string name, string fileName)
|
||||
: base(name)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("fileName");
|
||||
}
|
||||
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for type configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="typeData">TypeData instance</param>
|
||||
/// <param name="isRemove">Specify the operation with the typedata</param>
|
||||
public TypeConfigurationEntry(TypeData typeData, bool isRemove)
|
||||
: base("*")
|
||||
{
|
||||
if (typeData == null)
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("typeData");
|
||||
}
|
||||
|
||||
TypeData = typeData;
|
||||
IsRemove = isRemove;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for type configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the type configuration entry</param>
|
||||
/// <param name="fileName">File name that contains the types configuration information.</param>
|
||||
/// <param name="psSnapinInfo">PSSnapin from which type info comes.</param>
|
||||
/// <exception cref="ArgumentException">when <paramref name="fileName"/> is null, empty or does not end in .ps1xml</exception>
|
||||
internal TypeConfigurationEntry(string name, string fileName, PSSnapInInfo psSnapinInfo)
|
||||
: base(name, psSnapinInfo)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("fileName");
|
||||
}
|
||||
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for type configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="fileName">File name that contains the types configuration information.</param>
|
||||
/// <exception cref="ArgumentException">when <paramref name="fileName"/> is null, empty or does not end in .ps1xml</exception>
|
||||
public TypeConfigurationEntry(string fileName)
|
||||
: base(fileName)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("fileName");
|
||||
}
|
||||
#pragma warning suppress 56506
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets file name that contains the types configuration information.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string FileName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the strong type data contains the type configuration information
|
||||
/// </summary>
|
||||
public TypeData TypeData { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Set to true if the strong type data is to be removed
|
||||
/// </summary>
|
||||
public bool IsRemove { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines class for type configuration entry.
|
||||
/// </summary>
|
||||
internal sealed class FormatConfigurationEntry : RunspaceConfigurationEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Initiate an instance for type configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the format configuration entry</param>
|
||||
/// <param name="fileName">File name that contains the format configuration information.</param>
|
||||
/// <exception cref="ArgumentException">when <paramref name="fileName"/> is null or empty</exception>
|
||||
public FormatConfigurationEntry(string name, string fileName)
|
||||
: base(name)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("fileName");
|
||||
}
|
||||
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for Format configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the Format configuration entry</param>
|
||||
/// <param name="fileName">File name that contains the Formats configuration information.</param>
|
||||
/// <param name="psSnapinInfo">PSSnapin from which the format comes.</param>
|
||||
/// <exception cref="ArgumentException">when <paramref name="fileName"/> is null, empty or does not end in .ps1xml</exception>
|
||||
internal FormatConfigurationEntry(string name, string fileName, PSSnapInInfo psSnapinInfo)
|
||||
: base(name, psSnapinInfo)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("fileName");
|
||||
}
|
||||
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for type configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="fileName">File name that contains the format configuration information.</param>
|
||||
/// <exception cref="ArgumentException">when <paramref name="fileName"/> is null or empty</exception>
|
||||
public FormatConfigurationEntry(string fileName)
|
||||
: base(fileName)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("fileName");
|
||||
}
|
||||
#pragma warning suppress 56506
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for type configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="typeDefinition"></param>
|
||||
public FormatConfigurationEntry(ExtendedTypeDefinition typeDefinition)
|
||||
: base("*")
|
||||
{
|
||||
if (typeDefinition == null)
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("typeDefinition");
|
||||
}
|
||||
FormatData = typeDefinition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets file name that contains the format configuration information.
|
||||
/// </summary>
|
||||
/// <value>File name that contains the format configuration information.</value>
|
||||
public string FileName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the typeDefinition that contains the format configuration information
|
||||
/// </summary>
|
||||
public ExtendedTypeDefinition FormatData { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class to define configuration data for cmdlets
|
||||
/// </summary>
|
||||
internal sealed class CmdletConfigurationEntry : RunspaceConfigurationEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Initiate an instance for cmdlet configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the cmdlet configuration entry</param>
|
||||
/// <param name="implementingType">Class that include implementation of the cmdlet</param>
|
||||
/// <param name="helpFileName">Name of the help file that include help information for the cmdlet</param>
|
||||
public CmdletConfigurationEntry(string name, Type implementingType, string helpFileName)
|
||||
: base(name)
|
||||
{
|
||||
if (implementingType == null)
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("implementingType");
|
||||
}
|
||||
|
||||
ImplementingType = implementingType;
|
||||
|
||||
if (!String.IsNullOrEmpty(helpFileName))
|
||||
{
|
||||
HelpFileName = helpFileName.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
HelpFileName = helpFileName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for cmdlet configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the cmdlet configuration entry</param>
|
||||
/// <param name="implementingType">Class that include implementation of the cmdlet</param>
|
||||
/// <param name="psSnapinInfo">PSSnapin from which the cmdlet comes.</param>
|
||||
/// <param name="helpFileName">Name of the help file that include help information for the cmdlet</param>
|
||||
internal CmdletConfigurationEntry(string name, Type implementingType, string helpFileName, PSSnapInInfo psSnapinInfo)
|
||||
: base(name, psSnapinInfo)
|
||||
{
|
||||
if (implementingType == null)
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("implementingType");
|
||||
}
|
||||
|
||||
ImplementingType = implementingType;
|
||||
|
||||
if (!String.IsNullOrEmpty(helpFileName))
|
||||
{
|
||||
HelpFileName = helpFileName.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
HelpFileName = helpFileName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get class that include implementation of the cmdlet
|
||||
/// </summary>
|
||||
public Type ImplementingType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get name of the help file that include help information for the cmdlet
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string HelpFileName { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Define class for provider configuration entry
|
||||
/// </summary>
|
||||
internal sealed class ProviderConfigurationEntry : RunspaceConfigurationEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Initiate an instance for provider configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the provider configuration entry</param>
|
||||
/// <param name="implementingType">Class that include implementation of the provider</param>
|
||||
/// <param name="helpFileName">Name of the help file that include help information for the provider</param>
|
||||
public ProviderConfigurationEntry(string name, Type implementingType, string helpFileName)
|
||||
: base(name)
|
||||
{
|
||||
if (implementingType == null)
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("implementingType");
|
||||
}
|
||||
|
||||
ImplementingType = implementingType;
|
||||
|
||||
if (!String.IsNullOrEmpty(helpFileName))
|
||||
{
|
||||
HelpFileName = helpFileName.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
HelpFileName = helpFileName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for provider configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the provider configuration entry</param>
|
||||
/// <param name="implementingType">Class that include implementation of the provider</param>
|
||||
/// <param name="helpFileName">Name of the help file that include help information for the provider</param>
|
||||
/// <param name="psSnapinInfo">PSSnapin from which provider comes from.</param>
|
||||
internal ProviderConfigurationEntry(string name, Type implementingType, string helpFileName, PSSnapInInfo psSnapinInfo)
|
||||
: base(name, psSnapinInfo)
|
||||
{
|
||||
if (implementingType == null)
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("implementingType");
|
||||
}
|
||||
|
||||
ImplementingType = implementingType;
|
||||
|
||||
if (!String.IsNullOrEmpty(helpFileName))
|
||||
{
|
||||
HelpFileName = helpFileName.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
HelpFileName = helpFileName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get class that include implementation of the provider.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Type ImplementingType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get name of the help file that include help information for the provider
|
||||
/// </summary>
|
||||
public string HelpFileName { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Define class for script configuration entry
|
||||
/// </summary>
|
||||
internal sealed class ScriptConfigurationEntry : RunspaceConfigurationEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Initiate an instance for script configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the script configuration entry</param>
|
||||
/// <param name="definition">Content of the script</param>
|
||||
public ScriptConfigurationEntry(string name, string definition)
|
||||
: base(name)
|
||||
{
|
||||
if (String.IsNullOrEmpty(definition) || String.IsNullOrEmpty(definition.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("definition");
|
||||
}
|
||||
|
||||
Definition = definition.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get content for the script.
|
||||
/// </summary>
|
||||
public string Definition { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration data for assemblies.
|
||||
/// </summary>
|
||||
internal sealed class AssemblyConfigurationEntry : RunspaceConfigurationEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Initiate an instance for assembly configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Strong name of the assembly</param>
|
||||
/// <param name="fileName">Name of the assembly file</param>
|
||||
public AssemblyConfigurationEntry(string name, string fileName)
|
||||
: base(name)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("fileName");
|
||||
}
|
||||
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiate an instance for assembly configuration entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Strong name of the assembly</param>
|
||||
/// <param name="fileName">Name of the assembly file</param>
|
||||
/// <param name="psSnapinInfo">PSSnapin information.</param>
|
||||
/// <exception cref="ArgumentException">when <paramref name="fileName"/> is null, empty or does not end in .ps1xml</exception>
|
||||
internal AssemblyConfigurationEntry(string name, string fileName, PSSnapInInfo psSnapinInfo)
|
||||
: base(name, psSnapinInfo)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(fileName.Trim()))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("fileName");
|
||||
}
|
||||
|
||||
FileName = fileName.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get name of the assembly file
|
||||
/// </summary>
|
||||
/// <value>Name of the assembly file</value>
|
||||
public string FileName { get; }
|
||||
}
|
||||
|
||||
internal enum UpdateAction
|
||||
{
|
||||
Add,
|
||||
Remove,
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore 56506
|
||||
@@ -4214,7 +4214,7 @@ namespace System.Management.Automation.Runspaces
|
||||
Update(errors, typeData, false);
|
||||
StandardMembersUpdated();
|
||||
// Throw exception if there are any errors
|
||||
FormatAndTypeDataHelper.ThrowExceptionOnError("ErrorsUpdatingTypes", errors, RunspaceConfigurationCategory.Types);
|
||||
FormatAndTypeDataHelper.ThrowExceptionOnError("ErrorsUpdatingTypes", errors, FormatAndTypeDataHelper.Category.Types);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -4240,7 +4240,7 @@ namespace System.Management.Automation.Runspaces
|
||||
Update(errors, typeData, true);
|
||||
StandardMembersUpdated();
|
||||
// Throw exception if there are any errors
|
||||
FormatAndTypeDataHelper.ThrowExceptionOnError("ErrorsUpdatingTypes", errors, RunspaceConfigurationCategory.Types);
|
||||
FormatAndTypeDataHelper.ThrowExceptionOnError("ErrorsUpdatingTypes", errors, FormatAndTypeDataHelper.Category.Types);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace System.Management.Automation.Runspaces
|
||||
string errorId,
|
||||
Collection<string> independentErrors,
|
||||
Collection<PSSnapInTypeAndFormatErrors> PSSnapinFilesCollection,
|
||||
RunspaceConfigurationCategory category)
|
||||
Category category)
|
||||
{
|
||||
Collection<string> errors = new Collection<string>();
|
||||
if (independentErrors != null)
|
||||
@@ -148,12 +148,12 @@ namespace System.Management.Automation.Runspaces
|
||||
}
|
||||
|
||||
string message = string.Empty;
|
||||
if (category == RunspaceConfigurationCategory.Types)
|
||||
if (category == Category.Types)
|
||||
{
|
||||
message =
|
||||
StringUtil.Format(ExtendedTypeSystem.TypesXmlError, allErrors.ToString());
|
||||
}
|
||||
else if (category == RunspaceConfigurationCategory.Formats)
|
||||
else if (category == Category.Formats)
|
||||
{
|
||||
message = StringUtil.Format(FormatAndOutXmlLoadingStrings.FormatLoadingErrors, allErrors.ToString());
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace System.Management.Automation.Runspaces
|
||||
internal static void ThrowExceptionOnError(
|
||||
string errorId,
|
||||
ConcurrentBag<string> errors,
|
||||
RunspaceConfigurationCategory category)
|
||||
Category category)
|
||||
{
|
||||
if (errors.Count == 0)
|
||||
{
|
||||
@@ -182,12 +182,12 @@ namespace System.Management.Automation.Runspaces
|
||||
}
|
||||
|
||||
string message = string.Empty;
|
||||
if (category == RunspaceConfigurationCategory.Types)
|
||||
if (category == Category.Types)
|
||||
{
|
||||
message =
|
||||
StringUtil.Format(ExtendedTypeSystem.TypesXmlError, allErrors.ToString());
|
||||
}
|
||||
else if (category == RunspaceConfigurationCategory.Formats)
|
||||
else if (category == Category.Formats)
|
||||
{
|
||||
message = StringUtil.Format(FormatAndOutXmlLoadingStrings.FormatLoadingErrors, allErrors.ToString());
|
||||
}
|
||||
@@ -195,6 +195,12 @@ namespace System.Management.Automation.Runspaces
|
||||
ex.SetErrorId(errorId);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
internal enum Category
|
||||
{
|
||||
Types,
|
||||
Formats,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user