initial commit
This commit is contained in:
26
PhotoRenamer.Base/FilesHelper.cs
Normal file
26
PhotoRenamer.Base/FilesHelper.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace PhotoRenamer.Base
|
||||
{
|
||||
|
||||
public static class FilesHelper
|
||||
{
|
||||
private static readonly string[] SupportedFileExtensions = {".jpg", ".cr2", ".mp4"};
|
||||
|
||||
public static IEnumerable<string> FindSupportedFilesRecursively(string path)
|
||||
{
|
||||
var files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories);
|
||||
foreach (var file in files)
|
||||
{
|
||||
var fileExt = Path.GetExtension(file);
|
||||
if(fileExt == null) continue;
|
||||
foreach (var supportedFileExtension in SupportedFileExtensions)
|
||||
{
|
||||
if (fileExt.Equals(supportedFileExtension, StringComparison.InvariantCultureIgnoreCase)) yield return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
PhotoRenamer.Base/PhotoRenamer.Base.csproj
Normal file
15
PhotoRenamer.Base/PhotoRenamer.Base.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ExifLibNet" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user