mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
CLI - Added CLI project
Core - Don't register debug logger on release builds
This commit is contained in:
parent
70bf8824db
commit
651fc515d2
26
src/Artemis.ConsoleUI/Artemis.UI.Console.csproj
Normal file
26
src/Artemis.ConsoleUI/Artemis.UI.Console.csproj
Normal file
@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
<AssemblyName>Artemis.UI.Console</AssemblyName>
|
||||
<RootNamespace>Artemis.UI.Console</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
|
||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
|
||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.1" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
50
src/Artemis.ConsoleUI/Program.cs
Normal file
50
src/Artemis.ConsoleUI/Program.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Ninject;
|
||||
using Artemis.Core.Services;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.UI.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// This is just a little experiment to show that Artemis can run without the UI and even on other OSes
|
||||
/// Some notes
|
||||
/// - Any plugin relying on WPF and/or Artemis.UI.Shared won't load
|
||||
/// - There is no input provider so key-press events and brushes won't work
|
||||
/// - Device providers using Windows SDKs won't work, OpenRGB will though!
|
||||
/// - You may need to fiddle around to get SkiaSharp binaries going
|
||||
/// - There is no UI obviously
|
||||
/// </summary>
|
||||
internal class Program
|
||||
{
|
||||
private static readonly AutoResetEvent Closing = new(false);
|
||||
|
||||
protected static void OnExit(object sender, ConsoleCancelEventArgs args)
|
||||
{
|
||||
Closing.Set();
|
||||
}
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
Utilities.PrepareFirstLaunch();
|
||||
Utilities.ShutdownRequested += UtilitiesOnShutdownRequested;
|
||||
StandardKernel kernel = new() {Settings = {InjectNonPublic = true}};
|
||||
kernel.Load<CoreModule>();
|
||||
|
||||
ICoreService core = kernel.Get<ICoreService>();
|
||||
core.StartupArguments = args.ToList();
|
||||
core.IsElevated = false;
|
||||
core.Initialize();
|
||||
|
||||
System.Console.CancelKeyPress += OnExit;
|
||||
Closing.WaitOne();
|
||||
}
|
||||
|
||||
private static void UtilitiesOnShutdownRequested(object sender, EventArgs e)
|
||||
{
|
||||
Closing.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<PublishDir>bin\publish\linux</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishSingleFile>False</PublishSingleFile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
1280
src/Artemis.ConsoleUI/packages.lock.json
Normal file
1280
src/Artemis.ConsoleUI/packages.lock.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -50,6 +50,7 @@
|
||||
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
|
||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||
<PackageReference Include="Serilog.Enrichers.Demystify" Version="1.0.0-dev-00019" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||
<PackageReference Include="SkiaSharp" Version="2.80.2" />
|
||||
|
||||
@ -16,7 +16,10 @@ namespace Artemis.Core.Ninject
|
||||
.WriteTo.File(Constants.DataFolder + "logs/Artemis log-.log",
|
||||
rollingInterval: RollingInterval.Day,
|
||||
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}")
|
||||
.WriteTo.Console()
|
||||
#if DEBUG
|
||||
.WriteTo.Debug()
|
||||
#endif
|
||||
.WriteTo.Sink<ArtemisSink>()
|
||||
.MinimumLevel.ControlledBy(LoggingLevelSwitch)
|
||||
.CreateLogger();
|
||||
|
||||
@ -98,6 +98,18 @@
|
||||
"Serilog": "2.7.1"
|
||||
}
|
||||
},
|
||||
"Serilog.Sinks.Console": {
|
||||
"type": "Direct",
|
||||
"requested": "[3.1.1, )",
|
||||
"resolved": "3.1.1",
|
||||
"contentHash": "56mI5AqvyF/i/c2451nvV71kq370XOCE4Uu5qiaJ295sOhMb9q3BWwG7mWLOVSnmpWiq0SBT3SXfgRXGNP6vzA==",
|
||||
"dependencies": {
|
||||
"Serilog": "2.5.0",
|
||||
"System.Console": "4.3.0",
|
||||
"System.Runtime.InteropServices": "4.3.0",
|
||||
"System.Runtime.InteropServices.RuntimeInformation": "4.3.0"
|
||||
}
|
||||
},
|
||||
"Serilog.Sinks.Debug": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.0.0, )",
|
||||
|
||||
@ -403,6 +403,17 @@
|
||||
"Serilog": "2.7.1"
|
||||
}
|
||||
},
|
||||
"Serilog.Sinks.Console": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.1.1",
|
||||
"contentHash": "56mI5AqvyF/i/c2451nvV71kq370XOCE4Uu5qiaJ295sOhMb9q3BWwG7mWLOVSnmpWiq0SBT3SXfgRXGNP6vzA==",
|
||||
"dependencies": {
|
||||
"Serilog": "2.5.0",
|
||||
"System.Console": "4.3.0",
|
||||
"System.Runtime.InteropServices": "4.3.0",
|
||||
"System.Runtime.InteropServices.RuntimeInformation": "4.3.0"
|
||||
}
|
||||
},
|
||||
"Serilog.Sinks.Debug": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.0.0",
|
||||
@ -1332,6 +1343,7 @@
|
||||
"Ninject.Extensions.Conventions": "3.3.0",
|
||||
"Serilog": "2.10.0",
|
||||
"Serilog.Enrichers.Demystify": "1.0.0-dev-00019",
|
||||
"Serilog.Sinks.Console": "3.1.1",
|
||||
"Serilog.Sinks.Debug": "2.0.0",
|
||||
"Serilog.Sinks.File": "4.1.0",
|
||||
"SkiaSharp": "2.80.2",
|
||||
|
||||
@ -492,6 +492,17 @@
|
||||
"Serilog": "2.7.1"
|
||||
}
|
||||
},
|
||||
"Serilog.Sinks.Console": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.1.1",
|
||||
"contentHash": "56mI5AqvyF/i/c2451nvV71kq370XOCE4Uu5qiaJ295sOhMb9q3BWwG7mWLOVSnmpWiq0SBT3SXfgRXGNP6vzA==",
|
||||
"dependencies": {
|
||||
"Serilog": "2.5.0",
|
||||
"System.Console": "4.3.0",
|
||||
"System.Runtime.InteropServices": "4.3.0",
|
||||
"System.Runtime.InteropServices.RuntimeInformation": "4.3.0"
|
||||
}
|
||||
},
|
||||
"Serilog.Sinks.Debug": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.0.0",
|
||||
@ -1453,6 +1464,7 @@
|
||||
"Ninject.Extensions.Conventions": "3.3.0",
|
||||
"Serilog": "2.10.0",
|
||||
"Serilog.Enrichers.Demystify": "1.0.0-dev-00019",
|
||||
"Serilog.Sinks.Console": "3.1.1",
|
||||
"Serilog.Sinks.Debug": "2.0.0",
|
||||
"Serilog.Sinks.File": "4.1.0",
|
||||
"SkiaSharp": "2.80.2",
|
||||
|
||||
@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Core", "Artemis.Cor
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.UI.Shared", "Artemis.UI.Shared\Artemis.UI.Shared.csproj", "{ADB357E6-151D-4D0D-87CB-68FD0BC29812}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.UI.Console", "Artemis.ConsoleUI\Artemis.UI.Console.csproj", "{ACCC50FD-611A-41C4-B58F-DDC80B47D0CF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@ -33,6 +35,10 @@ Global
|
||||
{ADB357E6-151D-4D0D-87CB-68FD0BC29812}.Debug|x64.Build.0 = Debug|x64
|
||||
{ADB357E6-151D-4D0D-87CB-68FD0BC29812}.Release|x64.ActiveCfg = Release|x64
|
||||
{ADB357E6-151D-4D0D-87CB-68FD0BC29812}.Release|x64.Build.0 = Release|x64
|
||||
{ACCC50FD-611A-41C4-B58F-DDC80B47D0CF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ACCC50FD-611A-41C4-B58F-DDC80B47D0CF}.Debug|x64.Build.0 = Debug|x64
|
||||
{ACCC50FD-611A-41C4-B58F-DDC80B47D0CF}.Release|x64.ActiveCfg = Release|x64
|
||||
{ACCC50FD-611A-41C4-B58F-DDC80B47D0CF}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user