/// <summary> /// Consume a similar log /// </summary> /// <param name="logLine">The log that we are going to consume</param> public void ConsumeLog(LineHolder logLine) { _sentences.Add(logLine.Line); _changingWords.Add(logLine.SplitWords[_changingWordAt]); if (logLine.SameSentence != null) { _sentences.AddRange(logLine.SameSentence); } }
public void LayoutHandler(object sender, LayoutEventArgs e) { this.SuspendLayout(); int lineSzForCalc = 23; SortedList lineList = new SortedList(); foreach(ToolBarDockHolder holder in this.Controls) { if(holder.Visible) { int prefLine = GetPreferredLine(lineSzForCalc, holder); int prefPos = GetPreferredPosition(holder); LineHolder line = (LineHolder)lineList[prefLine]; if(line == null) { line = new LineHolder(prefLine); lineList.Add(prefLine, line); } int csize = GetHolderWidth(holder); int lsize = GetHolderLineSize(holder); line.AddColumn(new ColumnHolder(prefPos, holder, csize+1)); if(line.Size-1 < lsize) line.Size = lsize+1; } } int pos = 0; _lastLineCount = lineList.Count; if(_lastLineCount == 0) _lastLineCount = 1; for(int ndx = 0; ndx < lineList.Count; ndx++) { LineHolder line = (LineHolder)lineList.GetByIndex(ndx); if(line != null) { line.Distribute(); foreach(ColumnHolder col in line.Columns) { if(Horizontal) { col.Holder.Location = new Point(col.Position, pos); col.Holder.PreferredDockedLocation = new Point(col.Holder.PreferredDockedLocation.X, pos + col.Holder.Height/2); } else { col.Holder.Location = new Point(pos, col.Position); col.Holder.PreferredDockedLocation = new Point(pos + col.Holder.Width/2, col.Holder.PreferredDockedLocation.Y); } } pos += line.Size+1; } } FitHolders(); this.ResumeLayout(); }
public void LoadNewLogs(List <string> logLines) { if (logLines == null) { return; } foreach (string line in logLines) { LineHolder logLine = new LineHolder(line); AddLogLine(logLine); } }
public SimilarLogHolder(Regex similarCheck, LineHolder logLine) { _changingWordAt = logLine.DifferentWordAt; _similarCheck = similarCheck; _sentences = new List <string>(); _changingWords = new HashSet <string>(); _changingWords.Add(logLine.SplitWords[_changingWordAt]); _sentences.Add(logLine.Line); if (logLine.SameSentence != null) { _sentences.AddRange(logLine.SameSentence); } }
private void AddLogLine(LineHolder logLine) { List <SimilarLogHolder> similarLogList; if (_similarLogDictionary.TryGetValue(logLine.SplitWords.Length, out similarLogList)) { // check if the new entry is in known sentence foreach (var similarLog in similarLogList) { if (similarLog.CheckSimilar(logLine.LineWithouDate)) { similarLog.ConsumeLog(logLine); return; } } } for (int i = 0; i < _singleLogLines.Count; i++) { // check if there a sentence similar to the new one Regex regex; LineHolder.Similarity similar = _singleLogLines[i].CheckSimilar(logLine, out regex); if (similar == LineHolder.Similarity.Similar) { SimilarLogHolder similarLogHolder = new SimilarLogHolder(regex, _singleLogLines[i]); similarLogHolder.ConsumeLog(logLine); if (similarLogList == null) { _similarLogDictionary.Add(logLine.SplitWords.Length, new List <SimilarLogHolder>()); } _similarLogDictionary[logLine.SplitWords.Length].Add(similarLogHolder); return; } if (similar == LineHolder.Similarity.Same) { // added the line to the log as they are the same sentence in a diffrent date return; } } _singleLogLines.Add(logLine); }
public void LayoutHandler(object sender, LayoutEventArgs e) { this.SuspendLayout(); int lineSzForCalc = 23; SortedList lineList = new SortedList(); foreach (ToolBarDockHolder holder in this.Controls) { if (holder.Visible) { int prefLine = GetPreferredLine(lineSzForCalc, holder); int prefPos = GetPreferredPosition(holder); LineHolder line = (LineHolder)lineList[prefLine]; if (line == null) { line = new LineHolder(prefLine); lineList.Add(prefLine, line); } int csize = GetHolderWidth(holder); int lsize = GetHolderLineSize(holder); line.AddColumn(new ColumnHolder(prefPos, holder, csize + 1)); if (line.Size - 1 < lsize) { line.Size = lsize + 1; } } } int pos = 0; _lastLineCount = lineList.Count; if (_lastLineCount == 0) { _lastLineCount = 1; } for (int ndx = 0; ndx < lineList.Count; ndx++) { LineHolder line = (LineHolder)lineList.GetByIndex(ndx); if (line != null) { line.Distribute(); foreach (ColumnHolder col in line.Columns) { if (Horizontal) { col.Holder.Location = new Point(col.Position, pos); col.Holder.PreferredDockedLocation = new Point(col.Holder.PreferredDockedLocation.X, pos + col.Holder.Height / 2); } else { col.Holder.Location = new Point(pos, col.Position); col.Holder.PreferredDockedLocation = new Point(pos + col.Holder.Width / 2, col.Holder.PreferredDockedLocation.Y); } } pos += line.Size + 1; } } FitHolders(); this.ResumeLayout(); }