Skip to content

Commit

Permalink
Merge pull request #207 from zarunbal/Development
Browse files Browse the repository at this point in the history
merge development to master
  • Loading branch information
Hirogen authored Nov 28, 2021
2 parents c4d319f + 34b9105 commit dad21ef
Show file tree
Hide file tree
Showing 15 changed files with 1,540 additions and 1,256 deletions.
42 changes: 26 additions & 16 deletions src/LogExpert/Classes/DateTimeParser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ private static Section ParseSection(Tokenizer reader, int index, out bool syntax
string token;
List<string> tokens = new List<string>();

syntaxError = false;
while ((token = ReadToken(reader, out syntaxError)) != null)
{
if (token == ";")
Expand Down Expand Up @@ -104,30 +103,39 @@ private static void ParseMilliseconds(List<string> tokens, out List<string> resu
private static string ReadToken(Tokenizer reader, out bool syntaxError)
{
var offset = reader.Position;
if (
ReadLiteral(reader) ||
if (ReadLiteral(reader))
{
syntaxError = false;
var length = reader.Position - offset;
return reader.Substring(offset, length);
}

if (
// Symbols
reader.ReadOneOf("#?,!&%+-$€£0123456789{}():;/.@ ") ||

// Date
reader.ReadString("tt", true) ||
reader.ReadOneOrMore('y') ||
reader.ReadOneOrMore('Y') ||
reader.ReadOneOrMore('m') ||
reader.ReadOneOrMore('M') ||
reader.ReadOneOrMore('d') ||
reader.ReadOneOrMore('D') ||
reader.ReadOneOrMore('h') ||
reader.ReadOneOrMore('H') ||
reader.ReadOneOrMore('s') ||
reader.ReadOneOrMore('S'))
reader.ReadString("tt", true) ||
reader.ReadOneOrMore('y') ||
reader.ReadOneOrMore('Y') ||
reader.ReadOneOrMore('m') ||
reader.ReadOneOrMore('M') ||
reader.ReadOneOrMore('d') ||
reader.ReadOneOrMore('D') ||
reader.ReadOneOrMore('h') ||
reader.ReadOneOrMore('H') ||
reader.ReadOneOrMore('s') ||
reader.ReadOneOrMore('S') ||
//Latin Date String: (a.C.n. ante Christum natum)
reader.ReadString("gg"))
{
syntaxError = false;
var length = reader.Position - offset;
return reader.Substring(offset, length);
}

// Symbols

syntaxError = reader.Position < reader.Length;
return null;
}
Expand All @@ -139,11 +147,13 @@ private static bool ReadLiteral(Tokenizer reader)
reader.Advance(2);
return true;
}
else if (reader.ReadEnclosed('"', '"'))

if (reader.ReadEnclosed('"', '"'))
{
return true;
}
else if (reader.ReadEnclosed('\'', '\''))

if (reader.ReadEnclosed('\'', '\''))
{
return true;
}
Expand Down
21 changes: 17 additions & 4 deletions src/LogExpert/Config/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Reflection;
using System.Windows.Forms;
using NLog;
using System.Linq;

namespace LogExpert
{
Expand Down Expand Up @@ -390,24 +391,36 @@ private Settings Import(Settings currentSettings, Stream fs, ExportImportFlags f

if ((flags & ExportImportFlags.ColumnizerMasks) == ExportImportFlags.ColumnizerMasks)
{
newSettings.preferences.columnizerMaskList = importSettings.preferences.columnizerMaskList;
newSettings.preferences.columnizerMaskList = ReplaceOrKeepExisting(flags, ownSettings.preferences.columnizerMaskList, importSettings.preferences.columnizerMaskList);
}
if ((flags & ExportImportFlags.HighlightMasks) == ExportImportFlags.HighlightMasks)
{
newSettings.preferences.highlightMaskList = importSettings.preferences.highlightMaskList;
newSettings.preferences.highlightMaskList = ReplaceOrKeepExisting(flags, ownSettings.preferences.highlightMaskList, importSettings.preferences.highlightMaskList);
}
if ((flags & ExportImportFlags.HighlightSettings) == ExportImportFlags.HighlightSettings)
{
newSettings.hilightGroupList = importSettings.hilightGroupList;
newSettings.hilightGroupList = ReplaceOrKeepExisting(flags, ownSettings.hilightGroupList, importSettings.hilightGroupList);
}
if ((flags & ExportImportFlags.ToolEntries) == ExportImportFlags.ToolEntries)
{
newSettings.preferences.toolEntries = importSettings.preferences.toolEntries;
newSettings.preferences.toolEntries = ReplaceOrKeepExisting(flags, ownSettings.preferences.toolEntries, importSettings.preferences.toolEntries);
}

return newSettings;
}

private static List<T> ReplaceOrKeepExisting<T>(ExportImportFlags flags, List<T> existingList, List<T> newList)
{
if ((flags & ExportImportFlags.KeepExisting) == ExportImportFlags.KeepExisting)
{
return existingList.Union(newList).ToList();
}
else
{
return newList;
}
}

#endregion

protected void OnConfigChanged(SettingsFlags flags)
Expand Down
4 changes: 3 additions & 1 deletion src/LogExpert/Config/ExportImportFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public enum ExportImportFlags : long
HighlightMasks = 4,
ToolEntries = 8,
Other = 16,
All = HighlightSettings | ColumnizerMasks | HighlightMasks | ToolEntries | Other
KeepExisting = 32,
All = HighlightSettings | ColumnizerMasks | HighlightMasks | ToolEntries | Other,
AllKeepExisting = All | KeepExisting
}
}
2 changes: 2 additions & 0 deletions src/LogExpert/Controls/LogTabWindow/LogTabWindowPrivate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ private void OpenFileDialog()

private void LoadFiles(string[] names, bool invertLogic)
{
Array.Sort(names);

if (names.Length == 1)
{
if (names[0].EndsWith(".lxj"))
Expand Down
5 changes: 3 additions & 2 deletions src/LogExpert/Controls/LogWindow/LogWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ public LogWindow(LogTabWindow parent, string fileName, bool isTempFile,
filterComboBox.Items.Add(item);
}

filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.preferences.maximumFilterEntriesDisplayed;

filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.preferences.maximumFilterEntriesDisplayed;
AutoResizeFilterBox();

filterRegexCheckBox.Checked = filterParams.isRegex;
filterCaseSensitiveCheckBox.Checked = filterParams.isCaseSensitive;
filterTailCheckBox.Checked = filterParams.isFilterTail;
Expand Down
Loading

0 comments on commit dad21ef

Please sign in to comment.