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/Pages/SettingsPage.axaml.cs b/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml.cs
deleted file mode 100644
index ac77946..0000000
--- a/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Interactivity;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Options;
-using ZonyLrcTools.Common.Configuration;
-using ZonyLrcTools.Desktop.Helpers;
-using ZonyLrcTools.Desktop.ViewModels.Settings;
-
-namespace ZonyLrcTools.Desktop.Pages;
-
-public partial class SettingsPage : UserControl
-{
- public SettingsPage()
- {
- InitializeComponent();
- DataContext = new SettingsViewModel(App.Current.Services.GetRequiredService>().Value);
- }
-
- private void OnGitHubClick(object? sender, RoutedEventArgs? eventArgs) => UrlHelper.OpenLink("https://github.com/real-zony/ZonyLrcToolsX");
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/Program.cs b/src/ZonyLrcTools.Desktop/Program.cs
deleted file mode 100644
index fbcdb38..0000000
--- a/src/ZonyLrcTools.Desktop/Program.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using Avalonia;
-using Avalonia.ReactiveUI;
-using System;
-using System.Text;
-
-namespace ZonyLrcTools.Desktop;
-
-class Program
-{
- // Initialization code. Don't use any Avalonia, third-party APIs or any
- // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
- // yet and stuff might break.
- [STAThread]
- public static void Main(string[] args)
- {
- Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
- BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
- }
-
- // Avalonia configuration, don't remove; also used by visual designer.
- public static AppBuilder BuildAvaloniaApp()
- => AppBuilder.Configure()
- .UsePlatformDetect()
- .WithInterFont()
- .LogToTrace()
- .UseReactiveUI();
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewLocator.cs b/src/ZonyLrcTools.Desktop/ViewLocator.cs
deleted file mode 100644
index 0f9e6c8..0000000
--- a/src/ZonyLrcTools.Desktop/ViewLocator.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using Avalonia.Controls;
-using Avalonia.Controls.Templates;
-using ZonyLrcTools.Desktop.ViewModels;
-
-namespace ZonyLrcTools.Desktop;
-
-public class ViewLocator : IDataTemplate
-{
- public Control Build(object data)
- {
- var name = data.GetType().FullName!.Replace("ViewModel", "View");
- var type = Type.GetType(name);
-
- if (type != null)
- {
- return (Control)Activator.CreateInstance(type)!;
- }
-
- return new TextBlock { Text = "Not Found: " + name };
- }
-
- public bool Match(object data)
- {
- return data is ViewModelBase;
- }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/HomeViewModel.cs b/src/ZonyLrcTools.Desktop/ViewModels/HomeViewModel.cs
deleted file mode 100644
index 574a98c..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/HomeViewModel.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Collections.ObjectModel;
-using ReactiveUI;
-using ZonyLrcTools.Common;
-
-namespace ZonyLrcTools.Desktop.ViewModels;
-
-public class HomeViewModel : ViewModelBase
-{
- private ObservableCollection _songs = new();
-
- public ObservableCollection Songs
- {
- get => _songs;
- set => this.RaiseAndSetIfChanged(ref _songs, value);
- }
-
- private int _downloadProgress;
-
- public int DownloadProgress
- {
- get => _downloadProgress;
- set => this.RaiseAndSetIfChanged(ref _downloadProgress, value);
- }
-
- private int _maxProgress;
-
- public int MaxProgress
- {
- get => _maxProgress;
- set => this.RaiseAndSetIfChanged(ref _maxProgress, value);
- }
-}
-
-public class SongInfoViewModel : ReactiveObject
-{
- public SongInfoViewModel(MusicInfo info)
- {
- _info = info;
- DownloadStatus = DownloadStatus.NotStarted;
-
- this.WhenAnyValue(x => x.Info)
- .Subscribe(_ =>
- {
- this.RaisePropertyChanged(nameof(SongName));
- this.RaisePropertyChanged(nameof(ArtistName));
- this.RaisePropertyChanged(nameof(FilePath));
- });
- }
-
- private MusicInfo _info;
-
- public MusicInfo Info
- {
- get => _info;
- set => this.RaiseAndSetIfChanged(ref _info, value);
- }
-
- public string SongName => Info.Name;
- public string ArtistName => Info.Artist;
- public string FilePath => Info.FilePath;
-
- private DownloadStatus _downloadStatus;
-
- public DownloadStatus DownloadStatus
- {
- get => _downloadStatus;
- set => this.RaiseAndSetIfChanged(ref _downloadStatus, value);
- }
-}
-
-public enum DownloadStatus
-{
- NotStarted = 1,
- Completed,
- Failed
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/Settings/BlockWordViewModel.cs b/src/ZonyLrcTools.Desktop/ViewModels/Settings/BlockWordViewModel.cs
deleted file mode 100644
index 200dfa8..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/Settings/BlockWordViewModel.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using ReactiveUI.Fody.Helpers;
-using ZonyLrcTools.Common.Configuration;
-
-namespace ZonyLrcTools.Desktop.ViewModels.Settings;
-
-public class BlockWordViewModel : ViewModelBase
-{
- public BlockWordViewModel(GlobalOptions options)
- {
- IsEnable = options.Provider.Tag.BlockWord.IsEnable;
- FilePath = options.Provider.Tag.BlockWord.FilePath;
-
- SubscribeToProperty(this, x => x.IsEnable, x => options.Provider.Tag.BlockWord.IsEnable = x);
- SubscribeToProperty(this, x => x.FilePath, x => options.Provider.Tag.BlockWord.FilePath = x!);
- }
-
- [Reactive] public bool IsEnable { get; set; }
-
- [Reactive] public string? FilePath { get; set; }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/Settings/GlobalConfigurationViewModel.cs b/src/ZonyLrcTools.Desktop/ViewModels/Settings/GlobalConfigurationViewModel.cs
deleted file mode 100644
index 1020fc8..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/Settings/GlobalConfigurationViewModel.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using ReactiveUI;
-using ReactiveUI.Fody.Helpers;
-using ZonyLrcTools.Common.Configuration;
-
-namespace ZonyLrcTools.Desktop.ViewModels.Settings;
-
-public class GlobalConfigurationViewModel : ViewModelBase
-{
- public GlobalConfigurationViewModel(GlobalOptions config)
- {
- var globalConfig = config.Provider.Lyric.Config;
-
- InitializeLineBreakComboBoxItem(globalConfig);
-
- IsOneLine = globalConfig.IsOneLine;
- IsEnableTranslation = globalConfig.IsEnableTranslation;
- IsSkipExistLyricFiles = globalConfig.IsSkipExistLyricFiles;
- IsOnlyOutputTranslation = globalConfig.IsOnlyOutputTranslation;
-
- SubscribeToProperty(this, x => x.IsOneLine, x => globalConfig.IsOneLine = x);
- SubscribeToProperty(this, x => x.IsEnableTranslation, x => globalConfig.IsEnableTranslation = x);
- SubscribeToProperty(this, x => x.IsSkipExistLyricFiles, x => globalConfig.IsSkipExistLyricFiles = x);
- SubscribeToProperty(this, x => x.IsOnlyOutputTranslation, x => globalConfig.IsOnlyOutputTranslation = x);
- }
-
- [Reactive] public bool IsOneLine { get; set; }
-
- [Reactive] public bool IsEnableTranslation { get; set; }
-
- [Reactive] public bool IsSkipExistLyricFiles { get; set; }
-
- [Reactive] public bool IsOnlyOutputTranslation { get; set; }
-
- private void InitializeLineBreakComboBoxItem(GlobalLyricsConfigOptions config)
- {
- LineBreakOptions =
- [
- new TextComboboxItem { Name = "Windows", Value = "\r\n" },
- new TextComboboxItem { Name = "Unix", Value = "\n" },
- new TextComboboxItem { Name = "Mac", Value = "\r" }
- ];
- SelectedLineBreak = LineBreakOptions.FirstOrDefault(x => x.Value == config.LineBreak)
- ?? LineBreakOptions.First();
-
- FileEncodingOptions = Encoding.GetEncodings()
- .Select(x => new TextComboboxItem { Name = x.DisplayName, Value = x.Name })
- .ToList();
- FileEncodingOptions.Insert(0, new TextComboboxItem { Name = "UTF-8-BOM", Value = "utf-8-bom" });
- SelectedFileEncoding = FileEncodingOptions.FirstOrDefault(x => x.Value == config.FileEncoding)
- ?? FileEncodingOptions.First();
-
- this.WhenAnyValue(x => x.SelectedLineBreak)
- .Subscribe(x => config.LineBreak = x.Value);
- this.WhenAnyValue(x => x.SelectedFileEncoding)
- .Subscribe(x => config.FileEncoding = x.Value);
- }
-
- public List LineBreakOptions { get; private set; }
-
- [Reactive] public TextComboboxItem SelectedLineBreak { get; set; }
-
- public List FileEncodingOptions { get; private set; }
-
- [Reactive] public TextComboboxItem SelectedFileEncoding { get; set; }
-
- public class TextComboboxItem
- {
- public string Name { get; set; } = default!;
- public string Value { get; set; } = default!;
- }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/Settings/LyricsProviderViewModel.cs b/src/ZonyLrcTools.Desktop/ViewModels/Settings/LyricsProviderViewModel.cs
deleted file mode 100644
index 27824e4..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/Settings/LyricsProviderViewModel.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using System;
-using System.Globalization;
-using Avalonia.Data;
-using Avalonia.Data.Converters;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Options;
-using ReactiveUI.Fody.Helpers;
-using ZonyLrcTools.Common.Configuration;
-
-namespace ZonyLrcTools.Desktop.ViewModels.Settings;
-
-public class LyricsProviderViewModel : ViewModelBase
-{
- public LyricsProviderViewModel(LyricsProviderOptions options)
- {
- var globalOptions = App.Current.Services.GetRequiredService>().Value;
-
- Name = options.Name;
- Priority = options.Priority;
- Depth = options.Depth;
-
- SubscribeToProperty(this, x => x.Priority, x => globalOptions.Provider.Lyric.GetLyricProviderOption(Name).Priority = x);
- SubscribeToProperty(this, x => x.Depth, x => globalOptions.Provider.Lyric.GetLyricProviderOption(Name).Depth = x);
- }
-
- public string Name { get; set; }
-
- [Reactive] public int Priority { get; set; }
-
- [Reactive] public int Depth { get; set; }
-}
-
-internal class NullToDefaultValueConverter : IValueConverter
-{
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- return value != null ? System.Convert.ToDecimal(value) : 0;
- }
-
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- if (value is decimal dValue)
- {
- return System.Convert.ToInt32(dValue);
- }
-
- return BindingOperations.DoNothing;
- }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/Settings/SettingsViewModel.cs b/src/ZonyLrcTools.Desktop/ViewModels/Settings/SettingsViewModel.cs
deleted file mode 100644
index 0b84221..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/Settings/SettingsViewModel.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Reactive;
-using System.Threading.Tasks;
-using Avalonia.Controls;
-using Avalonia.Platform.Storage;
-using ReactiveUI;
-using ZonyLrcTools.Common.Configuration;
-
-namespace ZonyLrcTools.Desktop.ViewModels.Settings;
-
-public class SettingsViewModel : ViewModelBase
-{
- public SettingsViewModel(GlobalOptions globalOptions)
- {
- Config = new GlobalConfigurationViewModel(globalOptions);
- LyricsProviders = new ObservableCollection(globalOptions.Provider.Lyric.Plugin.Select(p => new LyricsProviderViewModel(p)));
- Tag = new TagInfoViewModel(globalOptions);
- BrowseBlockWordFileCommand = ReactiveCommand.CreateFromTask(BrowseBlockWordFile);
- }
-
- public static string Version => typeof(Program).Assembly.GetName().Version!.ToString();
-
- public TagInfoViewModel Tag { get; }
-
- public ReactiveCommand BrowseBlockWordFileCommand { get; }
-
- public GlobalConfigurationViewModel Config { get; }
-
- public ObservableCollection LyricsProviders { get; }
-
- private async Task BrowseBlockWordFile(Window parentWindow)
- {
- var storage = parentWindow.StorageProvider;
- if (storage.CanOpen)
- {
- var options = new FilePickerOpenOptions
- {
- AllowMultiple = false,
- FileTypeFilter = new[]
- {
- new FilePickerFileType("JSON")
- {
- Patterns = new[] { "*.json" }
- }
- }
- };
-
- var files = await storage.OpenFilePickerAsync(options);
- if (files.Count > 0)
- {
- Tag.BlockWord.FilePath = files[0].Path.LocalPath;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/Settings/TagInfoProviderViewModel.cs b/src/ZonyLrcTools.Desktop/ViewModels/Settings/TagInfoProviderViewModel.cs
deleted file mode 100644
index 5bf9177..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/Settings/TagInfoProviderViewModel.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System.Collections.ObjectModel;
-using System.Linq;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Options;
-using ReactiveUI.Fody.Helpers;
-using ZonyLrcTools.Common.Configuration;
-
-namespace ZonyLrcTools.Desktop.ViewModels.Settings;
-
-public class TagInfoProviderViewModel : ViewModelBase
-{
- public TagInfoProviderViewModel(TagInfoProviderOptions options)
- {
- var globalOptions = App.Current.Services.GetRequiredService>().Value;
-
- Name = options.Name;
- Priority = options.Priority;
- Extensions = options.Extensions == null ? [] : new ObservableCollection(options.Extensions.Select(x => new ObservableKeyValuePair(x.Key, x.Value)));
-
- SubscribeToProperty(this, x => x.Priority, x => globalOptions.Provider.Tag.GetTagProviderOption(Name).Priority = x);
- SubscribeToProperty(this, x => x.Extensions, x => globalOptions.Provider.Tag.GetTagProviderOption(Name).Extensions = x.ToDictionary(pair => pair.Key, pair => pair.Value));
- }
-
- public string? Name { get; set; }
-
- [Reactive] public int Priority { get; set; }
-
- [Reactive] public ObservableCollection Extensions { get; set; }
-}
-
-public class ObservableKeyValuePair : ViewModelBase
-{
- [Reactive] public string Key { get; set; }
-
- [Reactive] public string Value { get; set; }
-
- public ObservableKeyValuePair(string key, string value)
- {
- Key = key;
- Value = value;
- }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/Settings/TagInfoViewModel.cs b/src/ZonyLrcTools.Desktop/ViewModels/Settings/TagInfoViewModel.cs
deleted file mode 100644
index 20031d3..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/Settings/TagInfoViewModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections.ObjectModel;
-using System.Linq;
-using ZonyLrcTools.Common.Configuration;
-
-namespace ZonyLrcTools.Desktop.ViewModels.Settings;
-
-public class TagInfoViewModel : ViewModelBase
-{
- public TagInfoViewModel(GlobalOptions options)
- {
- BlockWord = new BlockWordViewModel(options);
- TagInfoProviders = new ObservableCollection(options.Provider.Tag.Plugin.Select(p => new TagInfoProviderViewModel(p)));
- }
-
- public BlockWordViewModel BlockWord { get; }
-
- public ObservableCollection TagInfoProviders { get; }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/ViewModels/ViewModelBase.cs b/src/ZonyLrcTools.Desktop/ViewModels/ViewModelBase.cs
deleted file mode 100644
index 470004d..0000000
--- a/src/ZonyLrcTools.Desktop/ViewModels/ViewModelBase.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Linq.Expressions;
-using ReactiveUI;
-
-namespace ZonyLrcTools.Desktop.ViewModels;
-
-public abstract class ViewModelBase : ReactiveObject
-{
- protected void SubscribeToProperty(TSender sender, Expression> property, Action updateGlobalConfigAction)
- {
- sender.WhenAnyValue(property)
- .Subscribe(x =>
- {
- updateGlobalConfigAction(x);
- App.Current.UpdateConfiguration();
- });
- }
-}
\ No newline at end of file
diff --git a/src/ZonyLrcTools.Desktop/Views/MainView.axaml b/src/ZonyLrcTools.Desktop/Views/MainView.axaml
deleted file mode 100644
index fcc2ab4..0000000
--- a/src/ZonyLrcTools.Desktop/Views/MainView.axaml
+++ /dev/null
@@ -1,74 +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