Пример #1
0
		public void RemoveWindow(LogWindow logWindow)
		{
			lock (_logWindowList)
			{
				_logWindowList.Remove(logWindow);
			}
			OnWindowRemoved();
		}
Пример #2
0
		public FilterPipe(FilterParams filterParams, LogWindow logWindow)
		{
			FilterParams = filterParams;
			LogWindow = logWindow;
			IsStopped = false;
			FileName = Path.GetTempFileName();
			
			Logger.logInfo("Created temp file: " + FileName);
		}
Пример #3
0
		public void AddWindow(LogWindow logWindow)
		{
			lock (_logWindowList)
			{
				if (!_logWindowList.Contains(logWindow))
				{
					_logWindowList.Add(logWindow);
				}
			}
		}
Пример #4
0
		public LogTabPage(LogWindow logWindow, String title)
			: base("MMi" + (title == null ? Util.GetNameFromPath(logWindow.FileName) : title))
		{
			this.title = title;
			if (this.title == null)
				this.title = Util.GetNameFromPath(logWindow.FileName);
			this.LogWindow = logWindow;
			this.LogWindow.FileSizeChanged += FileSizeChanged;
			this.LogWindow.TailFollowed += TailFollowed;
			this.ledThread = new Thread(new ThreadStart(this.LedThreadProc));
			this.ledThread.IsBackground = true;
			this.ledThread.Start();
		}
Пример #5
0
		/// <summary>
		/// Scrolls all LogWindows to the given timestamp
		/// </summary>
		/// <param name="timestamp"></param>
		public void NavigateToTimestamp(DateTime timestamp, LogWindow sender)
		{
			CurrentTimestamp = timestamp;
			lock (_logWindowList)
			{
				foreach (LogWindow logWindow in _logWindowList)
				{
					if (sender != logWindow)
					{
						logWindow.ScrollToTimestamp(timestamp, false, false);
					}
				}
			}
		}
Пример #6
0
		private ColumnizerCallback(ColumnizerCallback original)
		{
			_logWindow = original._logWindow;
			LineNum = original.LineNum;
		}
Пример #7
0
 protected void OnFilterListChanged(LogWindow source)
 {
     if (FilterListChanged != null)
     {
         FilterListChanged(this, new FilterListChangedEventArgs(source));
     }
 }
Пример #8
0
 public void AddToTimeSync(LogWindow master)
 {
     Logger.logInfo("Syncing window for " + Util.GetNameFromPath(FileName) + " to " + Util.GetNameFromPath(master.FileName));
     lock (_timeSyncListLock)
     {
         if (IsTimeSynced && master.TimeSyncList != TimeSyncList)  // already synced but master has different sync list
         {
             FreeFromTimeSync();
         }
         TimeSyncList = master.TimeSyncList;
         TimeSyncList.AddWindow(this);
         ScrollToTimestamp(TimeSyncList.CurrentTimestamp, false, false);
     }
     OnSyncModeChanged();
 }
Пример #9
0
 void AddSlaveToTimesync(LogWindow slave)
 {
     lock (_timeSyncListLock)
     {
         if (TimeSyncList == null)
         {
             if (slave.TimeSyncList == null)
             {
                 TimeSyncList = new TimeSyncList();
                 TimeSyncList.AddWindow(this);
             }
             else
             {
                 TimeSyncList = slave.TimeSyncList;
             }
             int currentLineNum = dataGridView.CurrentCellAddress.Y;
             int refLine = currentLineNum;
             DateTime timeStamp = GetTimestampForLine(ref refLine, true);
             if (!timeStamp.Equals(DateTime.MinValue) && !_shouldTimestampDisplaySyncingCancel)
             {
                 TimeSyncList.CurrentTimestamp = timeStamp;
             }
             TimeSyncList.WindowRemoved += TimeSyncList_WindowRemoved;
         }
     }
     slave.AddToTimeSync(this);
     OnSyncModeChanged();
 }
Пример #10
0
		public WindowFileEntry(LogWindow logWindow)
		{
			this.LogWindow = logWindow;
		}
Пример #11
0
 public WindowFileEntry(LogWindow logWindow)
 {
     this.logWindow = logWindow;
 }
Пример #12
0
 private void ConnectToolWindows(LogWindow logWindow)
 {
     ConnectBookmarkWindow(logWindow);
 }
Пример #13
0
 private void DisconnectToolWindows(LogWindow logWindow)
 {
     DisconnectBookmarkWindow(logWindow);
 }
