コード例 #1
0
ファイル: OrderObjectBase.cs プロジェクト: x1m0/PowerShell
        /// <summary>
        /// Utility function used to create OrderByPropertyEntry for the supplied input object.
        /// </summary>
        /// <param name="cmdlet">PSCmdlet</param>
        /// <param name="inputObject">Input Object.</param>
        /// <param name="isCaseSensitive">Indicates if the Property value comparisons need to be case sensitive or not.</param>
        /// <param name="cultureInfo">Culture Info that needs to be used for comparison.</param>
        /// <returns>OrderByPropertyEntry for the supplied InputObject.</returns>
        internal OrderByPropertyEntry CreateOrderByPropertyEntry(
            PSCmdlet cmdlet,
            PSObject inputObject,
            bool isCaseSensitive,
            CultureInfo cultureInfo)
        {
            Diagnostics.Assert(cmdlet != null, "cmdlet must be an instance");

            if (_unExpandedParametersWithWildCardPattern != null)
            {
                ExpandExpressions(inputObject, _unExpandedParametersWithWildCardPattern, _mshParameterList);
            }

            List <ErrorRecord>   evaluationErrors     = new List <ErrorRecord>();
            List <string>        propertyNotFoundMsgs = new List <string>();
            OrderByPropertyEntry result =
                OrderByPropertyEntryEvaluationHelper.ProcessObject(inputObject, _mshParameterList, evaluationErrors, propertyNotFoundMsgs, isCaseSensitive, cultureInfo);

            foreach (ErrorRecord err in evaluationErrors)
            {
                cmdlet.WriteError(err);
            }
            foreach (string debugMsg in propertyNotFoundMsgs)
            {
                cmdlet.WriteDebug(debugMsg);
            }

            return(result);
        }
コード例 #2
0
ファイル: OrderObjectBase.cs プロジェクト: x1m0/PowerShell
        internal static List <OrderByPropertyEntry> CreateOrderMatrix(
            PSCmdlet cmdlet,
            List <PSObject> inputObjects,
            List <MshParameter> mshParameterList
            )
        {
            List <OrderByPropertyEntry> orderMatrixToCreate = new List <OrderByPropertyEntry>();

            foreach (PSObject so in inputObjects)
            {
                if (so == null || so == AutomationNull.Value)
                {
                    continue;
                }
                List <ErrorRecord>   evaluationErrors     = new List <ErrorRecord>();
                List <string>        propertyNotFoundMsgs = new List <string>();
                OrderByPropertyEntry result =
                    OrderByPropertyEntryEvaluationHelper.ProcessObject(so, mshParameterList, evaluationErrors, propertyNotFoundMsgs);
                foreach (ErrorRecord err in evaluationErrors)
                {
                    cmdlet.WriteError(err);
                }
                foreach (string debugMsg in propertyNotFoundMsgs)
                {
                    cmdlet.WriteDebug(debugMsg);
                }
                orderMatrixToCreate.Add(result);
            }

            return(orderMatrixToCreate);
        }
コード例 #3
0
ファイル: OrderByProperty.cs プロジェクト: modulexcite/pash-1
        internal static List <OrderByPropertyEntry> CreateOrderMatrix(PSCmdlet cmdlet, List <PSObject> inputObjects, List <MshParameter> mshParameterList)
        {
            List <OrderByPropertyEntry> list = new List <OrderByPropertyEntry>();

            foreach (PSObject obj2 in inputObjects)
            {
                if ((obj2 != null) && (obj2 != AutomationNull.Value))
                {
                    List <ErrorRecord>   errors = new List <ErrorRecord>();
                    List <string>        propertyNotFoundMsgs = new List <string>();
                    OrderByPropertyEntry item = OrderByPropertyEntryEvaluationHelper.ProcessObject(obj2, mshParameterList, errors, propertyNotFoundMsgs);
                    foreach (ErrorRecord record in errors)
                    {
                        cmdlet.WriteError(record);
                    }
                    foreach (string str in propertyNotFoundMsgs)
                    {
                        cmdlet.WriteDebug(str);
                    }
                    list.Add(item);
                }
            }
            return(list);
        }