diff --git a/src/CsvColumnizer/CsvColumnizerConfigDlg.Designer.cs b/src/CsvColumnizer/CsvColumnizerConfigDlg.Designer.cs
index 7b6aa0f8..d05ebcdf 100644
--- a/src/CsvColumnizer/CsvColumnizerConfigDlg.Designer.cs
+++ b/src/CsvColumnizer/CsvColumnizerConfigDlg.Designer.cs
@@ -20,216 +20,213 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
- #region Windows Form Designer generated code
+ #region Windows Form Designer generated code
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.okButton = new System.Windows.Forms.Button();
- this.cancelButton = new System.Windows.Forms.Button();
- this.delimiterTextBox = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.quoteCharTextBox = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.escapeCharTextBox = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.escapeCheckBox = new System.Windows.Forms.CheckBox();
- this.commentCharTextBox = new System.Windows.Forms.TextBox();
- this.label4 = new System.Windows.Forms.Label();
- this.fieldNamesCheckBox = new System.Windows.Forms.CheckBox();
- this.minColumnsNumericUpDown = new System.Windows.Forms.NumericUpDown();
- this.label5 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- ((System.ComponentModel.ISupportInitialize)(this.minColumnsNumericUpDown)).BeginInit();
- this.SuspendLayout();
- //
- // okButton
- //
- this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.okButton.Location = new System.Drawing.Point(148, 202);
- this.okButton.Name = "okButton";
- this.okButton.Size = new System.Drawing.Size(75, 23);
- this.okButton.TabIndex = 0;
- this.okButton.Text = "OK";
- this.okButton.UseVisualStyleBackColor = true;
- this.okButton.Click += new System.EventHandler(this.OnOkButtonClick);
- //
- // cancelButton
- //
- this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.cancelButton.Location = new System.Drawing.Point(229, 202);
- this.cancelButton.Name = "cancelButton";
- this.cancelButton.Size = new System.Drawing.Size(75, 23);
- this.cancelButton.TabIndex = 1;
- this.cancelButton.Text = "Cancel";
- this.cancelButton.UseVisualStyleBackColor = true;
- //
- // delimiterTextBox
- //
- this.delimiterTextBox.Location = new System.Drawing.Point(95, 13);
- this.delimiterTextBox.MaxLength = 1;
- this.delimiterTextBox.Name = "delimiterTextBox";
- this.delimiterTextBox.Size = new System.Drawing.Size(28, 20);
- this.delimiterTextBox.TabIndex = 2;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(12, 16);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(74, 13);
- this.label1.TabIndex = 3;
- this.label1.Text = "Delimiter char:";
- //
- // quoteCharTextBox
- //
- this.quoteCharTextBox.Location = new System.Drawing.Point(95, 40);
- this.quoteCharTextBox.Name = "quoteCharTextBox";
- this.quoteCharTextBox.Size = new System.Drawing.Size(28, 20);
- this.quoteCharTextBox.TabIndex = 4;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(12, 43);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(63, 13);
- this.label2.TabIndex = 5;
- this.label2.Text = "Quote char:";
- //
- // escapeCharTextBox
- //
- this.escapeCharTextBox.Location = new System.Drawing.Point(95, 67);
- this.escapeCharTextBox.Name = "escapeCharTextBox";
- this.escapeCharTextBox.Size = new System.Drawing.Size(28, 20);
- this.escapeCharTextBox.TabIndex = 6;
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(12, 70);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(70, 13);
- this.label3.TabIndex = 7;
- this.label3.Text = "Escape char:";
- //
- // escapeCheckBox
- //
- this.escapeCheckBox.AutoSize = true;
- this.escapeCheckBox.Location = new System.Drawing.Point(130, 69);
- this.escapeCheckBox.Name = "escapeCheckBox";
- this.escapeCheckBox.Size = new System.Drawing.Size(110, 17);
- this.escapeCheckBox.TabIndex = 8;
- this.escapeCheckBox.Text = "use escape chars";
- this.escapeCheckBox.UseVisualStyleBackColor = true;
- this.escapeCheckBox.CheckedChanged += new System.EventHandler(this.OnEscapeCheckBoxCheckedChanged);
- //
- // commentCharTextBox
- //
- this.commentCharTextBox.Location = new System.Drawing.Point(95, 94);
- this.commentCharTextBox.Name = "commentCharTextBox";
- this.commentCharTextBox.Size = new System.Drawing.Size(28, 20);
- this.commentCharTextBox.TabIndex = 9;
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(12, 97);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(78, 13);
- this.label4.TabIndex = 10;
- this.label4.Text = "Comment char:";
- //
- // fieldNamesCheckBox
- //
- this.fieldNamesCheckBox.AutoSize = true;
- this.fieldNamesCheckBox.Location = new System.Drawing.Point(15, 161);
- this.fieldNamesCheckBox.Name = "fieldNamesCheckBox";
- this.fieldNamesCheckBox.Size = new System.Drawing.Size(163, 17);
- this.fieldNamesCheckBox.TabIndex = 11;
- this.fieldNamesCheckBox.Text = "First line contains field names";
- this.fieldNamesCheckBox.UseVisualStyleBackColor = true;
- //
- // minColumnsNumericUpDown
- //
- this.minColumnsNumericUpDown.Location = new System.Drawing.Point(95, 120);
- this.minColumnsNumericUpDown.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.minColumnsNumericUpDown.Name = "minColumnsNumericUpDown";
- this.minColumnsNumericUpDown.Size = new System.Drawing.Size(48, 20);
- this.minColumnsNumericUpDown.TabIndex = 12;
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(12, 122);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(66, 13);
- this.label5.TabIndex = 13;
- this.label5.Text = "Min columns";
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(149, 122);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(119, 13);
- this.label6.TabIndex = 14;
- this.label6.Text = "(0 = no minimum check)";
- //
- // CsvColumnizerConfigDlg
- //
- this.ClientSize = new System.Drawing.Size(316, 237);
- this.ControlBox = false;
- this.Controls.Add(this.label6);
- this.Controls.Add(this.label5);
- this.Controls.Add(this.minColumnsNumericUpDown);
- this.Controls.Add(this.fieldNamesCheckBox);
- this.Controls.Add(this.label4);
- this.Controls.Add(this.commentCharTextBox);
- this.Controls.Add(this.escapeCheckBox);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.escapeCharTextBox);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.quoteCharTextBox);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.delimiterTextBox);
- this.Controls.Add(this.cancelButton);
- this.Controls.Add(this.okButton);
- this.MaximizeBox = false;
- this.Name = "CsvColumnizerConfigDlg";
- this.ShowIcon = false;
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "CSV Columnizer Configuration";
- ((System.ComponentModel.ISupportInitialize)(this.minColumnsNumericUpDown)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ okButton = new System.Windows.Forms.Button();
+ cancelButton = new System.Windows.Forms.Button();
+ delimiterTextBox = new System.Windows.Forms.TextBox();
+ label1 = new System.Windows.Forms.Label();
+ textBoxQuoteChar = new System.Windows.Forms.TextBox();
+ labelQuoteChar = new System.Windows.Forms.Label();
+ textboxEscapeChar = new System.Windows.Forms.TextBox();
+ labelEscapeChar = new System.Windows.Forms.Label();
+ checkBoxEscape = new System.Windows.Forms.CheckBox();
+ textBoxCommentChar = new System.Windows.Forms.TextBox();
+ labelCommentChar = new System.Windows.Forms.Label();
+ checkBoxFieldNames = new System.Windows.Forms.CheckBox();
+ numericUpDownMinColumns = new System.Windows.Forms.NumericUpDown();
+ labelMinColumns = new System.Windows.Forms.Label();
+ labelMinColumnsNoCheck = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownMinColumns).BeginInit();
+ SuspendLayout();
+ //
+ // okButton
+ //
+ okButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
+ okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
+ okButton.Location = new System.Drawing.Point(15, 217);
+ okButton.Name = "okButton";
+ okButton.Size = new System.Drawing.Size(75, 25);
+ okButton.TabIndex = 0;
+ okButton.Text = "OK";
+ okButton.UseVisualStyleBackColor = true;
+ okButton.Click += OnOkButtonClick;
+ //
+ // cancelButton
+ //
+ cancelButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
+ cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ cancelButton.Location = new System.Drawing.Point(96, 217);
+ cancelButton.Name = "cancelButton";
+ cancelButton.Size = new System.Drawing.Size(75, 25);
+ cancelButton.TabIndex = 1;
+ cancelButton.Text = "Cancel";
+ cancelButton.UseVisualStyleBackColor = true;
+ //
+ // delimiterTextBox
+ //
+ delimiterTextBox.Location = new System.Drawing.Point(126, 12);
+ delimiterTextBox.MaxLength = 1;
+ delimiterTextBox.Name = "delimiterTextBox";
+ delimiterTextBox.Size = new System.Drawing.Size(28, 23);
+ delimiterTextBox.TabIndex = 2;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new System.Drawing.Point(15, 15);
+ label1.Name = "label1";
+ label1.Size = new System.Drawing.Size(84, 15);
+ label1.TabIndex = 3;
+ label1.Text = "Delimiter char:";
+ //
+ // textBoxQuoteChar
+ //
+ textBoxQuoteChar.Location = new System.Drawing.Point(126, 41);
+ textBoxQuoteChar.Name = "textBoxQuoteChar";
+ textBoxQuoteChar.Size = new System.Drawing.Size(28, 23);
+ textBoxQuoteChar.TabIndex = 4;
+ //
+ // labelQuoteChar
+ //
+ labelQuoteChar.AutoSize = true;
+ labelQuoteChar.Location = new System.Drawing.Point(15, 44);
+ labelQuoteChar.Name = "labelQuoteChar";
+ labelQuoteChar.Size = new System.Drawing.Size(69, 15);
+ labelQuoteChar.TabIndex = 5;
+ labelQuoteChar.Text = "Quote char:";
+ //
+ // textboxEscapeChar
+ //
+ textboxEscapeChar.Location = new System.Drawing.Point(126, 70);
+ textboxEscapeChar.Name = "textboxEscapeChar";
+ textboxEscapeChar.Size = new System.Drawing.Size(28, 23);
+ textboxEscapeChar.TabIndex = 6;
+ //
+ // labelEscapeChar
+ //
+ labelEscapeChar.AutoSize = true;
+ labelEscapeChar.Location = new System.Drawing.Point(15, 73);
+ labelEscapeChar.Name = "labelEscapeChar";
+ labelEscapeChar.Size = new System.Drawing.Size(72, 15);
+ labelEscapeChar.TabIndex = 7;
+ labelEscapeChar.Text = "Escape char:";
+ //
+ // checkBoxEscape
+ //
+ checkBoxEscape.AutoSize = true;
+ checkBoxEscape.Location = new System.Drawing.Point(15, 99);
+ checkBoxEscape.Name = "checkBoxEscape";
+ checkBoxEscape.Size = new System.Drawing.Size(114, 19);
+ checkBoxEscape.TabIndex = 8;
+ checkBoxEscape.Text = "use escape chars";
+ checkBoxEscape.UseVisualStyleBackColor = true;
+ checkBoxEscape.CheckedChanged += OnEscapeCheckBoxCheckedChanged;
+ //
+ // textBoxCommentChar
+ //
+ textBoxCommentChar.Location = new System.Drawing.Point(126, 119);
+ textBoxCommentChar.Name = "textBoxCommentChar";
+ textBoxCommentChar.Size = new System.Drawing.Size(28, 23);
+ textBoxCommentChar.TabIndex = 9;
+ //
+ // labelCommentChar
+ //
+ labelCommentChar.AutoSize = true;
+ labelCommentChar.Location = new System.Drawing.Point(12, 124);
+ labelCommentChar.Name = "labelCommentChar";
+ labelCommentChar.Size = new System.Drawing.Size(90, 15);
+ labelCommentChar.TabIndex = 10;
+ labelCommentChar.Text = "Comment char:";
+ //
+ // checkBoxFieldNames
+ //
+ checkBoxFieldNames.AutoSize = true;
+ checkBoxFieldNames.Location = new System.Drawing.Point(15, 192);
+ checkBoxFieldNames.Name = "checkBoxFieldNames";
+ checkBoxFieldNames.Size = new System.Drawing.Size(182, 19);
+ checkBoxFieldNames.TabIndex = 11;
+ checkBoxFieldNames.Text = "First line contains field names";
+ checkBoxFieldNames.UseVisualStyleBackColor = true;
+ //
+ // numericUpDownMinColumns
+ //
+ numericUpDownMinColumns.Location = new System.Drawing.Point(106, 148);
+ numericUpDownMinColumns.Maximum = new decimal(new int[] { 10, 0, 0, 0 });
+ numericUpDownMinColumns.Name = "numericUpDownMinColumns";
+ numericUpDownMinColumns.Size = new System.Drawing.Size(48, 23);
+ numericUpDownMinColumns.TabIndex = 12;
+ //
+ // labelMinColumns
+ //
+ labelMinColumns.AutoSize = true;
+ labelMinColumns.Location = new System.Drawing.Point(15, 150);
+ labelMinColumns.Name = "labelMinColumns";
+ labelMinColumns.Size = new System.Drawing.Size(77, 15);
+ labelMinColumns.TabIndex = 13;
+ labelMinColumns.Text = "Min columns";
+ //
+ // labelMinColumnsNoCheck
+ //
+ labelMinColumnsNoCheck.AutoSize = true;
+ labelMinColumnsNoCheck.Location = new System.Drawing.Point(15, 174);
+ labelMinColumnsNoCheck.Name = "labelMinColumnsNoCheck";
+ labelMinColumnsNoCheck.Size = new System.Drawing.Size(139, 15);
+ labelMinColumnsNoCheck.TabIndex = 14;
+ labelMinColumnsNoCheck.Text = "(0 = no minimum check)";
+ //
+ // CsvColumnizerConfigDlg
+ //
+ ClientSize = new System.Drawing.Size(204, 250);
+ ControlBox = false;
+ Controls.Add(labelMinColumnsNoCheck);
+ Controls.Add(labelMinColumns);
+ Controls.Add(numericUpDownMinColumns);
+ Controls.Add(checkBoxFieldNames);
+ Controls.Add(labelCommentChar);
+ Controls.Add(textBoxCommentChar);
+ Controls.Add(checkBoxEscape);
+ Controls.Add(labelEscapeChar);
+ Controls.Add(textboxEscapeChar);
+ Controls.Add(labelQuoteChar);
+ Controls.Add(textBoxQuoteChar);
+ Controls.Add(label1);
+ Controls.Add(delimiterTextBox);
+ Controls.Add(cancelButton);
+ Controls.Add(okButton);
+ MaximizeBox = false;
+ Name = "CsvColumnizerConfigDlg";
+ ShowIcon = false;
+ ShowInTaskbar = false;
+ StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ Text = "CSV Columnizer Configuration";
+ ((System.ComponentModel.ISupportInitialize)numericUpDownMinColumns).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
- #endregion
+ #endregion
- private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox delimiterTextBox;
private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox quoteCharTextBox;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.TextBox escapeCharTextBox;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.CheckBox escapeCheckBox;
- private System.Windows.Forms.TextBox commentCharTextBox;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.CheckBox fieldNamesCheckBox;
- private System.Windows.Forms.NumericUpDown minColumnsNumericUpDown;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.TextBox textBoxQuoteChar;
+ private System.Windows.Forms.Label labelQuoteChar;
+ private System.Windows.Forms.TextBox textboxEscapeChar;
+ private System.Windows.Forms.Label labelEscapeChar;
+ private System.Windows.Forms.CheckBox checkBoxEscape;
+ private System.Windows.Forms.TextBox textBoxCommentChar;
+ private System.Windows.Forms.Label labelCommentChar;
+ private System.Windows.Forms.CheckBox checkBoxFieldNames;
+ private System.Windows.Forms.NumericUpDown numericUpDownMinColumns;
+ private System.Windows.Forms.Label labelMinColumns;
+ private System.Windows.Forms.Label labelMinColumnsNoCheck;
}
}
\ No newline at end of file
diff --git a/src/CsvColumnizer/CsvColumnizerConfigDlg.cs b/src/CsvColumnizer/CsvColumnizerConfigDlg.cs
index bd477eaa..4c2fd0ab 100644
--- a/src/CsvColumnizer/CsvColumnizerConfigDlg.cs
+++ b/src/CsvColumnizer/CsvColumnizerConfigDlg.cs
@@ -1,4 +1,5 @@
using System;
+using System.Drawing;
using System.Windows.Forms;
namespace CsvColumnizer
@@ -15,9 +16,14 @@ public partial class CsvColumnizerConfigDlg : Form
public CsvColumnizerConfigDlg(CsvColumnizerConfig config)
{
+ SuspendLayout();
+ AutoScaleDimensions = new SizeF(96F, 96F);
+ AutoScaleMode = AutoScaleMode.Dpi;
+
_config = config;
InitializeComponent();
FillValues();
+ ResumeLayout();
}
#endregion
@@ -27,23 +33,23 @@ public CsvColumnizerConfigDlg(CsvColumnizerConfig config)
private void FillValues()
{
delimiterTextBox.Text = _config.DelimiterChar;
- quoteCharTextBox.Text = _config.QuoteChar.ToString();
- escapeCharTextBox.Text = _config.EscapeChar.ToString();
- escapeCheckBox.Checked = _config.EscapeChar != '\0';
- commentCharTextBox.Text = _config.CommentChar.ToString();
- fieldNamesCheckBox.Checked = _config.HasFieldNames;
- escapeCharTextBox.Enabled = escapeCheckBox.Checked;
- minColumnsNumericUpDown.Value = _config.MinColumns;
+ textBoxQuoteChar.Text = _config.QuoteChar.ToString();
+ textboxEscapeChar.Text = _config.EscapeChar.ToString();
+ checkBoxEscape.Checked = _config.EscapeChar != '\0';
+ textBoxCommentChar.Text = _config.CommentChar.ToString();
+ checkBoxFieldNames.Checked = _config.HasFieldNames;
+ textboxEscapeChar.Enabled = checkBoxEscape.Checked;
+ numericUpDownMinColumns.Value = _config.MinColumns;
}
private void RetrieveValues()
{
_config.DelimiterChar = delimiterTextBox.Text;
- _config.QuoteChar = quoteCharTextBox.Text[0];
- _config.EscapeChar = escapeCheckBox.Checked ? escapeCharTextBox.Text[0] : '\0';
- _config.CommentChar = commentCharTextBox.Text[0];
- _config.HasFieldNames = fieldNamesCheckBox.Checked;
- _config.MinColumns = (int) minColumnsNumericUpDown.Value;
+ _config.QuoteChar = textBoxQuoteChar.Text[0];
+ _config.EscapeChar = checkBoxEscape.Checked ? textboxEscapeChar.Text[0] : '\0';
+ _config.CommentChar = textBoxCommentChar.Text[0];
+ _config.HasFieldNames = checkBoxFieldNames.Checked;
+ _config.MinColumns = (int)numericUpDownMinColumns.Value;
}
#endregion
@@ -57,9 +63,10 @@ private void OnOkButtonClick(object sender, EventArgs e)
private void OnEscapeCheckBoxCheckedChanged(object sender, EventArgs e)
{
- escapeCharTextBox.Enabled = escapeCheckBox.Checked;
+ textboxEscapeChar.Enabled = checkBoxEscape.Checked;
}
#endregion
+
}
}
\ No newline at end of file
diff --git a/src/CsvColumnizer/CsvColumnizerConfigDlg.resx b/src/CsvColumnizer/CsvColumnizerConfigDlg.resx
index ff31a6db..e0a4c980 100644
--- a/src/CsvColumnizer/CsvColumnizerConfigDlg.resx
+++ b/src/CsvColumnizer/CsvColumnizerConfigDlg.resx
@@ -1,17 +1,17 @@
-
diff --git a/src/Log4jXmlColumnizer/Log4jXmlColumnizer.cs b/src/Log4jXmlColumnizer/Log4jXmlColumnizer.cs
index c3d9851d..88e66fc2 100644
--- a/src/Log4jXmlColumnizer/Log4jXmlColumnizer.cs
+++ b/src/Log4jXmlColumnizer/Log4jXmlColumnizer.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -221,7 +222,6 @@ public IColumnizedLogLine SplitLine(ILogLineColumnizerCallback callback, ILogLin
Column[] columns = Column.CreateColumns(COLUMN_COUNT, clogLine);
-
// If the line is too short (i.e. does not follow the format for this columnizer) return the whole line content
// in colum 8 (the log message column). Date and time column will be left blank.
if (line.FullLine.Length < 15)
@@ -233,10 +233,12 @@ public IColumnizedLogLine SplitLine(ILogLineColumnizerCallback callback, ILogLin
try
{
DateTime dateTime = GetTimestamp(callback, line);
+
if (dateTime == DateTime.MinValue)
{
columns[8].FullValue = line.FullLine;
}
+
string newDate = dateTime.ToString(DATETIME_FORMAT);
columns[0].FullValue = newDate;
}
@@ -305,6 +307,7 @@ public DateTime GetTimestamp(ILogLineColumnizerCallback callback, ILogLine line)
}
int endIndex = line.FullLine.IndexOf(separatorChar, 1);
+
if (endIndex > 20 || endIndex < 0)
{
return DateTime.MinValue;
@@ -314,12 +317,12 @@ public DateTime GetTimestamp(ILogLineColumnizerCallback callback, ILogLine line)
try
{
// convert log4j timestamp into a readable format:
- long timestamp;
- if (long.TryParse(value, out timestamp))
+ if (long.TryParse(value, out long timestamp))
{
// Add the time offset before returning
DateTime dateTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
dateTime = dateTime.AddMilliseconds(timestamp);
+
if (_config.localTimestamps)
{
dateTime = dateTime.ToLocalTime();
@@ -347,7 +350,7 @@ public void PushValue(ILogLineColumnizerCallback callback, int column, string va
DateTime oldDateTime = DateTime.ParseExact(oldValue, DATETIME_FORMAT, cultureInfo);
long mSecsOld = oldDateTime.Ticks / TimeSpan.TicksPerMillisecond;
long mSecsNew = newDateTime.Ticks / TimeSpan.TicksPerMillisecond;
- timeOffset = (int) (mSecsNew - mSecsOld);
+ timeOffset = (int)(mSecsNew - mSecsOld);
}
catch (FormatException)
{
@@ -411,10 +414,7 @@ public Priority GetPriority(string fileName, IEnumerable samples)
#region Private Methods
- private string[] GetAllColumnNames()
- {
- return ["Timestamp", "Level", "Logger", "Thread", "Class", "Method", "File", "Line", "Message"];
- }
+ private string[] GetAllColumnNames() => ["Timestamp", "Level", "Logger", "Thread", "Class", "Method", "File", "Line", "Message"];
///
@@ -442,7 +442,7 @@ private Column[] MapColumns(Column[] cols)
}
- return output.ToArray();
+ return [.. output];
}
#endregion
diff --git a/src/Log4jXmlColumnizer/Log4jXmlColumnizerConfigDlg.cs b/src/Log4jXmlColumnizer/Log4jXmlColumnizerConfigDlg.cs
index ca386094..fae1414d 100644
--- a/src/Log4jXmlColumnizer/Log4jXmlColumnizerConfigDlg.cs
+++ b/src/Log4jXmlColumnizer/Log4jXmlColumnizerConfigDlg.cs
@@ -1,4 +1,5 @@
using System;
+using System.Drawing;
using System.Windows.Forms;
namespace LogExpert
@@ -15,10 +16,15 @@ public partial class Log4jXmlColumnizerConfigDlg : Form
public Log4jXmlColumnizerConfigDlg(Log4jXmlColumnizerConfig config)
{
+ SuspendLayout();
+ AutoScaleDimensions = new SizeF(96F, 96F);
+ AutoScaleMode = AutoScaleMode.Dpi;
+
_config = config;
InitializeComponent();
FillListBox();
localTimeCheckBox.Checked = _config.localTimestamps;
+ ResumeLayout();
}
#endregion
@@ -33,7 +39,7 @@ private void FillListBox()
foreach (Log4jColumnEntry entry in _config.columnList)
{
- DataGridViewRow row = new DataGridViewRow();
+ DataGridViewRow row = new();
row.Cells.Add(new DataGridViewCheckBoxCell());
row.Cells.Add(new DataGridViewTextBoxCell());
row.Cells.Add(new DataGridViewTextBoxCell());
@@ -58,8 +64,8 @@ private void OkButton_Click(object sender, EventArgs e)
{
_config.columnList[i].visible = (bool)columnGridView.Rows[i].Cells[0].Value;
string sLen = (string)columnGridView.Rows[i].Cells[2].Value;
- int len;
- if (int.TryParse(sLen, out len))
+
+ if (int.TryParse(sLen, out int len))
{
_config.columnList[i].maxLen = len;
}
diff --git a/src/RegexColumnizer/RegexColumnizerConfigDialog.Designer.cs b/src/RegexColumnizer/RegexColumnizerConfigDialog.Designer.cs
index 9e02a094..42a27daa 100644
--- a/src/RegexColumnizer/RegexColumnizerConfigDialog.Designer.cs
+++ b/src/RegexColumnizer/RegexColumnizerConfigDialog.Designer.cs
@@ -64,7 +64,7 @@ private void InitializeComponent()
this.btnOk.TabIndex = 1;
this.btnOk.Text = "Ok";
this.btnOk.UseVisualStyleBackColor = true;
- this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
+ this.btnOk.Click += new System.EventHandler(this.OnBtnOkClick);
//
// lblRegEx
//
@@ -93,7 +93,7 @@ private void InitializeComponent()
this.tbCheck.TabIndex = 4;
this.tbCheck.Text = "Check";
this.tbCheck.UseVisualStyleBackColor = true;
- this.tbCheck.Click += new System.EventHandler(this.tbCheck_Click);
+ this.tbCheck.Click += new System.EventHandler(this.OnButtonCheckClick);
//
// tbTestLine
//
diff --git a/src/RegexColumnizer/RegexColumnizerConfigDialog.cs b/src/RegexColumnizer/RegexColumnizerConfigDialog.cs
index 2d436aa3..b44cf02f 100644
--- a/src/RegexColumnizer/RegexColumnizerConfigDialog.cs
+++ b/src/RegexColumnizer/RegexColumnizerConfigDialog.cs
@@ -1,75 +1,82 @@
using System;
using System.Data;
+using System.Drawing;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace RegexColumnizer
{
- public partial class RegexColumnizerConfigDialog : Form
- {
- public RegexColumnizerConfigDialog()
- {
- InitializeComponent();
- }
+ public partial class RegexColumnizerConfigDialog : Form
+ {
+ public RegexColumnizerConfigDialog()
+ {
+ SuspendLayout();
+ AutoScaleDimensions = new SizeF(96F, 96F);
+ AutoScaleMode = AutoScaleMode.Dpi;
- public RegexColumnizerConfig Config { get; set; }
+ InitializeComponent();
+ ResumeLayout();
+ }
+
+ public RegexColumnizerConfig Config { get; set; }
- private void btnOk_Click(object sender, EventArgs e)
- {
- if (Check())
- {
- Config.Expression = tbExpression.Text;
+ private void OnBtnOkClick(object sender, EventArgs e)
+ {
+ if (Check())
+ {
+ Config.Expression = tbExpression.Text;
Config.Name = tbName.Text;
}
- }
+ }
- private void RegexColumnizerConfigDialog_Load(object sender, EventArgs e)
- {
- tbExpression.Text = Config.Expression;
+ private void RegexColumnizerConfigDialog_Load(object sender, EventArgs e)
+ {
+ tbExpression.Text = Config.Expression;
tbName.Text = Config.Name;
}
- private void tbCheck_Click(object sender, EventArgs e)
- {
- Check();
- }
+ private void OnButtonCheckClick(object sender, EventArgs e)
+ {
+ Check();
+ }
+
+ private bool Check()
+ {
+ DataTable table = new();
- private bool Check()
- {
- DataTable table = new DataTable();
- try
- {
- Regex regex = new Regex(tbExpression.Text);
- var groupNames = regex.GetGroupNames();
- int offset = groupNames.Length > 1 ? 1 : 0;
- for (int i = offset; i < groupNames.Length; i++)
- {
- table.Columns.Add(groupNames[i]);
- }
+ try
+ {
+ Regex regex = new(tbExpression.Text);
+ var groupNames = regex.GetGroupNames();
+ int offset = groupNames.Length > 1 ? 1 : 0;
- if (!string.IsNullOrEmpty(tbTestLine.Text))
- {
- Match match = regex.Match(tbTestLine.Text);
- var row = table.NewRow();
- var values = match.Groups.OfType().Skip(offset).Select(group => group.Value).Cast