示例#1
0
        private HelpCategory ToHelpCategory(string[] category, ref bool failed)
        {
            if (category == null || category.Length == 0)
            {
                return(HelpCategory.None);
            }

            HelpCategory helpCategory = HelpCategory.None;

            failed = false;

            for (int i = 0; i < category.Length; i++)
            {
                try
                {
                    HelpCategory temp = (HelpCategory)Enum.Parse(typeof(HelpCategory), category[i], true);

                    helpCategory |= temp;
                }
                catch (ArgumentException argumentException)
                {
                    Exception   e           = new HelpCategoryInvalidException(category[i], argumentException);
                    ErrorRecord errorRecord = new ErrorRecord(e, "InvalidHelpCategory", ErrorCategory.InvalidArgument, null);
                    this.WriteError(errorRecord);

                    failed = true;
                }
            }

            return(helpCategory);
        }
示例#2
0
        private HelpCategory ToHelpCategory(string[] category, ref bool failed)
        {
            if ((category == null) || (category.Length == 0))
            {
                return(HelpCategory.None);
            }
            HelpCategory none = HelpCategory.None;

            failed = false;
            for (int i = 0; i < category.Length; i++)
            {
                try
                {
                    HelpCategory category3 = (HelpCategory)Enum.Parse(typeof(HelpCategory), category[i], true);
                    none |= category3;
                }
                catch (ArgumentException exception)
                {
                    Exception   exception2  = new HelpCategoryInvalidException(category[i], exception);
                    ErrorRecord errorRecord = new ErrorRecord(exception2, "InvalidHelpCategory", ErrorCategory.InvalidArgument, null);
                    base.WriteError(errorRecord);
                    failed = true;
                }
            }
            return(none);
        }
示例#3
0
 private HelpCategory ToHelpCategory(string[] category, ref bool failed)
 {
     if ((category == null) || (category.Length == 0))
     {
         return HelpCategory.None;
     }
     HelpCategory none = HelpCategory.None;
     failed = false;
     for (int i = 0; i < category.Length; i++)
     {
         try
         {
             HelpCategory category3 = (HelpCategory) Enum.Parse(typeof(HelpCategory), category[i], true);
             none |= category3;
         }
         catch (ArgumentException exception)
         {
             Exception exception2 = new HelpCategoryInvalidException(category[i], exception);
             ErrorRecord errorRecord = new ErrorRecord(exception2, "InvalidHelpCategory", ErrorCategory.InvalidArgument, null);
             base.WriteError(errorRecord);
             failed = true;
         }
     }
     return none;
 }
示例#4
0
        private HelpCategory ToHelpCategory(string[] category, ref bool failed)
        {
            if (category == null || category.Length == 0)
                return HelpCategory.None;

            HelpCategory helpCategory = HelpCategory.None;

            failed = false;

            for (int i = 0; i < category.Length; i++)
            {
                try
                {
                    HelpCategory temp = (HelpCategory)Enum.Parse(typeof(HelpCategory), category[i], true);

                    helpCategory |= temp;
                }
                catch (ArgumentException argumentException)
                {
                    Exception e = new HelpCategoryInvalidException(category[i], argumentException);
                    ErrorRecord errorRecord = new ErrorRecord(e, "InvalidHelpCategory", ErrorCategory.InvalidArgument, null);
                    this.WriteError(errorRecord);

                    failed = true;
                }
            }

            return helpCategory;
        }