Compare commits

..

128 Commits

Author SHA1 Message Date
Zhe Fang
b1e9c25e01 Merge branch 'dev' of https://github.com/jayfunc/BetterLyrics into dev 2025-12-23 20:43:31 -05:00
Zhe Fang
346de93c3f fix: AlbumArtThemeColors is not updated when PaletteGeneratorType is changed 2025-12-23 20:43:29 -05:00
Zhe Fang
6f48cbcd16 Add Contributor Covenant Code of Conduct
This document outlines the Contributor Covenant Code of Conduct, detailing our pledge, standards, enforcement responsibilities, and consequences for violations.
2025-12-23 18:02:06 -05:00
Zhe Fang
85b3121479 chores 2025-12-23 15:48:39 -05:00
Zhe Fang
94f00d1a31 chores 2025-12-23 14:10:35 -05:00
Zhe Fang
be9e4bba0f chores: update readme 2025-12-23 14:04:48 -05:00
Zhe Fang
2454927582 Merge pull request #169 from jayfunc/l10n_dev
New Crowdin updates
2025-12-23 13:44:27 -05:00
Zhe Fang
aca5f8e00d New translations resources.resw (Malay) 2025-12-23 13:43:43 -05:00
Zhe Fang
09709e8e62 New translations resources.resw (Hindi) 2025-12-23 13:43:42 -05:00
Zhe Fang
98fd8b43c4 New translations resources.resw (Thai) 2025-12-23 13:43:41 -05:00
Zhe Fang
3051180eb9 New translations resources.resw (Indonesian) 2025-12-23 13:43:38 -05:00
Zhe Fang
d48c81cfa1 New translations resources.resw (Vietnamese) 2025-12-23 13:43:37 -05:00
Zhe Fang
695147be9b New translations resources.resw (Portuguese) 2025-12-23 13:43:36 -05:00
Zhe Fang
e782944a44 New translations resources.resw (Arabic) 2025-12-23 13:43:35 -05:00
Zhe Fang
01462d42ce New translations resources.resw (Russian) 2025-12-23 13:43:33 -05:00
Zhe Fang
65b7dfcc44 New translations resources.resw (Japanese) 2025-12-23 13:43:31 -05:00
Zhe Fang
ec3146d4a7 New translations resources.resw (German) 2025-12-23 13:43:30 -05:00
Zhe Fang
9ec0bf0b1a New translations resources.resw (Spanish) 2025-12-23 13:43:29 -05:00
Zhe Fang
47e4b93613 New translations resources.resw (French) 2025-12-23 13:43:28 -05:00
Zhe Fang
192ad4a503 fix: i18n 2025-12-23 13:08:42 -05:00
Zhe Fang
091e33ae08 Merge branch 'dev' of https://github.com/jayfunc/BetterLyrics into dev 2025-12-23 13:04:44 -05:00
Zhe Fang
3b010ed674 add: more langs 2025-12-23 13:04:42 -05:00
Zhe Fang
a9f685d51b Merge pull request #168 from jayfunc/l10n_dev
New Crowdin updates
2025-12-23 13:04:04 -05:00
Zhe Fang
c6c31f8839 New translations resources.resw (Chinese Traditional) 2025-12-23 13:03:26 -05:00
Zhe Fang
78c53760cc New translations resources.resw (Chinese Simplified) 2025-12-23 13:03:25 -05:00
Zhe Fang
0bb6b5a204 New translations resources.resw (Chinese Traditional) 2025-12-23 12:34:51 -05:00
Zhe Fang
dff36a5e4d New translations resources.resw (Chinese Simplified) 2025-12-23 12:34:50 -05:00
Zhe Fang
0188e443db New translations resources.resw (Chinese Traditional) 2025-12-23 11:05:21 -05:00
Zhe Fang
5a9cdedc0c New translations resources.resw (Chinese Simplified) 2025-12-23 11:05:19 -05:00
Zhe Fang
31460fcc6d New translations resources.resw (Russian) 2025-12-23 11:05:18 -05:00
Zhe Fang
c12fc6f381 New translations resources.resw (Korean) 2025-12-23 11:05:16 -05:00
Zhe Fang
e5e0342994 New translations resources.resw (Japanese) 2025-12-23 11:05:15 -05:00
Zhe Fang
061958f20c New translations resources.resw (German) 2025-12-23 11:05:14 -05:00
Zhe Fang
95c73d0a34 New translations resources.resw (Spanish) 2025-12-23 11:05:13 -05:00
Zhe Fang
026a12ac87 New translations resources.resw (French) 2025-12-23 11:05:11 -05:00
Zhe Fang
da53f2166f Update contributors for Simplified Chinese section 2025-12-23 09:59:48 -05:00
Zhe Fang
717277e17c Update contributors for Simplified Chinese translation 2025-12-23 09:59:02 -05:00
Zhe Fang
1dc3ea57e9 chores: delete unused res items 2025-12-23 09:54:07 -05:00
Zhe Fang
4ec2ba8b59 chores: delete unused res item 2025-12-23 09:49:38 -05:00
Zhe Fang
91d9f253f0 Merge pull request #167 from jayfunc/l10n_dev
New Crowdin updates
2025-12-23 09:38:59 -05:00
Zhe Fang
90cf373e50 New translations resources.resw (Chinese Simplified) 2025-12-23 09:37:57 -05:00
Zhe Fang
cf2778da7a Add contributor table and translation invitation link 2025-12-23 09:27:10 -05:00
Zhe Fang
45ff7d7aa8 Update README with language and contributor information
Added a table listing supported languages and contributors.
2025-12-23 09:24:18 -05:00
Zhe Fang
eb37cb1b55 New translations resources.resw (Chinese Traditional) 2025-12-23 09:15:18 -05:00
Zhe Fang
45aa1d787d New translations resources.resw (Chinese Simplified) 2025-12-23 09:15:15 -05:00
Zhe Fang
0b28419ab5 New translations resources.resw (Russian) 2025-12-23 09:15:13 -05:00
Zhe Fang
258bf9220e New translations resources.resw (Korean) 2025-12-23 09:15:12 -05:00
Zhe Fang
9ece9f3edc New translations resources.resw (Japanese) 2025-12-23 09:15:11 -05:00
Zhe Fang
40c1f0a5ce New translations resources.resw (German) 2025-12-23 09:15:10 -05:00
Zhe Fang
5f75e6c63c New translations resources.resw (Spanish) 2025-12-23 09:15:09 -05:00
Zhe Fang
43387ce4c8 New translations resources.resw (French) 2025-12-23 09:15:08 -05:00
Zhe Fang
34eda9a262 fix: i18n 2025-12-23 08:51:38 -05:00
Zhe Fang
804673696f fix: i18n 2025-12-23 07:35:19 -05:00
Zhe Fang
b69e3bb24b chores: i18n 2025-12-23 07:12:36 -05:00
Zhe Fang
c028aa8e46 chores 2025-12-23 06:18:16 -05:00
Zhe Fang
fe3e257215 chores 2025-12-22 18:13:11 -05:00
Zhe Fang
eae2428d85 fix: lang 2025-12-22 17:19:09 -05:00
Zhe Fang
b078365136 fix: lang 2025-12-22 17:07:16 -05:00
Zhe Fang
1ede8dbef4 fix: song info fade 2025-12-22 16:45:41 -05:00
Zhe Fang
a66051b937 chores: i18n 2025-12-22 16:01:43 -05:00
Zhe Fang
1eca21c285 chores: i18n 2025-12-22 14:17:43 -05:00
Zhe Fang
2254a28e40 Merge branch 'dev' of https://github.com/jayfunc/BetterLyrics into dev 2025-12-22 11:47:30 -05:00
Zhe Fang
812eca369d chores: improve i18n method 2025-12-22 11:47:29 -05:00
Zhe Fang
132d3d8ac8 Merge pull request #164 from jayfunc/l10n_dev
New Crowdin updates
2025-12-22 11:46:56 -05:00
Zhe Fang
641a23621f New translations resources.resw (Chinese Simplified) 2025-12-22 11:46:00 -05:00
Zhe Fang
6802d10142 Merge pull request #163 from jayfunc/l10n_dev
New Crowdin updates
2025-12-22 06:47:45 -05:00
Zhe Fang
36f43e6d54 New translations resources.resw (Chinese Simplified) 2025-12-22 06:46:42 -05:00
Zhe Fang
e8298ec7bd New translations resources.resw (Chinese Simplified) 2025-12-22 06:33:43 -05:00
Zhe Fang
99a21cb935 New translations resources.resw (German) 2025-12-21 19:17:28 -05:00
Zhe Fang
b6da7bea5d New translations resources.resw (Chinese Traditional) 2025-12-21 19:17:27 -05:00
Zhe Fang
cf5bf75346 New translations resources.resw (Russian) 2025-12-21 19:17:26 -05:00
Zhe Fang
7497d7014d New translations resources.resw (Korean) 2025-12-21 19:17:24 -05:00
Zhe Fang
dd8c62ffa5 New translations resources.resw (Japanese) 2025-12-21 19:17:24 -05:00
Zhe Fang
15b147ba06 New translations resources.resw (Spanish) 2025-12-21 19:17:23 -05:00
Zhe Fang
85146ffc95 New translations resources.resw (French) 2025-12-21 19:17:22 -05:00
Zhe Fang
e9dce765e4 fix: i18n 2025-12-21 18:18:25 -05:00
Zhe Fang
3b2c4477b5 Merge pull request #162 from jayfunc/l10n_dev
New Crowdin updates
2025-12-21 18:07:48 -05:00
Zhe Fang
9d71c4aecf New translations resources.resw (German) 2025-12-21 18:02:53 -05:00
Zhe Fang
7184c148c4 New translations resources.resw (Chinese Traditional) 2025-12-21 18:02:52 -05:00
Zhe Fang
85f928ce3b New translations resources.resw (Chinese Simplified) 2025-12-21 18:02:51 -05:00
Zhe Fang
7c5032b0c2 New translations resources.resw (Russian) 2025-12-21 18:02:50 -05:00
Zhe Fang
2c3bd056b7 New translations resources.resw (Korean) 2025-12-21 18:02:49 -05:00
Zhe Fang
9f2843b7a0 New translations resources.resw (Japanese) 2025-12-21 18:02:48 -05:00
Zhe Fang
7fb6d5346e New translations resources.resw (Spanish) 2025-12-21 18:02:47 -05:00
Zhe Fang
27125d9051 New translations resources.resw (French) 2025-12-21 18:02:46 -05:00
Zhe Fang
5b2fb8b345 fix: english 2025-12-21 17:06:10 -05:00
Zhe Fang
d558811cb4 Merge pull request #161 from jayfunc/l10n_dev
New Crowdin updates
2025-12-21 16:58:03 -05:00
Zhe Fang
6e30aa7ebd New translations resources.resw (Chinese Traditional) 2025-12-21 16:56:21 -05:00
Zhe Fang
15fc337944 Merge pull request #160 from jayfunc/l10n_dev
New Crowdin updates
2025-12-21 16:46:11 -05:00
Zhe Fang
b7ef159b9e New translations resources.resw (German) 2025-12-21 16:44:37 -05:00
Zhe Fang
393b33ed83 New translations resources.resw (Chinese Traditional) 2025-12-21 16:44:36 -05:00
Zhe Fang
23dfda4413 New translations resources.resw (Chinese Simplified) 2025-12-21 16:44:35 -05:00
Zhe Fang
fde7340f4d New translations resources.resw (Russian) 2025-12-21 16:44:34 -05:00
Zhe Fang
22330d7fe9 New translations resources.resw (Korean) 2025-12-21 16:44:33 -05:00
Zhe Fang
c64e5776e8 New translations resources.resw (Japanese) 2025-12-21 16:44:32 -05:00
Zhe Fang
ffa2cd75a0 New translations resources.resw (Spanish) 2025-12-21 16:44:31 -05:00
Zhe Fang
873e75a7e9 New translations resources.resw (French) 2025-12-21 16:44:30 -05:00
Zhe Fang
ffa4101d5f chores: i18n 2025-12-21 16:26:35 -05:00
Zhe Fang
1c12b582c2 chores: add help us translate message 2025-12-21 16:22:32 -05:00
Zhe Fang
c50d31ced7 chores 2025-12-21 16:03:10 -05:00
Zhe Fang
f8108151b6 Merge pull request #159 from jayfunc/l10n_dev
New Crowdin updates
2025-12-21 16:02:22 -05:00
Zhe Fang
2932366767 New translations resources.resw (German) 2025-12-21 16:01:50 -05:00
Zhe Fang
cbf643ca70 Merge branch 'dev' of https://github.com/jayfunc/BetterLyrics into dev 2025-12-21 15:53:46 -05:00
Zhe Fang
a72d0f5c28 chores 2025-12-21 15:53:44 -05:00
Zhe Fang
3b4d98f9a3 Merge pull request #158 from jayfunc/l10n_dev
New Crowdin updates
2025-12-21 15:52:58 -05:00
Zhe Fang
d5828101d8 New translations resources.resw (Chinese Traditional) 2025-12-21 15:45:59 -05:00
Zhe Fang
56051537ea New translations resources.resw (Chinese Simplified) 2025-12-21 15:45:58 -05:00
Zhe Fang
6b465a09b1 New translations resources.resw (Russian) 2025-12-21 15:45:57 -05:00
Zhe Fang
450b86ebaf New translations resources.resw (Dutch) 2025-12-21 15:45:56 -05:00
Zhe Fang
c0078baa13 New translations resources.resw (Korean) 2025-12-21 15:45:55 -05:00
Zhe Fang
6b28212ec3 New translations resources.resw (Japanese) 2025-12-21 15:45:54 -05:00
Zhe Fang
9a3c2f5f70 New translations resources.resw (Spanish) 2025-12-21 15:45:54 -05:00
Zhe Fang
31be2bd8f7 New translations resources.resw (French) 2025-12-21 15:45:52 -05:00
Zhe Fang
47056e07a1 Merge branch 'dev' of https://github.com/jayfunc/BetterLyrics into dev 2025-12-21 15:03:32 -05:00
Zhe Fang
f30673b9d3 chores: add langs 2025-12-21 15:03:31 -05:00
Zhe Fang
d8624c49d0 Update Crowdin configuration file 2025-12-21 14:45:18 -05:00
Zhe Fang
72810e7440 Update Crowdin configuration file 2025-12-21 14:39:11 -05:00
Zhe Fang
e881d36743 chores: i18n 2025-12-21 14:34:34 -05:00
Zhe Fang
aa3e79d3ff chores: i18n 2025-12-21 13:28:22 -05:00
Zhe Fang
9979474ce1 fix 2025-12-21 12:24:46 -05:00
Zhe Fang
2e7cd93cfe fix: renderer error 2025-12-21 08:04:26 -05:00
Zhe Fang
bdc31c3e0d fix: lyrics source search issue when id is not null; feat: support ftp, smb, webdav (still testing) 2025-12-21 06:34:11 -05:00
Zhe Fang
631d079aa2 chores: adjustment for album art info flyout 2025-12-19 16:29:36 -05:00
Zhe Fang
f76ef87167 feat: save album art to local 2025-12-19 16:10:14 -05:00
Zhe Fang
76aa5ee8d0 fix: search control result can not invoke play selected lyrics line 2025-12-19 14:46:23 -05:00
Zhe Fang
d7f4978a66 chores: update deps 2025-12-19 09:36:53 -05:00
Zhe Fang
0905c46e45 fix: scroll 2025-12-19 08:54:24 -05:00
Zhe Fang
d0991c5ddb fix: 3d lyrics effect incorrect y center 2025-12-17 20:22:26 -05:00
110 changed files with 21189 additions and 2373 deletions

View File

@@ -53,27 +53,27 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<AppxBundle>Always</AppxBundle>
<DefaultLanguage>en-US</DefaultLanguage>
<DefaultLanguage>en</DefaultLanguage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AppxBundle>Always</AppxBundle>
<DefaultLanguage>en-US</DefaultLanguage>
<DefaultLanguage>en</DefaultLanguage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<AppxBundle>Always</AppxBundle>
<DefaultLanguage>en-US</DefaultLanguage>
<DefaultLanguage>en</DefaultLanguage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AppxBundle>Always</AppxBundle>
<DefaultLanguage>en-US</DefaultLanguage>
<DefaultLanguage>en</DefaultLanguage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<AppxBundle>Always</AppxBundle>
<DefaultLanguage>en-US</DefaultLanguage>
<DefaultLanguage>en</DefaultLanguage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<AppxBundle>Always</AppxBundle>
<DefaultLanguage>en-US</DefaultLanguage>
<DefaultLanguage>en</DefaultLanguage>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">

View File

@@ -12,7 +12,7 @@
<Identity
Name="37412.BetterLyrics"
Publisher="CN=E1428B0E-DC1D-4EA4-ACB1-4556569D5BA9"
Version="1.1.198.0" />
Version="1.1.221.0" />
<mp:PhoneIdentity PhoneProductId="ca4a4830-fc19-40d9-b823-53e2bff3d816" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
@@ -28,11 +28,22 @@
</Dependencies>
<Resources>
<Resource Language="en-US"/>
<Resource Language="zh-CN"/>
<Resource Language="zh-TW"/>
<Resource Language="ja-JP"/>
<Resource Language="ko-KR"/>
<Resource Language="ar"/>
<Resource Language="de"/>
<Resource Language="en"/>
<Resource Language="es"/>
<Resource Language="fr"/>
<Resource Language="hi"/>
<Resource Language="id"/>
<Resource Language="ja"/>
<Resource Language="ko"/>
<Resource Language="ms"/>
<Resource Language="pt"/>
<Resource Language="ru"/>
<Resource Language="th"/>
<Resource Language="vi"/>
<Resource Language="zh-Hans"/>
<Resource Language="zh-Hant"/>
</Resources>
<Applications>

View File

@@ -65,7 +65,6 @@
<converter:ByteArrayToImageConverter x:Key="ByteArrayToImageConverter" />
<converter:DisplayLanguageCodeToIndexConverter x:Key="DisplayLanguageCodeToIndexConverter" />
<converter:PathToParentFolderConverter x:Key="PathToParentFolderConverter" />
<converter:TrackToLyricsConverter x:Key="TrackToLyricsConverter" />
<converter:IntToBoolConverter x:Key="IntToBoolConverter" />
<converter:IndexToDisplayConverter x:Key="IndexToDisplayConverter" />
<converter:IntToDoubleConverter x:Key="IntToDoubleConverter" />
@@ -75,6 +74,7 @@
<converter:TextAlignmentTypeToHorizontalAlignmentConverter x:Key="TextAlignmentTypeToHorizontalAlignmentConverter" />
<converter:LyricsLayoutOrientationToOrientationConverter x:Key="LyricsLayoutOrientationToOrientationConverter" />
<converter:LyricsLayoutOrientationNegationToOrientationConverter x:Key="LyricsLayoutOrientationNegationToOrientationConverter" />
<converter:FileSourceTypeToIconConverter x:Key="FileSourceTypeToIconConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />

View File

@@ -2,13 +2,14 @@
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Hooks;
using BetterLyrics.WinUI3.Models.Settings;
using BetterLyrics.WinUI3.Services.AlbumArtSearchService;
using BetterLyrics.WinUI3.Services.DiscordService;
using BetterLyrics.WinUI3.Services.LastFMService;
using BetterLyrics.WinUI3.Services.LibWatcherService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using BetterLyrics.WinUI3.Services.LyricsSearchService;
using BetterLyrics.WinUI3.Services.MediaSessionsService;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.SettingsService;
using BetterLyrics.WinUI3.Services.TranslationService;
using BetterLyrics.WinUI3.Services.TransliterationService;
@@ -19,8 +20,10 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.UI.Xaml;
using Microsoft.Windows.ApplicationModel.Resources;
using Microsoft.Windows.Globalization;
using Serilog;
using System;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
@@ -118,8 +121,8 @@ namespace BetterLyrics.WinUI3
.AddSingleton<ITranslationService, TranslationService>()
.AddSingleton<ITransliterationService, TransliterationService>()
.AddSingleton<ILastFMService, LastFMService>()
.AddSingleton<IResourceService, ResourceService>()
.AddSingleton<IDiscordService, DiscordService>()
.AddSingleton<ILocalizationService, LocalizationService>()
// ViewModels
.AddSingleton<AppSettingsControlViewModel>()
.AddSingleton<PlaybackSettingsControlViewModel>()

