forked from dobrou/CsvLINQPadDriver
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap text fix. LINQPad 5 files enumeration works the same as for LINQPad 6. LPRun 6.14.10
- Loading branch information
Ivan Ivon
committed
Jul 19, 2021
1 parent
439306b
commit fc8626d
Showing
24 changed files
with
117 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Src/CsvLINQPadDriver/Bcl/Extensions/DirectoryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
using CsvLINQPadDriver.Extensions; | ||
|
||
namespace CsvLINQPadDriver.Bcl.Extensions | ||
{ | ||
internal static class DirectoryExtensions | ||
{ | ||
public static IEnumerable<string> EnumerateFiles(this ICollection<Exception>? exceptions, string path, string searchPattern, SearchOption searchOption) | ||
{ | ||
var directories = new Queue<string>(new[] { path }); | ||
|
||
while (directories.Any()) | ||
{ | ||
var currentDirectory = directories.Dequeue(); | ||
|
||
if (searchOption == SearchOption.AllDirectories) | ||
{ | ||
try | ||
{ | ||
foreach (var directory in Directory.EnumerateDirectories(currentDirectory)) | ||
{ | ||
directories.Enqueue(directory); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
exceptions?.Add(e); | ||
continue; | ||
} | ||
} | ||
|
||
foreach (var file in Directory.EnumerateFiles(currentDirectory, searchPattern).SkipExceptions(exceptions)) | ||
{ | ||
yield return file; | ||
} | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...iver/Microsoft.Bcl/ImmutableExtensions.cs → ...ver/Bcl/Extensions/ImmutableExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...cl/System.Private.CoreLib/System/Range.cs → ...ft/System.Private.CoreLib/System/Range.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace CsvLINQPadDriver.Extensions | ||
{ | ||
internal static class EnumerableExtensions | ||
{ | ||
public static IEnumerable<T> SkipExceptions<T>(this IEnumerable<T> source, ICollection<Exception>? exceptions = null) | ||
{ | ||
using var enumerator = source.GetEnumerator(); | ||
|
||
while (true) | ||
{ | ||
try | ||
{ | ||
if (!enumerator.MoveNext()) | ||
{ | ||
break; | ||
} | ||
} | ||
catch (Exception exception) | ||
{ | ||
exceptions?.Add(exception); | ||
continue; | ||
} | ||
|
||
yield return enumerator.Current; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
<assemblyIdentity | ||
name="CsvLINQPadDriver" | ||
version="6.14.0.0" | ||
version="6.14.1.0" | ||
type="win32" | ||
/> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>6.14.10</Version> | ||
<PackageReleaseNotes>LPRun 6.14.10</PackageReleaseNotes> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters