Esempio n. 1
0
        private bool CombineWriteLineMessage(WriteLineMessage writeLineMessage)
        {
            WriteMessage item;

            if (writeLineMessage.Value.Length == 0)
            {
                if (this.messageQueue.Count > 0)
                {
                    item = this.messageQueue[this.messageQueue.Count - 1] as WriteMessage;
                }
                else
                {
                    item = null;
                }
                WriteMessage writeMessage = item;
                if (writeMessage != null)
                {
                    this.messageQueue[this.messageQueue.Count - 1] = new WriteLineMessage(writeMessage.ForegroundColor, writeMessage.BackgroundColor, writeMessage.Value);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        private void FlushMessageQueue(Size bufferSize)
        {
            int num  = -1;
            int num1 = 0;

            while (num1 < this.messageQueue.Count)
            {
                if (this.messageQueue[num1].MessageType != ClientMessageType.WriteLine)
                {
                    num1++;
                }
                else
                {
                    num = num1;
                    break;
                }
            }
            if (num >= 0)
            {
                int num2 = num + 1;
                while (num2 < this.messageQueue.Count && num2 - num < 0x400 && this.messageQueue[num2].MessageType == ClientMessageType.WriteLine)
                {
                    num2++;
                }
                if (num2 - num >= 128)
                {
                    List <ClientMessage> clientMessages = new List <ClientMessage>();
                    for (int i = 0; i < num; i++)
                    {
                        clientMessages.Add(this.messageQueue[i]);
                    }
                    WriteLineMessage item     = (WriteLineMessage)this.messageQueue[num];
                    object[]         objArray = new object[1];
                    objArray[0] = num2 - num;
                    clientMessages.Add(new WriteLineMessage(item.ForegroundColor, item.BackgroundColor, string.Format(CultureInfo.CurrentCulture, Resources.ClientMessagesFlushed_Format, objArray)));
                    for (int j = num2; j < this.messageQueue.Count; j++)
                    {
                        clientMessages.Add(this.messageQueue[j]);
                    }
                    this.messageQueue = clientMessages;
                    return;
                }
                else
                {
                    throw new InvalidOperationException(Resources.ErrorTooManyClientMessages);
                }
            }
            else
            {
                throw new InvalidOperationException(Resources.ErrorTooManyClientMessages);
            }
        }
Esempio n. 3
0
		private bool CombineWriteLineMessage(WriteLineMessage writeLineMessage)
		{
			WriteMessage item;
			if (writeLineMessage.Value.Length == 0)
			{
				if (this.messageQueue.Count > 0)
				{
					item = this.messageQueue[this.messageQueue.Count - 1] as WriteMessage;
				}
				else
				{
					item = null;
				}
				WriteMessage writeMessage = item;
				if (writeMessage != null)
				{
					this.messageQueue[this.messageQueue.Count - 1] = new WriteLineMessage(writeMessage.ForegroundColor, writeMessage.BackgroundColor, writeMessage.Value);
					return true;
				}
				else
				{
					return false;
				}
			}
			else
			{
				return false;
			}
		}