Beispiel #1
0
        private int DoFilter(FilterParams filterParams, int startLine, int maxCount, List <int> filterResultLines,
                             List <int> lastFilterLinesList, List <int> filterHitList, ProgressCallback progressCallback)
        {
            int lineNum         = startLine;
            int count           = 0;
            int callbackCounter = 0;

            try
            {
                filterParams.Reset();
                while ((count++ < maxCount || filterParams.isInRange) && !this.ShouldCancel)
                {
                    if (lineNum >= this.callback.GetLineCount())
                    {
                        return(count);
                    }
                    ILogLine line = this.callback.GetLogLine(lineNum);
                    if (line == null)
                    {
                        return(count);
                    }
                    this.callback.LineNum = lineNum;
                    if (Util.TestFilterCondition(filterParams, line, callback))
                    {
                        AddFilterLine(lineNum, false, filterParams, filterResultLines, lastFilterLinesList,
                                      filterHitList);
                    }
                    lineNum++;
                    callbackCounter++;
                    if (lineNum % PROGRESS_BAR_MODULO == 0)
                    {
                        progressCallback(callbackCounter);
                        callbackCounter = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.logError("Exception while filtering. Please report to developer: \n\n" + ex + "\n\n" +
                                ex.StackTrace);
                MessageBox.Show(null,
                                "Exception while filtering. Please report to developer: \n\n" + ex + "\n\n" + ex.StackTrace,
                                "LogExpert");
            }
            return(count);
        }
Beispiel #2
0
        private int DoFilter(FilterParams filterParams, int startLine, int maxCount, List <int> filterResultLines, List <int> lastFilterLinesList, List <int> filterHitList, ProgressCallback progressCallback)
        {
            int lineNum         = startLine;
            int count           = 0;
            int callbackCounter = 0;

            try
            {
                filterParams.Reset();
                while ((count++ < maxCount || filterParams.isInRange) && !ShouldCancel)
                {
                    if (lineNum >= _callback.GetLineCount())
                    {
                        return(count);
                    }
                    string line = _callback.GetLogLine(lineNum);
                    if (line == null)
                    {
                        return(count);
                    }
                    _callback.LineNum = lineNum;
                    if (Classes.DamerauLevenshtein.TestFilterCondition(filterParams, line, _callback))
                    {
                        AddFilterLine(lineNum, filterParams, filterResultLines, lastFilterLinesList, filterHitList);
                    }
                    lineNum++;
                    callbackCounter++;
                    if (lineNum % PROGRESS_BAR_MODULO == 0)
                    {
                        progressCallback(callbackCounter);
                        callbackCounter = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                string message = string.Format("Exception while filtering. Please report to developer: \n\n{0}\n\n{1}", ex, ex.StackTrace);
                Logger.logError(message);
                MessageBox.Show(null, message, "LogExpert");
            }
            return(count);
        }
Beispiel #3
0
		private int DoFilter(FilterParams filterParams, int startLine, int maxCount, List<int> filterResultLines, List<int> lastFilterLinesList, List<int> filterHitList, ProgressCallback progressCallback)
		{
			int lineNum = startLine;
			int count = 0;
			int callbackCounter = 0;
					
			try
			{
				filterParams.Reset();
				while ((count++ < maxCount || filterParams.isInRange) && !ShouldCancel)
				{
					if (lineNum >= _callback.GetLineCount())
					{
						return count;
					}
					string line = _callback.GetLogLine(lineNum);
					if (line == null)
					{
						return count;
					}
					_callback.LineNum = lineNum;
					if (Classes.DamerauLevenshtein.TestFilterCondition(filterParams, line, _callback))
					{
						AddFilterLine(lineNum, filterParams, filterResultLines, lastFilterLinesList, filterHitList);
					}
					lineNum++;
					callbackCounter++;
					if (lineNum % PROGRESS_BAR_MODULO == 0)
					{
						progressCallback(callbackCounter);
						callbackCounter = 0;
					}
				}
			}
			catch (Exception ex)
			{
				string message = string.Format("Exception while filtering. Please report to developer: \n\n{0}\n\n{1}", ex, ex.StackTrace);
				Logger.logError(message);
				MessageBox.Show(null, message, "LogExpert");
			}
			return count;
		}
Beispiel #4
0
        void Filter(FilterParams filterParams, List<int> filterResultLines, List<int> lastFilterLinesList, List<int> filterHitList)
        {
            long startTime = Environment.TickCount;
            try
            {
                filterParams.Reset();
                int lineNum = 0;
                ColumnizerCallback callback = new ColumnizerCallback(this);
                while (true)
                {
                    string line = CurrentLogFileReader.GetLogLine(lineNum);
                    if (line == null)
                    {
                        break;
                    }
                    callback.LineNum = lineNum;
                    if (Classes.DamerauLevenshtein.TestFilterCondition(filterParams, line, callback))
                    {
                        AddFilterLine(lineNum, false, filterParams, filterResultLines, lastFilterLinesList, filterHitList);
                    }
                    lineNum++;
                    if (lineNum % PROGRESS_BAR_MODULO == 0)
                    {
                        UpdateProgressBar(lineNum);
                    }
                    if (_shouldCancel)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.logError("Exception while filtering. Please report to developer: \n\n" + ex + "\n\n" + ex.StackTrace);
                MessageBox.Show(null, "Exception while filtering. Please report to developer: \n\n" + ex + "\n\n" + ex.StackTrace, "LogExpert");
            }
            long endTime = Environment.TickCount;
#if DEBUG
            Logger.logInfo("Single threaded filter duration: " + ((endTime - startTime)) + " ms.");
#endif
            StatusLineText("Filter duration: " + ((endTime - startTime)) + " ms.");
        }