From 5fd6487acc46901f4866a71f4f82f8a200ae2f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sander=20S=C3=A4de?= Date: Wed, 18 Mar 2020 19:13:53 +0200 Subject: [PATCH] =?UTF-8?q?Beta=204:=20=E2=80=A2Improve=20CSV=20compatibil?= =?UTF-8?q?ity=20with=20RFC=204180=20standard=20=E2=80=A2Add=20tooltips=20?= =?UTF-8?q?to=20many=20form=20elements=20=E2=80=A2Some=20general=20code=20?= =?UTF-8?q?cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/Writers/CsvWriter.cs | 20 +++++++-- DirLister.UI/MainForm.Designer.cs | 45 +++++++++++++------ DirLister.UI/MainForm.resx | 14 +++++- DirLister.UI/Program.cs | 2 +- Version.txt | 2 +- VersionHistory.html | 8 ++++ readme.md | 8 ++++ 7 files changed, 80 insertions(+), 19 deletions(-) diff --git a/DirLister.Core/Application/Writers/CsvWriter.cs b/DirLister.Core/Application/Writers/CsvWriter.cs index 213b00a..f10a9ab 100644 --- a/DirLister.Core/Application/Writers/CsvWriter.cs +++ b/DirLister.Core/Application/Writers/CsvWriter.cs @@ -13,7 +13,7 @@ internal sealed class CsvWriter : BaseWriter internal CsvWriter(Configuration configuration, DateTimeOffset endDate, List entries) : base( configuration, endDate, entries) { - _sb = new StringBuilder(); + _sb = new StringBuilder(entries.Count * 256); } @@ -95,7 +95,7 @@ private void GetFileLine(FileEntry entry) [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static string Quote(T value) + private static string Quote(T value, string delimiter = ",") { if (value == null || value.Equals(default(T))) { @@ -109,8 +109,22 @@ private static string Quote(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; } + + } } } diff --git a/DirLister.UI/MainForm.Designer.cs b/DirLister.UI/MainForm.Designer.cs index 7cbdebf..37a6c62 100644 --- a/DirLister.UI/MainForm.Designer.cs +++ b/DirLister.UI/MainForm.Designer.cs @@ -91,6 +91,7 @@ private void InitializeComponent() this.MainTabs = new System.Windows.Forms.TabControl(); this.AboutTab = new System.Windows.Forms.TabPage(); this.AboutPanel = new System.Windows.Forms.Panel(); + this.UpdateCheck = new System.Windows.Forms.Button(); this.ConfigurationFolderButton = new System.Windows.Forms.Button(); this.ProgramFolderButton = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); @@ -102,6 +103,7 @@ private void InitializeComponent() this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.MoveUp = new System.Windows.Forms.ToolStripMenuItem(); this.MoveDown = new System.Windows.Forms.ToolStripMenuItem(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); this.HistoryButton = new Sander.DirLister.UI.App.SplitButton(); this.txt2re = new Sander.DirLister.UI.App.HyperlinkLabel(); this.regexr = new Sander.DirLister.UI.App.HyperlinkLabel(); @@ -109,7 +111,6 @@ private void InitializeComponent() this.hyperlinkLabel1 = new Sander.DirLister.UI.App.HyperlinkLabel(); this.WikiLabel = new Sander.DirLister.UI.App.HyperlinkLabel(); this.HomeLabel = new Sander.DirLister.UI.App.HyperlinkLabel(); - this.UpdateCheck = new System.Windows.Forms.Button(); this.BottomPanel.SuspendLayout(); this.HistoryMenu.SuspendLayout(); this.LogTab.SuspendLayout(); @@ -195,6 +196,8 @@ private void InitializeComponent() this.SetDefault.Size = new System.Drawing.Size(121, 63); this.SetDefault.TabIndex = 0; this.SetDefault.Text = "Set as &default options"; + this.ToolTip.SetToolTip(this.SetDefault, "Set current options as default options.\r\nThis is especially useful when running \r" + + "\nDirLister silently from Explorer"); this.SetDefault.UseVisualStyleBackColor = true; this.SetDefault.Click += new System.EventHandler(this.SetDefault_Click); // @@ -340,6 +343,7 @@ private void InitializeComponent() this.IncludeMediaInfo.Size = new System.Drawing.Size(84, 19); this.IncludeMediaInfo.TabIndex = 2; this.IncludeMediaInfo.Text = "Media info"; + this.ToolTip.SetToolTip(this.IncludeMediaInfo, resources.GetString("IncludeMediaInfo.ToolTip")); this.IncludeMediaInfo.UseVisualStyleBackColor = true; // // IncludeFileDates @@ -419,6 +423,8 @@ private void InitializeComponent() this.CsvCheck.TabIndex = 2; this.CsvCheck.Tag = "csv"; this.CsvCheck.Text = "CSV"; + this.ToolTip.SetToolTip(this.CsvCheck, "Comma Separated Values.\r\nThe result is compliant with RFC 4180 standard\r\nand can " + + "be opened in any compliant viewer\r\nwithout modifications"); this.CsvCheck.UseVisualStyleBackColor = true; // // TxtCheck @@ -441,6 +447,7 @@ private void InitializeComponent() this.HtmlCheck.TabIndex = 0; this.HtmlCheck.Tag = "html"; this.HtmlCheck.Text = "HTML"; + this.ToolTip.SetToolTip(this.HtmlCheck, "HTML 5 with minimal JS"); this.HtmlCheck.UseVisualStyleBackColor = true; // // groupBox1 @@ -465,6 +472,7 @@ private void InitializeComponent() this.OpenFolderButton.Size = new System.Drawing.Size(75, 23); this.OpenFolderButton.TabIndex = 3; this.OpenFolderButton.Text = "Open"; + this.ToolTip.SetToolTip(this.OpenFolderButton, "Open the currently selected output folder"); this.OpenFolderButton.UseVisualStyleBackColor = true; this.OpenFolderButton.Click += new System.EventHandler(this.OpenFolderButton_Click); // @@ -476,6 +484,9 @@ private void InitializeComponent() this.OpenAfter.Size = new System.Drawing.Size(253, 19); this.OpenAfter.TabIndex = 2; this.OpenAfter.Text = "Open output file/folder after list generation"; + this.ToolTip.SetToolTip(this.OpenAfter, "If only one output format is selected,\r\nDirLister will open the file in default v" + + "iewer\r\nafter the list creation.\r\n\r\nIf there are multiple formats selected,\r\noutp" + + "ut folder is opened instead."); this.OpenAfter.UseVisualStyleBackColor = true; // // SelectOutputFolder @@ -511,6 +522,7 @@ private void InitializeComponent() this.InputTab.Size = new System.Drawing.Size(937, 347); this.InputTab.TabIndex = 0; this.InputTab.Text = "Input"; + this.InputTab.ToolTipText = "Input options"; this.InputTab.UseVisualStyleBackColor = true; // // RemoveAllButton @@ -521,6 +533,7 @@ private void InitializeComponent() this.RemoveAllButton.Size = new System.Drawing.Size(93, 23); this.RemoveAllButton.TabIndex = 7; this.RemoveAllButton.Text = "Remove &all"; + this.ToolTip.SetToolTip(this.RemoveAllButton, "Remove all currently selected drives and directories"); this.RemoveAllButton.UseVisualStyleBackColor = true; this.RemoveAllButton.Click += new System.EventHandler(this.RemoveAll_Click); // @@ -535,6 +548,7 @@ private void InitializeComponent() this.DirectoryList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1}); this.DirectoryList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.DirectoryList.HideSelection = false; this.DirectoryList.LabelWrap = false; this.DirectoryList.Location = new System.Drawing.Point(9, 37); this.DirectoryList.Name = "DirectoryList"; @@ -556,6 +570,7 @@ private void InitializeComponent() this.BrowseButton.Size = new System.Drawing.Size(103, 23); this.BrowseButton.TabIndex = 2; this.BrowseButton.Text = "Select &folder"; + this.ToolTip.SetToolTip(this.BrowseButton, "Add input folders. \r\nYou can also select local and network drives."); this.BrowseButton.UseVisualStyleBackColor = true; this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click); // @@ -634,6 +649,7 @@ private void InitializeComponent() this.WildcardList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.WildcardColumn}); this.WildcardList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.WildcardList.HideSelection = false; this.WildcardList.LabelWrap = false; this.WildcardList.Location = new System.Drawing.Point(7, 37); this.WildcardList.Name = "WildcardList"; @@ -803,6 +819,20 @@ private void InitializeComponent() this.AboutPanel.Size = new System.Drawing.Size(395, 322); this.AboutPanel.TabIndex = 7; // + // UpdateCheck + // + this.UpdateCheck.Dock = System.Windows.Forms.DockStyle.Bottom; + this.UpdateCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.UpdateCheck.Location = new System.Drawing.Point(0, 292); + this.UpdateCheck.Name = "UpdateCheck"; + this.UpdateCheck.Size = new System.Drawing.Size(395, 30); + this.UpdateCheck.TabIndex = 16; + this.UpdateCheck.Text = "Check for updates"; + this.ToolTip.SetToolTip(this.UpdateCheck, "Check for updates from GitHub,\r\nNo information whatsoever is sent to \r\nGitHub abo" + + "ut the current user, version etc"); + this.UpdateCheck.UseVisualStyleBackColor = true; + this.UpdateCheck.Click += new System.EventHandler(this.UpdateCheck_Click); + // // ConfigurationFolderButton // this.ConfigurationFolderButton.Dock = System.Windows.Forms.DockStyle.Top; @@ -992,18 +1022,6 @@ private void InitializeComponent() this.HomeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.HomeLabel.Url = "https://github.com/SanderSade/DirLister"; // - // UpdateCheck - // - this.UpdateCheck.Dock = System.Windows.Forms.DockStyle.Bottom; - this.UpdateCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.UpdateCheck.Location = new System.Drawing.Point(0, 292); - this.UpdateCheck.Name = "UpdateCheck"; - this.UpdateCheck.Size = new System.Drawing.Size(395, 30); - this.UpdateCheck.TabIndex = 16; - this.UpdateCheck.Text = "Check for updates"; - this.UpdateCheck.UseVisualStyleBackColor = true; - this.UpdateCheck.Click += new System.EventHandler(this.UpdateCheck_Click); - // // MainForm // this.AllowDrop = true; @@ -1133,6 +1151,7 @@ private void InitializeComponent() private System.Windows.Forms.Button ProgramFolderButton; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button UpdateCheck; + private System.Windows.Forms.ToolTip ToolTip; } } diff --git a/DirLister.UI/MainForm.resx b/DirLister.UI/MainForm.resx index 3e5fa8f..31e3951 100644 --- a/DirLister.UI/MainForm.resx +++ b/DirLister.UI/MainForm.resx @@ -117,9 +117,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 443, 17 + 17, 17 + + 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. + 139, 17 @@ -127,7 +139,7 @@ 310, 17 - 25 + 178 diff --git a/DirLister.UI/Program.cs b/DirLister.UI/Program.cs index 8fd55ce..592f84f 100644 --- a/DirLister.UI/Program.cs +++ b/DirLister.UI/Program.cs @@ -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}"; diff --git a/Version.txt b/Version.txt index cf8e9f1..d6f8402 100644 --- a/Version.txt +++ b/Version.txt @@ -1 +1 @@ -v2 beta 3 +v2 beta 4 diff --git a/VersionHistory.html b/VersionHistory.html index 8cbc890..f4e6257 100644 --- a/VersionHistory.html +++ b/VersionHistory.html @@ -1,6 +1,14 @@

Version history

+ +

v2.beta 4

+
    +
  • Improve CSV compatibility with RFC 4180 standard
  • +
  • Add tooltips to many form elements
  • +
  • Some general code cleanup
  • +
+

v2.beta 3

  • Fix issue with incorrect size for large (2GB+) files
  • diff --git a/readme.md b/readme.md index 2189521..8686013 100644 --- a/readme.md +++ b/readme.md @@ -58,6 +58,14 @@ While most of the preferences can be set from UI, there are some advanced option

    Version history

    + +

    v2.beta 4

    +
      +
    • Improve CSV compatibility with RFC 4180 standard
    • +
    • Add tooltips to many form elements
    • +
    • Some general code cleanup
    • +
    +

    v2.beta 3

    • Fix issue with incorrect size for large (2GB+) files