Exemplo n.º 1
0
 private void WriteErrorIfPerfectMatchNotFound(bool hadAMatch, string path, string requestedValueName)
 {
     if (!hadAMatch && !WildcardPattern.ContainsWildcardCharacters(requestedValueName))
     {
         string propertyNotAtPath = RegistryProviderStrings.PropertyNotAtPath;
         Exception exception = new PSArgumentException(string.Format(Thread.CurrentThread.CurrentCulture, propertyNotAtPath, new object[] { requestedValueName, path }), (string)null);
         base.WriteError(new ErrorRecord(exception, exception.GetType().FullName, ErrorCategory.InvalidArgument, requestedValueName));
     }
 }
Exemplo n.º 2
0
        private void WriteErrorIfPerfectMatchNotFound(bool hadAMatch, string path, string requestedValueName)
        {
            if (!hadAMatch && !WildcardPattern.ContainsWildcardCharacters(requestedValueName))
            {
                // we did not have any match and the requested name did not have
                // any globbing characters (perfect match attempted)
                // we need to write an error

                string formatString = RegistryProviderStrings.PropertyNotAtPath;
                Exception e =
                    new PSArgumentException(
                        string.Format(
                            CultureInfo.CurrentCulture,
                            formatString,
                            requestedValueName,
                            path),
                        (Exception)null);
                WriteError(new ErrorRecord(
                    e,
                    e.GetType().FullName,
                    ErrorCategory.InvalidArgument,
                    requestedValueName));
            }
        }