diff --git a/Deploy/buildlpx.cmd b/Deploy/buildlpx.cmd index 40fbe7b..0ef80d1 100644 --- a/Deploy/buildlpx.cmd +++ b/Deploy/buildlpx.cmd @@ -1,4 +1,4 @@ -@set version=6.5.1 +@set version=6.5.2 @set zip="%ProgramFiles%\7-Zip\7z.exe" @set output="CsvLINQPadDriver.%version%.lpx6" diff --git a/Src/CsvLINQPadDriver/CsvDataContextDriver.cs b/Src/CsvLINQPadDriver/CsvDataContextDriver.cs index 301639e..de20d12 100644 --- a/Src/CsvLINQPadDriver/CsvDataContextDriver.cs +++ b/Src/CsvLINQPadDriver/CsvDataContextDriver.cs @@ -31,7 +31,16 @@ public override string GetConnectionDescription(IConnectionInfo cxInfo) { var parsedFiles = new CsvDataContextDriverProperties(cxInfo).ParsedFiles.ToImmutableList(); var parsedFilesCount = parsedFiles.Count; - return $"{FileUtils.GetLongestCommonPrefixPath(parsedFiles)}{(parsedFilesCount > 1 ? $" ({"file".ToQuantity(parsedFilesCount)})" : string.Empty)}"; + + return $"{FileUtils.GetLongestCommonPrefixPath(parsedFiles)}{GetFilesCountString()}"; + + string GetFilesCountString() => + parsedFilesCount switch + { + 0 => "(no files)", + 1 => string.Empty, + _ => $" ({"file".ToQuantity(parsedFilesCount)})" + }; } public override bool ShowConnectionDialog(IConnectionInfo cxInfo, ConnectionDialogOptions connectionDialogOptions) diff --git a/Src/CsvLINQPadDriver/CsvDataContextDriverProperties.cs b/Src/CsvLINQPadDriver/CsvDataContextDriverProperties.cs index 7fb3ec5..de58b2a 100644 --- a/Src/CsvLINQPadDriver/CsvDataContextDriverProperties.cs +++ b/Src/CsvLINQPadDriver/CsvDataContextDriverProperties.cs @@ -36,7 +36,6 @@ public string Files public IEnumerable ParsedFiles => Regex.Split(Files, @"[\r\n]+") - .Select(fileName => fileName.Trim()) .GetFilesOnly() .Distinct(StringComparer.InvariantCultureIgnoreCase); diff --git a/Src/CsvLINQPadDriver/CsvLINQPadDriver.csproj b/Src/CsvLINQPadDriver/CsvLINQPadDriver.csproj index 5862b27..46e229c 100644 --- a/Src/CsvLINQPadDriver/CsvLINQPadDriver.csproj +++ b/Src/CsvLINQPadDriver/CsvLINQPadDriver.csproj @@ -24,11 +24,11 @@ MIT https://github.com/i2van/CsvLINQPadDriver NuGetIcon.png - Display number of files loaded. + Display no files text when no files loaded. Copyright © Martin Dobroucký 2013-2014, Ivan Ivon 2021 - 6.5.1.0 - 6.5.1.0 - 6.5.1 + 6.5.2.0 + 6.5.2.0 + 6.5.2 true Connection.ico diff --git a/Src/CsvLINQPadDriver/Helpers/FileUtils.cs b/Src/CsvLINQPadDriver/Helpers/FileUtils.cs index 6cf8b06..2b651ce 100644 --- a/Src/CsvLINQPadDriver/Helpers/FileUtils.cs +++ b/Src/CsvLINQPadDriver/Helpers/FileUtils.cs @@ -224,9 +224,9 @@ private static CsvParser CreateCsvParser(string fileName, char csvSeparator) public static IEnumerable GetFilesOnly(this IEnumerable paths) => paths - .Select(p => p.Trim()) - .Where(p => !p.StartsWith("#")) - .Where(p => !string.IsNullOrWhiteSpace(p)); + .Select(path => path.Trim()) + .Where(path => !path.StartsWith("#")) + .Where(path => !string.IsNullOrWhiteSpace(path)); private static IEnumerable EnumFiles(string path) {