Пример #14
0
        private void ChangeCurrentLogWindow(LogWindow newLogWindow)
        {
            if (newLogWindow == currentLogWindow)
            {
                return; // do nothing if wishing to set the same window
            }

            LogWindow oldLogWindow = currentLogWindow;

            currentLogWindow = newLogWindow;
            string titleName = showInstanceNumbers ? "LogExpert #" + instanceNumber : "LogExpert";

            if (oldLogWindow != null)
            {
                oldLogWindow.StatusLineEvent     -= StatusLineEvent;
                oldLogWindow.ProgressBarUpdate   -= ProgressBarUpdate;
                oldLogWindow.GuiStateUpdate      -= GuiStateUpdate;
                oldLogWindow.ColumnizerChanged   -= ColumnizerChanged;
                oldLogWindow.BookmarkAdded       -= BookmarkAdded;
                oldLogWindow.BookmarkRemoved     -= BookmarkRemoved;
                oldLogWindow.BookmarkTextChanged -= BookmarkTextChanged;
                DisconnectToolWindows(oldLogWindow);
            }

            if (newLogWindow != null)
            {
                newLogWindow.StatusLineEvent     += StatusLineEvent;
                newLogWindow.ProgressBarUpdate   += ProgressBarUpdate;
                newLogWindow.GuiStateUpdate      += GuiStateUpdate;
                newLogWindow.ColumnizerChanged   += ColumnizerChanged;
                newLogWindow.BookmarkAdded       += BookmarkAdded;
                newLogWindow.BookmarkRemoved     += BookmarkRemoved;
                newLogWindow.BookmarkTextChanged += BookmarkTextChanged;

                if (newLogWindow.IsTempFile)
                {
                    Text = titleName + @" - " + newLogWindow.TempTitleName;
                }
                else
                {
                    Text = titleName + @" - " + newLogWindow.FileName;
                }

                multiFileToolStripMenuItem.Checked      = CurrentLogWindow.IsMultiFile;
                multiFileToolStripMenuItem.Enabled      = true;
                multiFileEnabledStripMenuItem.Checked   = CurrentLogWindow.IsMultiFile;
                cellSelectModeToolStripMenuItem.Checked = true;
                cellSelectModeToolStripMenuItem.Enabled = true;
                closeFileToolStripMenuItem.Enabled      = true;
                searchToolStripMenuItem.Enabled         = true;
                filterToolStripMenuItem.Enabled         = true;
                goToLineToolStripMenuItem.Enabled       = true;
                //ConnectToolWindows(newLogWindow);
            }
            else
            {
                Text = titleName;
                multiFileToolStripMenuItem.Checked    = false;
                multiFileEnabledStripMenuItem.Checked = false;
                followTailCheckBox.Checked            = false;
                menuStrip1.Enabled = true;
                timeshiftToolStripMenuItem.Enabled      = false;
                timeshiftToolStripMenuItem.Checked      = false;
                timeshiftMenuTextBox.Text               = "";
                timeshiftMenuTextBox.Enabled            = false;
                multiFileToolStripMenuItem.Enabled      = false;
                cellSelectModeToolStripMenuItem.Checked = false;
                cellSelectModeToolStripMenuItem.Enabled = false;
                closeFileToolStripMenuItem.Enabled      = false;
                searchToolStripMenuItem.Enabled         = false;
                filterToolStripMenuItem.Enabled         = false;
                goToLineToolStripMenuItem.Enabled       = false;
                dateTimeDragControl.Visible             = false;
            }
        }
