コード例 #1
0
 private void InitializeGroupBy()
 {
     if ((this.parameters != null) && (this.parameters.groupByParameter != null))
     {
         MshExpression entry        = this.parameters.groupByParameter.GetEntry("expression") as MshExpression;
         string        displayLabel = null;
         object        obj2         = this.parameters.groupByParameter.GetEntry("label");
         if (obj2 != AutomationNull.Value)
         {
             displayLabel = obj2 as string;
         }
         this.groupingManager = new GroupingInfoManager();
         this.groupingManager.Initialize(entry, displayLabel);
     }
     else if (this.dataBaseInfo.view != null)
     {
         GroupBy groupBy = this.dataBaseInfo.view.groupBy;
         if ((groupBy != null) && ((groupBy.startGroup != null) && (groupBy.startGroup.expression != null)))
         {
             MshExpression groupingExpression = this.expressionFactory.CreateFromExpressionToken(groupBy.startGroup.expression, this.dataBaseInfo.view.loadingInfo);
             this.groupingManager = new GroupingInfoManager();
             this.groupingManager.Initialize(groupingExpression, null);
         }
     }
 }
コード例 #2
0
        private void InitializeGroupBy()
        {
            // first check if there is an override from the command line
            if (parameters != null && parameters.groupByParameter != null)
            {
                // get the expression to use
                PSPropertyExpression groupingKeyExpression = parameters.groupByParameter.GetEntry(FormatParameterDefinitionKeys.ExpressionEntryKey) as PSPropertyExpression;

                // set the label
                string label    = null;
                object labelKey = parameters.groupByParameter.GetEntry(FormatParameterDefinitionKeys.LabelEntryKey);
                if (labelKey != AutomationNull.Value)
                {
                    label = labelKey as string;
                }

                _groupingManager = new GroupingInfoManager();
                _groupingManager.Initialize(groupingKeyExpression, label);
                return;
            }

            // check if we have a view to initialize from
            if (this.dataBaseInfo.view != null)
            {
                GroupBy gb = this.dataBaseInfo.view.groupBy;
                if (gb is null)
                {
                    return;
                }

                if (gb.startGroup is null || gb.startGroup.expression is null)
                {
                    return;
                }

                PSPropertyExpression ex = this.expressionFactory.CreateFromExpressionToken(gb.startGroup.expression, this.dataBaseInfo.view.loadingInfo);

                _groupingManager = new GroupingInfoManager();
                _groupingManager.Initialize(ex, null);
            }
        }
コード例 #3
0
ファイル: FormatViewGenerator.cs プロジェクト: 40a/PowerShell
        private void InitializeGroupBy()
        {
            // first check if there is an override from the command line
            if (parameters != null && parameters.groupByParameter != null)
            {
                // get the expression to use
                MshExpression groupingKeyExpression = parameters.groupByParameter.GetEntry(FormatParameterDefinitionKeys.ExpressionEntryKey) as MshExpression;

                // set the label
                string label = null;
                object labelKey = parameters.groupByParameter.GetEntry(FormatParameterDefinitionKeys.LabelEntryKey);
                if (labelKey != AutomationNull.Value)
                {
                    label = labelKey as string;
                }
                _groupingManager = new GroupingInfoManager();
                _groupingManager.Initialize(groupingKeyExpression, label);
                return;
            }

            // check if we have a view to initialize from
            if (this.dataBaseInfo.view != null)
            {
                GroupBy gb = this.dataBaseInfo.view.groupBy;
                if (gb == null)
                {
                    return;
                }
                if (gb.startGroup == null || gb.startGroup.expression == null)
                {
                    return;
                }

                MshExpression ex = this.expressionFactory.CreateFromExpressionToken(gb.startGroup.expression, this.dataBaseInfo.view.loadingInfo);

                _groupingManager = new GroupingInfoManager();
                _groupingManager.Initialize(ex, null);
            }
        }
コード例 #4
0
ファイル: ViewGenerator.cs プロジェクト: nickchal/pash
 private void InitializeGroupBy()
 {
     if ((this.parameters != null) && (this.parameters.groupByParameter != null))
     {
         MshExpression entry = this.parameters.groupByParameter.GetEntry("expression") as MshExpression;
         string displayLabel = null;
         object obj2 = this.parameters.groupByParameter.GetEntry("label");
         if (obj2 != AutomationNull.Value)
         {
             displayLabel = obj2 as string;
         }
         this.groupingManager = new GroupingInfoManager();
         this.groupingManager.Initialize(entry, displayLabel);
     }
     else if (this.dataBaseInfo.view != null)
     {
         GroupBy groupBy = this.dataBaseInfo.view.groupBy;
         if ((groupBy != null) && ((groupBy.startGroup != null) && (groupBy.startGroup.expression != null)))
         {
             MshExpression groupingExpression = this.expressionFactory.CreateFromExpressionToken(groupBy.startGroup.expression, this.dataBaseInfo.view.loadingInfo);
             this.groupingManager = new GroupingInfoManager();
             this.groupingManager.Initialize(groupingExpression, null);
         }
     }
 }