Skip to content

Commit

Permalink
Add: glob support
Browse files Browse the repository at this point in the history
  • Loading branch information
Qianming Xue committed Jul 28, 2022
1 parent 810a9d6 commit 5ec3ad4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions DragonWindows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -130,6 +132,11 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing">
<Version>6.0.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
25 changes: 25 additions & 0 deletions DragonWindows.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32602.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragonWindows", "DragonWindows.csproj", "{0CBD9DC9-EE7C-4E47-ADA1-81C1B6AB1049}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0CBD9DC9-EE7C-4E47-ADA1-81C1B6AB1049}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CBD9DC9-EE7C-4E47-ADA1-81C1B6AB1049}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CBD9DC9-EE7C-4E47-ADA1-81C1B6AB1049}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CBD9DC9-EE7C-4E47-ADA1-81C1B6AB1049}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B602BD3-21EE-49A0-A9D8-4FFC39AD3BD0}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions Window1.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
using System.Windows.Media;
using System.Windows.Controls.Primitives;
using System.Runtime.CompilerServices;
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
using System.IO;

namespace DragonWindows
{
Expand Down Expand Up @@ -54,6 +57,13 @@ public Window1()
}
}

// glob matching
var matcher = new Matcher();
matcher.AddIncludePatterns(filenames);
PatternMatchingResult result = matcher.Execute(
new DirectoryInfoWrapper(new DirectoryInfo(".")));
filenames = result.Files.Select(file => file.Path).ToList();

// check if filenames available
var currentDirectory = System.IO.Directory.GetCurrentDirectory();
var fullFilenames = new List<String>();
Expand Down

0 comments on commit 5ec3ad4

Please sign in to comment.