예제 #1
0
		internal MessageCreatedEventArgs(ClientMessage message, bool isInputMessage)
		{
			this.Message = message;
			this.IsInputMessage = isInputMessage;
		}
예제 #2
0
 internal MessageCreatedEventArgs(ClientMessage message, bool isInputMessage)
 {
     this.Message        = message;
     this.IsInputMessage = isInputMessage;
 }
예제 #3
0
		public void Post(ClientMessage message, bool isInputMessage, bool isInternalMessage, Size bufferSize)
		{
			if (message.JsonSerializationLength <= PowwaSessionManager.Instance.JsonSerializer.MaxJsonLength)
			{
				bool flag = false;
				if (message.MessageType != ClientMessageType.Write)
				{
					if (message.MessageType == ClientMessageType.WriteLine)
					{
						flag = this.CombineWriteLineMessage((WriteLineMessage)message);
					}
				}
				else
				{
					flag = this.CombineWriteMessage((WriteMessage)message, bufferSize);
				}
				if (!flag)
				{
					if (this.messageQueue.Count >= 0x2800 && !isInputMessage && message.MessageType != ClientMessageType.CommandCompleted && !isInternalMessage)
					{
						this.messagesAvailable.Set();
						this.FlushMessageQueue(bufferSize);
					}
					this.messageQueue.Add(message);
				}
				if (message.MessageType != ClientMessageType.CommandCompleted)
				{
					if (this.messageQueue.Count != 1)
					{
						if (!this.messagesAvailableTimer.Enabled)
						{
							this.messagesAvailable.Set();
						}
					}
					else
					{
						this.messagesAvailableTimer.Stop();
						this.messagesAvailableTimer.Start();
					}
				}
				else
				{
					this.messagesAvailable.Set();
				}
				if (isInputMessage)
				{
					this.pendingInputMessage = message;
				}
				return;
			}
			else
			{
				this.messagesAvailable.Set();
				throw new InvalidOperationException(Resources.ErrorClientMessageTooLarge);
			}
		}
예제 #4
0
		public MessageQueue()
		{
			ElapsedEventHandler elapsedEventHandler = null;
			this.messageQueue = new List<ClientMessage>();
			this.messagesAvailable = new AutoResetEvent(false);
			TimeSpan messagesAvailableDelay = MessageQueue.MessagesAvailableDelay;
			System.Timers.Timer timer = new System.Timers.Timer(messagesAvailableDelay.TotalMilliseconds);
			timer.AutoReset = false;
			this.messagesAvailableTimer = timer;
			System.Timers.Timer timer1 = this.messagesAvailableTimer;
			if (elapsedEventHandler == null)
			{
				elapsedEventHandler = (object param0, ElapsedEventArgs param1) => this.messagesAvailable.Set();
			}
			timer1.Elapsed += elapsedEventHandler;
			this.pendingInputMessage = null;
			this.pendingInputMessageReply = null;
			this.pendingInputMessageReplyAvailable = new AutoResetEvent(false);
			this.MessagesAvailableEventTimeout = MessageQueue.GetMessagesMaxWaitTime;
			this.WaitingForUserReply = false;
		}
예제 #5
0
		public object GetUserReply()
		{
			object obj = this.pendingInputMessageReply;
			this.pendingInputMessage = null;
			this.pendingInputMessageReply = null;
			return obj;
		}