Beispiel #1
0
		public void DataArrived(byte[] data, int offset, int count) {
			try {
				TerminalConnection con = _tag.Connection;
				con.AddReceivedDataStats(count);
				con.BinaryLogger.Append(data, offset, count);

				if(_tag.ModalTerminalTask!=null && _tag.ModalTerminalTask.CanReceive)
					_tag.ModalTerminalTask.Input(data, offset, count);
				else {
					TerminalDocument document = _tag.Document;
					lock(document) {
						_tag.InvalidateParam.Reset();
						_tag.Terminal.Input(data, offset, count);

						//右端にキャレットが来たときは便宜的に次行の頭にもっていく
						if(document.CaretColumn==_tag.Connection.TerminalWidth) {
							document.CurrentLineNumber++; //これによって次行の存在を保証
							document.CaretColumn = 0;
						}

						CheckDiscardDocument();
						AdjustTransientScrollBar();

						int n = document.CurrentLineNumber-_tag.Connection.TerminalHeight+1-document.FirstLineNumber;
						if(n < 0) n = 0;

						//Debug.WriteLine(String.Format("E={0} C={1} T={2} H={3} LC={4} MAX={5} n={6}", _transientScrollBarEnabled, _tag.Document.CurrentLineNumber, _tag.Document.TopLineNumber, _tag.Connection.TerminalHeight, _transientScrollBarLargeChange, _transientScrollBarMaximum, n));
						if(IsAutoScrollMode(n)) {
							_transientScrollBarValue = n;
							document.TopLineNumber = n + document.FirstLineNumber;
						}
						else
							_transientScrollBarValue = document.TopLineNumber - document.FirstLineNumber;

						_tag.NotifyUpdate();
					}

					//Invalidateをlockの外に出す。このほうが安全と思われた
					if(_tag.Pane!=null) _tag.InvalidateParam.InvokeFor(_tag.Pane);

					ITerminalTextLogger tl = con.TextLogger;
					if(tl!=null) {
						tl.PacketDelimiter();
						tl.Flush();
					}
				}

				ITerminalBinaryLogger bl = con.BinaryLogger;
				if(bl!=null)
					bl.Flush();
			}
			catch(Exception ex) {
				GEnv.InterThreadUIService.ReportCriticalError(ex);
			}
		}
 public InternalLoggerT(ITerminalTextLogger l, TerminalConnection p)
 {
     _parent = p;
     _logger = l;
 }
 //�I������
 internal virtual void Close()
 {
     if(_loggerT!=null) {
         _loggerT.Flush();
         _loggerT.Close();
         _loggerT = null;
     }
     if(_loggerB!=null) {
         _loggerB.Flush();
         _loggerB.Close();
         _loggerB = null;
     }
     _closed = true;
 }
        public void ResetLog(LogType t, string path, bool append)
        {
            _logType = t;
            _logPath = path;

            if(_loggerT!=null) _loggerT.Close();
            if(_loggerB!=null) _loggerB.Close();

            switch(t) {
                case LogType.None:
                    _loggerT = new NullTextLogger();
                    _loggerB = new NullBinaryLogger();
                    break;
                case LogType.Default:
                    _loggerT = new DefaultLogger(new StreamWriter(path, append, Encoding.Default));
                    _loggerB = new NullBinaryLogger();
                    break;
                case LogType.Binary:
                    _loggerT = new NullTextLogger();
                    _loggerB = new BinaryLogger(new FileStream(path, append? FileMode.Append : FileMode.Create));
                    break;
                case LogType.Xml:
                    _loggerT = new XmlLogger(new StreamWriter(path, append, Encoding.UTF8), _param); //DebugLog��UTF8
                    _loggerB = new NullBinaryLogger();
                    break;
            }
            _loggerT = new InternalLoggerT(_loggerT, this);
            _loggerB = new InternalLoggerB(_loggerB, this);
            _loggerT.TerminalResized(_width, _height);
        }
 public InternalLoggerT(ITerminalTextLogger l, TerminalConnection p, string controlName)
 {
     //edited by xavier: added controlname
     _parent = p;
     _logger = l;
     _controlName = controlName;//edited by xavier: added controlname
 }