View File

@@ -10,13 +10,20 @@
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<AppxDefaultResourceQualifiers>Language=ar;de;en;es;fr;hi;id;ja;ko;ms;pt;ru;th;vi;zh-Hans;zh-Hant;</AppxDefaultResourceQualifiers>
</PropertyGroup>
<ItemGroup>
<Compile Remove="TemplateSelector\**" />
<Compile Remove="ViewModels\Lyrics\**" />
<Content Remove="TemplateSelector\**" />
<Content Remove="ViewModels\Lyrics\**" />
<EmbeddedResource Remove="TemplateSelector\**" />
<EmbeddedResource Remove="ViewModels\Lyrics\**" />
<None Remove="TemplateSelector\**" />
<None Remove="ViewModels\Lyrics\**" />
<Page Remove="TemplateSelector\**" />
<Page Remove="ViewModels\Lyrics\**" />
<PRIResource Remove="TemplateSelector\**" />
<PRIResource Remove="ViewModels\Lyrics\**" />
</ItemGroup>
<ItemGroup>
@@ -37,6 +44,7 @@
<None Remove="Controls\NowPlayingBar.xaml" />
<None Remove="Controls\PlaybackSettingsControl.xaml" />
<None Remove="Controls\PropertyRow.xaml" />
<None Remove="Controls\RemoteServerConfigControl.xaml" />
<None Remove="Controls\ShortcutTextBox.xaml" />
<None Remove="Controls\SystemTray.xaml" />
<None Remove="Controls\WindowSettingsControl.xaml" />
@@ -58,20 +66,21 @@
<PackageReference Include="CommunityToolkit.Labs.WinUI.Controls.OpacityMaskView" Version="0.1.251021-build.2365" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.Shimmer" Version="0.1.250703-build.2173" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Extensions" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Helpers" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Triggers" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Extensions" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Helpers" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Triggers" Version="8.2.251219" />
<PackageReference Include="ComputeSharp.D2D1.WinUI" Version="3.2.0" />
<PackageReference Include="csharp-pinyin" Version="1.0.1" />
<PackageReference Include="DevWinUI.Controls" Version="9.7.1" />
<PackageReference Include="DevWinUI.Controls" Version="9.8.1" />
<PackageReference Include="Dubya.WindowsMediaController" Version="2.5.6" />
<PackageReference Include="F23.StringSimilarity" Version="7.0.1" />
<PackageReference Include="FlaUI.UIA3" Version="5.0.0" />
<PackageReference Include="FluentFTP" Version="53.0.2" />
<PackageReference Include="H.NotifyIcon.WinUI" Version="2.4.1" />
<PackageReference Include="Hqub.Last.fm" Version="2.5.1" />
<PackageReference Include="Interop.UIAutomationClient" Version="10.19041.0" />
@@ -85,6 +94,7 @@
<PackageReference Include="NTextCat" Version="0.3.65" />
<PackageReference Include="Serilog.Extensions.Logging" Version="10.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageReference Include="SMBLibrary" Version="1.5.5.1" />
<PackageReference Include="System.Drawing.Common" Version="10.0.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.1" />
<PackageReference Include="TagLibSharp" Version="2.3.0" />
@@ -95,6 +105,7 @@
<PackageReference Include="Vanara.PInvoke.User32" Version="4.2.1" />
<PackageReference Include="Vanara.Windows.Shell" Version="4.2.1" />
<PackageReference Include="VCollab.DiscordRichPresence" Version="1.7.0" />
<PackageReference Include="WebDav.Client" Version="2.9.0" />
<PackageReference Include="WinUIEx" Version="2.9.0" />
<PackageReference Include="z440.atl.core" Version="7.9.0" />
</ItemGroup>
@@ -332,12 +343,9 @@
</Page>
</ItemGroup>
<ItemGroup>
<PRIResource Update="Strings\en-US\Resources.resw">
<Generator></Generator>
</PRIResource>
</ItemGroup>
<ItemGroup>
<Folder Include="TemplateSelector\" />
<Page Update="Controls\RemoteServerConfigControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Controls\NowPlayingBar.xaml">

View File

@@ -6,6 +6,8 @@
public const string AuthorGitHub = "https://github.com/jayfunc";
public const string Crowdin = "https://crowdin.com/project/betterlyrics/invite?h=413bb0df7afa420247a98fefdae5e12c2647410";
public const string BetterLyricsGitHub = $"{AuthorGitHub}/BetterLyrics";
public const string ShareHub = $"{BetterLyricsGitHub}/blob/dev/ShareHub/index.md";

View File

@@ -71,9 +71,9 @@
<StackPanel Spacing="6">
<TextBlock x:Uid="SetingsPageFeedback" />
<StackPanel Margin="-12,0,0,0" Orientation="Horizontal">
<HyperlinkButton x:Uid="SettingsPageQQGroup" NavigateUri="{x:Bind const:Link.QQGroup}" />
<HyperlinkButton x:Uid="SettingsPageDiscord" NavigateUri="{x:Bind const:Link.Discord}" />
<HyperlinkButton x:Uid="SettingsPageTelegram" NavigateUri="{x:Bind const:Link.Telegram}" />
<HyperlinkButton Content="QQ 反馈交流群" NavigateUri="{x:Bind const:Link.QQGroup}" />
<HyperlinkButton Content="Discord" NavigateUri="{x:Bind const:Link.Discord}" />
<HyperlinkButton Content="Telegram" NavigateUri="{x:Bind const:Link.Telegram}" />
</StackPanel>
</StackPanel>
</dev:SettingsCard>

View File

@@ -3,6 +3,7 @@
x:Class="BetterLyrics.WinUI3.Controls.AppSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:consts="using:BetterLyrics.WinUI3.Constants"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dev="using:DevWinUI"
@@ -42,6 +43,14 @@
<Button x:Uid="SettingsPageRestart" Command="{x:Bind ViewModel.RestartAppCommand}" />
</dev:SettingsCard>
</dev:SettingsExpander.Items>
<dev:SettingsExpander.ItemsFooter>
<InfoBar IsClosable="False" IsOpen="True">
<HyperlinkButton
x:Uid="SettingsPageHelpUsTranslate"
Padding="0"
NavigateUri="{x:Bind consts:Link.Crowdin}" />
</InfoBar>
</dev:SettingsExpander.ItemsFooter>
</dev:SettingsExpander>
<!-- Startup -->

View File

@@ -6,7 +6,6 @@ using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.Linq;
using static Vanara.PInvoke.User32.RAWINPUT;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

View File

@@ -81,14 +81,6 @@
Value="{x:Bind LyricsBackgroundSettings.CoverOverlayBlurAmount, Mode=TwoWay}" />
</dev:SettingsCard>
<!--<dev:SettingsCard x:Uid="SettingsPageBackgroundAcrylicEffectAmount" IsEnabled="{x:Bind LyricsBackgroundSettings.IsCoverOverlayEnabled, Mode=OneWay}">
<uc:ExtendedSlider
Default="0"
Maximum="10"
Minimum="0"
Value="{x:Bind LyricsBackgroundSettings.CoverAcrylicEffectAmount, Mode=TwoWay}" />
</dev:SettingsCard>-->
</dev:SettingsExpander.Items>
</dev:SettingsExpander>

View File

@@ -13,7 +13,6 @@ using BetterLyrics.WinUI3.Services.SettingsService;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Messages;
using Lyricify.Lyrics.Providers.Web.Netease;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.UI.Xaml;
using Microsoft.UI;
@@ -21,13 +20,11 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Storage.Streams;
using Windows.UI;
using static Vanara.PInvoke.Ole32;
namespace BetterLyrics.WinUI3.Controls
{
@@ -548,11 +545,12 @@ namespace BetterLyrics.WinUI3.Controls
_isMouseScrollingChanged = false;
_lyricsRenderer.CalculateLyrics3DMatrix(
lyricsStyle: lyricsStyle,
lyricsEffect: lyricsEffect,
lyricsX: _renderLyricsStartX,
lyricsY: _renderLyricsStartY,
lyricsWidth: _renderLyricsWidth,
canvasHeight: sender.Size.Height
lyricsHeight: _renderLyricsHeight
);
_isLayoutChanged = false;

View File

@@ -278,18 +278,43 @@
</Pivot.HeaderTemplate>
<Pivot.ItemTemplate>
<DataTemplate x:DataType="models:LyricsData">
<ListView ItemsSource="{x:Bind LyricsLines, Mode=OneWay}" SelectionChanged="ListView_SelectionChanged">
<ListView
ItemContainerStyle="{StaticResource ListViewStretchedItemContainerStyle}"
ItemsSource="{x:Bind LyricsLines, Mode=OneWay}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:LyricsLine">
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="{ThemeResource SystemFillColorNeutralBrush}" Text="{x:Bind StartMs, Mode=OneWay, Converter={StaticResource MillisecondsToFormattedTimeConverter}}" />
<TextBlock
Margin="1,0"
Foreground="{ThemeResource SystemFillColorNeutralBrush}"
Text="-" />
<TextBlock Foreground="{ThemeResource SystemFillColorNeutralBrush}" Text="{x:Bind EndMs, Mode=OneWay, Converter={StaticResource MillisecondsToFormattedTimeConverter}}" />
<TextBlock Margin="6,0" Text="{x:Bind OriginalText, Mode=OneWay}" />
</StackPanel>
<Grid Margin="0,6" ColumnSpacing="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Foreground="{ThemeResource SystemFillColorNeutralBrush}" Text="{x:Bind StartMs, Mode=OneWay, Converter={StaticResource MillisecondsToFormattedTimeConverter}}" />
<Button
HorizontalAlignment="Center"
VerticalAlignment="Center"
Click="PlayLyricsLineButton_Click"
Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
FontSize=16,
Glyph=&#xE768;}"
Opacity="0"
Style="{StaticResource AccentButtonStyle}">
<Button.OpacityTransition>
<ScalarTransition />
</Button.OpacityTransition>
<interactivity:Interaction.Behaviors>
<interactivity:EventTriggerBehavior EventName="PointerEntered">
<interactivity:ChangePropertyAction PropertyName="Opacity" Value="1" />
</interactivity:EventTriggerBehavior>
<interactivity:EventTriggerBehavior EventName="PointerExited">
<interactivity:ChangePropertyAction PropertyName="Opacity" Value="0" />
</interactivity:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
</Grid>
<local:PropertyRow Grid.Column="1" Value="{x:Bind OriginalText, Mode=OneWay}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

View File

@@ -18,10 +18,10 @@ namespace BetterLyrics.WinUI3.Controls
DataContext = Ioc.Default.GetRequiredService<LyricsSearchControlViewModel>();
}
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void PlayLyricsLineButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
ViewModel.SelectedLyricsLine = e.OriginalSource as LyricsLine;
var lyricsLine = (LyricsLine)((Button)sender).DataContext;
ViewModel.PlayLyricsLine(lyricsLine);
}
}
}

View File

@@ -10,7 +10,6 @@ using CommunityToolkit.WinUI.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

View File

@@ -1,5 +1,4 @@
using BetterLyrics.WinUI3.Hooks;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Services.SettingsService;
using BetterLyrics.WinUI3.ViewModels;
using BetterLyrics.WinUI3.Views;
@@ -7,7 +6,6 @@ using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using System.Linq;
using System.Threading.Tasks;
// To learn more about WinUI, the WinUI project structure,

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<UserControl
x:Class="BetterLyrics.WinUI3.Controls.MediaSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@@ -9,6 +8,7 @@
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:local="using:BetterLyrics.WinUI3.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:BetterLyrics.WinUI3.Models"
xmlns:ui="using:CommunityToolkit.WinUI"
mc:Ignorable="d">
@@ -49,25 +49,35 @@
ItemsSource="{x:Bind ViewModel.AppSettings.LocalMediaFolders, Mode=OneWay}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<dev:SettingsExpander>
<DataTemplate x:DataType="models:MediaFolder">
<dev:SettingsExpander Description="{x:Bind ConnectionSummary, Mode=OneWay}">
<dev:SettingsExpander.HeaderIcon>
<FontIcon FontFamily="{StaticResource IconFontFamily}" Glyph="{x:Bind SourceType, Converter={StaticResource FileSourceTypeToIconConverter}, Mode=OneWay}" />
</dev:SettingsExpander.HeaderIcon>
<dev:SettingsExpander.Header>
<HyperlinkButton
Padding="0"
Click="LocalFolderHyperlinkButton_Click"
Content="{Binding Path, Mode=OneWay}"
Tag="{Binding Path, Mode=OneWay}" />
Content="{x:Bind Path, Mode=OneWay}"
Tag="{x:Bind Path, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind ConnectionSummary}" />
</dev:SettingsExpander.Header>
<ToggleSwitch IsOn="{Binding IsEnabled, Mode=TwoWay}" />
<ToggleSwitch IsOn="{x:Bind IsEnabled, Mode=TwoWay}" />
<dev:SettingsExpander.Items>
<dev:SettingsCard>
<dev:SettingsCard.Header>
<HyperlinkButton
x:Uid="SettingsPageRemovePath"
Padding="0"
Click="SettingsPageRemovePathButton_Click"
Tag="{Binding}" />
</dev:SettingsCard.Header>
</dev:SettingsCard>
<dev:SettingsCard x:Uid="SettingsPageMusicLibRealTimeWatch">
<dev:SettingsCard x:Uid="SettingsPageMusicLibRealTimeWatch" IsEnabled="{Binding IsLocal, Mode=OneWay}">
<ToggleSwitch IsOn="{Binding IsRealTimeWatchEnabled, Mode=TwoWay}" />
</dev:SettingsCard>
</dev:SettingsExpander.Items>
@@ -76,15 +86,55 @@
</ListView.ItemTemplate>
</ListView>
<dev:SettingsCard x:Uid="SettingsPageAddFolder" Style="{StaticResource DefaultSettingsExpanderItemStyle}">
<Button
x:Uid="SettingsPageAddFolderButton"
Command="{x:Bind ViewModel.SelectAndAddFolderCommand}"
CommandParameter="{Binding ElementName=RootGrid}" />
<dev:SettingsCard Style="{StaticResource DefaultSettingsExpanderItemStyle}">
<DropDownButton x:Uid="SettingsPageAddFolderButton">
<DropDownButton.Flyout>
<MenuFlyout>
<MenuFlyoutItem
x:Uid="SettingsPageLocalFolder"
Command="{x:Bind ViewModel.SelectAndAddFolderCommand}"
CommandParameter="{Binding ElementName=RootGrid}"
Icon="Folder" />
<MenuFlyoutSeparator Visibility="Collapsed" />
<MenuFlyoutItem
Command="{x:Bind ViewModel.AddRemoteSourceCommand}"
CommandParameter="SMB"
Text="SMB"
Visibility="Collapsed">
<MenuFlyoutItem.Icon>
<FontIcon FontFamily="{StaticResource IconFontFamily}" Glyph="&#xE839;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem
Command="{x:Bind ViewModel.AddRemoteSourceCommand}"
CommandParameter="FTP"
Text="FTP"
Visibility="Collapsed">
<MenuFlyoutItem.Icon>
<FontIcon FontFamily="{StaticResource IconFontFamily}" Glyph="&#xE838;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem
Command="{x:Bind ViewModel.AddRemoteSourceCommand}"
CommandParameter="WebDAV"
Text="WebDAV"
Visibility="Collapsed">
<MenuFlyoutItem.Icon>
<FontIcon FontFamily="{StaticResource IconFontFamily}" Glyph="&#xE774;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
</dev:SettingsCard>
</StackPanel>
</Grid>
</ScrollViewer>
</Grid>
</UserControl>
</UserControl>

View File

@@ -22,7 +22,7 @@ namespace BetterLyrics.WinUI3.Controls
private void SettingsPageRemovePathButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
ViewModel.RemoveFolderAsync((LocalMediaFolder)(sender as HyperlinkButton)!.Tag);
ViewModel.RemoveFolderAsync((MediaFolder)(sender as HyperlinkButton)!.Tag);
}
private async void LocalFolderHyperlinkButton_Click(object sender, RoutedEventArgs e)

View File

@@ -356,7 +356,7 @@
Padding="8,4"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}"
Background="{ThemeResource LayerOnMicaBaseAltFillColorDefaultBrush}"
CornerRadius="6"
Opacity="{x:Bind ViewModel.TimelineSliderThumbOpacity, Mode=OneWay}">
<Grid.OpacityTransition>

View File

@@ -190,7 +190,7 @@ public sealed partial class NowPlayingBar : UserControl,
private void TimelineSliderOverlay_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
{
ViewModel.TimelineSliderThumbOpacity = 0.7f;
ViewModel.TimelineSliderThumbOpacity = 1f;
}
private void TimelineSliderOverlay_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)

View File

