Restart process
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using ExifLibrary;
|
||||
using JetBrains.Annotations;
|
||||
using PhotoRenamer.Base.Types;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<MediaFile> GetMediaFiles(IEnumerable<string> files)
|
||||
{
|
||||
if (files == null) throw new ArgumentNullException(nameof(files));
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
var imageFile = ImageFile.FromFile(file);
|
||||
var dateTime = imageFile.Properties.Get<ExifDateTime>(ExifTag.DateTimeOriginal);
|
||||
var mediaFile = new MediaFile(file, dateTime.Value);
|
||||
yield return mediaFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ExifLibNet" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PhotoRenamer.Base.Types
|
||||
{
|
||||
public class MediaFile
|
||||
{
|
||||
public MediaFile(string path, DateTime creationDate)
|
||||
{
|
||||
Path = path;
|
||||
CreationDate = creationDate;
|
||||
}
|
||||
|
||||
public string Path { get; }
|
||||
public DateTime CreationDate { get; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user