Пример #1
0
 public PowwaHost(ClientInfo clientInfo)
 {
     this.instanceId       = new Guid("3BADF81F-2A26-468B-ADCC-F93DC13F8084");
     this.version          = new Version(1, 0, 0);
     this.userInterface    = new PowwaHostUserInterface(clientInfo);
     this.currentCulture   = clientInfo.CurrentCulture;
     this.currentUICulture = clientInfo.CurrentUICulture;
     standardErrorWriter   = new WebWriter(this);
     standardOutputWriter  = new WebWriter(this);
     standardInputReader   = new WebReader(this);
 }
Пример #2
0
        public override Dictionary <string, PSObject> Prompt(string caption, string message, Collection <FieldDescription> descriptions)
        {
            bool flag = false;
            Dictionary <string, PSObject> reply;

            PowwaEvents.PowwaEVENT_DEBUG_LOG0("Prompt(): Enter");
            try
            {
                if (descriptions != null)
                {
                    if (descriptions.Count != 0)
                    {
                        PromptFieldDescription[] promptFieldDescriptionArray = new PromptFieldDescription[descriptions.Count];
                        int num = 0;
                        while (num < descriptions.Count)
                        {
                            if (descriptions[num] != null)
                            {
                                Type            fieldType       = PowwaHostUserInterface.GetFieldType(descriptions[num], out flag);
                                PromptFieldType promptFieldType = PromptFieldType.String;
                                if (fieldType != typeof(SecureString))
                                {
                                    if (fieldType == typeof(PSCredential))
                                    {
                                        promptFieldType = PromptFieldType.Credential;
                                    }
                                }
                                else
                                {
                                    promptFieldType = PromptFieldType.SecureString;
                                }
                                PromptFieldDescription promptFieldDescription = new PromptFieldDescription();
                                promptFieldDescription.Name                  = descriptions[num].Name;
                                promptFieldDescription.Label                 = descriptions[num].Label;
                                promptFieldDescription.HelpMessage           = descriptions[num].HelpMessage;
                                promptFieldDescription.PromptFieldType       = promptFieldType;
                                promptFieldDescription.PromptFieldTypeIsList = flag;
                                promptFieldDescriptionArray[num]             = promptFieldDescription;
                                num++;
                            }
                            else
                            {
                                object[] objArray = new object[1];
                                objArray[0] = num;
                                string str = string.Format(CultureInfo.InvariantCulture, "descriptions[{0}]", objArray);
                                PowwaEvents.PowwaEVENT_DEBUG_LOG1("Prompt(): Invalid Description", str, "null");
                                throw new ArgumentNullException(str);
                            }
                        }
                        MessageCreatedEventArgs messageCreatedEventArg = new MessageCreatedEventArgs(new PromptMessage(caption, message, promptFieldDescriptionArray), true);
                        this.OnMessageCreated(messageCreatedEventArg);
                        reply = (Dictionary <string, PSObject>)messageCreatedEventArg.Reply;
                    }
                    else
                    {
                        int count = descriptions.Count;
                        PowwaEvents.PowwaEVENT_DEBUG_LOG1("Prompt(): Invalid Argument", "Descriptions.Count", count.ToString(CultureInfo.InvariantCulture));
                        throw new ArgumentException("descriptions cannot be an empty array", "descriptions");
                    }
                }
                else
                {
                    PowwaEvents.PowwaEVENT_DEBUG_LOG1("Prompt(): Invalid Argument", "Descriptions", "null");
                    throw new ArgumentNullException("descriptions");
                }
            }
            finally
            {
                PowwaEvents.PowwaEVENT_DEBUG_LOG0("Prompt(): Exit");
            }
            return(reply);
        }
Пример #3
0
		public PowwaHost(ClientInfo clientInfo)
		{
			this.instanceId = new Guid("3BADF81F-2A26-468B-ADCC-F93DC13F8084");
			this.version = new Version(1, 0, 0);
			this.userInterface = new PowwaHostUserInterface(clientInfo);
			this.currentCulture = clientInfo.CurrentCulture;
			this.currentUICulture = clientInfo.CurrentUICulture;
			standardErrorWriter = new WebWriter(this);
			standardOutputWriter = new WebWriter(this);
			standardInputReader = new WebReader(this);
		}