Changed: smart-directory and refactoring

This commit is contained in:
Ray 2021-10-27 17:18:21 +01:00
parent 788a9ea107
commit 8c89ff6def
3 changed files with 15 additions and 7 deletions

View File

@ -124,7 +124,7 @@ namespace RandomFileRunner
if (File.Exists(item))
{
if (SmartFileSystem.IsFileAccessible(item))
if (SmartDirectory.IsFileAccessible(item))
{
foundFiles.Add(item);
ThreadControl.SetText(label2, foundFiles.Count.ToString());
@ -135,7 +135,7 @@ namespace RandomFileRunner
if (Directory.Exists(item))
{
SmartFileSystem.GetFiles(item, textBox1.Text, SearchDirecory_OnFound);
SmartDirectory.GetFiles(item, textBox1.Text, SearchDirecory_OnFound);
ThreadControl.SetText(label2, foundFiles.Count.ToString());

View File

@ -21,20 +21,21 @@
<ItemGroup>
<Compile Remove="RyzStudio\Data\**" />
<Compile Remove="RyzStudio\IO\**" />
<Compile Remove="RyzStudio\Net\**" />
<Compile Remove="RyzStudio\Windows\ThemedForms\PickerBox\**" />
<EmbeddedResource Remove="RyzStudio\Data\**" />
<EmbeddedResource Remove="RyzStudio\IO\**" />
<EmbeddedResource Remove="RyzStudio\Net\**" />
<EmbeddedResource Remove="RyzStudio\Windows\ThemedForms\PickerBox\**" />
<None Remove="RyzStudio\Data\**" />
<None Remove="RyzStudio\IO\**" />
<None Remove="RyzStudio\Net\**" />
<None Remove="RyzStudio\Windows\ThemedForms\PickerBox\**" />
</ItemGroup>
<ItemGroup>
<Compile Remove="RyzStudio\IO\FileType.cs" />
<Compile Remove="RyzStudio\IO\SessionFileFormatBase.cs" />
<Compile Remove="RyzStudio\IO\SharpZipLib.cs" />
<Compile Remove="RyzStudio\IO\SmarterFileSystem.cs" />
<Compile Remove="RyzStudio\Windows\Forms\StackLayoutPanel.cs" />
<Compile Remove="RyzStudio\Windows\Forms\TCustomProgressBar.cs" />
<Compile Remove="RyzStudio\Windows\Forms\TCustomProgressBar.Designer.cs" />

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace RandomFileRunner.IO
{
public class SmartFileSystem
public class SmartDirectory
{
public static List<string> GetFiles(string path, string pattern)
@ -16,6 +16,8 @@ namespace RandomFileRunner.IO
List<string> fileList = new List<string>();
List<string> directoryList = new List<string>();
if (string.IsNullOrWhiteSpace(pattern)) pattern = "*";
directoryList.Add(path);
while (true)
@ -51,8 +53,13 @@ namespace RandomFileRunner.IO
directoryList.Add(item);
}
foreach (string item in Directory.EnumerateFiles(directory, pattern, SearchOption.TopDirectoryOnly))
foreach (string item in Directory.EnumerateFiles(directory, "*", SearchOption.TopDirectoryOnly))
{
if (!MatchFileSearchPattern(pattern, Path.GetFileName(item)))
{
continue;
}
if (!IsFileAccessible(item))
{
continue;