diff --git a/ZonyLrcTools.sln b/ZonyLrcTools.sln index 2afb3fa..a82357d 100644 --- a/ZonyLrcTools.sln +++ b/ZonyLrcTools.sln @@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Tests", "tests EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Common", "src\ZonyLrcTools.Common\ZonyLrcTools.Common.csproj", "{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Desktop", "src\ZonyLrcTools.Desktop\ZonyLrcTools.Desktop.csproj", "{DC92902B-4303-4E43-AFB3-3F93FD3986AD}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,10 +31,6 @@ Global {9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Release|Any CPU.Build.0 = Release|Any CPU - {DC92902B-4303-4E43-AFB3-3F93FD3986AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC92902B-4303-4E43-AFB3-3F93FD3986AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC92902B-4303-4E43-AFB3-3F93FD3986AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC92902B-4303-4E43-AFB3-3F93FD3986AD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -48,6 +42,5 @@ Global {55D74323-ABFA-4A73-A3BF-F3E8D5DE6DE8} = {C29FB05C-54B1-4020-94D2-87E192EB2F98} {FFBD3200-568F-455B-8390-5E76C51D522C} = {AF8ADB2F-E46C-4DEE-8316-652D9FE1A69B} {9B42E4CA-61AA-4798-8D2B-2D8A7035EB67} = {C29FB05C-54B1-4020-94D2-87E192EB2F98} - {DC92902B-4303-4E43-AFB3-3F93FD3986AD} = {C29FB05C-54B1-4020-94D2-87E192EB2F98} EndGlobalSection EndGlobal diff --git a/src/ZonyLrcTools.Desktop/App.axaml b/src/ZonyLrcTools.Desktop/App.axaml deleted file mode 100644 index 75057c1..0000000 --- a/src/ZonyLrcTools.Desktop/App.axaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - Microsoft YaHei, Simsun, Arial - - - - - - - - - - \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/App.axaml.cs b/src/ZonyLrcTools.Desktop/App.axaml.cs deleted file mode 100644 index b555928..0000000 --- a/src/ZonyLrcTools.Desktop/App.axaml.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.IO; -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; -using YamlDotNet.Core; -using YamlDotNet.Serialization; -using YamlDotNet.Serialization.NamingConventions; -using ZonyLrcTools.Common.Configuration; -using ZonyLrcTools.Common.Infrastructure.DependencyInject; -using ZonyLrcTools.Common.Infrastructure.Network; -using ZonyLrcTools.Desktop.ViewModels; -using ZonyLrcTools.Desktop.Views; - -namespace ZonyLrcTools.Desktop; - -public class App : Application -{ - public new static App Current => (App)Application.Current!; - public IServiceProvider Services { get; } = ConfigureServices(); - - public IOptions GlobalOptions => Services.GetRequiredService>(); - - private Lazy _yamlSerializer = new(() => new SerializerBuilder() - .WithNamingConvention(CamelCaseNamingConvention.Instance) - .WithDefaultScalarStyle(ScalarStyle.DoubleQuoted) - .Build()); - - 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); - } - - public override void OnFrameworkInitializationCompleted() - { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - desktop.MainWindow = new MainWindow - { - DataContext = new HomeViewModel(), - }; - } - - base.OnFrameworkInitializationCompleted(); - } - - public void UpdateConfiguration() - { - var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.yaml"); - var yamlString = _yamlSerializer.Value.Serialize(GlobalOptions.Value); - File.WriteAllText(configPath, yamlString); - } -} \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Assets/avalonia-logo.ico b/src/ZonyLrcTools.Desktop/Assets/avalonia-logo.ico deleted file mode 100644 index da8d49f..0000000 Binary files a/src/ZonyLrcTools.Desktop/Assets/avalonia-logo.ico and /dev/null differ diff --git a/src/ZonyLrcTools.Desktop/Assets/logo.ico b/src/ZonyLrcTools.Desktop/Assets/logo.ico deleted file mode 100644 index f23d47f..0000000 Binary files a/src/ZonyLrcTools.Desktop/Assets/logo.ico and /dev/null differ diff --git a/src/ZonyLrcTools.Desktop/Controls/DownloadStatusControl.axaml b/src/ZonyLrcTools.Desktop/Controls/DownloadStatusControl.axaml deleted file mode 100644 index bb93aea..0000000 --- a/src/ZonyLrcTools.Desktop/Controls/DownloadStatusControl.axaml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Controls/DownloadStatusControl.axaml.cs b/src/ZonyLrcTools.Desktop/Controls/DownloadStatusControl.axaml.cs deleted file mode 100644 index aa4258e..0000000 --- a/src/ZonyLrcTools.Desktop/Controls/DownloadStatusControl.axaml.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Avalonia; -using Avalonia.Controls.Primitives; -using FluentIcons.Common; -using ZonyLrcTools.Desktop.ViewModels; - -namespace ZonyLrcTools.Desktop.Controls; - -public class DownloadStatusControl : TemplatedControl -{ - public static readonly StyledProperty StatusProperty = - AvaloniaProperty.Register(nameof(Status)); - - public static readonly StyledProperty SymbolProperty = - AvaloniaProperty.Register(nameof(Symbol)); - - public static readonly StyledProperty TextProperty = - AvaloniaProperty.Register(nameof(Text)); - - public DownloadStatus Status - { - get => GetValue(StatusProperty); - set => SetValue(StatusProperty, value); - } - - public Symbol Symbol - { - get => GetValue(SymbolProperty); - set => SetValue(SymbolProperty, value); - } - - public string Text - { - get => GetValue(TextProperty); - set => SetValue(TextProperty, value); - } -} \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/FodyWeavers.xml b/src/ZonyLrcTools.Desktop/FodyWeavers.xml deleted file mode 100644 index 63fc148..0000000 --- a/src/ZonyLrcTools.Desktop/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs b/src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs deleted file mode 100644 index ffd88f3..0000000 --- a/src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs +++ /dev/null @@ -1,33 +0,0 @@ -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 deleted file mode 100644 index 14ad8dd..0000000 --- a/src/ZonyLrcTools.Desktop/Infrastructure/Logging/SerilogWarpLogger.cs +++ /dev/null @@ -1,35 +0,0 @@ -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/HomePage.axaml b/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml deleted file mode 100644 index 96d3b60..0000000 --- a/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml.cs b/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml.cs deleted file mode 100644 index a8b0c42..0000000 --- a/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using ZonyLrcTools.Desktop.ViewModels; - -namespace ZonyLrcTools.Desktop.Pages; - -public partial class HomePage : UserControl -{ - public HomePage() - { - InitializeComponent(); - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - - if (DataContext is HomeViewModel vm) - { - vm.MaxProgress = 100; - vm.DownloadProgress = 0; - } - } -} \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml b/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml deleted file mode 100644 index 16feba5..0000000 --- a/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Views/MainView.axaml.cs b/src/ZonyLrcTools.Desktop/Views/MainView.axaml.cs deleted file mode 100644 index ec9de68..0000000 --- a/src/ZonyLrcTools.Desktop/Views/MainView.axaml.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System.Linq; -using System.Threading.Tasks; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Platform.Storage; -using DynamicData; -using FluentAvalonia.UI.Controls; -using Microsoft.Extensions.DependencyInjection; -using ZonyLrcTools.Common; -using ZonyLrcTools.Common.Lyrics; -using ZonyLrcTools.Desktop.Pages; -using ZonyLrcTools.Desktop.ViewModels; - -namespace ZonyLrcTools.Desktop.Views; - -public partial class MainView : UserControl -{ - private Window? _window; - - private Frame? _frameView; - private Button? _settingsButton; - private Button? _openFolderButton; - private Button? _downloadButton; - - public MainView() - { - InitializeComponent(); - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - - _window = e.Root as Window; - - _frameView = this.FindControl("FrameView"); - _frameView?.Navigate(typeof(HomePage)); - - _settingsButton = this.FindControl