Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ protected override void OnBuildInitialized()

AppveyorArtifacts.ForEach((artifact) =>
{
Process proc = new Process();
var proc = new Process();
proc.StartInfo = new ProcessStartInfo("appveyor", $"PushArtifact \"{artifact}\"");
if (!proc.Start())
{
Expand All @@ -464,7 +464,7 @@ protected override void OnBuildInitialized()
{
AbsolutePath logExpertApplicationData = SpecialFolder(SpecialFolders.ApplicationData) / "LogExpert";

DirectoryInfo info = new DirectoryInfo(logExpertApplicationData);
var info = new DirectoryInfo(logExpertApplicationData);
info.GetDirectories().ForEach(a => a.Delete(true));
logExpertApplicationData.DeleteDirectory();
});
Expand All @@ -474,7 +474,7 @@ protected override void OnBuildInitialized()
{
AbsolutePath logExpertDocuments = SpecialFolder(SpecialFolders.UserProfile) / "Documents" / "LogExpert";

DirectoryInfo info = new DirectoryInfo(logExpertDocuments);
var info = new DirectoryInfo(logExpertDocuments);
info.GetDirectories().ForEach(a => a.Delete(true));
logExpertDocuments.DeleteDirectory();
});
Expand Down
8 changes: 4 additions & 4 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ dotnet_code_quality.CA1001.excluded_symbol_names =
dotnet_code_quality.CA1001.excluded_type_names_with_derived_types =

# CA1002: Do not expose generic lists
dotnet_diagnostic.CA1002.severity = warning
dotnet_diagnostic.CA1002.severity = suggestion
dotnet_code_quality.CA1002.api_surface = all

# CA1003: Use generic event handler instances
Expand Down Expand Up @@ -906,7 +906,7 @@ dotnet_code_quality.CA1806.additional_use_results_methods =
dotnet_diagnostic.CA1810.severity = warning

# CA1812: Avoid uninstantiated internal classes
dotnet_diagnostic.CA1812.severity = warning
dotnet_diagnostic.CA1812.severity = None

# CA1813: Avoid unsealed attributes
dotnet_diagnostic.CA1813.severity = suggestion
Expand Down Expand Up @@ -1021,7 +1021,7 @@ dotnet_diagnostic.CA1849.severity = warning
dotnet_diagnostic.CA1850.severity = warning

# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = warning
dotnet_diagnostic.CA2000.severity = None
dotnet_code_quality.CA2000.excluded_symbol_names =
dotnet_code_quality.CA2000.excluded_type_names_with_derived_types =
dotnet_code_quality.CA2000.dispose_analysis_kind = NonExceptionPaths
Expand Down Expand Up @@ -1100,7 +1100,7 @@ dotnet_code_quality.CA2208.api_surface = all
dotnet_diagnostic.CA2211.severity = warning

# CA2213: Disposable fields should be disposed
dotnet_diagnostic.CA2213.severity = warning
dotnet_diagnostic.CA2213.severity = None

# CA2214: Do not call overridable methods in constructors
dotnet_diagnostic.CA2214.severity = warning
Expand Down
91 changes: 45 additions & 46 deletions src/AutoColumnizer/AutoColumnizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,63 @@

using System;

namespace AutoColumnizer
{
public class AutoColumnizer : ILogLineColumnizer
{
#region ILogLineColumnizer implementation
namespace AutoColumnizer;

public string Text => GetName();
public class AutoColumnizer : ILogLineColumnizer
{
#region ILogLineColumnizer implementation

public bool IsTimeshiftImplemented()
{
return true;
}
public string Text => GetName();

public string GetName()
{
return "Auto Columnizer";
}
public bool IsTimeshiftImplemented()
{
return true;
}

public string GetDescription()
{
return "Automatically find the right columnizer for any file";
}
public string GetName()
{
return "Auto Columnizer";
}

public string GetDescription()
{
return "Automatically find the right columnizer for any file";
}

public int GetColumnCount()
{
throw new NotImplementedException();
}

public string[] GetColumnNames()
{
throw new NotImplementedException();
}
public int GetColumnCount()
{
throw new NotImplementedException();
}

public IColumnizedLogLine SplitLine(ILogLineColumnizerCallback callback, ILogLine line)
{
throw new NotImplementedException();
}
public string[] GetColumnNames()
{
throw new NotImplementedException();
}

public void SetTimeOffset(int msecOffset)
{
throw new NotImplementedException();
}
public IColumnizedLogLine SplitLine(ILogLineColumnizerCallback callback, ILogLine line)
{
throw new NotImplementedException();
}

public int GetTimeOffset()
{
throw new NotImplementedException();
}
public void SetTimeOffset(int msecOffset)
{
throw new NotImplementedException();
}

public DateTime GetTimestamp(ILogLineColumnizerCallback callback, ILogLine line)
{
throw new NotImplementedException();
}
public int GetTimeOffset()
{
throw new NotImplementedException();
}

public void PushValue(ILogLineColumnizerCallback callback, int column, string value, string oldValue)
{
}
public DateTime GetTimestamp(ILogLineColumnizerCallback callback, ILogLine line)
{
throw new NotImplementedException();
}

#endregion ILogLineColumnizer implementation
public void PushValue(ILogLineColumnizerCallback callback, int column, string value, string oldValue)
{
}

#endregion ILogLineColumnizer implementation
}
113 changes: 56 additions & 57 deletions src/ColumnizerLib.UnitTests/ColumnTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,82 @@
using System;
using System.Text;

namespace ColumnizerLib.UnitTests
namespace ColumnizerLib.UnitTests;

[TestFixture]
public class ColumnTests
{
[TestFixture]
public class ColumnTests
[Test]
public void Column_LineCutOf()
{
[Test]
public void Column_LineCutOf()
Column column = new();

StringBuilder builder = new();

for (var i = 0; i < 4675; i++)
{
Column column = new();
builder.Append("6");
}

StringBuilder builder = new();
var expected = builder + "...";
builder.Append("1234");

for (int i = 0; i < 4675; i++)
{
builder.Append("6");
}
column.FullValue = builder.ToString();

string expected = builder + "...";
builder.Append("1234");
Assert.That(column.DisplayValue, Is.EqualTo(expected));
Assert.That(column.FullValue, Is.EqualTo(builder.ToString()));
}

column.FullValue = builder.ToString();
[Test]
public void Column_NoLineCutOf()
{
Column column = new();

Assert.That(column.DisplayValue, Is.EqualTo(expected));
Assert.That(column.FullValue, Is.EqualTo(builder.ToString()));
}
StringBuilder builder = new();

[Test]
public void Column_NoLineCutOf()
for (var i = 0; i < 4675; i++)
{
Column column = new();
builder.Append("6");
}

var expected = builder.ToString();

StringBuilder builder = new();
column.FullValue = expected;

for (int i = 0; i < 4675; i++)
{
builder.Append("6");
}
Assert.That(column.DisplayValue, Is.EqualTo(expected));
Assert.That(column.FullValue, Is.EqualTo(expected));
}

string expected = builder.ToString();
[Test]
public void Column_NullCharReplacement()
{
Column column = new();

column.FullValue = expected;
column.FullValue = "asdf\0";

Assert.That(column.DisplayValue, Is.EqualTo(expected));
Assert.That(column.FullValue, Is.EqualTo(expected));
//Switch between the different implementation for the windows versions
//Not that great solution but currently I'm out of ideas, I know that currently
//only one implementation depending on the windows version is executed
if (Environment.Version >= Version.Parse("6.2"))
{
Assert.That(column.DisplayValue, Is.EqualTo("asdf␀"));
}

[Test]
public void Column_NullCharReplacement()
else
{
Column column = new();

column.FullValue = "asdf\0";

//Switch between the different implementation for the windows versions
//Not that great solution but currently I'm out of ideas, I know that currently
//only one implementation depending on the windows version is executed
if (Environment.Version >= Version.Parse("6.2"))
{
Assert.That(column.DisplayValue, Is.EqualTo("asdf␀"));
}
else
{
Assert.That(column.DisplayValue, Is.EqualTo("asdf "));
}

Assert.That(column.FullValue, Is.EqualTo("asdf\0"));
Assert.That(column.DisplayValue, Is.EqualTo("asdf "));
}

[Test]
public void Column_TabReplacement()
{
Column column = new();
Assert.That(column.FullValue, Is.EqualTo("asdf\0"));
}

[Test]
public void Column_TabReplacement()
{
Column column = new();

column.FullValue = "asdf\t";
column.FullValue = "asdf\t";

Assert.That(column.DisplayValue, Is.EqualTo("asdf "));
Assert.That(column.FullValue, Is.EqualTo("asdf\t"));
}
Assert.That(column.DisplayValue, Is.EqualTo("asdf "));
Assert.That(column.FullValue, Is.EqualTo("asdf\t"));
}
}
39 changes: 19 additions & 20 deletions src/ColumnizerLib.UnitTests/Extensions/LogLineExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@

using NUnit.Framework;

namespace ColumnizerLib.UnitTests.Extensions
{
[TestFixture]
namespace ColumnizerLib.UnitTests.Extensions;

[TestFixture]

internal class LogLineExtensionsTests
internal class LogLineExtensionsTests
{
private class TestingLogLine : ILogLine
{
private class TestingLogLine : ILogLine
{
public string FullLine { get; set; }
public string FullLine { get; set; }

public int LineNumber { get; set; }
public int LineNumber { get; set; }

public string Text { get; set; }
}
public string Text { get; set; }
}

[Test]
public void ToClipBoardText_ReturnsExpected()
[Test]
public void ToClipBoardText_ReturnsExpected()
{
var underTest = new TestingLogLine
{
var underTest = new TestingLogLine
{
FullLine = "a fullLine",
LineNumber = 89,
Text = "a text"
};
Assert.That(underTest.ToClipBoardText(), Is.EqualTo("\t90\ta fullLine"));
}
FullLine = "a fullLine",
LineNumber = 89,
Text = "a text"
};
Assert.That(underTest.ToClipBoardText(), Is.EqualTo("\t90\ta fullLine"));
}
}
Loading