diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..b4f16de --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,11 @@ + + + + net8.0 + enable + 5.0.0.0 + Zony(real-zony) + https://github.com/real-zony/ZonyLrcToolsX + + + \ No newline at end of file diff --git a/src/ZonyLrcTools.Cli/ZonyLrcTools.Cli.csproj b/src/ZonyLrcTools.Cli/ZonyLrcTools.Cli.csproj index 90991dd..5076ab1 100644 --- a/src/ZonyLrcTools.Cli/ZonyLrcTools.Cli.csproj +++ b/src/ZonyLrcTools.Cli/ZonyLrcTools.Cli.csproj @@ -3,10 +3,6 @@ net8.0 Exe - 0.0.0.1 - 0.0.0.1 - 0.0.0.1 - 0.0.0.1 diff --git a/src/ZonyLrcTools.Common/ZonyLrcTools.Common.csproj b/src/ZonyLrcTools.Common/ZonyLrcTools.Common.csproj index 650411f..b2a4c7a 100644 --- a/src/ZonyLrcTools.Common/ZonyLrcTools.Common.csproj +++ b/src/ZonyLrcTools.Common/ZonyLrcTools.Common.csproj @@ -4,7 +4,6 @@ net8.0 enable enable - 4.0.0.58 diff --git a/src/ZonyLrcTools.Desktop/App.axaml b/src/ZonyLrcTools.Desktop/App.axaml index fb9057b..0d50b1f 100644 --- a/src/ZonyLrcTools.Desktop/App.axaml +++ b/src/ZonyLrcTools.Desktop/App.axaml @@ -14,7 +14,20 @@ + + + + + + + Microsoft YaHei, Simsun, Arial + + + + + diff --git a/src/ZonyLrcTools.Desktop/App.axaml.cs b/src/ZonyLrcTools.Desktop/App.axaml.cs index dba6084..4d81481 100644 --- a/src/ZonyLrcTools.Desktop/App.axaml.cs +++ b/src/ZonyLrcTools.Desktop/App.axaml.cs @@ -4,30 +4,29 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; using Microsoft.Extensions.DependencyInjection; using ZonyLrcTools.Common.Infrastructure.DependencyInject; +using ZonyLrcTools.Common.Infrastructure.Network; using ZonyLrcTools.Desktop.ViewModels; using ZonyLrcTools.Desktop.Views; namespace ZonyLrcTools.Desktop; -public partial class App : Application +public class App : Application { public new static App Current => (App)Application.Current!; - public IServiceProvider Services { get; } + public IServiceProvider Services { get; } = ConfigureServices(); - public App() - { - Services = ConfigureServices(); - } - private static IServiceProvider ConfigureServices() { var services = new ServiceCollection(); + services.BeginAutoDependencyInject(); + services.BeginAutoDependencyInject(); services.ConfigureConfiguration(); - + services.ConfigureToolService(); + return services.BuildServiceProvider(); } - + public override void Initialize() { AvaloniaXamlLoader.Load(this); diff --git a/src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs b/src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs new file mode 100644 index 0000000..ffd88f3 --- /dev/null +++ b/src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs @@ -0,0 +1,33 @@ +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace ZonyLrcTools.Desktop.Helpers; + +public static class UrlHelper +{ + public static void OpenLink(string url) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + using var process = Process.Start(new ProcessStartInfo + { + FileName = "/bin/sh", + Arguments = $"-c \"xdg-open {url.Replace("\"", "\\\"")}\"", + RedirectStandardOutput = true, + UseShellExecute = false, + CreateNoWindow = true, + WindowStyle = ProcessWindowStyle.Hidden + }); + } + else + { + using var process = Process.Start(new ProcessStartInfo + { + FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? url : "open", + Arguments = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? url : "", + CreateNoWindow = true, + UseShellExecute = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + }); + } + } +} diff --git a/src/ZonyLrcTools.Desktop/Infrastructure/Logging/SerilogWarpLogger.cs b/src/ZonyLrcTools.Desktop/Infrastructure/Logging/SerilogWarpLogger.cs new file mode 100644 index 0000000..14ad8dd --- /dev/null +++ b/src/ZonyLrcTools.Desktop/Infrastructure/Logging/SerilogWarpLogger.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using ZonyLrcTools.Common.Infrastructure.DependencyInject; +using ZonyLrcTools.Common.Infrastructure.Logging; + +namespace ZonyLrcTools.Desktop.Infrastructure.Logging; + +public class SerilogWarpLogger(ILogger logger) : IWarpLogger, ITransientDependency +{ + public Task DebugAsync(string message, Exception? exception = null) + { + logger.LogDebug(message, exception); + + return Task.CompletedTask; + } + + public Task InfoAsync(string message, Exception? exception = null) + { + logger.LogInformation(message, exception); + return Task.CompletedTask; + } + + public Task WarnAsync(string message, Exception? exception = null) + { + logger.LogWarning(message, exception); + return Task.CompletedTask; + } + + public Task ErrorAsync(string message, Exception? exception = null) + { + logger.LogError(message, exception); + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml b/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml index d320b3c..527c6c2 100644 --- a/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml +++ b/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml @@ -5,20 +5,36 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="ZonyLrcTools.Desktop.Pages.SettingsPage" xmlns:ui="using:FluentAvalonia.UI.Controls" - xmlns:viewModels="clr-namespace:ZonyLrcTools.Desktop.ViewModels" xmlns:settings="clr-namespace:ZonyLrcTools.Desktop.ViewModels.Settings" x:DataType="settings:LyricsSettingsViewModel"> - - - - + + + + + + + + + + + + + + - + @@ -28,19 +44,19 @@ - + - + - + @@ -50,15 +66,15 @@ - + - - + + @@ -67,13 +83,13 @@ - + - + @@ -84,26 +100,25 @@ - - + + - + - + -