Пример #1
0
        void WritePipeToTab(FilterPipe pipe, IList<int> lineNumberList, string name, PersistenceData persistenceData)
        {
            Logger.logInfo("WritePipeToTab(): " + lineNumberList.Count + " lines.");
            _guiStateArgs.MenuEnabled = false;
            SendGuiStateUpdate();

            StartProgressBar(lineNumberList.Count, "Writing to temp file... Press ESC to cancel.");

            _isSearching = true;
            _shouldCancel = false;

            lock (_filterPipeList)
            {
                _filterPipeList.Add(pipe);
            }
            pipe.Closed += new FilterPipe.ClosedEventHandler(Pipe_Disconnected);
            int count = 0;
            pipe.OpenFile();
            LogExpertCallback callback = new LogExpertCallback(this);
            foreach (int i in lineNumberList)
            {
                if (_shouldCancel)
                {
                    break;
                }
                string line = CurrentLogFileReader.GetLogLine(i);
                if (CurrentColumnizer is ILogLineXmlColumnizer)
                {
                    callback.LineNum = i;
                    line = (CurrentColumnizer as ILogLineXmlColumnizer).GetLineTextForClipboard(line, callback);
                }
                pipe.WriteToPipe(line, i);
                if (++count % PROGRESS_BAR_MODULO == 0)
                {
                    _progressEventArgs.Value = count;
                    Invoke(new MethodInvoker(SendProgressBarUpdate));
                }
            }
            pipe.CloseFile();
            Logger.logInfo("WritePipeToTab(): finished");
            Invoke(new Action<FilterPipe, string, PersistenceData>(WriteFilterToTabFinished), new object[] { pipe, name, persistenceData });
        }
Пример #2
0
 /// <summary>
 /// Used to create a new tab and pipe the given content into it.
 /// </summary>
 /// <param name="lineEntryList"></param>
 public void WritePipeTab(IList<LineEntry> lineEntryList, string title)
 {
     FilterPipe pipe = new FilterPipe(new FilterParams(), this);
     pipe.IsStopped = true;
     pipe.Closed += new FilterPipe.ClosedEventHandler(Pipe_Disconnected);
     pipe.OpenFile();
     foreach (LineEntry entry in lineEntryList)
     {
         pipe.WriteToPipe(entry.logLine, entry.lineNum);
     }
     pipe.CloseFile();
     Invoke(new Action<FilterPipe, string, PersistenceData>(WriteFilterToTabFinished), new object[] { pipe, title, null });
 }