public ClientMessage[] SetPromptForCredentialReply(string userName, char[] password) { ClientMessage[] clientMessages; PowwaEvents.PowwaEVENT_DEBUG_LOG0("SetPromptForCredentialReply(): Enter"); try { lock (this.clientRequestLock) { lock (this.sessionStateLock) { PromptForCredentialMessage promptForCredentialMessage = this.ValidateSessionStateForMessageReply <PromptForCredentialMessage>(); if (promptForCredentialMessage.DomainCredentials) { StringBuilder stringBuilder = new StringBuilder(0x202); StringBuilder stringBuilder1 = new StringBuilder(0x152); uint num = PowwaSession.CredUIParseUserName(userName, stringBuilder, stringBuilder.Capacity, stringBuilder1, stringBuilder1.Capacity); if (num != 0) { PowwaEvents.PowwaEVENT_DEBUG_LOG2("SetPromptForCredentialReply(): Invalid UserName", "userName", userName, "errorCode", num.ToString(CultureInfo.InvariantCulture)); throw PowwaException.CreateValidationErrorException(Resources.InvalidUserNameInDomainCredentials); } } PSCredential pSCredential = new PSCredential(userName, PowwaSession.ToSecureString(password)); this.messageQueue.SetInputMessageReply(pSCredential); } clientMessages = this.GetClientMessages(); } } finally { PowwaEvents.PowwaEVENT_DEBUG_LOG0("SetPromptForCredentialReply(): Exit"); } return(clientMessages); }
public ClientMessage[] SetPromptForChoiceReply(int reply) { ClientMessage[] clientMessages; PowwaEvents.PowwaEVENT_DEBUG_LOG1("SetPromptForChoiceReply(): Enter", "reply", reply.ToString(CultureInfo.InvariantCulture)); try { lock (this.clientRequestLock) { lock (this.sessionStateLock) { PromptForChoiceMessage promptForChoiceMessage = this.ValidateSessionStateForMessageReply <PromptForChoiceMessage>(); if (reply < 0 || reply >= promptForChoiceMessage.Choices.Count) { int count = promptForChoiceMessage.Choices.Count; PowwaEvents.PowwaEVENT_DEBUG_LOG2("SetPromptForChoiceReply(): Choice not within the valid range", "reply", reply.ToString(CultureInfo.InvariantCulture), "message.Choices.Count", count.ToString(CultureInfo.InvariantCulture)); throw new ArgumentException("The choice is not within the valid range", "reply"); } else { this.messageQueue.SetInputMessageReply(reply); } } clientMessages = this.GetClientMessages(); } } finally { PowwaEvents.PowwaEVENT_DEBUG_LOG0("SetPromptForChoiceReply(): Exit"); } return(clientMessages); }
public ClientMessage[] SetPromptReply(object[] reply) { ClientMessage[] clientMessages; PowwaEvents.PowwaEVENT_DEBUG_LOG0("SetPromptReply(): Enter"); try { lock (this.clientRequestLock) { lock (this.sessionStateLock) { PromptMessage promptMessage = this.ValidateSessionStateForMessageReply <PromptMessage>(); if ((int)reply.Length == (int)promptMessage.Descriptions.Length) { Dictionary <string, PSObject> strs = new Dictionary <string, PSObject>(); for (int i = 0; i < (int)reply.Length; i++) { strs.Add(promptMessage.Descriptions[i].Name, PowwaSession.PromptReplyObjectToPsObject(reply[i], promptMessage.Descriptions[i])); } this.messageQueue.SetInputMessageReply(strs); } else { int length = (int)reply.Length; int num = (int)promptMessage.Descriptions.Length; PowwaEvents.PowwaEVENT_DEBUG_LOG2("SetPromptReply(): Number of items in the reply does not match prompt message", "reply.Length", length.ToString(CultureInfo.InvariantCulture), "message.Descriptions.Length", num.ToString(CultureInfo.InvariantCulture)); throw new ArgumentException("The number of items in the reply does not match the prompt message", "reply"); } } clientMessages = this.GetClientMessages(); } } finally { PowwaEvents.PowwaEVENT_DEBUG_LOG0("SetPromptReply(): Exit"); } return(clientMessages); }