Пример #15
0
        private void StartTool(string cmd, string args, bool sysoutPipe, string columnizerName, string workingDir)
        {
            if (string.IsNullOrEmpty(cmd))
            {
                return;
            }

            Process          process   = new Process();
            ProcessStartInfo startInfo = new ProcessStartInfo(cmd, args);

            if (!Util.IsNull(workingDir))
            {
                startInfo.WorkingDirectory = workingDir;
            }

            process.StartInfo           = startInfo;
            process.EnableRaisingEvents = true;

            if (sysoutPipe)
            {
                ILogLineColumnizer columnizer = ColumnizerPicker.DecideColumnizerByName(columnizerName,
                                                                                        PluginRegistry.GetInstance().RegisteredColumnizers);

                _logger.Info("Starting external tool with sysout redirection: {0} {1}", cmd, args);
                startInfo.UseShellExecute        = false;
                startInfo.RedirectStandardOutput = true;
                //process.OutputDataReceived += pipe.DataReceivedEventHandler;
                try
                {
                    process.Start();
                }
                catch (Win32Exception e)
                {
                    _logger.Error(e);
                    MessageBox.Show(e.Message);
                    return;
                }

                SysoutPipe pipe   = new SysoutPipe(process.StandardOutput);
                LogWindow  logWin = AddTempFileTab(pipe.FileName,
                                                   CurrentLogWindow.IsTempFile
                        ? CurrentLogWindow.TempTitleName
                        : Util.GetNameFromPath(CurrentLogWindow.FileName) + "->E");
                logWin.ForceColumnizer(columnizer);
                process.Exited += pipe.ProcessExitedEventHandler;
                //process.BeginOutputReadLine();
            }
            else
            {
                _logger.Info("Starting external tool: {0} {1}", cmd, args);
                try
                {
                    startInfo.UseShellExecute = false;
                    process.Start();
                }
                catch (Exception e)
                {
                    _logger.Error(e);
                    MessageBox.Show(e.Message);
                }
            }
        }
Пример #16
0
 private void SetTooltipText(LogWindow logWindow, string logFileName)
 {
     logWindow.ToolTipText = logFileName;
 }
Пример #17
0
		public TimeSpreadCalculator(LogWindow logWindow)
		{
			_logWindow = logWindow;
			_callback = new ColumnizerCallback(_logWindow);
			_calcThread = new Thread(new ThreadStart(WorkerFx));
			_calcThread.IsBackground = true;
			_calcThread.Name = "TimeSpreadCalculator Worker";
			_calcThread.Priority = ThreadPriority.BelowNormal;
			_calcThread.Start();
		}
		public FilterListChangedEventArgs(LogWindow logWindow)
		{
			this.LogWindow = logWindow;
		}
Пример #19
0
 private void DisconnectBookmarkWindow(LogWindow logWindow)
 {
     bookmarkWindow.SetBookmarkData(null);
     bookmarkWindow.SetCurrentFile(null);
 }
Пример #20
0
		public bool Contains(LogWindow logWindow)
		{
			return _logWindowList.Contains(logWindow);
		}
		public CurrentHighlightGroupChangedEventArgs(LogWindow logWindow, HilightGroup currentGroup)
		{
			this.LogWindow = logWindow;
			this.CurrentGroup = currentGroup;
		}
Пример #22
0
 public ColumnizerCallback(LogWindow logWindow)
 {
     this.logWindow = logWindow;
 }
Пример #23
0
 public void AddOtherWindowToTimesync(LogWindow other)
 {
     if (other.IsTimeSynced)
     {
         if (IsTimeSynced)
         {
             other.FreeFromTimeSync();
             AddSlaveToTimesync(other);
         }
         else
         {
             AddToTimeSync(other);
         }
     }
     else
     {
         AddSlaveToTimesync(other);
     }
 }
Пример #24
0
 private ColumnizerCallback(ColumnizerCallback original)
 {
     this.logWindow = original.logWindow;
     this.LineNum   = original.LineNum;
 }
Пример #25
0
 void FilterRestore(LogWindow newWin, PersistenceData persistenceData)
 {
     newWin.WaitForLoadingFinished();
     ILogLineColumnizer columnizer = Util.FindColumnizerByName(persistenceData.columnizerName, PluginRegistry.GetInstance().RegisteredColumnizers);
     if (columnizer != null)
     {
         Action<ILogLineColumnizer> fx = new Action<ILogLineColumnizer>(newWin.ForceColumnizer);
         newWin.Invoke(fx, new object[] { columnizer });
     }
     else
     {
         Logger.logWarn("FilterRestore(): Columnizer " + persistenceData.columnizerName + " not found");
     }
     newWin.BeginInvoke(new Action<PersistenceData>(newWin.RestoreFilters), new object[] { persistenceData });
 }
Пример #26
0
 public LogExpertCallback(LogWindow logWindow)
     : base(logWindow)
 {
 }
Пример #27
0
 void FreeSlaveFromTimesync(LogWindow slave)
 {
     slave.FreeFromTimeSync();
 }
Пример #28
0
		public PatternWindow(LogWindow logWindow)
		{
			this.logWindow = logWindow;
			InitializeComponent();
			this.recalcButton.Enabled = false;
		}
Пример #29
0
 public LogExpertCallback(LogWindow logWindow)
     : base(logWindow)
 {
 }
Пример #30
0
		public ColumnizerCallback(LogWindow logWindow)
		{
			_logWindow = logWindow;
		}