-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#14 refactoring: add project templates and logging library
- Loading branch information
Showing
16 changed files
with
3,828 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project> | ||
|
||
<!-- Project properties --> | ||
<PropertyGroup> | ||
<AppPlatforms>x64</AppPlatforms> | ||
<AppConfigurations>Debug;Release</AppConfigurations> | ||
<AppTargetFramework>net6.0</AppTargetFramework> | ||
<WindowsAppTargetFramework>net6.0-windows</WindowsAppTargetFramework> | ||
<LibraryTargetFramework>net6.0</LibraryTargetFramework> | ||
<TestTargetFramework>net6.0</TestTargetFramework> | ||
<CSharpLangVersion>10.0</CSharpLangVersion> | ||
</PropertyGroup> | ||
|
||
<!-- NuGet packages --> | ||
<PropertyGroup> | ||
<AcolyteNETPackageVersion>2.2.0</AcolyteNETPackageVersion> | ||
<FFMEWindowsPackageVersion>4.4.350</FFMEWindowsPackageVersion> | ||
<NExifToolPackageVersion>0.11.0</NExifToolPackageVersion> | ||
<MinVerPackageVersion>3.1.0</MinVerPackageVersion> | ||
<NLogPackageVersion>4.7.15</NLogPackageVersion> | ||
<NLogConfigPackageVersion>4.7.15</NLogConfigPackageVersion> | ||
<NLogSchemaPackageVersion>4.7.15</NLogSchemaPackageVersion> | ||
<OokiiDialogsWpfPackageVersion>5.0.1</OokiiDialogsWpfPackageVersion> | ||
</PropertyGroup> | ||
|
||
</Project> |
39 changes: 39 additions & 0 deletions
39
ClipChopper/Libraries/ClipChopper.Common/ClipChopper.Common.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Platforms>$(AppPlatforms)</Platforms> | ||
<Configurations>$(AppConfigurations)</Configurations> | ||
<OutputType>Library</OutputType> | ||
<TargetFramework>$(LibraryTargetFramework)</TargetFramework> | ||
<LangVersion>$(CSharpLangVersion)</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<Deterministic>true</Deterministic> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<MinVerTagPrefix>v</MinVerTagPrefix> | ||
<RootNamespace>ClipChopper.Common</RootNamespace> | ||
<IncludeSymbols>false</IncludeSymbols> | ||
<IsPackable>false</IsPackable> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
|
||
<PublishReadyToRun>true</PublishReadyToRun> | ||
<!-- Workaround to fix issue with debug mode in VS. --> | ||
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Authors>Valery Kirichenko; Vasily Vasilyev</Authors> | ||
<Product>ClipChopper</Product> | ||
<Company>ClipChopper</Company> | ||
<NeutralLanguage>en-US</NeutralLanguage> | ||
<RepositoryUrl>https://github.com/valery-kirichenko/clip-chopper</RepositoryUrl> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Acolyte.NET" Version="$(AcolyteNETPackageVersion)" /> | ||
<PackageReference Include="MinVer" Version="$(MinVerPackageVersion)" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
</Project> |
43 changes: 43 additions & 0 deletions
43
ClipChopper/Libraries/ClipChopper.Core/ClipChopper.Core.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Platforms>$(AppPlatforms)</Platforms> | ||
<Configurations>$(AppConfigurations)</Configurations> | ||
<OutputType>Library</OutputType> | ||
<TargetFramework>$(LibraryTargetFramework)</TargetFramework> | ||
<LangVersion>$(CSharpLangVersion)</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<Deterministic>true</Deterministic> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<MinVerTagPrefix>v</MinVerTagPrefix> | ||
<RootNamespace>ClipChopper.Core</RootNamespace> | ||
<IncludeSymbols>false</IncludeSymbols> | ||
<IsPackable>false</IsPackable> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
|
||
<PublishReadyToRun>true</PublishReadyToRun> | ||
<!-- Workaround to fix issue with debug mode in VS. --> | ||
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Authors>Valery Kirichenko; Vasily Vasilyev</Authors> | ||
<Product>ClipChopper</Product> | ||
<Company>ClipChopper</Company> | ||
<NeutralLanguage>en-US</NeutralLanguage> | ||
<RepositoryUrl>https://github.com/valery-kirichenko/clip-chopper</RepositoryUrl> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="$(SolutionDir)Libraries\ClipChopper.Common\ClipChopper.Common.csproj" /> | ||
<ProjectReference Include="$(SolutionDir)Libraries\ClipChopper.Logging\ClipChopper.Logging.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MinVer" Version="$(MinVerPackageVersion)" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
</Project> |
60 changes: 60 additions & 0 deletions
60
ClipChopper/Libraries/ClipChopper.Logging/ClipChopper.Logging.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Platforms>$(AppPlatforms)</Platforms> | ||
<Configurations>$(AppConfigurations)</Configurations> | ||
<OutputType>Library</OutputType> | ||
<TargetFramework>$(LibraryTargetFramework)</TargetFramework> | ||
<LangVersion>$(CSharpLangVersion)</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<Deterministic>true</Deterministic> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<MinVerTagPrefix>v</MinVerTagPrefix> | ||
<RootNamespace>ClipChopper.Logging</RootNamespace> | ||
<IncludeSymbols>false</IncludeSymbols> | ||
<IsPackable>false</IsPackable> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
|
||
<PublishReadyToRun>true</PublishReadyToRun> | ||
<!-- Workaround to fix issue with debug mode in VS. --> | ||
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Authors>Valery Kirichenko; Vasily Vasilyev</Authors> | ||
<Product>ClipChopper</Product> | ||
<Company>ClipChopper</Company> | ||
<NeutralLanguage>en-US</NeutralLanguage> | ||
<RepositoryUrl>https://github.com/valery-kirichenko/clip-chopper</RepositoryUrl> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="$(SolutionDir)Libraries\ClipChopper.Common\ClipChopper.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MinVer" Version="$(MinVerPackageVersion)" PrivateAssets="all" /> | ||
<PackageReference Include="NLog" Version="$(NLogPackageVersion)" /> | ||
<PackageReference Include="NLog.Config" Version="$(NLogConfigPackageVersion)"> | ||
<ExcludeAssets>all</ExcludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="NLog.Schema" Version="$(NLogSchemaPackageVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="NLog.config"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<ExcludeFromSingleFile>false</ExcludeFromSingleFile> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</Content> | ||
<Content Include="NLog.xsd"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<ExcludeFromSingleFile>false</ExcludeFromSingleFile> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace ClipChopper.Logging | ||
{ | ||
public interface ILogger | ||
{ | ||
void PrintHeader(string message); | ||
void PrintFooter(string message); | ||
void Debug(string message); | ||
void Info(string message); | ||
void Warn(string message); | ||
void Warn(Exception ex, string message); | ||
void Error(string message); | ||
void Error(Exception ex, string message); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
ClipChopper/Libraries/ClipChopper.Logging/LoggerFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using Acolyte.Assertions; | ||
|
||
namespace ClipChopper.Logging | ||
{ | ||
public static class LoggerFactory | ||
{ | ||
/// <summary> | ||
/// Creates logger instance for passed type. | ||
/// </summary> | ||
/// <typeparam name="T">Type for which instance is created.</typeparam> | ||
/// <returns>Created logger instance.</returns> | ||
/// <exception cref="ArgumentException"> | ||
/// Cannot get full name of type <typeparamref name="T" />. | ||
/// </exception> | ||
public static ILogger CreateLoggerFor<T>() | ||
{ | ||
Type type = typeof(T); | ||
string fullName = type.FullName ?? throw new ArgumentException( | ||
$"Could not get full name of class {type}." | ||
); | ||
return new NLogLoggerAdapter(fullName); | ||
} | ||
|
||
/// <summary> | ||
/// Creates logger instance for passed class type. | ||
/// </summary> | ||
/// <param name="type">Class name. Try to pass it with <c>typeof</c> operator.</param> | ||
/// <returns>Created logger instance.</returns> | ||
/// <exception cref="ArgumentNullException"> | ||
/// <paramref name="type" /> is <c>null</c>. | ||
/// </exception> | ||
/// <exception cref="ArgumentException"> | ||
/// Cannot get full name of passed type <paramref name="type" />. | ||
/// </exception> | ||
public static ILogger CreateLoggerFor(Type type) | ||
{ | ||
type.ThrowIfNull(nameof(type)); | ||
|
||
string fullName = type.FullName ?? throw new ArgumentException( | ||
$"Could not get full name of class {nameof(type)}" | ||
); | ||
return new NLogLoggerAdapter(fullName); | ||
} | ||
} | ||
} |
Oops, something went wrong.