diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs index b2cb8fa96e2..2488490c514 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs @@ -395,7 +395,7 @@ internal void SetParameter(string parameterName, bool isBeginProcess) if (nameset.Count == 0) { - throw new PSArgumentException(Strings.UnableToResolveParameterSetName); + throw new PSArgumentException(CimCmdletStrings.UnableToResolveParameterSetName); } else { @@ -452,7 +452,7 @@ internal string GetParameterSet() { if (boundParameterSetName != null) { - throw new PSArgumentException(Strings.UnableToResolveParameterSetName); + throw new PSArgumentException(CimCmdletStrings.UnableToResolveParameterSetName); } boundParameterSetName = parameterSetName; @@ -465,7 +465,7 @@ internal string GetParameterSet() // throw if there are > 1 parameter set if (noMandatoryParameterSet.Count > 1) { - throw new PSArgumentException(Strings.UnableToResolveParameterSetName); + throw new PSArgumentException(CimCmdletStrings.UnableToResolveParameterSetName); } else if (noMandatoryParameterSet.Count == 1) { @@ -482,7 +482,7 @@ internal string GetParameterSet() // throw if still can not find the parameter set name if (boundParameterSetName == null) { - throw new PSArgumentException(Strings.UnableToResolveParameterSetName); + throw new PSArgumentException(CimCmdletStrings.UnableToResolveParameterSetName); } return boundParameterSetName; @@ -903,7 +903,7 @@ internal void ThrowInvalidAuthenticationTypeError( string parameterName, PasswordAuthenticationMechanism authentication) { - string message = string.Format(CultureInfo.CurrentUICulture, Strings.InvalidAuthenticationTypeWithNullCredential, + string message = string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.InvalidAuthenticationTypeWithNullCredential, authentication, ImpersonatedAuthenticationMechanism.None, ImpersonatedAuthenticationMechanism.Negotiate, @@ -926,7 +926,7 @@ internal void ThrowConflictParameterWasSet( string conflictParameterName) { string message = string.Format(CultureInfo.CurrentUICulture, - Strings.ConflictParameterWasSet, + CimCmdletStrings.ConflictParameterWasSet, parameterName, conflictParameterName); PSArgumentException exception = new PSArgumentException(message, parameterName); ThrowTerminatingError(exception, operationName); @@ -955,7 +955,7 @@ internal void ThrowInvalidProperty( propList.Append(property); } - string message = string.Format(CultureInfo.CurrentUICulture, Strings.CouldNotFindPropertyFromGivenClass, + string message = string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.CouldNotFindPropertyFromGivenClass, className, propList); PSArgumentOutOfRangeException exception = new PSArgumentOutOfRangeException( parameterName, actualValue, message); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs index 74f4a571dd2..ba82ff9e432 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs @@ -392,7 +392,7 @@ private CimMethodParametersCollection CreateParametersCollection( if (declaration == null) { throw new ArgumentException(string.Format( - CultureInfo.CurrentUICulture, Strings.InvalidMethod, methodName, className)); + CultureInfo.CurrentUICulture, CimCmdletStrings.InvalidMethod, methodName, className)); } } else if (cimInstance != null) @@ -407,7 +407,7 @@ private CimMethodParametersCollection CreateParametersCollection( if (paramDeclaration == null) { throw new ArgumentException(string.Format( - CultureInfo.CurrentUICulture, Strings.InvalidMethodParameter, parameterName, methodName, className)); + CultureInfo.CurrentUICulture, CimCmdletStrings.InvalidMethodParameter, parameterName, methodName, className)); } parameter = CimMethodParameter.Create( diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs index 1ec18f0922b..559c58b8a11 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs @@ -169,7 +169,7 @@ public void RegisterCimIndication( DebugHelper.WriteLogEx("queryDialect = '{0}'; queryExpression = '{1}'", 0, queryDialect, queryExpression); if (cimSession == null) { - throw new ArgumentNullException(string.Format(CultureInfo.CurrentUICulture, Strings.NullArgument, @"cimSession")); + throw new ArgumentNullException(string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.NullArgument, @"cimSession")); } this.TargetComputerName = cimSession.ComputerName; diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs index fb6a5f5972e..0dd85ea213c 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs @@ -553,7 +553,7 @@ private void AddErrorRecord( { errRecords.Add( new ErrorRecord( - new CimException(string.Format(CultureInfo.CurrentUICulture, Strings.CouldNotFindCimsessionObject, propertyName, propertyValue)), + new CimException(string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.CouldNotFindCimsessionObject, propertyName, propertyValue)), string.Empty, ErrorCategory.ObjectNotFound, null)); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs index cd319d242d3..084bad51d91 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs @@ -872,7 +872,7 @@ internal void WriteOperationStartMessage(string operation, Hashtable parameterLi } string operationStartMessage = string.Format(CultureInfo.CurrentUICulture, - Strings.CimOperationStart, + CimCmdletStrings.CimOperationStart, operation, (parameters.Length == 0) ? "null" : parameters.ToString()); WriteMessage((UInt32)CimWriteMessageChannel.Verbose, operationStartMessage); @@ -888,7 +888,7 @@ internal void WriteOperationCompleteMessage(string operation) { DebugHelper.WriteLogEx(); string operationCompleteMessage = string.Format(CultureInfo.CurrentUICulture, - Strings.CimOperationCompleted, + CimCmdletStrings.CimOperationCompleted, operation); WriteMessage((UInt32)CimWriteMessageChannel.Verbose, operationCompleteMessage); } @@ -1104,7 +1104,7 @@ public void CreateInstanceAsync(string namespaceName, CimInstance instance) DebugHelper.WriteLogEx("EnableMethodResultStreaming = {0}", 0, this.options.EnableMethodResultStreaming); this.CheckAvailability(); this.targetCimInstance = instance; - this.operationName = Strings.CimOperationNameCreateInstance; + this.operationName = CimCmdletStrings.CimOperationNameCreateInstance; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"instance", instance); @@ -1124,7 +1124,7 @@ public void DeleteInstanceAsync(string namespaceName, CimInstance instance) DebugHelper.WriteLogEx("namespace = {0}; classname = {1};", 0, namespaceName, instance.CimSystemProperties.ClassName); this.CheckAvailability(); this.targetCimInstance = instance; - this.operationName = Strings.CimOperationNameDeleteInstance; + this.operationName = CimCmdletStrings.CimOperationNameDeleteInstance; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"instance", instance); @@ -1144,7 +1144,7 @@ public void GetInstanceAsync(string namespaceName, CimInstance instance) DebugHelper.WriteLogEx("namespace = {0}; classname = {1}; keyonly = {2}", 0, namespaceName, instance.CimSystemProperties.ClassName, this.options.KeysOnly); this.CheckAvailability(); this.targetCimInstance = instance; - this.operationName = Strings.CimOperationNameGetInstance; + this.operationName = CimCmdletStrings.CimOperationNameGetInstance; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"instance", instance); @@ -1164,7 +1164,7 @@ public void ModifyInstanceAsync(string namespaceName, CimInstance instance) DebugHelper.WriteLogEx("namespace = {0}; classname = {1}", 0, namespaceName, instance.CimSystemProperties.ClassName); this.CheckAvailability(); this.targetCimInstance = instance; - this.operationName = Strings.CimOperationNameModifyInstance; + this.operationName = CimCmdletStrings.CimOperationNameModifyInstance; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"instance", instance); @@ -1195,7 +1195,7 @@ public void EnumerateAssociatedInstancesAsync( DebugHelper.WriteLogEx("Instance class {0}, association class {1}", 0, sourceInstance.CimSystemProperties.ClassName, associationClassName); this.CheckAvailability(); this.targetCimInstance = sourceInstance; - this.operationName = Strings.CimOperationNameEnumerateAssociatedInstances; + this.operationName = CimCmdletStrings.CimOperationNameEnumerateAssociatedInstances; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"sourceInstance", sourceInstance); @@ -1218,7 +1218,7 @@ public void EnumerateInstancesAsync(string namespaceName, string className) DebugHelper.WriteLogEx("KeyOnly {0}", 0, this.options.KeysOnly); this.CheckAvailability(); this.targetCimInstance = null; - this.operationName = Strings.CimOperationNameEnumerateInstances; + this.operationName = CimCmdletStrings.CimOperationNameEnumerateInstances; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"className", className); @@ -1263,7 +1263,7 @@ public void QueryInstancesAsync( DebugHelper.WriteLogEx("KeyOnly = {0}", 0, this.options.KeysOnly); this.CheckAvailability(); this.targetCimInstance = null; - this.operationName = Strings.CimOperationNameQueryInstances; + this.operationName = CimCmdletStrings.CimOperationNameQueryInstances; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"queryDialect", queryDialect); @@ -1283,7 +1283,7 @@ public void EnumerateClassesAsync(string namespaceName) DebugHelper.WriteLogEx("namespace {0}", 0, namespaceName); this.CheckAvailability(); this.targetCimInstance = null; - this.operationName = Strings.CimOperationNameEnumerateClasses; + this.operationName = CimCmdletStrings.CimOperationNameEnumerateClasses; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.WriteOperationStartMessage(this.operationName, this.operationParameters); @@ -1300,7 +1300,7 @@ public void EnumerateClassesAsync(string namespaceName, string className) { this.CheckAvailability(); this.targetCimInstance = null; - this.operationName = Strings.CimOperationNameEnumerateClasses; + this.operationName = CimCmdletStrings.CimOperationNameEnumerateClasses; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"className", className); @@ -1320,7 +1320,7 @@ public void GetClassAsync(string namespaceName, string className) DebugHelper.WriteLogEx("namespace = {0}, className = {1}", 0, namespaceName, className); this.CheckAvailability(); this.targetCimInstance = null; - this.operationName = Strings.CimOperationNameGetClass; + this.operationName = CimCmdletStrings.CimOperationNameGetClass; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"className", className); @@ -1347,7 +1347,7 @@ public void InvokeMethodAsync( DebugHelper.WriteLogEx("EnableMethodResultStreaming = {0}", 0, this.options.EnableMethodResultStreaming); this.CheckAvailability(); this.targetCimInstance = instance; - this.operationName = Strings.CimOperationNameInvokeMethod; + this.operationName = CimCmdletStrings.CimOperationNameInvokeMethod; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"instance", instance); @@ -1373,7 +1373,7 @@ public void InvokeMethodAsync( DebugHelper.WriteLogEx("EnableMethodResultStreaming = {0}", 0, this.options.EnableMethodResultStreaming); this.CheckAvailability(); this.targetCimInstance = null; - this.operationName = Strings.CimOperationNameInvokeMethod; + this.operationName = CimCmdletStrings.CimOperationNameInvokeMethod; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"className", className); @@ -1400,7 +1400,7 @@ public void SubscribeAsync( DebugHelper.WriteLogEx("QueryDialect = '{0}'; queryExpression = '{1}'", 0, queryDialect, queryExpression); this.CheckAvailability(); this.targetCimInstance = null; - this.operationName = Strings.CimOperationNameSubscribeIndication; + this.operationName = CimCmdletStrings.CimOperationNameSubscribeIndication; this.operationParameters.Clear(); this.operationParameters.Add(@"namespaceName", namespaceName); this.operationParameters.Add(@"queryDialect", queryDialect); @@ -1904,7 +1904,7 @@ private void CheckAvailability() { if (!this.Completed) { - throw new InvalidOperationException(Strings.OperationInProgress); + throw new InvalidOperationException(CimCmdletStrings.OperationInProgress); } } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs index d55532e805e..fbe0830318d 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs @@ -232,7 +232,7 @@ private bool SetProperty(IDictionary properties, ref CimInstance cimInstance, re { // can not modify ReadOnly property exception = new CimException(string.Format(CultureInfo.CurrentUICulture, - Strings.CouldNotModifyReadonlyProperty, key, cimInstance)); + CimCmdletStrings.CouldNotModifyReadonlyProperty, key, cimInstance)); return false; } // allow modify the key property value as long as it is not readonly, @@ -281,7 +281,7 @@ private bool SetProperty(IDictionary properties, ref CimInstance cimInstance, re if (e.NativeErrorCode == NativeErrorCode.Failed) { string errorMessage = string.Format(CultureInfo.CurrentUICulture, - Strings.UnableToAddPropertyToInstance, + CimCmdletStrings.UnableToAddPropertyToInstance, newProperty.Name, cimInstance); exception = new CimException(errorMessage, e); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs index 720f5537d2b..bd02c5dde42 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs @@ -48,7 +48,7 @@ public CimWriteProgress( this.currentOperation = theCurrentOperation; if (string.IsNullOrEmpty(theStatusDescription)) { - this.statusDescription = Strings.DefaultStatusDescription; + this.statusDescription = CimCmdletStrings.DefaultStatusDescription; } else { diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs index 415d35ee1ba..e1104e4514b 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs @@ -434,7 +434,7 @@ public static string ValidateArgumentIsValidName(string parameterName, string va } DebugHelper.WriteLogEx("An invalid name: {0}={1}", 0, parameterName, value); - throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, Strings.InvalidParameterValue, value, parameterName)); + throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.InvalidParameterValue, value, parameterName)); } /// diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/resources/Microsoft.Management.Infrastructure.CimCmdlets.Strings.resx b/src/Microsoft.Management.Infrastructure.CimCmdlets/resources/CimCmdletStrings.resx similarity index 100% rename from src/Microsoft.Management.Infrastructure.CimCmdlets/resources/Microsoft.Management.Infrastructure.CimCmdlets.Strings.resx rename to src/Microsoft.Management.Infrastructure.CimCmdlets/resources/CimCmdletStrings.resx