Compare commits

..

No commits in common. "ad1e92362d99732ba4cdd1bfbd75050ae9f65bc2" and "9bf4b675e4c698e1da1e716a4dabba3d7dbbf6a6" have entirely different histories.

18 changed files with 15 additions and 1373 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,10 @@
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"};
@ -24,18 +22,5 @@ namespace PhotoRenamer.Base
}
}
}
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;
}
}
}
}

View File

@ -2,12 +2,11 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ExifLibNet" Version="2.1.1" />
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -1,8 +0,0 @@
namespace PhotoRenamer.Base
{
public static class RegionNames
{
public static string ContentRegion { get; } = "ContentRegion";
public static string LoggingRegion { get; } = "LoggingRegion";
}
}

View File

@ -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; }
}
}

View File

@ -1,5 +1,4 @@
using System;
using PhotoRenamer.Base;
using PhotoRenamer.File.Views;
using Prism.Ioc;
using Prism.Modularity;
@ -24,7 +23,7 @@ namespace PhotoRenamer.File
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<ViewA>();
_regionManager.RequestNavigate(RegionNames.ContentRegion, new Uri(nameof(ViewA), UriKind.Relative));
_regionManager.RequestNavigate("ContentRegion", new Uri(nameof(ViewA), UriKind.Relative));
}
}
}

View File

@ -1,19 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>PhotoRenamer.File</AssemblyName>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PhotoRenamer.Base\PhotoRenamer.Base.csproj" />
</ItemGroup>
</Project>

View File

@ -1,30 +0,0 @@
using System;
using PhotoRenamer.Base;
using PhotoRenamer.Logging.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
namespace PhotoRenamer.Logging
{
public class LoggingModule : IModule
{
private readonly IRegionManager _regionManager;
public LoggingModule(IRegionManager regionManager)
{
_regionManager = regionManager;
}
public void OnInitialized(IContainerProvider containerProvider)
{
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<ViewA>();
_regionManager.RequestNavigate(RegionNames.LoggingRegion, new Uri(nameof(ViewA), UriKind.Relative));
}
}
}

View File

@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<UseWPF>true</UseWPF>
<AssemblyName>PhotoRenamer.Logging</AssemblyName>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PhotoRenamer.Base\PhotoRenamer.Base.csproj" />
</ItemGroup>
</Project>

View File

@ -1,14 +0,0 @@
using System.Windows.Input;
using JetBrains.Annotations;
using Prism.Mvvm;
namespace PhotoRenamer.Logging.ViewModels
{
[UsedImplicitly]
public class ViewAViewModel : BindableBase
{
public ICommand SelectFilesCommand { get; }
public ICommand ClearCommand { get; }
}
}

View File

@ -1,17 +0,0 @@
<UserControl
x:Class="PhotoRenamer.Logging.Views.ViewA"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:viewModels="clr-namespace:PhotoRenamer.Logging.ViewModels"
d:DataContext="{d:DesignInstance viewModels:ViewAViewModel}"
d:DesignHeight="300"
d:DesignWidth="300"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d">
<GroupBox Margin="5" Header="Log">
<ListView />
</GroupBox>
</UserControl>

View File

@ -1,13 +0,0 @@
namespace PhotoRenamer.Logging.Views
{
/// <summary>
/// Interaction logic for ViewA.xaml
/// </summary>
public partial class ViewA
{
public ViewA()
{
InitializeComponent();
}
}
}

View File

@ -2,8 +2,6 @@ using System;
using System.IO;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PhotoRenamer.Base;
using PhotoRenamer.Base.Types;
namespace PhotoRenamer.Test
{
@ -15,7 +13,7 @@ namespace PhotoRenamer.Test
public FilesTest()
{
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets");
_files = FilesHelper.FindSupportedFilesRecursively(path).ToArray();
_files = Base.FilesHelper.FindSupportedFilesRecursively(path).ToArray();
}
[TestMethod, Priority(0)]
@ -29,8 +27,7 @@ namespace PhotoRenamer.Test
[TestMethod, Priority(1)]
public void GetMetaData()
{
var expected = new[] {new MediaFile("r", DateTime.Now), new MediaFile("r", DateTime.Now)};
var actual = FilesHelper.GetMediaFiles(_files);
}
}
}

View File

@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@ -14,7 +15,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0">
<PackageReference Include="coverlet.collector" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoRenamer.Test", "PhotoR
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoRenamer.Base", "PhotoRenamer.Base\PhotoRenamer.Base.csproj", "{DE85C395-3D50-4C12-9B7A-021180E26CE1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoRenamer.Logging", "PhotoRenamer.Logging\PhotoRenamer.Logging.csproj", "{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -35,10 +33,6 @@ Global
{DE85C395-3D50-4C12-9B7A-021180E26CE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE85C395-3D50-4C12-9B7A-021180E26CE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE85C395-3D50-4C12-9B7A-021180E26CE1}.Release|Any CPU.Build.0 = Release|Any CPU
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -2,7 +2,6 @@
using PhotoRenamer.Views;
using System.Windows;
using PhotoRenamer.File;
using PhotoRenamer.Logging;
using Prism.Modularity;
namespace PhotoRenamer
@ -25,7 +24,6 @@ namespace PhotoRenamer
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{
moduleCatalog.AddModule<FileModule>();
moduleCatalog.AddModule<LoggingModule>();
base.ConfigureModuleCatalog(moduleCatalog);
}
}

View File

@ -2,7 +2,6 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<UseWPF>true</UseWPF>
<AssemblyName>PhotoRenamer</AssemblyName>
<StartupObject>PhotoRenamer.App</StartupObject>
@ -11,9 +10,9 @@
<PublishSingleFile>false</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@ -21,8 +20,6 @@
<PackageReference Include="Prism.DryIoc" Version="7.2.0.1422" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PhotoRenamer.Base\PhotoRenamer.Base.csproj" />
<ProjectReference Include="..\PhotoRenamer.File\PhotoRenamer.File.csproj" />
<ProjectReference Include="..\PhotoRenamer.Logging\PhotoRenamer.Logging.csproj" />
</ItemGroup>
</Project>

View File

@ -2,23 +2,17 @@
x:Class="PhotoRenamer.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:base="clr-namespace:PhotoRenamer.Base;assembly=PhotoRenamer.Base"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:viewModels="clr-namespace:PhotoRenamer.ViewModels"
Title="{Binding Title}"
Width="1000"
Height="800"
Width="525"
Height="350"
d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel}"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ContentControl prism:RegionManager.RegionName="{x:Static base:RegionNames.ContentRegion}" />
<ContentControl Grid.Column="1" prism:RegionManager.RegionName="{x:Static base:RegionNames.LoggingRegion}" />
<ContentControl prism:RegionManager.RegionName="ContentRegion" />
</Grid>
</Window>