@@ -44,10 +44,10 @@
</interactivity:Interaction.Behaviors>
<InfoBar
x:Uid="SettingsPageMusicGalleryOpened"
Grid.Row="0"
IsClosable="False"
IsOpen="{x:Bind ViewModel.AppSettings.MusicGallerySettings.LyricsWindowStatus.IsOpened, Mode=OneWay}"
Message="音乐库窗口已打开,将忽略对其他播放源的监听"
Severity="Informational" />
<!-- 播放源列表 -->
@@ -467,9 +467,9 @@
</dev:SettingsCard>
<!-- Last.fm -->
<TextBlock x:Uid="SettingsPageLastFM" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="Last.fm" />
<dev:SettingsExpander
x:Uid="SettingsPageLastFMManager"
Header="Last.fm"
HeaderIcon="{ui:BitmapIcon Source=ms-appx:///Assets/LastFM.png}"
IsExpanded="{x:Bind ViewModel.IsLastFMAuthenticated, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="6">

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<UserControl
x:Class="BetterLyrics.WinUI3.Controls.RemoteServerConfigControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:BetterLyrics.WinUI3.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<StackPanel Width="400" Spacing="16">
<ProgressBar
x:Name="ProgressBar"
IsIndeterminate="True"
Visibility="Collapsed" />
<InfoBar
x:Name="ErrorInfoBar"
IsClosable="True"
IsOpen="False"
Severity="Error" />
<Grid ColumnDefinitions="*, Auto" ColumnSpacing="12">
<TextBox
x:Name="HostBox"
x:Uid="RemoteServerConfigControlServerAddress"
Grid.Column="0"
InputScope="Url"
PlaceholderText="192.168.1.x"
TextWrapping="Wrap" />
<NumberBox
x:Name="PortBox"
x:Uid="RemoteServerConfigControlPort"
Grid.Column="1"
MinWidth="100"
LargeChange="10"
SmallChange="1"
SpinButtonPlacementMode="Inline"
ToolTipService.ToolTip="80"
Value="80" />
</Grid>
<TextBox
x:Name="PathBox"
x:Uid="RemoteServerConfigControlPath"
TextWrapping="Wrap" />
<Grid ColumnDefinitions="*, *" ColumnSpacing="12">
<TextBox
x:Name="UserBox"
x:Uid="RemoteServerConfigControlUsername"
Grid.Column="0"
TextWrapping="Wrap" />
<PasswordBox
x:Name="PwdBox"
x:Uid="RemoteServerConfigControlPassword"
Grid.Column="1"
PasswordRevealMode="Peek" />
</Grid>
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,105 @@
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
namespace BetterLyrics.WinUI3.Controls
{
public sealed partial class RemoteServerConfigControl : UserControl
{
private readonly string _protocolType;
private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public RemoteServerConfigControl(string protocolType)
{
this.InitializeComponent();
_protocolType = protocolType;
SetupDefaults();
}
private void SetupDefaults()
{
switch (_protocolType.ToUpper())
{
case "SMB":
PortBox.Value = 445; // SMB Ĭ<>϶˿<CFB6>
PathBox.PlaceholderText = "SharedMusic";
break;
case "FTP":
PortBox.Value = 21; // FTP Ĭ<>϶˿<CFB6>
PathBox.PlaceholderText = "/pub/music";
break;
case "WEBDAV":
PortBox.Value = 80; // WebDAV Ĭ<>϶˿<CFB6>
PathBox.PlaceholderText = "/dav/music";
break;
}
}
public MediaFolder GetConfig()
{
if (string.IsNullOrWhiteSpace(HostBox.Text))
throw new ArgumentException(_localizationService.GetLocalizedString("RemoteServerConfigControlServerAddressRequired"));
string name = $"{_protocolType} - {HostBox.Text}";
Enum.TryParse(_protocolType, true, out FileSourceType sourceType);
var folder = new MediaFolder
{
Name = name,
Path = HostBox.Text, // <20><><EFBFBD><EFBFBD> Path <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP/Host
Port = (int)PortBox.Value,
UserName = UserBox.Text,
Password = PwdBox.Password, // <20><> PasswordBox <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
SourceType = sourceType,
IsRealTimeWatchEnabled = false
};
// <20><><EFBFBD><EFBFBD><E2B4A6>·<EFBFBD><C2B7><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><><D4B6>·<EFBFBD><C2B7><>ӵ<EFBFBD> Path <20><EFBFBD><EFA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֶδ<D6B6>
// Ϊ<>˼򵥣<CBBC><F2B5A5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MediaFolder <20><><EFBFBD>
// <20><><EFBFBD><EFBFBD> MediaFolder <20><><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD>һ<EFBFBD><D2BB> RemotePath <20>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Path <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// *<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MediaFolder <20><><EFBFBD><EFBFBD><E5A3AC><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>
// Path <20>ֶδ洢<CEB4><E6B4A2>ʽ<EFBFBD><CABD> "192.168.1.5/Music"
var rawPath = PathBox.Text.Trim().TrimStart('/', '\\'); // ȥ<><C8A5><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>б<EFBFBD><D0B1>
if (!string.IsNullOrEmpty(rawPath))
{
// <20>򵥵<EFBFBD>·<EFBFBD><C2B7>ƴ<EFBFBD><C6B4><EFBFBD>߼<EFBFBD>
if (sourceType == FileSourceType.SMB)
{
// SMBLibrary <20><><EFBFBD>߼<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD> Host <20>ֿ<EFBFBD><D6BF><EFBFBD>ShareName <20>ֿ<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP <20><><EFBFBD><EFBFBD> Path <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA> ShareName ƴ<>ں<EFBFBD><DABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
// Ϊ<>˷<EFBFBD><CBB7><EFBFBD><E3A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP <20><> ShareName ƴ<><C6B4>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Path
// <20><><EFBFBD><EFBFBD>: 192.168.1.5/Music
folder.Path = $"{HostBox.Text}/{rawPath}";
}
else
{
// FTP/WebDAV: 192.168.1.5/pub/music
folder.Path = $"{HostBox.Text}/{rawPath}";
}
}
return folder;
}
public void ShowError(string message)
{
ErrorInfoBar.Message = message;
ErrorInfoBar.IsOpen = true;
}
public void SetProgressBarVisibility(Visibility visibility)
{
ProgressBar.Visibility = visibility;
}
}
}

View File

@@ -1,6 +1,6 @@
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Hooks;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Input;
using Microsoft.UI.Xaml;
@@ -16,7 +16,7 @@ namespace BetterLyrics.WinUI3.Controls
{
public sealed partial class ShortcutTextBox : UserControl
{
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public ShortcutTextBox()
{

View File

@@ -1,5 +1,5 @@
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml.Data;
using System;
@@ -8,7 +8,7 @@ namespace BetterLyrics.WinUI3.Converter
{
public partial class AlbumArtSearchProviderToDisplayNameConverter : IValueConverter
{
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public object Convert(object value, Type targetType, object parameter, string language)
{
@@ -16,8 +16,8 @@ namespace BetterLyrics.WinUI3.Converter
{
return provider switch
{
AlbumArtSearchProvider.Local => _resourceService.GetLocalizedString("AlbumArtSearchLocalProvider"),
AlbumArtSearchProvider.SMTC => _resourceService.GetLocalizedString("AlbumArtSearchSMTCProvider"),
AlbumArtSearchProvider.Local => _localizationService.GetLocalizedString("AlbumArtSearchLocalProvider"),
AlbumArtSearchProvider.SMTC => _localizationService.GetLocalizedString("AlbumArtSearchSMTCProvider"),
AlbumArtSearchProvider.iTunes => "iTunes",
_ => throw new Exception($"Unknown AlbumArtSearchProvider: {provider}"),
};

View File

@@ -11,7 +11,8 @@ namespace BetterLyrics.WinUI3.Converter
{
if (value is string langCode)
{
return LanguageHelper.SupportedDisplayLanguages.FindIndex(x => x.LanguageCode == langCode);
var found = LanguageHelper.SupportedDisplayLanguages.FindIndex(x => x.LanguageCode == langCode);
return found == -1 ? 0 : found;
}
return 0;
}

View File

@@ -0,0 +1,27 @@
using BetterLyrics.WinUI3.Enums;
using Microsoft.UI.Xaml.Data;
using System;
namespace BetterLyrics.WinUI3.Converter
{
public partial class FileSourceTypeToIconConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is FileSourceType type)
{
return type switch
{
FileSourceType.Local => "\uE8B7", // Folder
FileSourceType.SMB => "\uE839", // Network
FileSourceType.FTP => "\uE838", // Globe
FileSourceType.WebDav => "\uE753", // Cloud
_ => "\uE8B7"
};
}
return "\uE8B7";
}
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException();
}
}

View File

@@ -11,7 +11,11 @@ namespace BetterLyrics.WinUI3.Converter
{
if (value is string langCode)
{
if (PhoneticHelper.IsPhoneticCode(langCode))
if (langCode == "N/A")
{
return langCode;
}
else if (PhoneticHelper.IsPhoneticCode(langCode))
{
return PhoneticHelper.GetDisplayName(langCode);
}

View File

@@ -1,7 +1,7 @@
// 2025/6/23 by Zhe Fang
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml.Data;
using System;
@@ -10,7 +10,7 @@ namespace BetterLyrics.WinUI3.Converter
{
public partial class LyricsSearchProviderToDisplayNameConverter : IValueConverter
{
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public object Convert(object value, Type targetType, object parameter, string language)
{
@@ -24,10 +24,10 @@ namespace BetterLyrics.WinUI3.Converter
LyricsSearchProvider.Kugou => "酷狗音乐",
LyricsSearchProvider.AmllTtmlDb => "amll-ttml-db",
LyricsSearchProvider.AppleMusic => "Apple Music",
LyricsSearchProvider.LocalLrcFile => _resourceService.GetLocalizedString("LyricsSearchProviderLocalLrcFile"),
LyricsSearchProvider.LocalMusicFile => _resourceService.GetLocalizedString("LyricsSearchProviderLocalMusicFile"),
LyricsSearchProvider.LocalEslrcFile => _resourceService.GetLocalizedString("LyricsSearchProviderEslrcFile"),
LyricsSearchProvider.LocalTtmlFile => _resourceService.GetLocalizedString("LyricsSearchProviderTtmlFile"),
LyricsSearchProvider.LocalLrcFile => _localizationService.GetLocalizedString("LyricsSearchProviderLocalLrcFile"),
LyricsSearchProvider.LocalMusicFile => _localizationService.GetLocalizedString("LyricsSearchProviderLocalMusicFile"),
LyricsSearchProvider.LocalEslrcFile => _localizationService.GetLocalizedString("LyricsSearchProviderEslrcFile"),
LyricsSearchProvider.LocalTtmlFile => _localizationService.GetLocalizedString("LyricsSearchProviderTtmlFile"),
_ => "N/A",
};
}

View File

@@ -1,6 +1,7 @@
// 2025/6/23 by Zhe Fang
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;
@@ -10,13 +11,13 @@ namespace BetterLyrics.WinUI3.Converter
{
public partial class MatchedLocalFilesPathToVisibilityConverter : IValueConverter
{
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is string path)
{
if (path == _resourceService.GetLocalizedString("MainPageNoLocalFilesMatched"))
if (path == _localizationService.GetLocalizedString("MainPageNoLocalFilesMatched"))
{
return Visibility.Collapsed;
}

View File

@@ -1,24 +0,0 @@
using ATL;
using BetterLyrics.WinUI3.Extensions;
using Microsoft.UI.Xaml.Data;
using System;
namespace BetterLyrics.WinUI3.Converter
{
public partial class TrackToLyricsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is Track track)
{
return track.GetRawLyrics();
}
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,7 +1,7 @@
// 2025/6/23 by Zhe Fang
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml.Data;
using System;
@@ -10,7 +10,7 @@ namespace BetterLyrics.WinUI3.Converter
{
public partial class TranslationSearchProviderToDisplayNameConverter : IValueConverter
{
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public object Convert(object value, Type targetType, object parameter, string language)
{
@@ -24,10 +24,10 @@ namespace BetterLyrics.WinUI3.Converter
TranslationSearchProvider.Kugou => "酷狗音乐",
TranslationSearchProvider.AmllTtmlDb => "amll-ttml-db",
TranslationSearchProvider.AppleMusic => "Apple Music",
TranslationSearchProvider.LocalLrcFile => _resourceService.GetLocalizedString("LyricsSearchProviderLocalLrcFile"),
TranslationSearchProvider.LocalMusicFile => _resourceService.GetLocalizedString("LyricsSearchProviderLocalMusicFile"),
TranslationSearchProvider.LocalEslrcFile => _resourceService.GetLocalizedString("LyricsSearchProviderEslrcFile"),
TranslationSearchProvider.LocalTtmlFile => _resourceService.GetLocalizedString("LyricsSearchProviderTtmlFile"),
TranslationSearchProvider.LocalLrcFile => _localizationService.GetLocalizedString("LyricsSearchProviderLocalLrcFile"),
TranslationSearchProvider.LocalMusicFile => _localizationService.GetLocalizedString("LyricsSearchProviderLocalMusicFile"),
TranslationSearchProvider.LocalEslrcFile => _localizationService.GetLocalizedString("LyricsSearchProviderEslrcFile"),
TranslationSearchProvider.LocalTtmlFile => _localizationService.GetLocalizedString("LyricsSearchProviderTtmlFile"),
TranslationSearchProvider.LibreTranslate => "LibreTranslate",
_ => "N/A",
};

View File

@@ -1,5 +1,5 @@
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml.Data;
using System;
@@ -8,7 +8,7 @@ namespace BetterLyrics.WinUI3.Converter
{
public partial class TransliterationSearchProviderToDisplayNameConverter : IValueConverter
{
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public object Convert(object value, Type targetType, object parameter, string language)
{
@@ -22,10 +22,10 @@ namespace BetterLyrics.WinUI3.Converter
TransliterationSearchProvider.Kugou => "酷狗音乐",
TransliterationSearchProvider.AmllTtmlDb => "amll-ttml-db",
TransliterationSearchProvider.AppleMusic => "Apple Music",
TransliterationSearchProvider.LocalLrcFile => _resourceService.GetLocalizedString("LyricsSearchProviderLocalLrcFile"),
TransliterationSearchProvider.LocalMusicFile => _resourceService.GetLocalizedString("LyricsSearchProviderLocalMusicFile"),
TransliterationSearchProvider.LocalEslrcFile => _resourceService.GetLocalizedString("LyricsSearchProviderEslrcFile"),
TransliterationSearchProvider.LocalTtmlFile => _resourceService.GetLocalizedString("LyricsSearchProviderTtmlFile"),
TransliterationSearchProvider.LocalLrcFile => _localizationService.GetLocalizedString("LyricsSearchProviderLocalLrcFile"),
TransliterationSearchProvider.LocalMusicFile => _localizationService.GetLocalizedString("LyricsSearchProviderLocalMusicFile"),
TransliterationSearchProvider.LocalEslrcFile => _localizationService.GetLocalizedString("LyricsSearchProviderEslrcFile"),
TransliterationSearchProvider.LocalTtmlFile => _localizationService.GetLocalizedString("LyricsSearchProviderTtmlFile"),
TransliterationSearchProvider.BetterLyrics => "BetterLyrics",
TransliterationSearchProvider.CutletDocker => "cutlet-docker",
_ => "N/A",

View File

@@ -0,0 +1,10 @@
namespace BetterLyrics.WinUI3.Enums
{
public enum FileSourceType
{
Local,
SMB,
FTP,
WebDav
}
}

View File

@@ -2,7 +2,7 @@
using BetterLyrics.WinUI3.Hooks;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Models.Settings;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using BetterLyrics.WinUI3.Views;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml;
@@ -12,14 +12,14 @@ namespace BetterLyrics.WinUI3.Extensions
{
public static class LyricsWindowStatusExtensions
{
private static readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private static readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public static LyricsWindowStatus DesktopMode(Window? window = null)
{
window ??= WindowHook.GetWindow<SystemTrayWindow>();
return new LyricsWindowStatus(window)
{
Name = _resourceService.GetLocalizedString("DesktopMode"),
Name = _localizationService.GetLocalizedString("DesktopMode"),
LyricsDisplayType = LyricsDisplayType.LyricsOnly,
WindowBounds = new Rect(100, 100, 600, 250),
IsLocked = true,
@@ -44,7 +44,7 @@ namespace BetterLyrics.WinUI3.Extensions
window ??= WindowHook.GetWindow<SystemTrayWindow>();
var status = new LyricsWindowStatus(window)
{
Name = _resourceService.GetLocalizedString("DockedMode"),
Name = _localizationService.GetLocalizedString("DockedMode"),
IsWorkArea = true,
IsAlwaysOnTop = true,
IsAlwaysOnTopPolling = true,
@@ -71,7 +71,7 @@ namespace BetterLyrics.WinUI3.Extensions
window ??= WindowHook.GetWindow<SystemTrayWindow>();
var status = new LyricsWindowStatus(window)
{
Name = _resourceService.GetLocalizedString("FullscreenMode"),
Name = _localizationService.GetLocalizedString("FullscreenMode"),
LyricsLayoutOrientation = LyricsLayoutOrientation.Vertical,
LyricsStyleSettings = new LyricsStyleSettings
{
@@ -93,7 +93,7 @@ namespace BetterLyrics.WinUI3.Extensions
window ??= WindowHook.GetWindow<SystemTrayWindow>();
return new LyricsWindowStatus(window)
{
Name = _resourceService.GetLocalizedString("StandardMode"),
Name = _localizationService.GetLocalizedString("StandardMode"),
};
}
@@ -102,7 +102,7 @@ namespace BetterLyrics.WinUI3.Extensions
window ??= WindowHook.GetWindow<SystemTrayWindow>();
return new LyricsWindowStatus(window)
{
Name = _resourceService.GetLocalizedString("NarrowMode"),
Name = _localizationService.GetLocalizedString("NarrowMode"),
WindowBounds = new Rect(100, 100, 400, 800),
LyricsLayoutOrientation = LyricsLayoutOrientation.Vertical,
};
@@ -113,7 +113,7 @@ namespace BetterLyrics.WinUI3.Extensions
window ??= WindowHook.GetWindow<SystemTrayWindow>();
return new LyricsWindowStatus(window)
{
Name = _resourceService.GetLocalizedString("TaskbarMode"),
Name = _localizationService.GetLocalizedString("TaskbarMode"),
LyricsDisplayType = LyricsDisplayType.LyricsOnly,
IsPinToTaskbar = true,
IsLocked = true,

View File

@@ -1,33 +0,0 @@
using ATL;
using System.IO;
namespace BetterLyrics.WinUI3.Extensions
{
public static class TrackExtensions
{
extension(Track track)
{
public string GetParentFolderName() => Directory.GetParent(track.Path)?.Name ?? "";
public string GetParentFolderPath() => Directory.GetParent(track.Path)?.FullName ?? "";
public string GetRawLyrics()
{
if (track.Path is string path)
{
try
{
return TagLib.File.Create(path).Tag.Lyrics;
}
catch (System.Exception)
{
return "";
}
}
return "";
}
public string GetFileName() => Path.GetFileName(track.Path);
}
}
}

View File

@@ -1,6 +1,6 @@
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
@@ -9,16 +9,24 @@ namespace BetterLyrics.WinUI3.Extensions
{
public static class WindowExtensions
{
private static readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private static readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
extension(Window window)
{
public void Init(
string titleKey,
string titleKey = "",
string title = "",
TitleBarHeightOption titleBarHeightOption = TitleBarHeightOption.Standard,
BackdropType backdropType = BackdropType.DesktopAcrylic)
{
window.Title = _resourceService.GetLocalizedString(titleKey);
if (titleKey != "")
{
window.Title = _localizationService.GetLocalizedString(titleKey);
}
if (title != "")
{
window.Title = title;
}
window.AppWindow.TitleBar.PreferredTheme = TitleBarTheme.UseDefaultAppMode;
window.AppWindow.SetIcons();

View File

@@ -1,8 +1,6 @@
using Microsoft.Graphics.Canvas.Text;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Documents;
using System.Windows.Markup;
using System.Windows.Media;

View File

@@ -1,8 +1,10 @@
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using NTextCat;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Globalization;
using System.Linq;
using Windows.Globalization;
@@ -10,9 +12,9 @@ namespace BetterLyrics.WinUI3.Helper
{
public class LanguageHelper
{
private static readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
private static readonly RankedLanguageIdentifierFactory _factory = new();
private static readonly RankedLanguageIdentifier _identifier;
private static readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
public const string ChineseCode = "zh";
public const string JapaneseCode = "ja";
@@ -92,12 +94,23 @@ namespace BetterLyrics.WinUI3.Helper
public static List<ExtendedLanguage> SupportedDisplayLanguages { get; set; } =
[
new ExtendedLanguage("", _resourceService.GetLocalizedString("SettingsPageSystemLanguage")),
new ExtendedLanguage("en-US", "English"),
new ExtendedLanguage("ja-JP"),
new ExtendedLanguage("ko-KR"),
new ExtendedLanguage("zh-CN", "简体中文"),
new ExtendedLanguage("zh-TW", "繁體中文"),
new ExtendedLanguage(CultureInfo.CurrentUICulture.Name, _localizationService.GetLocalizedString("SettingsPageSystemLanguage")),
new ExtendedLanguage("ar"),
new ExtendedLanguage("de"),
new ExtendedLanguage("en"),
new ExtendedLanguage("es"),
new ExtendedLanguage("fr"),
new ExtendedLanguage("hi"),
new ExtendedLanguage("id"),
new ExtendedLanguage("ja"),
new ExtendedLanguage("ko"),
new ExtendedLanguage("ms"),
new ExtendedLanguage("pt"),
new ExtendedLanguage("ru"),
new ExtendedLanguage("th"),
new ExtendedLanguage("vi"),
new ExtendedLanguage("zh-Hans"),
new ExtendedLanguage("zh-Hant"),
];
static LanguageHelper()
@@ -107,7 +120,7 @@ namespace BetterLyrics.WinUI3.Helper
public static string? DetectLanguageCode(string? text)
{
if (text == null) return null;
if (string.IsNullOrWhiteSpace(text)) return null;
var guessList = _identifier.Identify(text);
string? code = guessList?.FirstOrDefault()?.Item1.Iso639_2T;
code = code switch

View File

@@ -1,4 +1,4 @@
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using System;
@@ -6,7 +6,7 @@ namespace BetterLyrics.WinUI3.Helper
{
public static class PhoneticHelper
{
private static readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private static readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public const string PinyinCode = "zh-cmn-pinyin";
public const string JyutpingCode = "zh-yue-jyutping";
@@ -22,11 +22,11 @@ namespace BetterLyrics.WinUI3.Helper
switch (code)
{
case PinyinCode:
return _resourceService.GetLocalizedString("Pinyin");
return _localizationService.GetLocalizedString("Pinyin");
case JyutpingCode:
return _resourceService.GetLocalizedString("Jyutping");
return _localizationService.GetLocalizedString("Jyutping");
case RomanCode:
return _resourceService.GetLocalizedString("Romaji");
return _localizationService.GetLocalizedString("Romaji");
default:
throw new ArgumentOutOfRangeException(nameof(code));
}

View File

@@ -45,6 +45,12 @@ namespace BetterLyrics.WinUI3.Helper
public static async Task<StorageFile?> PickSaveFileAsync<T>(IDictionary<string, IList<string>> fileTypeChoices)
{
var window = WindowHook.GetWindow<T>();
return await PickSaveFileAsync(window, fileTypeChoices);
}
public static async Task<StorageFile?> PickSaveFileAsync<T>(T? window, IDictionary<string, IList<string>> fileTypeChoices)
{
if (window == null) return null;
var picker = new Windows.Storage.Pickers.FileSavePicker();

View File

@@ -1,4 +1,4 @@
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Windows.AppNotifications;
@@ -8,12 +8,12 @@ namespace BetterLyrics.WinUI3.Helper
{
public class ToastHelper
{
private static readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private static readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public static void ShowToast(string localizedTitleKey, string? description, InfoBarSeverity severity)
{
AppNotification notification = new AppNotificationBuilder()
.AddText(_resourceService.GetLocalizedString(localizedTitleKey))
.AddText(_localizationService.GetLocalizedString(localizedTitleKey))
.AddText(description)
.BuildNotification();

View File

@@ -124,8 +124,10 @@ namespace BetterLyrics.WinUI3.Logic
line.AngleTransition.SetEasingType(canvasYScrollTransition.EasingType);
line.AngleTransition.SetDuration(yScrollDuration);
line.AngleTransition.SetDelay(yScrollDelay);
line.AngleTransition.StartTransition(lyricsEffect.IsFanLyricsEnabled ?
Math.PI * (lyricsEffect.FanLyricsAngle / 180.0) * distanceFactor * (i > playingLineIndex ? 1 : -1) : 0);
line.AngleTransition.StartTransition(
(lyricsEffect.IsFanLyricsEnabled && !isMouseScrolling) ?
Math.PI * (lyricsEffect.FanLyricsAngle / 180.0) * distanceFactor * (i > playingLineIndex ? 1 : -1) :
0);
line.YOffsetTransition.SetEasingType(canvasYScrollTransition.EasingType);
line.YOffsetTransition.SetDuration(yScrollDuration);

View File

@@ -213,6 +213,17 @@ namespace BetterLyrics.WinUI3.Logic
if (value >= mousePosition.Y) { result = mid; right = mid - 1; }
else { left = mid + 1; }
}
if (result != -1)
{
var line = lines[result];
double lineTopY = offset + line.TopLeftPosition.Y;
if (mousePosition.Y < lineTopY)
{
result = -1;
}
}
return result;
}

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace BetterLyrics.WinUI3.Models
{

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace BetterLyrics.WinUI3.Models
{

View File

@@ -0,0 +1,37 @@
using BetterLyrics.WinUI3.Models.FileSystem;
using System;
using System.IO;
namespace BetterLyrics.WinUI3.Models
{
public class ExtendedTrack : ATL.Track
{
public new string Path { get; private set; } = "";
public string RawLyrics { get; set; } = "";
public string ParentFolderName => Directory.GetParent(Path)?.Name ?? "";
public string ParentFolderPath => Directory.GetParent(Path)?.FullName ?? "";
public string FileName => System.IO.Path.GetFileName(Path);
public ExtendedTrack() : base() { }
public ExtendedTrack(string path) : base(path)
{
Path = path;
}
public ExtendedTrack(string path, Stream stream) : base(stream, System.IO.Path.GetExtension(path))
{
Path = path;
SetRawLyrics(new StreamFileAbstraction(path, stream));
}
private void SetRawLyrics(StreamFileAbstraction streamFileAbstraction)
{
try
{
RawLyrics = TagLib.File.Create(streamFileAbstraction).Tag.Lyrics;
}
catch (Exception) { }
}
}
}

View File

@@ -0,0 +1,53 @@
using FluentFTP;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public partial class FTPFileSystem : IUnifiedFileSystem
{
private readonly AsyncFtpClient _client;
private readonly string _rootPath; // 服务器上的根路径 (例如 /pub/music)
public FTPFileSystem(string host, string user, string pass, int port, string remotePath)
{
// 如果 path 是 "192.168.1.5/Music",我们需要把 /Music 拆出来
// 但为了简单,假设 host 仅仅是 IPremotePath 才是路径
_rootPath = remotePath ?? "/";
var config = new FtpConfig { ConnectTimeout = 5000 };
_client = new AsyncFtpClient(host, user ?? "anonymous", pass ?? "", port > 0 ? port : 21, config);
}
public async Task<bool> ConnectAsync()
{
await _client.AutoConnect();
return _client.IsConnected;
}
public async Task<List<UnifiedFileItem>> GetFilesAsync(string relativePath)
{
string targetPath = Path.Combine(_rootPath, relativePath).Replace("\\", "/");
var items = await _client.GetListing(targetPath);
return items.Select(i => new UnifiedFileItem
{
Name = i.Name,
FullPath = i.FullName,
IsFolder = i.Type == FtpObjectType.Directory,
Size = i.Size,
LastModified = i.Modified
}).ToList();
}
public async Task<Stream> OpenReadAsync(string fullPath)
{
return await _client.OpenRead(fullPath);
}
public async Task DisconnectAsync() => await _client.Disconnect();
public void Dispose() => _client?.Dispose();
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public interface IUnifiedFileSystem : IDisposable
{
Task<bool> ConnectAsync();
Task<List<UnifiedFileItem>> GetFilesAsync(string relativePath);
Task<Stream> OpenReadAsync(string fullPath);
Task DisconnectAsync();
}
}

View File

@@ -0,0 +1,56 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public partial class LocalFileSystem : IUnifiedFileSystem
{
private readonly string _rootPath;
public LocalFileSystem(string rootPath)
{
_rootPath = rootPath;
}
public Task<bool> ConnectAsync()
{
return Task.FromResult(Directory.Exists(_rootPath));
}
public async Task<List<UnifiedFileItem>> GetFilesAsync(string relativePath)
{
var result = new List<UnifiedFileItem>();
var targetPath = string.IsNullOrWhiteSpace(relativePath)
? _rootPath
: Path.Combine(_rootPath, relativePath);
if (!Directory.Exists(targetPath)) return result;
var dirInfo = new DirectoryInfo(targetPath);
foreach (var item in dirInfo.GetFileSystemInfos())
{
bool isDir = (item.Attributes & FileAttributes.Directory) == FileAttributes.Directory;
result.Add(new UnifiedFileItem
{
Name = item.Name,
FullPath = item.FullName,
IsFolder = isDir,
Size = isDir ? 0 : ((FileInfo)item).Length,
LastModified = item.LastWriteTime
});
}
return result;
}
public async Task<Stream> OpenReadAsync(string fullPath)
{
return new FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read);
}
public async Task DisconnectAsync() => await Task.CompletedTask;
public void Dispose() { }
}
}

View File

@@ -0,0 +1,130 @@
using SMBLibrary;
using SMBLibrary.Client;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public partial class SMBFileSystem : IUnifiedFileSystem
{
private SMB2Client _client;
private ISMBFileStore _fileStore;
private readonly string _ip;
private readonly string _shareName;
private readonly string _pathInsideShare; // 共享里的子路径
private readonly string _username;
private readonly string _password;
// fullPathInput 例如: "192.168.1.5/Music/Pop"
public SMBFileSystem(string fullPathInput, string user, string pass)
{
_username = user;
_password = pass;
// 解析路径:分离 IP 和 共享名
var parts = fullPathInput.Replace("\\", "/").Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length >= 1) _ip = parts[0];
if (parts.Length >= 2) _shareName = parts[1];
// 剩下的部分重新拼起来作为子路径
if (parts.Length > 2)
_pathInsideShare = string.Join("\\", parts.Skip(2));
else
_pathInsideShare = "";
}
public async Task<bool> ConnectAsync()
{
_client = new SMB2Client();
bool connected = _client.Connect(_ip, SMBTransportType.DirectTCPTransport);
if (!connected) return false;
var status = _client.Login(string.Empty, _username, _password);
if (status != NTStatus.STATUS_SUCCESS) return false;
// 连接具体的共享文件夹
if (string.IsNullOrEmpty(_shareName)) return true; // 只连了服务器,没连共享
_fileStore = _client.TreeConnect(_shareName, out status);
return status == NTStatus.STATUS_SUCCESS;
}
public async Task<List<UnifiedFileItem>> GetFilesAsync(string relativePath)
{
var result = new List<UnifiedFileItem>();
if (_fileStore == null) return result;
// 拼接完整路径: Root里面的子路径 + 传入的相对路径
string queryPath = Path.Combine(_pathInsideShare, relativePath).Replace("/", "\\").TrimStart('\\');
// 打开目录
var statusRet = _fileStore.CreateFile(out object handle, out FileStatus status, queryPath,
AccessMask.GENERIC_READ, SMBLibrary.FileAttributes.Directory, ShareAccess.Read,
CreateDisposition.FILE_OPEN, CreateOptions.FILE_DIRECTORY_FILE, null);
if (statusRet != NTStatus.STATUS_SUCCESS) return result;
List<QueryDirectoryFileInformation> fileInfo;
do
{
statusRet = _fileStore.QueryDirectory(out fileInfo, handle, "*", FileInformationClass.FileDirectoryInformation);
List<FileDirectoryInformation> list = fileInfo.Select(x => (FileDirectoryInformation)x).ToList();
foreach (var item in list)
{
// 排除当前目录和父目录
if (item.FileName == "." || item.FileName == "..") continue;
result.Add(new UnifiedFileItem
{
Name = item.FileName,
FullPath = Path.Combine(queryPath, item.FileName),
IsFolder = (item.FileAttributes & SMBLibrary.FileAttributes.Directory) == SMBLibrary.FileAttributes.Directory,
Size = item.AllocationSize,
LastModified = item.LastWriteTime
});
}
if (statusRet == NTStatus.STATUS_NO_MORE_FILES)
{
break;
}
if (statusRet != NTStatus.STATUS_SUCCESS)
{
// Log
break;
}
} while (statusRet == NTStatus.STATUS_SUCCESS);
_fileStore.CloseFile(handle);
return result;
}
public async Task<Stream> OpenReadAsync(string fullPath)
{
var ret = _fileStore.CreateFile(out object handle, out FileStatus status, fullPath,
AccessMask.GENERIC_READ | AccessMask.SYNCHRONIZE, 0, ShareAccess.Read, CreateDisposition.FILE_OPEN, 0, null);
if (ret != NTStatus.STATUS_SUCCESS) throw new IOException($"SMB Open Error: {ret}");
return new SMBReadOnlyStream(_fileStore, handle);
}
public async Task DisconnectAsync()
{
_client?.Disconnect();
await Task.CompletedTask;
}
public void Dispose()
{
_client?.Disconnect();
}
}
}

View File

@@ -0,0 +1,114 @@
using SMBLibrary;
using SMBLibrary.Client;
using System;
using System.IO;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public partial class SMBReadOnlyStream : Stream
{
private readonly ISMBFileStore _store;
private readonly object _handle;
private long _position;
private long _length; // 新增:缓存文件长度
public SMBReadOnlyStream(ISMBFileStore store, object handle)
{
_store = store;
_handle = handle;
_position = 0;
var status = _store.GetFileInformation(out FileInformation result, handle, FileInformationClass.FileStandardInformation);
if (status == NTStatus.STATUS_SUCCESS && result is FileStandardInformation info)
{
_length = info.EndOfFile;
}
else
{
// 如果获取失败,这是一个严重问题,意味着无法 Seek 到末尾
// 暂时设为 0但后续读取可能会出问题
_length = 0;
}
}
public override bool CanRead => true;
public override bool CanSeek => true;
public override bool CanWrite => false;
public override long Length => _length;
public override long Position
{
get => _position;
set => _position = value;
}
public override int Read(byte[] buffer, int offset, int count)
{
// 保护:如果位置已经超过文件末尾,直接返回 0 (EOF)
if (_position >= _length) return 0;
// 保护:防止读取越界 (请求读取量不能超过剩余量)
long remaining = _length - _position;
int bytesToRequest = (int)Math.Min(count, remaining);
// 为了安全,保留对 remaining 的检查是必须的
if (bytesToRequest <= 0) return 0;
var status = _store.ReadFile(out byte[] data, _handle, _position, bytesToRequest);
if (status == NTStatus.STATUS_END_OF_FILE) return 0;
if (status != NTStatus.STATUS_SUCCESS)
{
throw new IOException($"SMB Read failed. Status: {status} (Pos: {_position}, Req: {bytesToRequest})");
}
if (data == null || data.Length == 0) return 0;
Array.Copy(data, 0, buffer, offset, data.Length);
_position += data.Length;
return data.Length;
}
public override long Seek(long offset, SeekOrigin origin)
{
long newPos = _position;
switch (origin)
{
case SeekOrigin.Begin:
newPos = offset;
break;
case SeekOrigin.Current:
newPos = _position + offset;
break;
case SeekOrigin.End:
newPos = _length + offset;
break;
}
// 允许 Seek 超过 EOF (标准 Stream 行为),但在 Read 时会返回 0
if (newPos < 0)
{
throw new IOException("An attempt was made to move the file pointer before the beginning of the file.");
}
_position = newPos;
return _position;
}
public override void SetLength(long value) => throw new NotSupportedException();
public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException();
public override void Flush() { }
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
try { _store.CloseFile(_handle); } catch { }
}
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.IO;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public class StreamFileAbstraction : TagLib.File.IFileAbstraction
{
private readonly string _name;
private readonly Stream _stream;
private readonly bool _closeStreamOnDispose;
public StreamFileAbstraction(string path, Stream stream, bool closeStreamOnDispose = false)
{
_name = Path.GetFileName(path);
_stream = stream ?? throw new ArgumentNullException(nameof(stream));
_closeStreamOnDispose = closeStreamOnDispose;
}
public string Name => _name;
public Stream ReadStream => _stream;
public Stream WriteStream
{
get
{
if (_stream.CanWrite)
{
return _stream;
}
throw new InvalidOperationException("The underlying stream is read-only. Tag saving is not supported for this source.");
}
}
public void CloseStream(Stream stream)
{
if (_closeStreamOnDispose)
{
stream?.Dispose();
}
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public class UnifiedFileItem
{
public string Name { get; set; }
public string FullPath { get; set; }
public long Size { get; set; }
public bool IsFolder { get; set; }
public DateTime? LastModified { get; set; }
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using WebDav;
namespace BetterLyrics.WinUI3.Models.FileSystem
{
public partial class WebDavFileSystem : IUnifiedFileSystem
{
private readonly WebDavClient _client;
private readonly string _baseUrl;
private readonly string _rootPath;
// host: http://192.168.1.5:5005
// path: /music
public WebDavFileSystem(string host, string user, string pass, int port, string path)
{
if (!host.StartsWith("http")) host = $"http://{host}";
if (port > 0) host = $"{host}:{port}";
_baseUrl = host;
_rootPath = path ?? "/";
_client = new WebDavClient(new WebDavClientParams
{
BaseAddress = new Uri(_baseUrl),
Credentials = new System.Net.NetworkCredential(user, pass)
});
}
public async Task<bool> ConnectAsync()
{
// WebDAV 无状态Propfind 测试根目录连通性
var result = await _client.Propfind(_rootPath);
return result.IsSuccessful;
}
public async Task<List<UnifiedFileItem>> GetFilesAsync(string relativePath)
{
var targetPath = Path.Combine(_rootPath, relativePath).Replace("\\", "/");
var result = await _client.Propfind(targetPath);
var list = new List<UnifiedFileItem>();
if (result.IsSuccessful)
{
foreach (var res in result.Resources)
{
if (res == null || res.Uri == null) continue;
// 排除掉文件夹自身 (WebDAV 通常会把当前请求的文件夹作为第一个结果返回)
// 通过判断 URL 结尾是否一致来简单过滤,或者判断 IsCollection 且 Uri 相同
// 这里简单处理:只要名字不为空
var name = System.Net.WebUtility.UrlDecode(res.Uri.Split('/').LastOrDefault());
if (string.IsNullOrEmpty(name)) continue;
// 如果名字和请求的目录名一样,可能是它自己,跳过 (这需要根据具体服务器响应调整)
// 更稳妥的是比较 Uri
list.Add(new UnifiedFileItem
{
Name = name,
FullPath = res.Uri.ToString(), // WebDAV 需要完整 URI
IsFolder = res.IsCollection,
Size = res.ContentLength ?? 0,
LastModified = res.LastModifiedDate
});
}
}
return list;
}
public async Task<Stream> OpenReadAsync(string fullPath)
{
// WebDAV 获取流
var res = await _client.GetRawFile(fullPath);
if (!res.IsSuccessful) throw new IOException($"WebDAV Error: {res.StatusCode}");
return res.Stream;
}
public async Task DisconnectAsync() => await Task.CompletedTask;
public void Dispose() => _client?.Dispose();
}
}

View File

@@ -1,20 +0,0 @@
// 2025/6/23 by Zhe Fang
using CommunityToolkit.Mvvm.ComponentModel;
namespace BetterLyrics.WinUI3.Models
{
public partial class LocalMediaFolder : ObservableRecipient
{
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsEnabled { get; set; } = true;
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsRealTimeWatchEnabled { get; set; } = false;
[ObservableProperty][NotifyPropertyChangedRecipients] public partial string Path { get; set; }
public LocalMediaFolder() { }
public LocalMediaFolder(string path)
{
Path = path;
}
}
}

View File

@@ -1,5 +1,5 @@
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using CommunityToolkit.Mvvm.DependencyInjection;
using System;
using System.Collections.Generic;
@@ -9,9 +9,9 @@ namespace BetterLyrics.WinUI3.Models
{
public class LyricsData
{
private static readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
private static readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
public List<LyricsLine> LyricsLines { get; set; }
public List<LyricsLine> LyricsLines { get; set; } = [];
public string? LanguageCode
{
get => field ?? LanguageHelper.DetectLanguageCode(WrappedOriginalText);
@@ -22,7 +22,6 @@ namespace BetterLyrics.WinUI3.Models
public LyricsData()
{
LyricsLines = [];
}
public LyricsData(List<LyricsLine> lyricsLines)
@@ -114,20 +113,24 @@ namespace BetterLyrics.WinUI3.Models
{
StartMs = 0,
EndMs = (int)TimeSpan.FromMinutes(99).TotalMilliseconds,
OriginalText = _resourceService.GetLocalizedString("LyricsNotFound"),
OriginalText = _localizationService.GetLocalizedString("LyricsNotFound"),
}]);
}
public static LyricsData GetLoadingPlaceholder()
{
return new LyricsData([
new LyricsLine
{
StartMs = 0,
EndMs = (int)TimeSpan.FromMinutes(99).TotalMilliseconds,
OriginalText = "● ● ●",
},
]);
return new LyricsData()
{
LyricsLines = [
new LyricsLine
{
StartMs = 0,
EndMs = (int)TimeSpan.FromMinutes(99).TotalMilliseconds,
OriginalText = "● ● ●",
},
],
LanguageCode = "N/A",
};
}
public LyricsLine? GetLyricsLine(double sec)

View File

@@ -0,0 +1,73 @@
// 2025/6/23 by Zhe Fang
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models.FileSystem;
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Text.Json.Serialization;
namespace BetterLyrics.WinUI3.Models
{
public partial class MediaFolder : ObservableRecipient
{
[ObservableProperty] public partial string Id { get; set; } = Guid.NewGuid().ToString();
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsEnabled { get; set; } = true;
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsRealTimeWatchEnabled { get; set; } = false;
[ObservableProperty][NotifyPropertyChangedRecipients][NotifyPropertyChangedFor(nameof(ConnectionSummary))] public partial string Path { get; set; }
[ObservableProperty]
[NotifyPropertyChangedRecipients]
[NotifyPropertyChangedFor(nameof(IsLocal))]
[NotifyPropertyChangedFor(nameof(ConnectionSummary))]
public partial FileSourceType SourceType { get; set; } = FileSourceType.Local;
[ObservableProperty][NotifyPropertyChangedRecipients] public partial string Name { get; set; }
[ObservableProperty] public partial string UserName { get; set; }
[ObservableProperty] public partial int Port { get; set; } = -1;
[JsonIgnore] public string Password { get; set; }
[JsonIgnore] public bool IsLocal => SourceType == FileSourceType.Local;
[JsonIgnore]
public string ConnectionSummary
{
get
{
if (IsLocal) return Path;
return $"{SourceType} - {Path} {(string.IsNullOrEmpty(UserName) ? "" : $"({UserName})")}";
}
}
[JsonIgnore] public string VaultKey => $"{Id}-{UserName}";
public MediaFolder() { }
public MediaFolder(string path)
{
Path = path;
}
public IUnifiedFileSystem? CreateFileSystem()
{
if (!IsEnabled) return null;
if (string.IsNullOrEmpty(Password) && !IsLocal)
{
Password = PasswordVaultHelper.Get(Constants.App.AppName, VaultKey) ?? "";
}
return SourceType switch
{
FileSourceType.Local => new LocalFileSystem(Path),
FileSourceType.SMB => new SMBFileSystem(Path, UserName, Password),
FileSourceType.FTP => new FTPFileSystem(Path, UserName, Password, Port, Path),
FileSourceType.WebDav => new WebDavFileSystem(Path, UserName, Password, Port, Path),
_ => throw new NotImplementedException()
};
}
}
}

View File

@@ -1,12 +1,10 @@
using ATL;
namespace BetterLyrics.WinUI3.Models
namespace BetterLyrics.WinUI3.Models
{
public class PlayQueueItem
{
public Track Track { get; set; }
public ExtendedTrack Track { get; set; }
public PlayQueueItem(Track track)
public PlayQueueItem(ExtendedTrack track)
{
Track = track;
}

View File

@@ -12,7 +12,7 @@ namespace BetterLyrics.WinUI3.Models.Settings
[ObservableProperty][NotifyPropertyChangedRecipients] public partial MusicGallerySettings MusicGallerySettings { get; set; } = new MusicGallerySettings();
[ObservableProperty][NotifyPropertyChangedRecipients] public partial AdvancedSettings AdvancedSettings { get; set; } = new AdvancedSettings();
[ObservableProperty][NotifyPropertyChangedRecipients] public partial FullyObservableCollection<LocalMediaFolder> LocalMediaFolders { get; set; } = [];
[ObservableProperty][NotifyPropertyChangedRecipients] public partial FullyObservableCollection<MediaFolder> LocalMediaFolders { get; set; } = [];
[ObservableProperty][NotifyPropertyChangedRecipients] public partial FullyObservableCollection<MediaSourceProviderInfo> MediaSourceProvidersInfo { get; set; } = [];
[ObservableProperty][NotifyPropertyChangedRecipients] public partial FullyObservableCollection<MappedSongSearchQuery> MappedSongSearchQueries { get; set; } = [];
[ObservableProperty][NotifyPropertyChangedRecipients] public partial FullyObservableCollection<LyricsWindowStatus> WindowBoundsRecords { get; set; } = [];

View File

@@ -1,9 +1,7 @@
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Helper;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.UI;
using System;
using System.Linq;
using Windows.UI;
namespace BetterLyrics.WinUI3.Models.Settings

View File

@@ -233,13 +233,15 @@ namespace BetterLyrics.WinUI3.Renderer
catch (Exception) { }
}
public void CalculateLyrics3DMatrix(LyricsEffectSettings lyricsEffect, double lyricsX, double lyricsY, double lyricsWidth, double canvasHeight)
public void CalculateLyrics3DMatrix(LyricsStyleSettings lyricsStyle, LyricsEffectSettings lyricsEffect, double lyricsX, double lyricsY, double lyricsWidth, double lyricsHeight)
{
if (!lyricsEffect.Is3DLyricsEnabled) return;
var playingLineTopOffsetFactor = lyricsStyle.PlayingLineTopOffset / 100.0;
Vector3 center = new(
(float)(lyricsX + lyricsWidth / 2),
(float)(lyricsY + canvasHeight / 2),
(float)(lyricsY + lyricsHeight * playingLineTopOffsetFactor / 2),
0);
float rotationX = (float)(Math.PI * lyricsEffect.Lyrics3DXAngle / 180.0);

View File

@@ -63,7 +63,7 @@ namespace BetterLyrics.WinUI3.Renderer
float blur,
float opacity)
{
if (opacity <= 0) return;
if (float.IsNaN(opacity) || opacity <= 0) return;
var bounds = layout.LayoutBounds;
var destRect = new Rect(

View File

@@ -1,7 +1,5 @@
using ATL;
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Helper.BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Services.SettingsService;
using Microsoft.Extensions.Logging;
@@ -49,7 +47,7 @@ namespace BetterLyrics.WinUI3.Services.AlbumArtSearchService
switch (provider.Provider)
{
case AlbumArtSearchProvider.Local:
result = SearchFile(songInfo)?.AsBuffer();
result = (await SearchFile(songInfo))?.AsBuffer();
break;
case AlbumArtSearchProvider.SMTC:
result = bufferFromSMTC;
@@ -77,29 +75,73 @@ namespace BetterLyrics.WinUI3.Services.AlbumArtSearchService
return null;
}
private byte[]? SearchFile(SongInfo songInfo)
private async Task<byte[]?> SearchFile(SongInfo songInfo)
{
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
if (!folder.IsEnabled) continue;
try
{
foreach (var file in DirectoryHelper.GetAllFiles(folder.Path))
using var fs = folder.CreateFileSystem();
if (fs == null) continue;
if (!await fs.ConnectAsync()) continue;
// 递归扫描
var foldersToScan = new Queue<string>();
foldersToScan.Enqueue(""); // 根目录
while (foldersToScan.Count > 0)
{
if (FileHelper.MusicExtensions.Contains(Path.GetExtension(file)))
var currentPath = foldersToScan.Dequeue();
var items = await fs.GetFilesAsync(currentPath);
foreach (var item in items)
{
Track track = new(file);
if ((track.Title == songInfo.Title && track.Artist == songInfo.DisplayArtists) || StringHelper.IsSwitchableNormalizedMatch(Path.GetFileNameWithoutExtension(file), songInfo.DisplayArtists, songInfo.Title))
if (item.IsFolder)
{
var bytes = track.EmbeddedPictures.FirstOrDefault()?.PictureData;
if (bytes != null)
foldersToScan.Enqueue(Path.Combine(currentPath, item.Name));
continue;
}
var ext = Path.GetExtension(item.Name).ToLower();
if (FileHelper.MusicExtensions.Contains(ext))
{
try
{
using (var stream = await fs.OpenReadAsync(item.FullPath))
{
var track = new ExtendedTrack(item.FullPath, stream);
bool isMetadataMatch = (track.Title == songInfo.Title && track.Artist == songInfo.DisplayArtists);
bool isFilenameMatch = StringHelper.IsSwitchableNormalizedMatch(
Path.GetFileNameWithoutExtension(item.Name),
songInfo.DisplayArtists,
songInfo.Title
);
if (isMetadataMatch || isFilenameMatch)
{
var bytes = track.EmbeddedPictures.FirstOrDefault()?.PictureData;
if (bytes != null && bytes.Length > 0)
{
return bytes;
}
}
}
}
catch
{
return bytes;
}
}
}
}
}
catch
{
}
}
return null;
}

View File

@@ -2,7 +2,7 @@
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Hooks;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using BetterLyrics.WinUI3.Services.SettingsService;
using BetterLyrics.WinUI3.Views;
using Hqub.Lastfm;
@@ -16,7 +16,7 @@ namespace BetterLyrics.WinUI3.Services.LastFMService
public partial class LastFMService : ILastFMService
{
private readonly ISettingsService _settingsService;
private readonly IResourceService _resourceService;
private readonly ILocalizationService _localizationService;
private readonly LastfmClient _client;
@@ -27,10 +27,10 @@ namespace BetterLyrics.WinUI3.Services.LastFMService
public bool IsAuthenticated { get; private set; }
public LastFMService(ISettingsService settingsService, IResourceService resourceService)
public LastFMService(ISettingsService settingsService, ILocalizationService localizationService)
{
_localizationService = localizationService;
_settingsService = settingsService;
_resourceService = resourceService;
_client = new LastfmClient(Constants.LastFM.ApiKey, Constants.LastFM.SharedSecret);
_client.Session.SessionKey = PasswordVaultHelper.Get(Constants.App.AppName, Constants.LastFM.SessionKeyCredentialKey) ?? string.Empty;
@@ -68,10 +68,10 @@ namespace BetterLyrics.WinUI3.Services.LastFMService
var dialog = new ContentDialog
{
Title = _resourceService.GetLocalizedString("LastFMRequestAuthTitle") ?? "",
Content = _resourceService.GetLocalizedString("LastFMRequestAuthDesc") ?? "",
PrimaryButtonText = _resourceService.GetLocalizedString("LastFMRequestAuthConfirm") ?? "",
CloseButtonText = _resourceService.GetLocalizedString("Cancel") ?? "",
Title = _localizationService.GetLocalizedString("LastFMRequestAuthTitle") ?? "",
Content = _localizationService.GetLocalizedString("LastFMRequestAuthDesc") ?? "",
PrimaryButtonText = _localizationService.GetLocalizedString("LastFMRequestAuthConfirm") ?? "",
CloseButtonText = _localizationService.GetLocalizedString("Cancel") ?? "",
DefaultButton = ContentDialogButton.Close,
XamlRoot = dialogXamlRoot,
};
@@ -95,10 +95,10 @@ namespace BetterLyrics.WinUI3.Services.LastFMService
var dialog = new ContentDialog
{
Title = _resourceService.GetLocalizedString("LastFMRequestUnAuthTitle") ?? "",
Content = _resourceService.GetLocalizedString("LastFMRequestUnAuthDesc") ?? "",
PrimaryButtonText = _resourceService.GetLocalizedString("LastFMRequestUnAuthConfirm") ?? "",
CloseButtonText = _resourceService.GetLocalizedString("Cancel") ?? "",
Title = _localizationService.GetLocalizedString("LastFMRequestUnAuthTitle") ?? "",
Content = _localizationService.GetLocalizedString("LastFMRequestUnAuthDesc") ?? "",
PrimaryButtonText = _localizationService.GetLocalizedString("LastFMRequestUnAuthConfirm") ?? "",
CloseButtonText = _localizationService.GetLocalizedString("Cancel") ?? "",
DefaultButton = ContentDialogButton.Close,
XamlRoot = dialogXamlRoot,
};

View File

@@ -0,0 +1,7 @@
namespace BetterLyrics.WinUI3.Services.LocalizationService
{
public interface ILocalizationService
{
string GetLocalizedString(string id);
}
}

View File

@@ -1,8 +1,8 @@
using Microsoft.Windows.ApplicationModel.Resources;
namespace BetterLyrics.WinUI3.Services.ResourceService
namespace BetterLyrics.WinUI3.Services.LocalizationService
{
public class ResourceService : IResourceService
public class LocalizationService : ILocalizationService
{
private readonly ResourceLoader _resourceLoader = new();

View File

@@ -1,10 +1,8 @@
// 2025/6/23 by Zhe Fang
using ATL;
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Extensions;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Helper.BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Providers;
using BetterLyrics.WinUI3.Services.SettingsService;
@@ -242,7 +240,7 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
lyricsSearchResult = await SearchAmllTtmlDbAsync(songInfo);
break;
case LyricsSearchProvider.LocalMusicFile:
lyricsSearchResult = SearchEmbedded(songInfo);
lyricsSearchResult = await SearchEmbedded(songInfo);
break;
case LyricsSearchProvider.LocalLrcFile:
case LyricsSearchProvider.LocalEslrcFile:
@@ -277,7 +275,9 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
private async Task<LyricsSearchResult> SearchFile(SongInfo songInfo, LyricsFormat format)
{
int maxScore = 0;
string? bestFile = null;
MediaFolder? bestFolder = null;
string? bestFilePath = null;
var lyricsSearchResult = new LyricsSearchResult();
@@ -288,47 +288,97 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
if (!folder.IsEnabled) continue;
try
{
try
using var fs = folder.CreateFileSystem();
if (fs == null) continue;
if (!await fs.ConnectAsync()) continue;
// 递归扫描
var foldersToScan = new Queue<string>();
foldersToScan.Enqueue(""); // 从根目录开始
string targetExt = format.ToFileExtension();
while (foldersToScan.Count > 0)
{
foreach (var file in DirectoryHelper.GetAllFiles(folder.Path, $"*{format.ToFileExtension()}"))
var currentPath = foldersToScan.Dequeue();
var items = await fs.GetFilesAsync(currentPath);
foreach (var item in items)
{
int score = MetadataComparer.CalculateScore(songInfo, new LyricsSearchResult { Reference = file });
if (score > maxScore)
if (item.IsFolder)
{
bestFile = file;
maxScore = score;
foldersToScan.Enqueue(Path.Combine(currentPath, item.Name));
continue;
}
if (item.Name.EndsWith(targetExt, StringComparison.OrdinalIgnoreCase))
{
int score = MetadataComparer.CalculateScore(songInfo, new LyricsSearchResult { Reference = item.FullPath });
if (score > maxScore)
{
maxScore = score;
bestFilePath = item.FullPath;
bestFolder = folder;
}
}
}
}
catch (Exception)
{
}
}
catch (Exception ex)
{
// 日志记录...
}
}
if (bestFile != null)
// 4. 如果找到了最佳匹配,读取内容
if (bestFolder != null && bestFilePath != null)
{
lyricsSearchResult.Reference = bestFile;
lyricsSearchResult.MatchPercentage = maxScore;
string? raw = await File.ReadAllTextAsync(bestFile, FileHelper.GetEncoding(bestFile));
if (raw != null)
try
{
lyricsSearchResult.Raw = raw;
// 重新连接以读取文件 (因为之前的 fs 已经在 using 结束时释放)
using var fs = bestFolder.CreateFileSystem();
if (fs != null && await fs.ConnectAsync())
{
using var stream = await fs.OpenReadAsync(bestFilePath);
// 使用 StreamReader 读取文本
// 注意:这里简单使用 Default 编码,如果需要探测编码(FileHelper.GetEncoding)
// 可能需要先读一部分字节来判断,或者使用带编码探测的库。
using var reader = new StreamReader(stream);
string raw = await reader.ReadToEndAsync();
lyricsSearchResult.Reference = bestFilePath;
lyricsSearchResult.MatchPercentage = maxScore;
lyricsSearchResult.Raw = raw;
}
}
catch (Exception)
{
// 读取失败处理
}
}
return lyricsSearchResult;
}
private LyricsSearchResult SearchEmbedded(SongInfo songInfo)
private async Task<LyricsSearchResult> SearchEmbedded(SongInfo songInfo)
{
int bestScore = 0;
string? bestFile = null;
string? bestFilePath = null;
string? bestRaw = null;
// 用于最后回填 Metadata
string? bestTitle = null;
string[]? bestArtists = null;
string? bestAlbum = null;
double bestDuration = 0;
var lyricsSearchResult = new LyricsSearchResult
{
Provider = LyricsSearchProvider.LocalMusicFile,
@@ -336,49 +386,89 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
if (!folder.IsEnabled) continue;
try
{
foreach (var file in DirectoryHelper.GetAllFiles(folder.Path))
using var fs = folder.CreateFileSystem();
if (fs == null) continue;
if (!await fs.ConnectAsync()) continue;
var foldersToScan = new Queue<string>();
foldersToScan.Enqueue("");
while (foldersToScan.Count > 0)
{
if (FileHelper.MusicExtensions.Contains(Path.GetExtension(file)))
var currentPath = foldersToScan.Dequeue();
var items = await fs.GetFilesAsync(currentPath);
foreach (var item in items)
{
var track = new Track(file);
var raw = track.GetRawLyrics();
if (!string.IsNullOrEmpty(raw))
if (item.IsFolder)
{
int score = MetadataComparer.CalculateScore(songInfo, new LyricsSearchResult
{
Title = track.Title,
Artists = track.Artist.Split(ATL.Settings.DisplayValueSeparator),
Album = track.Album,
Duration = track.Duration,
Reference = file,
});
foldersToScan.Enqueue(Path.Combine(currentPath, item.Name));
continue;
}
if (score > bestScore)
var ext = Path.GetExtension(item.Name).ToLower();
if (FileHelper.MusicExtensions.Contains(ext))
{
try
{
bestScore = score;
bestFile = file;
bestRaw = raw;
using var stream = await fs.OpenReadAsync(item.FullPath);
var track = new ExtendedTrack(item.FullPath, stream);
var raw = track.RawLyrics;
if (!string.IsNullOrEmpty(raw))
{
int score = MetadataComparer.CalculateScore(songInfo, new LyricsSearchResult
{
Title = track.Title,
Artists = track.Artist?.Split(ATL.Settings.DisplayValueSeparator),
Album = track.Album,
Duration = track.Duration,
Reference = item.FullPath,
});
if (score > bestScore)
{
bestScore = score;
bestFilePath = item.FullPath;
bestRaw = raw;
// 缓存当前最佳的元数据,避免最后还需要重新打开文件读一次
bestTitle = track.Title;
bestArtists = track.Artist?.Split(ATL.Settings.DisplayValueSeparator);
bestAlbum = track.Album;
bestDuration = track.Duration;
}
}
}
catch
{
// 单个文件解析失败忽略
}
}
}
}
}
catch
{
// 文件夹扫描失败忽略
}
}
if (bestFile != null)
if (bestFilePath != null)
{
var track = new Track(bestFile);
lyricsSearchResult.Title = track.Title;
lyricsSearchResult.Artists = track.Artist.Split(ATL.Settings.DisplayValueSeparator);
lyricsSearchResult.Album = track.Album;
lyricsSearchResult.Duration = track.Duration;
// 直接使用缓存的数据,不需要 new Track(bestFile) 了
lyricsSearchResult.Title = bestTitle;
lyricsSearchResult.Artists = bestArtists;
lyricsSearchResult.Album = bestAlbum;
lyricsSearchResult.Duration = bestDuration;
lyricsSearchResult.Raw = bestRaw;
lyricsSearchResult.Reference = bestFile;
lyricsSearchResult.Reference = bestFilePath;
lyricsSearchResult.MatchPercentage = bestScore;
}
@@ -560,13 +650,14 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
}
ISearchResult? result;
if (searcher == Searchers.Netease && songInfo.SongId != null)
if (songInfo.SongId != null && searcher == Searchers.Netease && PlayerIDHelper.IsNeteaseFamily(songInfo.PlayerId))
{
result = new NeteaseSearchResult("", [], "", [], 0, songInfo.SongId);
result = new NeteaseSearchResult(songInfo.Title, songInfo.Artists, songInfo.Album, [], (int)songInfo.DurationMs, songInfo.SongId);
}
else if (searcher == Searchers.QQMusic && songInfo.SongId != null)
else if (songInfo.SongId != null && searcher == Searchers.QQMusic && songInfo.PlayerId == Constants.PlayerID.QQMusic)
{
result = new QQMusicSearchResult("", [], "", [], 0, songInfo.SongId, "");
result = new QQMusicSearchResult(songInfo.Title, songInfo.Artists, songInfo.Album, [], (int)songInfo.DurationMs, songInfo.SongId, "");
}
else
{

View File

@@ -63,7 +63,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool CurrentIsPlaying { get; private set; } = false;
[ObservableProperty][NotifyPropertyChangedRecipients] public partial TimeSpan CurrentPosition { get; private set; } = TimeSpan.Zero;
[ObservableProperty][NotifyPropertyChangedRecipients] public partial SongInfo? CurrentSongInfo { get; private set; }
[ObservableProperty][NotifyPropertyChangedRecipients] public partial SongInfo? CurrentSongInfo { get; private set; } = SongInfoExtensions.Placeholder;
[ObservableProperty] public partial MediaSourceProviderInfo? CurrentMediaSourceProviderInfo { get; set; }
@@ -331,9 +331,9 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
CurrentSongInfo = new SongInfo
{
Title = mediaProperties?.Title ?? "",
Artists = fixedArtist?.SplitByCommonSplitter() ?? [],
Album = fixedAlbum ?? "",
Title = mediaProperties?.Title ?? "N/A",
Artists = fixedArtist?.SplitByCommonSplitter() ?? ["N/A"],
Album = fixedAlbum ?? "N/A",
DurationMs = mediaSession?.ControlSession?.GetTimelineProperties().EndTime.TotalMilliseconds ?? 0,
PlayerId = sessionId,
SongId = songId,

View File

@@ -1,7 +0,0 @@
namespace BetterLyrics.WinUI3.Services.ResourceService
{
public interface IResourceService
{
string GetLocalizedString(string id);
}
}

View File

@@ -7,7 +7,6 @@ namespace BetterLyrics.WinUI3.Services.SettingsService
public interface ISettingsService
{
AppSettings AppSettings { get; set; }
// App behavior
bool ImportSettings(string importPath);
void ExportSettings(string exportPath);

View File

@@ -7,12 +7,15 @@ using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Models.Settings;
using BetterLyrics.WinUI3.Serialization;
using BetterLyrics.WinUI3.Services.LocalizationService;
using BetterLyrics.WinUI3.ViewModels;
using CommunityToolkit.WinUI;
using Microsoft.UI.Dispatching;
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using Windows.ApplicationModel.Resources;
using Windows.Globalization;
namespace BetterLyrics.WinUI3.Services.SettingsService

View File

@@ -1,6 +1,4 @@
using BetterLyrics.WinUI3.Models;
using System.Collections.Generic;
using System.Threading;
using System.Threading;
using System.Threading.Tasks;
namespace BetterLyrics.WinUI3.Services.TranslationService

View File

@@ -1,10 +1,8 @@
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Serialization;
using BetterLyrics.WinUI3.Services.SettingsService;
using BetterLyrics.WinUI3.ViewModels;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading;
using System.Threading.Tasks;
namespace BetterLyrics.WinUI3.Services.TransliterationService

View File

@@ -1,15 +1,11 @@
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Serialization;
using BetterLyrics.WinUI3.Services.SettingsService;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Vanara.PInvoke;
namespace BetterLyrics.WinUI3.Services.TransliterationService
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -59,46 +59,46 @@
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
<xsd:element name="value" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
<xsd:attribute name="name" use="required" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="mimetype" type="xsd:string"/>
<xsd:attribute ref="xml:space"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="alias" type="xsd:string"/>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
<xsd:attribute ref="xml:space"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
@@ -120,6 +120,9 @@
<data name="ActionCompleted" xml:space="preserve">
<value>操作完成</value>
</data>
<data name="Add" xml:space="preserve">
<value>添加</value>
</data>
<data name="AlbumArtSearchLocalProvider" xml:space="preserve">
<value>本地音乐文件</value>
</data>
@@ -133,7 +136,7 @@
<value>窗口</value>
</data>
<data name="ArtistsSplitHint.Text" xml:space="preserve">
<value>入多位艺术家时请以下述一种分隔符分隔(不要混用)</value>
<value>入多位艺术家时,请使用以下分隔符之一进行分隔(请勿混合使用)</value>
</data>
<data name="BaseWindowHostInfoBarCheckBox.Content" xml:space="preserve">
<value>不再显示此消息</value>
@@ -145,7 +148,7 @@
<value>取消</value>
</data>
<data name="Copy.Content" xml:space="preserve">
<value>拷贝</value>
<value>复制</value>
</data>
<data name="CreatePlaylistSuccessfully" xml:space="preserve">
<value>播放列表创建成功</value>
@@ -247,10 +250,10 @@
<value>歌词语言</value>
</data>
<data name="LyricsPageLyricsProviderPrefix.Header" xml:space="preserve">
<value>歌词来源</value>
<value>歌词提供方</value>
</data>
<data name="LyricsPageLyricsSearch.Text" xml:space="preserve">
<value>手动索歌词</value>
<value>手动索歌词</value>
</data>
<data name="LyricsPageLyricsSettings.Text" xml:space="preserve">
<value>歌词窗口管理快捷设置</value>
@@ -268,10 +271,7 @@
<value>设置</value>
</data>
<data name="LyricsPageTimelineOffsetButtonToolTip.Content" xml:space="preserve">
<value>歌词时间偏移</value>
</data>
<data name="LyricsPageTitle" xml:space="preserve">
<value>BetterLyrics</value>
<value>歌词时间偏移</value>
</data>
<data name="LyricsPageTranslationEnabled.Description" xml:space="preserve">
<value>将优先读取歌词内翻译,若无匹配则向 LibreTranslate 服务器请求机器翻译</value>
@@ -283,10 +283,10 @@
<value>仅显示翻译</value>
</data>
<data name="LyricsPageTranslationProviderPrefix.Header" xml:space="preserve">
<value>翻译来源</value>
<value>翻译提供方</value>
</data>
<data name="LyricsPageTransliterationProviderPrefix.Header" xml:space="preserve">
<value>音译来源</value>
<value>音译提供方</value>
</data>
<data name="LyricsParseError" xml:space="preserve">
<value>歌词解析失败</value>
@@ -304,7 +304,7 @@
<value>时长</value>
</data>
<data name="LyricsSearchControlHelp.Text" xml:space="preserve">
<value>* 保存更改立即生效,此后将以映射信息和目标歌词源检索该曲目歌词;标记为纯音乐将直接返回纯音乐占位歌词。重置以按原始数据检索。</value>
<value>* 保存更改立即生效,随后歌曲歌词将通过映射信息和目标歌词进行检索;标记为纯音乐将直接恢复为纯音乐占位歌词。重置后将恢复原始数据检索。</value>
</data>
<data name="LyricsSearchControlIgnoreCache.Header" xml:space="preserve">
<value>搜索时忽略缓存</value>
@@ -331,7 +331,7 @@
<value>歌曲信息映射</value>
</data>
<data name="LyricsSearchControlTargetSearchProvider.Header" xml:space="preserve">
<value>目标歌词搜索提供</value>
<value>目标歌词搜索提供</value>
</data>
<data name="LyricsSearchControlTitle.Header" xml:space="preserve">
<value>标题</value>
@@ -361,7 +361,7 @@
<value>歌词窗口模式</value>
</data>
<data name="LyricsWindowSettingsControlSetDefault.Text" xml:space="preserve">
<value>设为默认</value>
<value>设为默认</value>
</data>
<data name="LyricsWindowSettingsControlShare.Text" xml:space="preserve">
<value>导出</value>
@@ -370,13 +370,13 @@
<value>歌词窗口切换器</value>
</data>
<data name="LyricsWindowSwitchWindowHelp.Text" xml:space="preserve">
<value>转到“设置”以添加更多模式</value>
<value>转到 “设置” 以添加更多模式</value>
</data>
<data name="LyricsWindowSwitchWindowTitle" xml:space="preserve">
<value>歌词窗口切换器</value>
</data>
<data name="MainPageAlbumArtOnly.Content" xml:space="preserve">
<value>仅显示专辑区域</value>
<value>仅显示专辑封面区域</value>
</data>
<data name="MainPageEnterImmersiveModeHint" xml:space="preserve">
<value>再次悬停以显示切换按钮</value>
@@ -394,16 +394,13 @@
<value>歌词时间轴偏移</value>
</data>
<data name="MainPageSplitView.Content" xml:space="preserve">
<value>分视图</value>
</data>
<data name="MainPageWelcomeTeachingTip.Title" xml:space="preserve">
<value>欢迎使用 BetterLyrics</value>
<value>分视图</value>
</data>
<data name="MusicGalleryPageAddToCustomList.Text" xml:space="preserve">
<value>添加到播放列表</value>
</data>
<data name="MusicGalleryPageAddToEnd.Text" xml:space="preserve">
<value>列表的尾</value>
<value>列表的尾</value>
</data>
<data name="MusicGalleryPageAddToNext.Text" xml:space="preserve">
<value>下一个项目</value>
@@ -412,7 +409,7 @@
<value>添加到播放队列</value>
</data>
<data name="MusicGalleryPageAllSongs" xml:space="preserve">
<value>所有歌曲</value>
<value>所有音乐</value>
</data>
<data name="MusicGalleryPageEmptyPlayingQueue.Text" xml:space="preserve">
<value>清除播放队列</value>
@@ -433,7 +430,7 @@
<value>比特率</value>
</data>
<data name="MusicGalleryPageFileInfoDuration.Header" xml:space="preserve">
<value>期间</value>
<value>时长</value>
</data>
<data name="MusicGalleryPageFileInfoEncoder.Header" xml:space="preserve">
<value>编码器</value>
@@ -448,7 +445,7 @@
<value>路径</value>
</data>
<data name="MusicGalleryPageFileInfoSampleRate.Header" xml:space="preserve">
<value>样率</value>
<value>样率</value>
</data>
<data name="MusicGalleryPageFileInfoTitle.Header" xml:space="preserve">
<value>标题</value>
@@ -472,7 +469,7 @@
<value>播放队列</value>
</data>
<data name="MusicGalleryPagePlayingQueueEmpty.Text" xml:space="preserve">
<value>播放队列是空的</value>
<value>播放队列为空</value>
</data>
<data name="MusicGalleryPagePlaylist.Text" xml:space="preserve">
<value>播放列表</value>
@@ -487,13 +484,13 @@
<value>从播放列表中删除</value>
</data>
<data name="MusicGalleryPageRemoveFromPlayingQueue.Text" xml:space="preserve">
<value>从播放列表移除</value>
<value>从播放队列删除</value>
</data>
<data name="MusicGalleryPageScrollToPlayingItem.Text" xml:space="preserve">
<value>定位到播放项</value>
<value>滚动到播放项</value>
</data>
<data name="MusicGalleryPageSelectAll.Content" xml:space="preserve">
<value>选择全部</value>
<value>选择所有</value>
</data>
<data name="MusicGalleryPageSingleLoop.Text" xml:space="preserve">
<value>单曲循环</value>
@@ -517,7 +514,7 @@
<value>排序类型</value>
</data>
<data name="MusicGalleryPageStarredPlaylist.Content" xml:space="preserve">
<value>已加星标的歌单</value>
<value>已加星标的播放列表</value>
</data>
<data name="MusicGalleryPageStopTrack.Text" xml:space="preserve">
<value>停止</value>
@@ -546,6 +543,24 @@
<data name="PrivacyPolicy.Content" xml:space="preserve">
<value>隐私政策</value>
</data>
<data name="RemoteServerConfigControlPassword.Header" xml:space="preserve">
<value>密码</value>
</data>
<data name="RemoteServerConfigControlPath.Header" xml:space="preserve">
<value>路径</value>
</data>
<data name="RemoteServerConfigControlPort.Header" xml:space="preserve">
<value>端口</value>
</data>
<data name="RemoteServerConfigControlServerAddress.Header" xml:space="preserve">
<value>服务器地址</value>
</data>
<data name="RemoteServerConfigControlServerAddressRequired" xml:space="preserve">
<value>服务器地址为必填项</value>
</data>
<data name="RemoteServerConfigControlUsername.Header" xml:space="preserve">
<value>用户名</value>
</data>
<data name="Romaji" xml:space="preserve">
<value>罗马音</value>
</data>
@@ -582,20 +597,11 @@
<data name="SettingsPageAbout.Content" xml:space="preserve">
<value>关于</value>
</data>
<data name="SettingsPageAcrylicBase.Content" xml:space="preserve">
<value>亚克力(基础)</value>
</data>
<data name="SettingsPageAcrylicThin.Content" xml:space="preserve">
<value>亚克力(薄层)</value>
</data>
<data name="SettingsPageAdaptEnvColor.Description" xml:space="preserve">
<value>开启该项将覆盖歌词背景设置中的主题设置</value>
</data>
<data name="SettingsPageAdaptEnvColor.Header" xml:space="preserve">
<value>适应环境色</value>
</data>
<data name="SettingsPageAddFolder.Header" xml:space="preserve">
<value>添加文件夹</value>
<value>适应环境色</value>
</data>
<data name="SettingsPageAddFolderButton.Content" xml:space="preserve">
<value>添加</value>
@@ -607,22 +613,22 @@
<value>专辑</value>
</data>
<data name="SettingsPageAlbumArt.Text" xml:space="preserve">
<value>专辑</value>
<value>专辑封面</value>
</data>
<data name="SettingsPageAlbumArtHeight.Header" xml:space="preserve">
<value>专辑图片高度</value>
<value>专辑封面高度</value>
</data>
<data name="SettingsPageAlbumArtLayer.Header" xml:space="preserve">
<value>专辑艺术图层</value>
<value>专辑封面层</value>
</data>
<data name="SettingsPageAlbumArtSearchProvidersConfig.Text" xml:space="preserve">
<value>配置专辑封面源</value>
</data>
<data name="SettingsPageAlbumArtSize.Header" xml:space="preserve">
<value>专辑封面尺寸</value>
<value>专辑封面大小</value>
</data>
<data name="SettingsPageAlbumEffect.Text" xml:space="preserve">
<value>专辑区域动效</value>
<value>专辑封面效果</value>
</data>
<data name="SettingsPageAlbumLib.Content" xml:space="preserve">
<value>专辑封面源</value>
@@ -631,10 +637,10 @@
<value>圆角半径</value>
</data>
<data name="SettingsPageAlbumShadowAmount.Header" xml:space="preserve">
<value>阴影扩散程度</value>
<value>阴影扩散</value>
</data>
<data name="SettingsPageAlbumStyle.Text" xml:space="preserve">
<value>专辑区域样式</value>
<value>专辑封面区域样式</value>
</data>
<data name="SettingsPageAlignment.Header" xml:space="preserve">
<value>对齐方式</value>
@@ -652,7 +658,7 @@
<value>将歌词窗口置于顶层</value>
</data>
<data name="SettingsPageApp.Content" xml:space="preserve">
<value>应用外观行为</value>
<value>应用外观行为</value>
</data>
<data name="SettingsPageAppAppearance.Text" xml:space="preserve">
<value>应用外观</value>
@@ -670,10 +676,10 @@
<value>自动调整</value>
</data>
<data name="SettingsPageAutoOpenLyricsWindow.Header" xml:space="preserve">
<value>程序启动时自动打开默认歌词窗口</value>
<value>启动时自动打开默认歌词窗口</value>
</data>
<data name="SettingsPageAutoOpenMusicGalleryWindow.Header" xml:space="preserve">
<value>应用程序启动时打开音乐库窗口</value>
<value>启动时打开音乐库窗口</value>
</data>
<data name="SettingsPageAutoPlayWhenOpenMusicGalleryWindow.Header" xml:space="preserve">
<value>打开音乐库窗口时自动继续播放</value>
@@ -682,29 +688,20 @@
<value>自动启动</value>
</data>
<data name="SettingsPageAutoStartWindow.Header" xml:space="preserve">
<value>启动应用时</value>
<value>启动应用程序时</value>
</data>
<data name="SettingsPageBackdrop.Header" xml:space="preserve">
<value>歌词背景材质</value>
</data>
<data name="SettingsPageBackgroundAcrylicEffectAmount.Header" xml:space="preserve">
<value>专辑背景亚克力效果强度</value>
</data>
<data name="SettingsPageBackgroundOverlay.Text" xml:space="preserve">
<value>歌词背景</value>
</data>
<data name="SettingsPageBlurAmount.Header" xml:space="preserve">
<value>模糊</value>
<value>模糊</value>
</data>
<data name="SettingsPageBorderless.Header" xml:space="preserve">
<value>无边框窗口</value>
</data>
<data name="SettingsPageBorderlessHotKey.Header" xml:space="preserve">
<value>无边框歌词窗口快捷方式</value>
</data>
<data name="SettingsPageBottomGapFactor.Header" xml:space="preserve">
<value>底部间隙高度因子</value>
</data>
<data name="SettingsPageCache.Description" xml:space="preserve">
<value>包括日志文件,网络歌词缓存</value>
</data>
@@ -735,12 +732,6 @@
<data name="SettingsPageClearCache.Content" xml:space="preserve">
<value>清除缓存文件</value>
</data>
<data name="SettingsPageClickThrough.Header" xml:space="preserve">
<value>点击穿透</value>
</data>
<data name="SettingsPageClickThroughHotKey.Header" xml:space="preserve">
<value>点击穿透快捷键</value>
</data>
<data name="SettingsPageCloseStatus.Text" xml:space="preserve">
<value>关闭</value>
</data>
@@ -760,7 +751,7 @@
<value>配置播放源</value>
</data>
<data name="SettingsPageCreateFromCurrent.Text" xml:space="preserve">
<value>拷贝</value>
<value>复制</value>
</data>
<data name="SettingsPageCreateFromTemplates.Content" xml:space="preserve">
<value>从模板创建</value>
@@ -789,9 +780,6 @@
<data name="SettingsPageDisclaimer.Message" xml:space="preserve">
<value>本项目按原样提供,不提供任何形式的保证。所有歌词、字体、图标和其他第三方资源均为其各自版权所有者的财产。本项目的作者不主张此类资源的所有权。本项目为非商业性项目,不得用于侵犯任何权利。用户有责任确保自己的使用符合适用的法律和许可。</value>
</data>
<data name="SettingsPageDiscord.Content" xml:space="preserve">
<value>Discord</value>
</data>
<data name="SettingsPageDiscordPresence.Header" xml:space="preserve">
<value>通过 Discord Presence 显示收听状态</value>
</data>
@@ -805,7 +793,7 @@
<value>目标显示器</value>
</data>
<data name="SettingsPageDockPlacement.Header" xml:space="preserve">
<value>工作区位置</value>
<value>工作区位置</value>
</data>
<data name="SettingsPageDockPlacementBottom.Content" xml:space="preserve">
<value>底部</value>
@@ -817,7 +805,7 @@
<value>窗口高度</value>
</data>
<data name="SettingsPageDragArea.Header" xml:space="preserve">
<value>可拖区域</value>
<value>可拖区域</value>
</data>
<data name="SettingsPageEasingFuncType.Header" xml:space="preserve">
<value>缓动动画类型</value>
@@ -864,9 +852,6 @@
<data name="SettingsPageEffectScopeLongDurationSyllable.Content" xml:space="preserve">
<value>长时间音节</value>
</data>
<data name="SettingsPageEN.Content" xml:space="preserve">
<value>English</value>
</data>
<data name="SettingsPageEnvColorSample.Header" xml:space="preserve">
<value>环境色彩采样模式</value>
</data>
@@ -898,7 +883,7 @@
<value>扇形歌词</value>
</data>
<data name="SettingsPageFAQ.Content" xml:space="preserve">
<value>常见问题与解答</value>
<value>常见问题</value>
</data>
<data name="SettingsPageFixedTimeStep.Header" xml:space="preserve">
<value>固定时间步长渲染</value>
@@ -922,7 +907,7 @@
<value>强制置于顶层</value>
</data>
<data name="SettingsPageForceWordByWordEffect.Description" xml:space="preserve">
<value>即使当前歌词没有逐字信息,也会迫使其模拟逐字效果</value>
<value>即使当前歌词没有逐字信息,仍强制模拟逐字效果</value>
</data>
<data name="SettingsPageForceWordByWordEffect.Header" xml:space="preserve">
<value>强制启用逐字歌词效果</value>
@@ -933,17 +918,17 @@
<data name="SettingsPageFullscreenMode.Text" xml:space="preserve">
<value>全屏模式</value>
</data>
<data name="SettingsPageGeneralLayoutFactor.Text" xml:space="preserve">
<value>一般布局系数</value>
</data>
<data name="SettingsPageHeight.Header" xml:space="preserve">
<value>高度</value>
</data>
<data name="SettingsPageHello.Text" xml:space="preserve">
<value>您好</value>
</data>
<data name="SettingsPageHelpUsTranslate.Content" xml:space="preserve">
<value>帮助我们翻译此应用程序</value>
</data>
<data name="SettingsPageHideWindow.Description" xml:space="preserve">
<value>音乐未播放/播放时自动隐藏/显示歌词窗口</value>
<value>音乐停止播放时自动隐藏/显示歌词窗口</value>
</data>
<data name="SettingsPageHideWindow.Header" xml:space="preserve">
<value>自动隐藏/显示窗口</value>
@@ -951,11 +936,8 @@
<data name="SettingsPageHoldDragSort.Content" xml:space="preserve">
<value>按住此处并拖动以排序</value>
</data>
<data name="SettingsPageHorizontalLayoutFactor.Text" xml:space="preserve">
<value>水平布局系数</value>
</data>
<data name="SettingsPageImageSwitchType.Header" xml:space="preserve">
<value>专辑切换动画</value>
<value>专辑封面切换动画</value>
</data>
<data name="SettingsPageImport.Content" xml:space="preserve">
<value>导入</value>
@@ -966,9 +948,6 @@
<data name="SettingsPageImportSettingsInfo.Content" xml:space="preserve">
<value>导入成功后,该程序将自动重新启动</value>
</data>
<data name="SettingsPageJA.Content" xml:space="preserve">
<value>日本語</value>
</data>
<data name="SettingsPageJapanese.Description" xml:space="preserve">
<value>将优先读取歌词内音译,若无匹配则向 cutlet-docker 服务器请求机器音译</value>
</data>
@@ -979,25 +958,16 @@
<value>立即加入</value>
</data>
<data name="SettingsPageJyutping.Content" xml:space="preserve">
<value>广东话拼音</value>
</data>
<data name="SettingsPageKO.Content" xml:space="preserve">
<value>한국어</value>
<value>粤语拼音</value>
</data>
<data name="SettingsPageLanguage.Header" xml:space="preserve">
<value>语言</value>
</data>
<data name="SettingsPageLastFM.Text" xml:space="preserve">
<value>Last.fm</value>
</data>
<data name="SettingsPageLastFMAuth.Content" xml:space="preserve">
<value>授权</value>
</data>
<data name="SettingsPageLastFMManager.Header" xml:space="preserve">
<value>Last.fm</value>
</data>
<data name="SettingsPageLastFMPlaycount.Header" xml:space="preserve">
<value>听歌总数量</value>
<value>总播放次数</value>
</data>
<data name="SettingsPageLastFMRefresh.Content" xml:space="preserve">
<value>刷新</value>
@@ -1029,9 +999,6 @@
<data name="SettingsPageLeft.Content" xml:space="preserve">
<value>靠左</value>
</data>
<data name="SettingsPageLeftGapFactor.Header" xml:space="preserve">
<value>左间隙区域宽度因子</value>
</data>
<data name="SettingsPageLibreTranslateServer.Header" xml:space="preserve">
<value>服务器地址</value>
</data>
@@ -1044,6 +1011,9 @@
<data name="SettingsPageListenNewSession.Header" xml:space="preserve">
<value>启用对新播放源的监听</value>
</data>
<data name="SettingsPageLocalFolder.Text" xml:space="preserve">
<value>本地文件夹</value>
</data>
<data name="SettingsPageLog.Header" xml:space="preserve">
<value>日志记录</value>
</data>
@@ -1063,13 +1033,13 @@
<value>歌词背景</value>
</data>
<data name="SettingsPageLyricsBgFontColor.Header" xml:space="preserve">
<value>非当前播放行</value>
<value>非当前行</value>
</data>
<data name="SettingsPageLyricsBlack.Content" xml:space="preserve">
<value>黑体</value>
</data>
<data name="SettingsPageLyricsBlurEffect.Description" xml:space="preserve">
<value>非当前行启用模糊效果</value>
<value>非当前行启用模糊</value>
</data>
<data name="SettingsPageLyricsBlurEffect.Header" xml:space="preserve">
<value>模糊效果</value>
@@ -1080,11 +1050,8 @@
<data name="SettingsPageLyricsCenterTopOffset.Header" xml:space="preserve">
<value>当前行位置</value>
</data>
<data name="SettingsPageLyricsColFactor.Header" xml:space="preserve">
<value>歌词区域宽度因子</value>
</data>
<data name="SettingsPageLyricsEffect.Text" xml:space="preserve">
<value>歌词效</value>
<value>歌词效</value>
</data>
<data name="SettingsPageLyricsExtraBlack.Content" xml:space="preserve">
<value>超黑</value>
@@ -1096,13 +1063,13 @@
<value>超细</value>
</data>
<data name="SettingsPageLyricsFadeOutEffect.Description" xml:space="preserve">
<value>非当前行启用淡出效果</value>
<value>非当前行启用淡入淡出效果</value>
</data>
<data name="SettingsPageLyricsFadeOutEffect.Header" xml:space="preserve">
<value>淡出效果</value>
</data>
<data name="SettingsPageLyricsFgFontColor.Header" xml:space="preserve">
<value>当前播放行</value>
<value>当前行</value>
</data>
<data name="SettingsPageLyricsFgFontColorAdaptiveColored.Content" xml:space="preserve">
<value>适应歌词背景(彩色)</value>
@@ -1126,7 +1093,7 @@
<value>自定义</value>
</data>
<data name="SettingsPageLyricsFontFamily.Header" xml:space="preserve">
<value>字体家族</value>
<value>字体系列</value>
</data>
<data name="SettingsPageLyricsFontSize.Header" xml:space="preserve">
<value>字体大小</value>
@@ -1135,10 +1102,10 @@
<value>歌词描边宽度</value>
</data>
<data name="SettingsPageLyricsFontWeight.Header" xml:space="preserve">
<value>字体粗细</value>
<value>字</value>
</data>
<data name="SettingsPageLyricsGlowEffect.Header" xml:space="preserve">
<value>光效果</value>
<value>光效果</value>
</data>
<data name="SettingsPageLyricsHighlight.Header" xml:space="preserve">
<value>高亮</value>
@@ -1176,9 +1143,6 @@
<data name="SettingsPageLyricsOutOfSightEffect.Header" xml:space="preserve">
<value>远离视野</value>
</data>
<data name="SettingsPageLyricsRowFactor.Header" xml:space="preserve">
<value>歌词区域高度因子</value>
</data>
<data name="SettingsPageLyricsScaleEffect.Description" xml:space="preserve">
<value>为持续时间较长的音节启用缩放</value>
</data>
@@ -1219,7 +1183,7 @@
<value>歌词时间轴同步</value>
</data>
<data name="SettingsPageLyricsTimelineThreshold.Description" xml:space="preserve">
<value>当歌词进度抖动时,请尝试增加该阈值;更改此值会导致歌词同步偏差</value>
<value>当歌词进度抖动时,请尝试增加该阈值;更改此值会导致歌词同步出现偏差</value>
</data>
<data name="SettingsPageLyricsTimelineThreshold.Header" xml:space="preserve">
<value>歌词时间轴同步阈值</value>
@@ -1237,13 +1201,13 @@
<value>歌词窗口</value>
</data>
<data name="SettingsPageLyricsWindowManager.Text" xml:space="preserve">
<value>歌词窗口管理</value>
<value>歌词窗口管理</value>
</data>
<data name="SettingsPageLyricsWindowMgr.Content" xml:space="preserve">
<value>歌词窗口管理</value>
<value>歌词窗口管理</value>
</data>
<data name="SettingsPageLyricsWindowSwitchHotKey.Header" xml:space="preserve">
<value>歌词窗口状态切换快捷方式</value>
<value>歌词窗口状态切换快捷</value>
</data>
<data name="SettingsPageLyricsWindowToolTip.Content" xml:space="preserve">
<value>歌词窗口</value>
@@ -1263,18 +1227,6 @@
<data name="SettingsPageMediaSourceProvidersConfig.Header" xml:space="preserve">
<value>监听此播放源</value>
</data>
<data name="SettingsPageMica.Content" xml:space="preserve">
<value>云母</value>
</data>
<data name="SettingsPageMicaAlt.Content" xml:space="preserve">
<value>云母(替代样式)</value>
</data>
<data name="SettingsPageMiddleGapColFactor.Header" xml:space="preserve">
<value>中间区域间隙宽度系数</value>
</data>
<data name="SettingsPageMiddleGapRowFactor.Header" xml:space="preserve">
<value>中间间隙区域高度系数</value>
</data>
<data name="SettingsPageMockMusicPlaying.Header" xml:space="preserve">
<value>播放测试音乐</value>
</data>
@@ -1287,6 +1239,9 @@
<data name="SettingsPageMusicGalleryLyrics.Header" xml:space="preserve">
<value>音乐库内嵌歌词窗口</value>
</data>
<data name="SettingsPageMusicGalleryOpened.Message" xml:space="preserve">
<value>音乐库窗口处于开启状态,已忽略对其他播放源的监听</value>
</data>
<data name="SettingsPageMusicLib.Description" xml:space="preserve">
<value>添加存放音乐或歌词的文件夹</value>
</data>
@@ -1300,7 +1255,7 @@
<value>窄屏模式</value>
</data>
<data name="SettingsPageNextSongHotKey.Header" xml:space="preserve">
<value>下一曲目快捷键</value>
<value>下一曲目快捷键</value>
</data>
<data name="SettingsPageNoBackdrop.Content" xml:space="preserve">
<value>无</value>
@@ -1342,7 +1297,7 @@
<value>歌词注音</value>
</data>
<data name="SettingsPagePhoneticText.Header" xml:space="preserve">
<value>注音</value>
<value>发音标示</value>
</data>
<data name="SettingsPagePinToTaskbar.Header" xml:space="preserve">
<value>固定到任务栏</value>
@@ -1372,14 +1327,11 @@
<value>播放与暂停快捷键</value>
</data>
<data name="SettingsPagePreviousSongHotKey.Header" xml:space="preserve">
<value>上一曲目快捷键</value>
<value>上一曲目快捷键</value>
</data>
<data name="SettingsPagePureLayer.Header" xml:space="preserve">
<value>纯色层</value>
</data>
<data name="SettingsPageQQGroup.Content" xml:space="preserve">
<value>QQ 反馈交流群</value>
</data>
<data name="SettingsPageRealtimeStatus.Text" xml:space="preserve">
<value>实时状态</value>
</data>
@@ -1410,15 +1362,9 @@
<data name="SettingsPageRight.Content" xml:space="preserve">
<value>靠右</value>
</data>
<data name="SettingsPageRightGapFactor.Header" xml:space="preserve">
<value>右间隙区域宽度因子</value>
</data>
<data name="SettingsPageRomaji.Header" xml:space="preserve">
<value>日语注音</value>
</data>
<data name="SettingsPageSC.Content" xml:space="preserve">
<value>简体中文</value>
</data>
<data name="SettingsPageScope.Header" xml:space="preserve">
<value>范围</value>
</data>
@@ -1516,7 +1462,7 @@
<value>频谱位置</value>
</data>
<data name="SettingsPageSpectrumLayerStyle.Header" xml:space="preserve">
<value>频谱风格</value>
<value>频谱样式</value>
</data>
<data name="SettingsPageSpectrumPlacementBottom.Content" xml:space="preserve">
<value>底部</value>
@@ -1540,7 +1486,7 @@
<value>启动</value>
</data>
<data name="SettingsPageStopTrackOnGalleryWindowClosed.Header" xml:space="preserve">
<value>关闭音乐库时停止播放</value>
<value>关闭音乐库窗口时停止播放</value>
</data>
<data name="SettingsPageStrokeFontColor.Header" xml:space="preserve">
<value>描边颜色</value>
@@ -1557,12 +1503,6 @@
<data name="SettingsPageTaskbarPlacement.Header" xml:space="preserve">
<value>任务栏固定位置</value>
</data>
<data name="SettingsPageTC.Content" xml:space="preserve">
<value>繁體中文</value>
</data>
<data name="SettingsPageTelegram.Content" xml:space="preserve">
<value>Telegram</value>
</data>
<data name="SettingsPageThanksForPurchasing.Text" xml:space="preserve">
<value>感谢您购买 BetterLyrics</value>
</data>
@@ -1590,15 +1530,6 @@
<data name="SettingsPageToggleHotKey.Header" xml:space="preserve">
<value>切入与切出快捷键</value>
</data>
<data name="SettingsPageTopGapFactor.Header" xml:space="preserve">
<value>顶部间隙区域高度因子</value>
</data>
<data name="SettingsPageTrackSummaryColFactor.Header" xml:space="preserve">
<value>曲目摘要区域宽度因子</value>
</data>
<data name="SettingsPageTrackSummaryRowFactor.Header" xml:space="preserve">
<value>曲目摘要区域高度系数</value>
</data>
<data name="SettingsPageTranslatedText.Header" xml:space="preserve">
<value>译文</value>
</data>
@@ -1611,18 +1542,12 @@
<data name="SettingsPageTranslationInfoLink.Text" xml:space="preserve">
<value>访问 https://github.com/LibreTranslate/LibreTranslate 获取安装教程及更多信息(本软件与该翻译服务无任何联系)</value>
</data>
<data name="SettingsPageTransparent.Content" xml:space="preserve">
<value>透明</value>
</data>
<data name="SettingsPageUserWhoPurchased.Text" xml:space="preserve">
<value>以及购买支持 BetterLyrics 的用户</value>
</data>
<data name="SettingsPageVersion.Text" xml:space="preserve">
<value>版本号</value>
</data>
<data name="SettingsPageVerticalLayoutFactor.Text" xml:space="preserve">
<value>垂直布局系数</value>
</data>
<data name="SettingsPageWesternChar.Header" xml:space="preserve">
<value>拉丁字母</value>
</data>
@@ -1630,19 +1555,19 @@
<value>宽度</value>
</data>
<data name="SettingsPageWindowBounds.Header" xml:space="preserve">
<value>窗口边</value>
<value>窗口边</value>
</data>
<data name="SettingsPageWorkArea.Description" xml:space="preserve">
<value>作为一个独的工作区停靠屏幕上/下边缘</value>
<value>作为一个独的工作区停靠屏幕上/下边缘</value>
</data>
<data name="SettingsPageWorkArea.Header" xml:space="preserve">
<value>工作区</value>
<value>作为工作区</value>
</data>
<data name="SettingsPageWorkAreaHeight.Header" xml:space="preserve">
<value>工作区高度</value>
<value>工作区高度</value>
</data>
<data name="SettingsPageYouNowUsing.Text" xml:space="preserve">
<value>正在使用软件的</value>
<value>正在使用软件的</value>
</data>
<data name="StandardMode" xml:space="preserve">
<value>标准模式</value>
@@ -1686,9 +1611,6 @@
<data name="TracksAddToPlaylistSuccessfully" xml:space="preserve">
<value>所选曲目已添加到此播放列表</value>
</data>
<data name="TranslateServerNotSet" xml:space="preserve">
<value>未设置Translate服务器请先在设置中进行配置</value>
</data>
<data name="TryRunMultipleInstance" xml:space="preserve">
<value>BetterLyrics 已经在运行</value>
</data>

View File

@@ -37,9 +37,6 @@ namespace BetterLyrics.WinUI3.ViewModels
[ObservableProperty]
public partial ObservableCollection<LyricsData>? LyricsDataArr { get; set; }
[ObservableProperty]
public partial LyricsLine? SelectedLyricsLine { get; set; }
[ObservableProperty]
public partial MappedSongSearchQuery? MappedSongSearchQuery { get; set; }
@@ -99,6 +96,15 @@ namespace BetterLyrics.WinUI3.ViewModels
return found;
}
public void PlayLyricsLine(LyricsLine? value)
{
if (value?.StartMs == null)
{
return;
}
_mediaSessionsService.ChangePosition(value.StartMs / 1000.0);
}
[RelayCommand]
private void Search()
{
@@ -188,15 +194,6 @@ namespace BetterLyrics.WinUI3.ViewModels
}
}
partial void OnSelectedLyricsLineChanged(LyricsLine? value)
{
if (value?.StartMs == null)
{
return;
}
_mediaSessionsService.ChangePosition(value.StartMs / 1000.0);
}
public void Receive(PropertyChangedMessage<SongInfo?> message)
{
if (message.Sender is IMediaSessionsService)

View File

@@ -1,7 +1,9 @@
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Controls;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Hooks;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Models.Settings;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using BetterLyrics.WinUI3.Services.SettingsService;
using BetterLyrics.WinUI3.Views;
using CommunityToolkit.Mvvm.ComponentModel;
@@ -18,29 +20,18 @@ namespace BetterLyrics.WinUI3.ViewModels
public partial class MediaSettingsControlViewModel : BaseViewModel
{
private readonly ISettingsService _settingsService;
private readonly IResourceService _resourceService;
private readonly ILocalizationService _localizationService;
[ObservableProperty]
public partial AppSettings AppSettings { get; set; }
public MediaSettingsControlViewModel(ISettingsService settingsService, IResourceService resourceService)
public MediaSettingsControlViewModel(ISettingsService settingsService, ILocalizationService localizationService)
{
_localizationService = localizationService;
_settingsService = settingsService;
_resourceService = resourceService;
AppSettings = _settingsService.AppSettings;
}
[RelayCommand]
private async Task SelectAndAddFolderAsync(UIElement sender)
{
var folder = await PickerHelper.PickSingleFolderAsync<SettingsWindow>();
if (folder != null)
{
AddFolderAsync(folder.Path);
}
}
private void AddFolderAsync(string path)
{
var normalizedPath = Path.GetFullPath(path).TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
@@ -62,13 +53,93 @@ namespace BetterLyrics.WinUI3.ViewModels
}
else
{
AppSettings.LocalMediaFolders.Add(new LocalMediaFolder(path));
AppSettings.LocalMediaFolders.Add(new MediaFolder(path));
}
}
public void RemoveFolderAsync(LocalMediaFolder folder)
public void RemoveFolderAsync(MediaFolder folder)
{
AppSettings.LocalMediaFolders.Remove(folder);
}
[RelayCommand]
private async Task SelectAndAddFolderAsync(UIElement sender)
{
var folder = await PickerHelper.PickSingleFolderAsync<SettingsWindow>();
if (folder != null)
{
AddFolderAsync(folder.Path);
}
}
[RelayCommand]
private async Task AddRemoteSourceAsync(string protocolType)
{
var dialog = new ContentDialog
{
XamlRoot = WindowHook.GetWindow<SettingsWindow>()?.Content.XamlRoot,
Style = Application.Current.Resources["DefaultContentDialogStyle"] as Style,
Title = protocolType,
PrimaryButtonText = _localizationService.GetLocalizedString("Add"),
CloseButtonText = _localizationService.GetLocalizedString("Cancel"),
DefaultButton = ContentDialogButton.Primary,
Content = new RemoteServerConfigControl(protocolType)
};
dialog.PrimaryButtonClick += async (s, e) =>
{
var configControl = (RemoteServerConfigControl)dialog.Content;
try
{
e.Cancel = true;
dialog.IsPrimaryButtonEnabled = false;
configControl.IsEnabled = false;
configControl.SetProgressBarVisibility(Visibility.Visible);
var tempFolder = configControl.GetConfig();
var provider = tempFolder.CreateFileSystem();
bool isConnected = provider != null && await provider.ConnectAsync();
if (isConnected)
{
await provider!.DisconnectAsync();
PasswordVaultHelper.Save(Constants.App.AppName, tempFolder.VaultKey, tempFolder.Password);
AppSettings.LocalMediaFolders.Add(tempFolder);
e.Cancel = false;
}
else
{
ShowErrorTip(configControl, _localizationService.GetLocalizedString("SettingsPageServerTestFailedInfo"));
}
}
catch (Exception ex)
{
ShowErrorTip(configControl, ex.Message);
}
finally
{
dialog.IsPrimaryButtonEnabled = true;
configControl.IsEnabled = true;
configControl.SetProgressBarVisibility(Visibility.Collapsed);
}
};
await dialog.ShowAsync();
}
private void ShowErrorTip(RemoteServerConfigControl control, string message)
{
// 你可以在 RemoteServerConfigControl 里加一个 InfoBar 用来显示错误
// 假设你在 UserControl 里公开了一个 ShowError 方法
control.ShowError(message);
}
}
}

View File

@@ -1,14 +1,12 @@
using ATL;
using BetterLyrics.WinUI3.Collections;
using BetterLyrics.WinUI3.Collections;
using BetterLyrics.WinUI3.Constants;
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Extensions;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Helper.BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Models.Settings;
using BetterLyrics.WinUI3.Services.LibWatcherService;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.LocalizationService;
using BetterLyrics.WinUI3.Services.SettingsService;
using BetterLyrics.WinUI3.Views;
using CommunityToolkit.Mvvm.ComponentModel;
@@ -34,7 +32,7 @@ namespace BetterLyrics.WinUI3.ViewModels
{
private readonly ILibWatcherService _libWatcherService;
private readonly ISettingsService _settingsService;
private readonly IResourceService _resourceService;
private readonly ILocalizationService _localizationService;
private readonly MediaPlayer _mediaPlayer = new();
private readonly MediaTimelineController _timelineController = new();
@@ -43,11 +41,11 @@ namespace BetterLyrics.WinUI3.ViewModels
private readonly DispatcherQueueTimer _refreshSongsTimer;
// All songs
private List<Track> _tracks = [];
private List<ExtendedTrack> _tracks = [];
// Songs in current playlist
private List<Track> _playlistTracks = [];
private List<ExtendedTrack> _playlistTracks = [];
// Filtered songs based on search query for current playlist
private List<Track> _filteredTracks = [];
private List<ExtendedTrack> _filteredTracks = [];
[ObservableProperty]
public partial AppSettings AppSettings { get; set; }
@@ -62,7 +60,7 @@ namespace BetterLyrics.WinUI3.ViewModels
public partial ObservableCollection<GroupInfoList> GroupedTracks { get; set; } = [];
[ObservableProperty]
public partial List<Track> SelectedTracks { get; set; } = [];
public partial List<ExtendedTrack> SelectedTracks { get; set; } = [];
[ObservableProperty]
public partial int SelectedTracksTotalDuration { get; set; } = 0;
@@ -73,7 +71,7 @@ namespace BetterLyrics.WinUI3.ViewModels
public PlayQueueItem? PlayingQueueItem => TrackPlayingQueue.ElementAtOrDefault(AppSettings.MusicGallerySettings.PlayQueueIndex);
[ObservableProperty]
public partial Track? PlayingTrack { get; set; } = null;
public partial ExtendedTrack? PlayingTrack { get; set; } = null;
[ObservableProperty]
public partial CommonSongProperty SongOrderType { get; set; } = CommonSongProperty.Title;
@@ -90,23 +88,23 @@ namespace BetterLyrics.WinUI3.ViewModels
public partial bool IsDataLoading { get; set; } = false;
[ObservableProperty]
public partial Track TrackRightTapped { get; set; } = new();
public partial ExtendedTrack TrackRightTapped { get; set; } = new();
[ObservableProperty]
public partial string SongSearchQuery { get; set; } = string.Empty;
public MusicGalleryPageViewModel(ISettingsService settingsService, ILibWatcherService libWatcherService, IResourceService resourceService)
public MusicGalleryPageViewModel(ISettingsService settingsService, ILibWatcherService libWatcherService, ILocalizationService localizationService)
{
_localizationService = localizationService;
_refreshSongsTimer = _dispatcherQueue.CreateTimer();
_settingsService = settingsService;
_resourceService = resourceService;
AppSettings = _settingsService.AppSettings;
TrackPlayingQueue = [.. AppSettings.MusicGallerySettings.PlayQueuePaths.Select(x => new PlayQueueItem(new Track(x)))];
TrackPlayingQueue = [.. AppSettings.MusicGallerySettings.PlayQueuePaths.Select(x => new PlayQueueItem(new ExtendedTrack(x)))];
TrackPlayingQueue.CollectionChanged += TrackPlayingQueue_CollectionChanged;
SongsTabInfoList.Add(new SongsTabInfo(_resourceService.GetLocalizedString("MusicGalleryPageAllSongs"), "\uE8A9", false, false, CommonSongProperty.Title, string.Empty));
SongsTabInfoList.Add(new SongsTabInfo(_localizationService.GetLocalizedString("MusicGalleryPageAllSongs"), "\uE8A9", false, false, CommonSongProperty.Title, string.Empty));
RefreshSongs();
@@ -281,28 +279,75 @@ namespace BetterLyrics.WinUI3.ViewModels
IsDataLoading = true;
_tracks.Clear();
Task.Run(() =>
Task.Run(async () =>
{
try
{
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
if (!folder.IsEnabled) continue;
try
{
foreach (var file in DirectoryHelper.GetAllFiles(folder.Path))
using var fs = folder.CreateFileSystem();
if (fs == null) continue;
if (!await fs.ConnectAsync()) continue;
// 递归扫描队列
var foldersToScan = new Queue<string>();
foldersToScan.Enqueue(""); // 从根目录开始
while (foldersToScan.Count > 0)
{
if (FileHelper.MusicExtensions.Contains(Path.GetExtension(file)))
var currentPath = foldersToScan.Dequeue();
var items = await fs.GetFilesAsync(currentPath);
foreach (var item in items)
{
Track track = new(file);
if (track.Duration <= 0) continue;
_tracks.Add(track);
if (item.IsFolder)
{
foldersToScan.Enqueue(Path.Combine(currentPath, item.Name));
continue;
}
var ext = Path.GetExtension(item.Name).ToLower();
if (FileHelper.MusicExtensions.Contains(ext))
{
try
{
using (var stream = await fs.OpenReadAsync(item.FullPath))
{
ExtendedTrack track = new ExtendedTrack(item.FullPath, stream);
if (track.Duration > 0)
{
// 读取专辑图写入内存
// 因为此后该流将关闭无法再次访问
_ = track.EmbeddedPictures;
_tracks.Add(track);
}
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Error loading track {item.Name}: {ex.Message}");
}
}
}
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Folder scan error ({folder.Name}): {ex.Message}");
}
}
}
catch (Exception)
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Global scan error: {ex.Message}");
}
_dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
@@ -337,7 +382,7 @@ namespace BetterLyrics.WinUI3.ViewModels
_playlistTracks = _tracks.Where(t => t.Artist.Equals(SelectedSongsTabInfo.FilterValue, StringComparison.OrdinalIgnoreCase)).ToList();
break;
case CommonSongProperty.Folder:
_playlistTracks = _tracks.Where(t => t.GetParentFolderPath().Equals(SelectedSongsTabInfo.FilterValue, StringComparison.OrdinalIgnoreCase)).ToList();
_playlistTracks = _tracks.Where(t => t.ParentFolderPath.Equals(SelectedSongsTabInfo.FilterValue, StringComparison.OrdinalIgnoreCase)).ToList();
break;
case CommonSongProperty.M3UFilePath:
if (SelectedSongsTabInfo.FilterValue is string path)
@@ -375,9 +420,9 @@ namespace BetterLyrics.WinUI3.ViewModels
t.Artist.Contains(SongSearchQuery, StringComparison.OrdinalIgnoreCase) ||
t.Album.Contains(SongSearchQuery, StringComparison.OrdinalIgnoreCase) ||
// 文件名(包含后缀)
t.GetFileName().Contains(SongSearchQuery, StringComparison.OrdinalIgnoreCase) ||
t.FileName.Contains(SongSearchQuery, StringComparison.OrdinalIgnoreCase) ||
// 文件所在文件夹的路径
t.GetParentFolderPath().Contains(SongSearchQuery, StringComparison.OrdinalIgnoreCase)).ToList();
t.ParentFolderPath.Contains(SongSearchQuery, StringComparison.OrdinalIgnoreCase)).ToList();
}
private void ApplySongOrderType()
@@ -387,25 +432,25 @@ namespace BetterLyrics.WinUI3.ViewModels
case CommonSongProperty.Title:
GroupedTracks = _filteredTracks.GetGroupedBy(
t => LanguageHelper.GetOrderChar(t.Title),
o => ((Track)o).Title
o => ((ExtendedTrack)o).Title
);
break;
case CommonSongProperty.Artist:
GroupedTracks = _filteredTracks.GetGroupedBy(
t => LanguageHelper.GetOrderChar(t.Artist),
o => ((Track)o).Artist
o => ((ExtendedTrack)o).Artist
);
break;
case CommonSongProperty.Album:
GroupedTracks = _filteredTracks.GetGroupedBy(
t => LanguageHelper.GetOrderChar(t.Album),
o => ((Track)o).Album
o => ((ExtendedTrack)o).Album
);
break;
case CommonSongProperty.Folder:
GroupedTracks = _filteredTracks.GetGroupedBy(
t => LanguageHelper.GetOrderChar(t.GetParentFolderName()),
o => ((Track)o).Album
t => LanguageHelper.GetOrderChar(t.ParentFolderName),
o => ((ExtendedTrack)o).Album
);
break;
}

View File

@@ -3,7 +3,7 @@ using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Models.Settings;
using BetterLyrics.WinUI3.Services.LastFMService;
using BetterLyrics.WinUI3.Services.MediaSessionsService;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.Services.SettingsService;
using BetterLyrics.WinUI3.Services.TranslationService;
using BetterLyrics.WinUI3.Services.TransliterationService;

View File

@@ -1,4 +1,3 @@
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Extensions;
using BetterLyrics.WinUI3.Hooks;
using Microsoft.UI.Windowing;
@@ -18,7 +17,7 @@ namespace BetterLyrics.WinUI3.Views
{
InitializeComponent();
this.Init("LyricsSearchPageTitle", backdropType: BackdropType.Transparent);
this.Init("LyricsSearchPageTitle");
AppWindow.Closing += AppWindow_Closing;
}

View File

@@ -22,7 +22,7 @@ namespace BetterLyrics.WinUI3.Views
{
InitializeComponent();
this.Init("LyricsWindowSwitchWindowTitle", TitleBarHeightOption.Collapsed, BackdropType.Transparent);
this.Init(title: "LyricsWindowSwitchWindowTitle", titleBarHeightOption: TitleBarHeightOption.Collapsed, backdropType: BackdropType.Transparent);
this.CenterOnScreen();
this.SetWindowStyle(WindowStyle.Popup | WindowStyle.Visible);

View File

@@ -82,7 +82,7 @@
x:Uid="MusicGalleryPageFileInfoPath"
Link="{x:Bind ViewModel.TrackRightTapped.Path, Mode=OneWay}"
Value="{x:Bind ViewModel.TrackRightTapped.Path, Mode=OneWay}" />
<uc:PropertyRow x:Uid="MusicGalleryPageFileInfoLyrics" Value="{x:Bind ViewModel.TrackRightTapped, Converter={StaticResource TrackToLyricsConverter}, Mode=OneWay}" />
<uc:PropertyRow x:Uid="MusicGalleryPageFileInfoLyrics" Value="{x:Bind ViewModel.TrackRightTapped.RawLyrics, Mode=OneWay}" />
</StackPanel>
</Grid>
</ScrollViewer>
@@ -381,7 +381,7 @@
</MenuBarItemFlyout>
</ListView.ContextFlyout>
<ListView.ItemTemplate>
<DataTemplate x:DataType="atl:Track">
<DataTemplate x:DataType="models:ExtendedTrack">
<Grid
Padding="12"
ColumnSpacing="12"

View File

@@ -1,10 +1,9 @@
using ATL;
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Extensions;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Models.Settings;
using BetterLyrics.WinUI3.Services.ResourceService;
using BetterLyrics.WinUI3.ViewModels;
using CommunityToolkit.Mvvm.DependencyInjection;
using DevWinUI;
@@ -26,8 +25,6 @@ namespace BetterLyrics.WinUI3.Views
/// </summary>
public sealed partial class MusicGalleryPage : Page
{
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
public MusicGalleryPageViewModel ViewModel => (MusicGalleryPageViewModel)DataContext;
public MusicGalleryPage()
@@ -54,7 +51,7 @@ namespace BetterLyrics.WinUI3.Views
private async void SongPathHyperlinkButton_Click(object sender, RoutedEventArgs e)
{
await LauncherHelper.SelectAndShowFile(((Track)((HyperlinkButton)sender).DataContext).Path);
await LauncherHelper.SelectAndShowFile(((ExtendedTrack)((HyperlinkButton)sender).DataContext).Path);
}
private async void PlayingQueueListVireItemGrid_Tapped(object sender, TappedRoutedEventArgs e)
@@ -104,7 +101,7 @@ namespace BetterLyrics.WinUI3.Views
private async void AddSongToQueueNextMenuFlyoutItem_Click(object sender, RoutedEventArgs e)
{
bool startPlaying = ViewModel.TrackPlayingQueue.Count == 0;
ViewModel.TrackPlayingQueue.InsertRange(ViewModel.AppSettings.MusicGallerySettings.PlayQueueIndex + 1, SongListView.SelectedItems.Cast<Track>().Select(x => new PlayQueueItem(x)));
ViewModel.TrackPlayingQueue.InsertRange(ViewModel.AppSettings.MusicGallerySettings.PlayQueueIndex + 1, SongListView.SelectedItems.Cast<ExtendedTrack>().Select(x => new PlayQueueItem(x)));
if (startPlaying)
{
ViewModel.AppSettings.MusicGallerySettings.PlayQueueIndex = ViewModel.AppSettings.MusicGallerySettings.PlayQueueIndex + 1;
@@ -115,7 +112,7 @@ namespace BetterLyrics.WinUI3.Views
private async void AddSongToQueueEndMenuFlyoutItem_Click(object sender, RoutedEventArgs e)
{
bool startPlaying = ViewModel.TrackPlayingQueue.Count == 0;
ViewModel.TrackPlayingQueue.AddRange(SongListView.SelectedItems.Cast<Track>().Select(x => new PlayQueueItem(x)));
ViewModel.TrackPlayingQueue.AddRange(SongListView.SelectedItems.Cast<ExtendedTrack>().Select(x => new PlayQueueItem(x)));
if (startPlaying)
{
ViewModel.AppSettings.MusicGallerySettings.PlayQueueIndex = ViewModel.AppSettings.MusicGallerySettings.PlayQueueIndex + 1;
@@ -125,7 +122,7 @@ namespace BetterLyrics.WinUI3.Views
private void SongListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ViewModel.SelectedTracks = SongListView.SelectedItems.Cast<Track>().ToList();
ViewModel.SelectedTracks = SongListView.SelectedItems.Cast<ExtendedTrack>().ToList();
ViewModel.SelectedTracksTotalDuration = ViewModel.SelectedTracks.Select(x => x.Duration).Sum();
if (SelectAllCheckBox != null)
{
@@ -142,22 +139,22 @@ namespace BetterLyrics.WinUI3.Views
private void ArtistHyperlibkButton_Click(object sender, RoutedEventArgs e)
{
var artist = ((Track)((FrameworkElement)sender).DataContext).Artist;
var artist = ((ExtendedTrack)((FrameworkElement)sender).DataContext).Artist;
var playlist = new SongsTabInfo(artist, "\uEFA9", true, false, CommonSongProperty.Artist, artist);
ViewModel.UpdateSelectedPlaylist(playlist);
}
private void AlbumHyperlibkButton_Click(object sender, RoutedEventArgs e)
{
var album = ((Track)((FrameworkElement)sender).DataContext).Album;
var album = ((ExtendedTrack)((FrameworkElement)sender).DataContext).Album;
var playlist = new SongsTabInfo(album, "\uE93C", true, false, CommonSongProperty.Album, album);
ViewModel.UpdateSelectedPlaylist(playlist);
}
private void PathHyperlibkButton_Click(object sender, RoutedEventArgs e)
{
var track = ((Track)((FrameworkElement)sender).DataContext);
var playlist = new SongsTabInfo(track.GetParentFolderName(), "\uE8B7", true, false, CommonSongProperty.Folder, track.GetParentFolderPath());
var track = ((ExtendedTrack)((FrameworkElement)sender).DataContext);
var playlist = new SongsTabInfo(track.ParentFolderName, "\uE8B7", true, false, CommonSongProperty.Folder, track.ParentFolderPath);
ViewModel.UpdateSelectedPlaylist(playlist);
}
@@ -210,7 +207,7 @@ namespace BetterLyrics.WinUI3.Views
private void SongListViewItemMoreButton_Click(object sender, RoutedEventArgs e)
{
ViewModel.TrackRightTapped = (Track)((FrameworkElement)sender).DataContext;
ViewModel.TrackRightTapped = (ExtendedTrack)((FrameworkElement)sender).DataContext;
SongFileInfoFlyout.ShowAt(sender as FrameworkElement);
}
@@ -260,8 +257,8 @@ namespace BetterLyrics.WinUI3.Views
private async void SongListViewItem_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
var displayedTracks = SongListView.Items.Cast<Track>();
var track = (Track)((FrameworkElement)sender).DataContext;
var displayedTracks = SongListView.Items.Cast<ExtendedTrack>();
var track = (ExtendedTrack)((FrameworkElement)sender).DataContext;
// Play all the songs
ViewModel.TrackPlayingQueue.Clear();

View File

@@ -11,7 +11,10 @@
xmlns:ui="using:CommunityToolkit.WinUI"
mc:Ignorable="d">
<Grid x:Name="RootGrid" Loaded="RootGrid_Loaded" Unloaded="RootGrid_Unloaded">
<Grid
x:Name="RootGrid"
Loaded="RootGrid_Loaded"
Unloaded="RootGrid_Unloaded">
<local:MusicGalleryPage x:Name="MusicGalleryPage" Margin="0,40,0,0" />

Some files were not shown because too many files have changed in this diff Show More