예제 #1
0
        internal static string GetCommandString(PSCommand command)
        {
            if (command.Commands.Count <= 0)
            {
                throw new ArgumentOutOfRangeException("command", "[ProxyHelper.GetCommandString] PSCommand should only have one command.");
            }
            StringBuilder stringBuilder = new StringBuilder(command.Commands[0].CommandText);

            foreach (CommandParameter commandParameter in command.Commands[0].Parameters)
            {
                ProxyHelper.BuildCommandFromParameter(commandParameter.Name, commandParameter.Value, stringBuilder);
            }
            return(stringBuilder.ToString());
        }
예제 #2
0
        // Token: 0x06001646 RID: 5702 RVA: 0x00054078 File Offset: 0x00052278
        private string GeneratePswsProxyCmdlet(CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters)
        {
            this.MakeNecessaryChangeOnParametersBeforeProxy(changeCmdletProxyParameters);
            StringBuilder stringBuilder = null;

            if (this.context.InvocationInfo != null)
            {
                stringBuilder = new StringBuilder(this.context.InvocationInfo.CommandName);
                foreach (object obj in this.context.InvocationInfo.UserSpecifiedParameters.Keys)
                {
                    string text = (string)obj;
                    ProxyHelper.BuildCommandFromParameter(text, this.GetParameterValueToProxy(text), stringBuilder);
                }
            }
            return(stringBuilder.ToString());
        }