コード例 #1
0
        private async Task <VariableContainerDetails> FetchVariableContainer(
            string scope,
            VariableContainerDetails autoVariables)
        {
            PSCommand psCommand = new PSCommand();

            psCommand.AddCommand("Get-Variable");
            psCommand.AddParameter("Scope", scope);

            var scopeVariableContainer =
                new VariableContainerDetails("Scope: " + scope);

            _variables.Add(scopeVariableContainer);

            var results = await ExecuteCommand <PSVariable>(psCommand);

            if (results != null)
            {
                foreach (PSVariable psvariable in results)
                {
                    var variableDetails = new VariableDetails(psvariable); // { Id = this.nextVariableId++ };
                    _variables.Add(variableDetails);
                    scopeVariableContainer.Children.Add(variableDetails);  //.Add(variableDetails.Name, variableDetails);

                    if ((autoVariables != null) && AddToAutoVariables(psvariable, scope))
                    {
                        autoVariables.Children.Add(variableDetails); //(variableDetails.Name, variableDetails);
                    }
                }
            }

            return(scopeVariableContainer);
        }
コード例 #2
0
        /// <summary>
        /// If this variable instance is expandable, this method returns the
        /// details of its children.  Otherwise it returns an empty array.
        /// </summary>
        /// <returns></returns>
        public override VariableDetailsBase[] GetChildren()
        {
            VariableDetails[] childVariables = null;

            if (this.IsExpandable)
            {
                if (_cachedChildren == null)
                {
                    _cachedChildren = GetChildren(_valueObject);
                }

                return _cachedChildren;
            }
            else
            {
                childVariables = new VariableDetails[0];
            }

            return childVariables;
        }
コード例 #3
0
        /// <summary>
        /// If this variable instance is expandable, this method returns the
        /// details of its children.  Otherwise it returns an empty array.
        /// </summary>
        /// <returns></returns>
        public override VariableDetailsBase[] GetChildren()
        {
            VariableDetails[] childVariables = null;

            if (this.IsExpandable)
            {
                if (_cachedChildren == null)
                {
                    _cachedChildren = GetChildren(_valueObject);
                }

                return(_cachedChildren);
            }
            else
            {
                childVariables = new VariableDetails[0];
            }

            return(childVariables);
        }