Skip to content

Commit

Permalink
Beta 4:
Browse files Browse the repository at this point in the history
•Improve CSV compatibility with RFC 4180 standard
•Add tooltips to many form elements
•Some general code cleanup
  • Loading branch information
SanderSade committed Mar 18, 2020
1 parent e3ce019 commit 5fd6487
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 19 deletions.
20 changes: 17 additions & 3 deletions DirLister.Core/Application/Writers/CsvWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal sealed class CsvWriter : BaseWriter
internal CsvWriter(Configuration configuration, DateTimeOffset endDate, List<FileEntry> entries) : base(
configuration, endDate, entries)
{
_sb = new StringBuilder();
_sb = new StringBuilder(entries.Count * 256);
}


Expand Down Expand Up @@ -95,7 +95,7 @@ private void GetFileLine(FileEntry entry)


[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static string Quote<T>(T value)
private static string Quote<T>(T value, string delimiter = ",")
{
if (value == null || value.Equals(default(T)))
{
Expand All @@ -109,8 +109,22 @@ private static string Quote<T>(T value)
case double d when d == 0d:
return "\"\"";
default:
return FormattableString.Invariant($"\"{value.ToString()}\"");
var valueString = value.ToString();
if (string.IsNullOrWhiteSpace(valueString))
{
return "\"\"";
}

if (valueString.Contains("\"") || valueString.Contains(delimiter) || valueString.Contains("\r") ||
valueString.Contains("\n"))
{
return string.Concat("\"", valueString.Replace("\"", "\"\""), "\"");
}

return valueString;
}


}
}
}
45 changes: 32 additions & 13 deletions DirLister.UI/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion DirLister.UI/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,29 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>443, 17</value>
</metadata>
<metadata name="HistoryMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="IncludeMediaInfo.ToolTip" xml:space="preserve">
<value>When enabled, adds media info for all
supported image, audio and video files.
Slows list creation noticeably.

You can see the supported formats
in the Log tab after list creation
when Media info is enabled.</value>
</data>
<metadata name="FolderSelectionDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>139, 17</value>
</metadata>
<metadata name="DirectoryMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>310, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
<value>178</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down
2 changes: 1 addition & 1 deletion DirLister.UI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Sander.DirLister.UI
{
internal static class Program
{
internal static readonly string Version = "v2 beta 3";
internal static readonly string Version = "v2 beta 4";
internal static readonly string VersionString = $"DirLister {Version}";


Expand Down
2 changes: 1 addition & 1 deletion Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2 beta 3
v2 beta 4
8 changes: 8 additions & 0 deletions VersionHistory.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

<h3>Version history</h3>


<h4>v2.beta 4</h4>
<ul>
<li>Improve CSV compatibility with RFC 4180 standard</li>
<li>Add tooltips to many form elements</li>
<li>Some general code cleanup</li>
</ul>

<h4>v2.beta 3</h4>
<ul>
<li>Fix issue with incorrect size for large (2GB+) files</li>
Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ While most of the preferences can be set from UI, there are some advanced option

<h3>Version history</h3>


<h4>v2.beta 4</h4>
<ul>
<li>Improve CSV compatibility with RFC 4180 standard</li>
<li>Add tooltips to many form elements</li>
<li>Some general code cleanup</li>
</ul>

<h4>v2.beta 3</h4>
<ul>
<li>Fix issue with incorrect size for large (2GB+) files</li>
Expand Down

0 comments on commit 5fd6487

Please sign in to comment.