Add MediaOrganizer project
This commit is contained in:
parent
01b38a2fec
commit
73d17fdb12
8 changed files with 170 additions and 0 deletions
2
Directory.Build.props
Executable file
2
Directory.Build.props
Executable file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<Project>
|
||||||
|
</Project>
|
||||||
2
Directory.Build.targets
Executable file
2
Directory.Build.targets
Executable file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<Project>
|
||||||
|
</Project>
|
||||||
2
global.json
Executable file
2
global.json
Executable file
|
|
@ -0,0 +1,2 @@
|
||||||
|
{
|
||||||
|
}
|
||||||
27
media-organizer.sln
Executable file
27
media-organizer.sln
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.0.31903.59
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "media-organizer", "src\media-organizer.csproj", "{E34F9D32-207E-4897-9CEC-26156FBD1B4D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{E34F9D32-207E-4897-9CEC-26156FBD1B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E34F9D32-207E-4897-9CEC-26156FBD1B4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E34F9D32-207E-4897-9CEC-26156FBD1B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E34F9D32-207E-4897-9CEC-26156FBD1B4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{E34F9D32-207E-4897-9CEC-26156FBD1B4D} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
93
src/Program.cs
Executable file
93
src/Program.cs
Executable file
|
|
@ -0,0 +1,93 @@
|
||||||
|
#pragma warning disable IDE0079
|
||||||
|
#pragma warning disable IDE0005
|
||||||
|
global using static Program;
|
||||||
|
#pragma warning restore
|
||||||
|
|
||||||
|
// Media Organizer
|
||||||
|
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
using ConsoleAppFramework;
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Configuration.Json;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
|
|
||||||
|
ConfigurationManager configuration = new();
|
||||||
|
ManifestEmbeddedFileProvider embeddedFileProvider = new(typeof(Program).Assembly, "Properties");
|
||||||
|
configuration.Sources.Insert(0, new JsonConfigurationSource()
|
||||||
|
{
|
||||||
|
FileProvider = embeddedFileProvider,
|
||||||
|
Path = "appsettings.json",
|
||||||
|
Optional = true,
|
||||||
|
ReloadOnChange = true
|
||||||
|
});
|
||||||
|
|
||||||
|
configuration.AddEnvironmentVariables("DOTNET_");
|
||||||
|
|
||||||
|
const string environment =
|
||||||
|
#if DEBUG
|
||||||
|
"Development"
|
||||||
|
#else
|
||||||
|
"Production"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
var environmentAppSettingsName = $"appsettings.{configuration.GetValue("Environment", environment)}.json";
|
||||||
|
|
||||||
|
configuration.Sources.Insert(2, new JsonConfigurationSource()
|
||||||
|
{
|
||||||
|
FileProvider = embeddedFileProvider,
|
||||||
|
Path = environmentAppSettingsName,
|
||||||
|
Optional = true,
|
||||||
|
ReloadOnChange = true
|
||||||
|
});
|
||||||
|
PhysicalFileProvider baseDirectoryFileProvider = new(AppContext.BaseDirectory);
|
||||||
|
configuration.Sources.Insert(3, new JsonConfigurationSource()
|
||||||
|
{
|
||||||
|
FileProvider = baseDirectoryFileProvider,
|
||||||
|
Path = "appsettings.json",
|
||||||
|
Optional = true,
|
||||||
|
ReloadOnChange = true
|
||||||
|
});
|
||||||
|
configuration.Sources.Insert(4, new JsonConfigurationSource()
|
||||||
|
{
|
||||||
|
FileProvider = baseDirectoryFileProvider,
|
||||||
|
Path = environmentAppSettingsName,
|
||||||
|
Optional = true,
|
||||||
|
ReloadOnChange = true
|
||||||
|
});
|
||||||
|
PhysicalFileProvider currentDirectoryFileProvider = new(Environment.CurrentDirectory);
|
||||||
|
configuration.Sources.Insert(5, new JsonConfigurationSource()
|
||||||
|
{
|
||||||
|
FileProvider = currentDirectoryFileProvider,
|
||||||
|
Path = "appsettings.json",
|
||||||
|
Optional = true,
|
||||||
|
ReloadOnChange = true
|
||||||
|
});
|
||||||
|
configuration.Sources.Insert(6, new JsonConfigurationSource()
|
||||||
|
{
|
||||||
|
FileProvider = currentDirectoryFileProvider,
|
||||||
|
Path = environmentAppSettingsName,
|
||||||
|
Optional = true,
|
||||||
|
ReloadOnChange = true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Configuration Sources:
|
||||||
|
// - Embedded: Properties\appsettings.json
|
||||||
|
// - InMemory
|
||||||
|
// - Embedded: Properties\appsettings.${Environment}.json
|
||||||
|
// - Physical: BaseDirectory\appsettings.json
|
||||||
|
// - Physical: BaseDirectory\appsettings${Environment}.json
|
||||||
|
// - Physical: CurrentDirectory\appsettings.json
|
||||||
|
// - Physical: CurrentDirectory\appsettings${Environment}.json
|
||||||
|
|
||||||
|
ServiceCollection services = new();
|
||||||
|
services.AddSingleton<IConfiguration>(configuration);
|
||||||
|
services.AddOptions();
|
||||||
|
ConsoleApp.ServiceProvider = services.BuildServiceProvider();
|
||||||
|
ConsoleApp.Create().Run(args);
|
||||||
|
|
||||||
|
internal static partial class Program
|
||||||
|
{
|
||||||
|
}
|
||||||
2
src/Properties/appsettings.json
Executable file
2
src/Properties/appsettings.json
Executable file
|
|
@ -0,0 +1,2 @@
|
||||||
|
{
|
||||||
|
}
|
||||||
0
src/appsettings.json
Executable file
0
src/appsettings.json
Executable file
42
src/media-organizer.csproj
Executable file
42
src/media-organizer.csproj
Executable file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<RootNamespace>MediaOrganizer</RootNamespace>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
|
||||||
|
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
|
||||||
|
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
|
<LangVersion>preview</LangVersion>
|
||||||
|
<SatelliteResourceLanguages>false</SatelliteResourceLanguages>
|
||||||
|
<TrimMode>partial</TrimMode>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Properties\appsettings.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ConsoleAppFramework" Version="5.6.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.10" />
|
||||||
|
<PackageReference Include="System.IO.Pipelines" Version="9.0.10" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue